Re: [matplotlib-devel] Make matplotlib running on GPU/CUDA

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
10 messages Options
Reply | Threaded
Open this post in threaded view
|

Re: [matplotlib-devel] Make matplotlib running on GPU/CUDA

Francesco Faccenda
Thank you Chris for your reply.

I have to admit I already stumbled on VisPy while doing my research on the web. Still, I've got a lot of code already working with matplotlib. Indeed, not only I plot data with it, but i manage a lot of mpl events to provide the users usefool tools, like lines picking, tooltips, lines copy/paste, square selectors for multiple selections, context menu and so on. Moreover, I got matplotlib embedded on wxpython as well. While at the beginning few lines were managed and noone complained, now that big amout of data has to be displayed, the non-GPU core of the library is starting to show its limits.

Since matplotlib is a reference library for this kind of  applications, I thought it deserved an update in this direction. If anyone is willing to do so, I'm available to discuss possible solutions and also provide any help I can give.

Best regards,
Francesco Faccenda

2017-09-13 0:46 GMT+02:00 Chris Barker <[hidden email]>:
On Tue, Sep 12, 2017 at 8:47 AM, Francesco Faccenda <[hidden email]> wrote:

But there’s a good news, I have a nice GPU available (an NVIDIA Tesla K40c), so I’d like to know if there is a way to make matplotlib run on it, or maybe wrap it on some GPU/CUDA wrapper and make it run smoothly.


I tihnk you want VisPy:


It's a plotting package with a kinda like  matplotlib API, built on OpenGL.

Unfortunately, it doesn't look like it's been updated in a while -- from teh docs. But the gitHub project is active:


So maybe it's only the docs that haven't been updated!

But probably  a much better option than trying to shoehorn GPU rendering into MPL.

The problem is that while MPL was designed to be "backend" independent -- so it is "easy" to plug in an alternative renderer, the rendering model is not really well suited to GPU rendering -- it would take a lot of refactoring to really be able to take advantage of the graphics card.

-CHB


--

Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR&R            <a href="tel:(206)%20526-6959" value="+12065266959" target="_blank">(206) 526-6959   voice
7600 Sand Point Way NE   <a href="tel:(206)%20526-6329" value="+12065266329" target="_blank">(206) 526-6329   fax
Seattle, WA  98115       <a href="tel:(206)%20526-6317" value="+12065266317" target="_blank">(206) 526-6317   main reception

[hidden email]


_______________________________________________
Matplotlib-devel mailing list
[hidden email]
https://mail.python.org/mailman/listinfo/matplotlib-devel
Reply | Threaded
Open this post in threaded view
|

Re: [matplotlib-devel] Make matplotlib running on GPU/CUDA

Benjamin Root
A bit of background regarding efforts in this area...

A long time ago, some experiments were done to see if an opengl backend could be made for matplotlib. The results weren't that great, particularly for text rendering, so the effort was dropped. The core developers all agree that an opengl backend would be neat to have, but we all have limited, if any, experience developing opengl. Furthermore, such a backend would likely require a lot of rapid development and trial-n-error. So, we encouraged others to go develop a package or two separately, with the eye for bringing it back into matplotlib when it was ready. Glumpy and a few other projects were born from that prodding.

VisPy was an attempt to consolidate the development efforts for those projects. The matplotlib devs had very fruitful discussions with some VisPy devs back at SciPy 2015, but the project became non-responsive shortly afterwards.

Ben Root


On Wed, Sep 13, 2017 at 3:31 AM, Francesco Faccenda <[hidden email]> wrote:
Thank you Chris for your reply.

I have to admit I already stumbled on VisPy while doing my research on the web. Still, I've got a lot of code already working with matplotlib. Indeed, not only I plot data with it, but i manage a lot of mpl events to provide the users usefool tools, like lines picking, tooltips, lines copy/paste, square selectors for multiple selections, context menu and so on. Moreover, I got matplotlib embedded on wxpython as well. While at the beginning few lines were managed and noone complained, now that big amout of data has to be displayed, the non-GPU core of the library is starting to show its limits.

Since matplotlib is a reference library for this kind of  applications, I thought it deserved an update in this direction. If anyone is willing to do so, I'm available to discuss possible solutions and also provide any help I can give.

Best regards,
Francesco Faccenda

2017-09-13 0:46 GMT+02:00 Chris Barker <[hidden email]>:
On Tue, Sep 12, 2017 at 8:47 AM, Francesco Faccenda <[hidden email]> wrote:

But there’s a good news, I have a nice GPU available (an NVIDIA Tesla K40c), so I’d like to know if there is a way to make matplotlib run on it, or maybe wrap it on some GPU/CUDA wrapper and make it run smoothly.


I tihnk you want VisPy:


It's a plotting package with a kinda like  matplotlib API, built on OpenGL.

Unfortunately, it doesn't look like it's been updated in a while -- from teh docs. But the gitHub project is active:


So maybe it's only the docs that haven't been updated!

But probably  a much better option than trying to shoehorn GPU rendering into MPL.

The problem is that while MPL was designed to be "backend" independent -- so it is "easy" to plug in an alternative renderer, the rendering model is not really well suited to GPU rendering -- it would take a lot of refactoring to really be able to take advantage of the graphics card.

-CHB


--

Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR&R            <a href="tel:(206)%20526-6959" value="+12065266959" target="_blank">(206) 526-6959   voice
7600 Sand Point Way NE   <a href="tel:(206)%20526-6329" value="+12065266329" target="_blank">(206) 526-6329   fax
Seattle, WA  98115       <a href="tel:(206)%20526-6317" value="+12065266317" target="_blank">(206) 526-6317   main reception

[hidden email]


_______________________________________________
Matplotlib-devel mailing list
[hidden email]
https://mail.python.org/mailman/listinfo/matplotlib-devel



_______________________________________________
Matplotlib-devel mailing list
[hidden email]
https://mail.python.org/mailman/listinfo/matplotlib-devel
Reply | Threaded
Open this post in threaded view
|

Re: [matplotlib-devel] Make matplotlib running on GPU/CUDA

Francesco Faccenda
Thank you, Ben.

unfortunately I don't have experience developing opengl neither, but I'd like to make an attempt riesuming this subject.

I am starting from this: https://github.com/ChrisBeaumont/mplgl

Can anyone confirm this is the last update we have for this project?

Francesco Faccenda

2017-09-13 16:21 GMT+02:00 Benjamin Root <[hidden email]>:
A bit of background regarding efforts in this area...

A long time ago, some experiments were done to see if an opengl backend could be made for matplotlib. The results weren't that great, particularly for text rendering, so the effort was dropped. The core developers all agree that an opengl backend would be neat to have, but we all have limited, if any, experience developing opengl. Furthermore, such a backend would likely require a lot of rapid development and trial-n-error. So, we encouraged others to go develop a package or two separately, with the eye for bringing it back into matplotlib when it was ready. Glumpy and a few other projects were born from that prodding.

VisPy was an attempt to consolidate the development efforts for those projects. The matplotlib devs had very fruitful discussions with some VisPy devs back at SciPy 2015, but the project became non-responsive shortly afterwards.

Ben Root


On Wed, Sep 13, 2017 at 3:31 AM, Francesco Faccenda <[hidden email]> wrote:
Thank you Chris for your reply.

I have to admit I already stumbled on VisPy while doing my research on the web. Still, I've got a lot of code already working with matplotlib. Indeed, not only I plot data with it, but i manage a lot of mpl events to provide the users usefool tools, like lines picking, tooltips, lines copy/paste, square selectors for multiple selections, context menu and so on. Moreover, I got matplotlib embedded on wxpython as well. While at the beginning few lines were managed and noone complained, now that big amout of data has to be displayed, the non-GPU core of the library is starting to show its limits.

Since matplotlib is a reference library for this kind of  applications, I thought it deserved an update in this direction. If anyone is willing to do so, I'm available to discuss possible solutions and also provide any help I can give.

Best regards,
Francesco Faccenda

2017-09-13 0:46 GMT+02:00 Chris Barker <[hidden email]>:
On Tue, Sep 12, 2017 at 8:47 AM, Francesco Faccenda <[hidden email]> wrote:

But there’s a good news, I have a nice GPU available (an NVIDIA Tesla K40c), so I’d like to know if there is a way to make matplotlib run on it, or maybe wrap it on some GPU/CUDA wrapper and make it run smoothly.


I tihnk you want VisPy:


It's a plotting package with a kinda like  matplotlib API, built on OpenGL.

Unfortunately, it doesn't look like it's been updated in a while -- from teh docs. But the gitHub project is active:


So maybe it's only the docs that haven't been updated!

But probably  a much better option than trying to shoehorn GPU rendering into MPL.

The problem is that while MPL was designed to be "backend" independent -- so it is "easy" to plug in an alternative renderer, the rendering model is not really well suited to GPU rendering -- it would take a lot of refactoring to really be able to take advantage of the graphics card.

-CHB


--

Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR&R            <a href="tel:(206)%20526-6959" value="+12065266959" target="_blank">(206) 526-6959   voice
7600 Sand Point Way NE   <a href="tel:(206)%20526-6329" value="+12065266329" target="_blank">(206) 526-6329   fax
Seattle, WA  98115       <a href="tel:(206)%20526-6317" value="+12065266317" target="_blank">(206) 526-6317   main reception

[hidden email]


_______________________________________________
Matplotlib-devel mailing list
[hidden email]
https://mail.python.org/mailman/listinfo/matplotlib-devel




_______________________________________________
Matplotlib-devel mailing list
[hidden email]
https://mail.python.org/mailman/listinfo/matplotlib-devel
Reply | Threaded
Open this post in threaded view
|

Re: [matplotlib-devel] Make matplotlib running on GPU/CUDA

Benjamin Root
That was one of the old attempts (but not the oldest). It doesn't seem like it ever intersected with the vispy project, though, so it is likely all that exists.

I would also look at https://www.youtube.com/watch?v=_3YoaeoiIFI
Luke does a nice job providing an overview of the vispy package. One of the most exciting things that the matplotlib and vispy devs were discussing at scipy 2015 was the possibility of making a matplotlib backend out of some parts from vispy. It was attractive because the vispy folks were actively working on improving their opengl code and packaging to make it work on a wide variety of hardware and setups. They had supposedly even implemented a headless opengl mode, too, which was very important for us.

Cheers!
Ben Root


On Thu, Sep 14, 2017 at 9:34 AM, Francesco Faccenda <[hidden email]> wrote:
Thank you, Ben.

unfortunately I don't have experience developing opengl neither, but I'd like to make an attempt riesuming this subject.

I am starting from this: https://github.com/ChrisBeaumont/mplgl

Can anyone confirm this is the last update we have for this project?

Francesco Faccenda

2017-09-13 16:21 GMT+02:00 Benjamin Root <[hidden email]>:
A bit of background regarding efforts in this area...

A long time ago, some experiments were done to see if an opengl backend could be made for matplotlib. The results weren't that great, particularly for text rendering, so the effort was dropped. The core developers all agree that an opengl backend would be neat to have, but we all have limited, if any, experience developing opengl. Furthermore, such a backend would likely require a lot of rapid development and trial-n-error. So, we encouraged others to go develop a package or two separately, with the eye for bringing it back into matplotlib when it was ready. Glumpy and a few other projects were born from that prodding.

VisPy was an attempt to consolidate the development efforts for those projects. The matplotlib devs had very fruitful discussions with some VisPy devs back at SciPy 2015, but the project became non-responsive shortly afterwards.

Ben Root


On Wed, Sep 13, 2017 at 3:31 AM, Francesco Faccenda <[hidden email]> wrote:
Thank you Chris for your reply.

I have to admit I already stumbled on VisPy while doing my research on the web. Still, I've got a lot of code already working with matplotlib. Indeed, not only I plot data with it, but i manage a lot of mpl events to provide the users usefool tools, like lines picking, tooltips, lines copy/paste, square selectors for multiple selections, context menu and so on. Moreover, I got matplotlib embedded on wxpython as well. While at the beginning few lines were managed and noone complained, now that big amout of data has to be displayed, the non-GPU core of the library is starting to show its limits.

Since matplotlib is a reference library for this kind of  applications, I thought it deserved an update in this direction. If anyone is willing to do so, I'm available to discuss possible solutions and also provide any help I can give.

Best regards,
Francesco Faccenda

2017-09-13 0:46 GMT+02:00 Chris Barker <[hidden email]>:
On Tue, Sep 12, 2017 at 8:47 AM, Francesco Faccenda <[hidden email]> wrote:

But there’s a good news, I have a nice GPU available (an NVIDIA Tesla K40c), so I’d like to know if there is a way to make matplotlib run on it, or maybe wrap it on some GPU/CUDA wrapper and make it run smoothly.


I tihnk you want VisPy:


It's a plotting package with a kinda like  matplotlib API, built on OpenGL.

Unfortunately, it doesn't look like it's been updated in a while -- from teh docs. But the gitHub project is active:


So maybe it's only the docs that haven't been updated!

But probably  a much better option than trying to shoehorn GPU rendering into MPL.

The problem is that while MPL was designed to be "backend" independent -- so it is "easy" to plug in an alternative renderer, the rendering model is not really well suited to GPU rendering -- it would take a lot of refactoring to really be able to take advantage of the graphics card.

-CHB


--

Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR&R            <a href="tel:(206)%20526-6959" value="+12065266959" target="_blank">(206) 526-6959   voice
7600 Sand Point Way NE   <a href="tel:(206)%20526-6329" value="+12065266329" target="_blank">(206) 526-6329   fax
Seattle, WA  98115       <a href="tel:(206)%20526-6317" value="+12065266317" target="_blank">(206) 526-6317   main reception

[hidden email]


_______________________________________________
Matplotlib-devel mailing list
[hidden email]
https://mail.python.org/mailman/listinfo/matplotlib-devel





_______________________________________________
Matplotlib-devel mailing list
[hidden email]
https://mail.python.org/mailman/listinfo/matplotlib-devel
Reply | Threaded
Open this post in threaded view
|

Re: [matplotlib-devel] Make matplotlib running on GPU/CUDA

Francesco Faccenda
I'll take a look, thank you.

So you are suggesting me to start form the VisPy code? Is there someone who I can refer in case I will need some clarification?

Francesco Faccenda

2017-09-14 15:50 GMT+02:00 Benjamin Root <[hidden email]>:
That was one of the old attempts (but not the oldest). It doesn't seem like it ever intersected with the vispy project, though, so it is likely all that exists.

I would also look at https://www.youtube.com/watch?v=_3YoaeoiIFI
Luke does a nice job providing an overview of the vispy package. One of the most exciting things that the matplotlib and vispy devs were discussing at scipy 2015 was the possibility of making a matplotlib backend out of some parts from vispy. It was attractive because the vispy folks were actively working on improving their opengl code and packaging to make it work on a wide variety of hardware and setups. They had supposedly even implemented a headless opengl mode, too, which was very important for us.

Cheers!
Ben Root


On Thu, Sep 14, 2017 at 9:34 AM, Francesco Faccenda <[hidden email]> wrote:
Thank you, Ben.

unfortunately I don't have experience developing opengl neither, but I'd like to make an attempt riesuming this subject.

I am starting from this: https://github.com/ChrisBeaumont/mplgl

Can anyone confirm this is the last update we have for this project?

Francesco Faccenda

2017-09-13 16:21 GMT+02:00 Benjamin Root <[hidden email]>:
A bit of background regarding efforts in this area...

A long time ago, some experiments were done to see if an opengl backend could be made for matplotlib. The results weren't that great, particularly for text rendering, so the effort was dropped. The core developers all agree that an opengl backend would be neat to have, but we all have limited, if any, experience developing opengl. Furthermore, such a backend would likely require a lot of rapid development and trial-n-error. So, we encouraged others to go develop a package or two separately, with the eye for bringing it back into matplotlib when it was ready. Glumpy and a few other projects were born from that prodding.

VisPy was an attempt to consolidate the development efforts for those projects. The matplotlib devs had very fruitful discussions with some VisPy devs back at SciPy 2015, but the project became non-responsive shortly afterwards.

Ben Root


On Wed, Sep 13, 2017 at 3:31 AM, Francesco Faccenda <[hidden email]> wrote:
Thank you Chris for your reply.

I have to admit I already stumbled on VisPy while doing my research on the web. Still, I've got a lot of code already working with matplotlib. Indeed, not only I plot data with it, but i manage a lot of mpl events to provide the users usefool tools, like lines picking, tooltips, lines copy/paste, square selectors for multiple selections, context menu and so on. Moreover, I got matplotlib embedded on wxpython as well. While at the beginning few lines were managed and noone complained, now that big amout of data has to be displayed, the non-GPU core of the library is starting to show its limits.

Since matplotlib is a reference library for this kind of  applications, I thought it deserved an update in this direction. If anyone is willing to do so, I'm available to discuss possible solutions and also provide any help I can give.

Best regards,
Francesco Faccenda

2017-09-13 0:46 GMT+02:00 Chris Barker <[hidden email]>:
On Tue, Sep 12, 2017 at 8:47 AM, Francesco Faccenda <[hidden email]> wrote:

But there’s a good news, I have a nice GPU available (an NVIDIA Tesla K40c), so I’d like to know if there is a way to make matplotlib run on it, or maybe wrap it on some GPU/CUDA wrapper and make it run smoothly.


I tihnk you want VisPy:


It's a plotting package with a kinda like  matplotlib API, built on OpenGL.

Unfortunately, it doesn't look like it's been updated in a while -- from teh docs. But the gitHub project is active:


So maybe it's only the docs that haven't been updated!

But probably  a much better option than trying to shoehorn GPU rendering into MPL.

The problem is that while MPL was designed to be "backend" independent -- so it is "easy" to plug in an alternative renderer, the rendering model is not really well suited to GPU rendering -- it would take a lot of refactoring to really be able to take advantage of the graphics card.

-CHB


--

Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR&R            <a href="tel:(206)%20526-6959" value="+12065266959" target="_blank">(206) 526-6959   voice
7600 Sand Point Way NE   <a href="tel:(206)%20526-6329" value="+12065266329" target="_blank">(206) 526-6329   fax
Seattle, WA  98115       <a href="tel:(206)%20526-6317" value="+12065266317" target="_blank">(206) 526-6317   main reception

[hidden email]


_______________________________________________
Matplotlib-devel mailing list
[hidden email]
https://mail.python.org/mailman/listinfo/matplotlib-devel






_______________________________________________
Matplotlib-devel mailing list
[hidden email]
https://mail.python.org/mailman/listinfo/matplotlib-devel
Reply | Threaded
Open this post in threaded view
|

Re: [matplotlib-devel] Make matplotlib running on GPU/CUDA

Benjamin Root
The person who has been most responsive to me in the past would be Nicolas Rougier, who developed glumpy. He might also be able to give you a better sense of where to start.

Ben Root

On Thu, Sep 14, 2017 at 10:37 AM, Francesco Faccenda <[hidden email]> wrote:
I'll take a look, thank you.

So you are suggesting me to start form the VisPy code? Is there someone who I can refer in case I will need some clarification?

Francesco Faccenda

2017-09-14 15:50 GMT+02:00 Benjamin Root <[hidden email]>:
That was one of the old attempts (but not the oldest). It doesn't seem like it ever intersected with the vispy project, though, so it is likely all that exists.

I would also look at https://www.youtube.com/watch?v=_3YoaeoiIFI
Luke does a nice job providing an overview of the vispy package. One of the most exciting things that the matplotlib and vispy devs were discussing at scipy 2015 was the possibility of making a matplotlib backend out of some parts from vispy. It was attractive because the vispy folks were actively working on improving their opengl code and packaging to make it work on a wide variety of hardware and setups. They had supposedly even implemented a headless opengl mode, too, which was very important for us.

Cheers!
Ben Root


On Thu, Sep 14, 2017 at 9:34 AM, Francesco Faccenda <[hidden email]> wrote:
Thank you, Ben.

unfortunately I don't have experience developing opengl neither, but I'd like to make an attempt riesuming this subject.

I am starting from this: https://github.com/ChrisBeaumont/mplgl

Can anyone confirm this is the last update we have for this project?

Francesco Faccenda

2017-09-13 16:21 GMT+02:00 Benjamin Root <[hidden email]>:
A bit of background regarding efforts in this area...

A long time ago, some experiments were done to see if an opengl backend could be made for matplotlib. The results weren't that great, particularly for text rendering, so the effort was dropped. The core developers all agree that an opengl backend would be neat to have, but we all have limited, if any, experience developing opengl. Furthermore, such a backend would likely require a lot of rapid development and trial-n-error. So, we encouraged others to go develop a package or two separately, with the eye for bringing it back into matplotlib when it was ready. Glumpy and a few other projects were born from that prodding.

VisPy was an attempt to consolidate the development efforts for those projects. The matplotlib devs had very fruitful discussions with some VisPy devs back at SciPy 2015, but the project became non-responsive shortly afterwards.

Ben Root


On Wed, Sep 13, 2017 at 3:31 AM, Francesco Faccenda <[hidden email]> wrote:
Thank you Chris for your reply.

I have to admit I already stumbled on VisPy while doing my research on the web. Still, I've got a lot of code already working with matplotlib. Indeed, not only I plot data with it, but i manage a lot of mpl events to provide the users usefool tools, like lines picking, tooltips, lines copy/paste, square selectors for multiple selections, context menu and so on. Moreover, I got matplotlib embedded on wxpython as well. While at the beginning few lines were managed and noone complained, now that big amout of data has to be displayed, the non-GPU core of the library is starting to show its limits.

Since matplotlib is a reference library for this kind of  applications, I thought it deserved an update in this direction. If anyone is willing to do so, I'm available to discuss possible solutions and also provide any help I can give.

Best regards,
Francesco Faccenda

2017-09-13 0:46 GMT+02:00 Chris Barker <[hidden email]>:
On Tue, Sep 12, 2017 at 8:47 AM, Francesco Faccenda <[hidden email]> wrote:

But there’s a good news, I have a nice GPU available (an NVIDIA Tesla K40c), so I’d like to know if there is a way to make matplotlib run on it, or maybe wrap it on some GPU/CUDA wrapper and make it run smoothly.


I tihnk you want VisPy:


It's a plotting package with a kinda like  matplotlib API, built on OpenGL.

Unfortunately, it doesn't look like it's been updated in a while -- from teh docs. But the gitHub project is active:


So maybe it's only the docs that haven't been updated!

But probably  a much better option than trying to shoehorn GPU rendering into MPL.

The problem is that while MPL was designed to be "backend" independent -- so it is "easy" to plug in an alternative renderer, the rendering model is not really well suited to GPU rendering -- it would take a lot of refactoring to really be able to take advantage of the graphics card.

-CHB


--

Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR&R            <a href="tel:(206)%20526-6959" value="+12065266959" target="_blank">(206) 526-6959   voice
7600 Sand Point Way NE   <a href="tel:(206)%20526-6329" value="+12065266329" target="_blank">(206) 526-6329   fax
Seattle, WA  98115       <a href="tel:(206)%20526-6317" value="+12065266317" target="_blank">(206) 526-6317   main reception

[hidden email]


_______________________________________________
Matplotlib-devel mailing list
[hidden email]
https://mail.python.org/mailman/listinfo/matplotlib-devel







_______________________________________________
Matplotlib-devel mailing list
[hidden email]
https://mail.python.org/mailman/listinfo/matplotlib-devel
Reply | Threaded
Open this post in threaded view
|

Re: [matplotlib-devel] Make matplotlib running on GPU/CUDA

Nicolas P. Rougier

As as matter of fact, I’m currently writing a (open access) book about Python, OpenGL and scientific visualization that explains pretty much everything. I hope to be able to release by the end of the year.

Concerning Vispy, the code might be a bit hard to handle at first but the project is still alive with new contributors.
Concerning glumpy, I still maintain it and it is less complex than Vispy but it does not offer the high-level interface of vispy. I usually make the comparison numpy/scipy and glumpy/vispy. But the two projects are independent (even if I transferred a lot of code from glumpy to vispy).

For a starter on OpenGL, you can have a look at glumpy documentation: http://glumpy.readthedocs.io/en/latest/

Nicolas



> On 14 Sep 2017, at 16:47, Benjamin Root <[hidden email]> wrote:
>
> The person who has been most responsive to me in the past would be Nicolas Rougier, who developed glumpy. He might also be able to give you a better sense of where to start.
>
> Ben Root
>
> On Thu, Sep 14, 2017 at 10:37 AM, Francesco Faccenda <[hidden email]> wrote:
> I'll take a look, thank you.
>
> So you are suggesting me to start form the VisPy code? Is there someone who I can refer in case I will need some clarification?
>
> Francesco Faccenda
>
> 2017-09-14 15:50 GMT+02:00 Benjamin Root <[hidden email]>:
> That was one of the old attempts (but not the oldest). It doesn't seem like it ever intersected with the vispy project, though, so it is likely all that exists.
>
> I would also look at https://www.youtube.com/watch?v=_3YoaeoiIFI
> Luke does a nice job providing an overview of the vispy package. One of the most exciting things that the matplotlib and vispy devs were discussing at scipy 2015 was the possibility of making a matplotlib backend out of some parts from vispy. It was attractive because the vispy folks were actively working on improving their opengl code and packaging to make it work on a wide variety of hardware and setups. They had supposedly even implemented a headless opengl mode, too, which was very important for us.
>
> Cheers!
> Ben Root
>
>
> On Thu, Sep 14, 2017 at 9:34 AM, Francesco Faccenda <[hidden email]> wrote:
> Thank you, Ben.
>
> unfortunately I don't have experience developing opengl neither, but I'd like to make an attempt riesuming this subject.
>
> I am starting from this: https://github.com/ChrisBeaumont/mplgl
>
> Can anyone confirm this is the last update we have for this project?
>
> Francesco Faccenda
>
> 2017-09-13 16:21 GMT+02:00 Benjamin Root <[hidden email]>:
> A bit of background regarding efforts in this area...
>
> A long time ago, some experiments were done to see if an opengl backend could be made for matplotlib. The results weren't that great, particularly for text rendering, so the effort was dropped. The core developers all agree that an opengl backend would be neat to have, but we all have limited, if any, experience developing opengl. Furthermore, such a backend would likely require a lot of rapid development and trial-n-error. So, we encouraged others to go develop a package or two separately, with the eye for bringing it back into matplotlib when it was ready. Glumpy and a few other projects were born from that prodding.
>
> VisPy was an attempt to consolidate the development efforts for those projects. The matplotlib devs had very fruitful discussions with some VisPy devs back at SciPy 2015, but the project became non-responsive shortly afterwards.
>
> Ben Root
>
>
> On Wed, Sep 13, 2017 at 3:31 AM, Francesco Faccenda <[hidden email]> wrote:
> Thank you Chris for your reply.
>
> I have to admit I already stumbled on VisPy while doing my research on the web. Still, I've got a lot of code already working with matplotlib. Indeed, not only I plot data with it, but i manage a lot of mpl events to provide the users usefool tools, like lines picking, tooltips, lines copy/paste, square selectors for multiple selections, context menu and so on. Moreover, I got matplotlib embedded on wxpython as well. While at the beginning few lines were managed and noone complained, now that big amout of data has to be displayed, the non-GPU core of the library is starting to show its limits.
>
> Since matplotlib is a reference library for this kind of  applications, I thought it deserved an update in this direction. If anyone is willing to do so, I'm available to discuss possible solutions and also provide any help I can give.
>
> Best regards,
> Francesco Faccenda
>
> 2017-09-13 0:46 GMT+02:00 Chris Barker <[hidden email]>:
> On Tue, Sep 12, 2017 at 8:47 AM, Francesco Faccenda <[hidden email]> wrote:
> But there’s a good news, I have a nice GPU available (an NVIDIA Tesla K40c), so I’d like to know if there is a way to make matplotlib run on it, or maybe wrap it on some GPU/CUDA wrapper and make it run smoothly.
>
>
> I tihnk you want VisPy:
>
> https://vispy.readthedocs.io/en/latest/
>
> It's a plotting package with a kinda like  matplotlib API, built on OpenGL.
>
> Unfortunately, it doesn't look like it's been updated in a while -- from teh docs. But the gitHub project is active:
>
> https://github.com/vispy/vispy
>
> So maybe it's only the docs that haven't been updated!
>
> But probably  a much better option than trying to shoehorn GPU rendering into MPL.
>
> The problem is that while MPL was designed to be "backend" independent -- so it is "easy" to plug in an alternative renderer, the rendering model is not really well suited to GPU rendering -- it would take a lot of refactoring to really be able to take advantage of the graphics card.
>
> -CHB
>
>
> --
>
> Christopher Barker, Ph.D.
> Oceanographer
>
> Emergency Response Division
> NOAA/NOS/OR&R            (206) 526-6959   voice
> 7600 Sand Point Way NE   (206) 526-6329   fax
> Seattle, WA  98115       (206) 526-6317   main reception
>
> [hidden email]
>
>
> _______________________________________________
> Matplotlib-devel mailing list
> [hidden email]
> https://mail.python.org/mailman/listinfo/matplotlib-devel
>
>
>
>
>
>
> _______________________________________________
> Matplotlib-devel mailing list
> [hidden email]
> https://mail.python.org/mailman/listinfo/matplotlib-devel

_______________________________________________
Matplotlib-devel mailing list
[hidden email]
https://mail.python.org/mailman/listinfo/matplotlib-devel
Reply | Threaded
Open this post in threaded view
|

Re: [matplotlib-devel] Make matplotlib running on GPU/CUDA

Antony Lee
One possibility for which I'd certainly appreciate some help is to see whether we can use cairo's gl backend (which is sadly quite underdocumented) in https://github.com/anntzer/mpl_cairo -- which can currently use cairo's raster ("image") and X11 backends, with pretty good performance (much better than the builtin gtk3cairo, and generally better than the builtin Agg backends).
Antony

2017-09-14 8:03 GMT-07:00 Nicolas Rougier <[hidden email]>:

As as matter of fact, I’m currently writing a (open access) book about Python, OpenGL and scientific visualization that explains pretty much everything. I hope to be able to release by the end of the year.

Concerning Vispy, the code might be a bit hard to handle at first but the project is still alive with new contributors.
Concerning glumpy, I still maintain it and it is less complex than Vispy but it does not offer the high-level interface of vispy. I usually make the comparison numpy/scipy and glumpy/vispy. But the two projects are independent (even if I transferred a lot of code from glumpy to vispy).

For a starter on OpenGL, you can have a look at glumpy documentation: http://glumpy.readthedocs.io/en/latest/

Nicolas



> On 14 Sep 2017, at 16:47, Benjamin Root <[hidden email]> wrote:
>
> The person who has been most responsive to me in the past would be Nicolas Rougier, who developed glumpy. He might also be able to give you a better sense of where to start.
>
> Ben Root
>
> On Thu, Sep 14, 2017 at 10:37 AM, Francesco Faccenda <[hidden email]> wrote:
> I'll take a look, thank you.
>
> So you are suggesting me to start form the VisPy code? Is there someone who I can refer in case I will need some clarification?
>
> Francesco Faccenda
>
> 2017-09-14 15:50 GMT+02:00 Benjamin Root <[hidden email]>:
> That was one of the old attempts (but not the oldest). It doesn't seem like it ever intersected with the vispy project, though, so it is likely all that exists.
>
> I would also look at https://www.youtube.com/watch?v=_3YoaeoiIFI
> Luke does a nice job providing an overview of the vispy package. One of the most exciting things that the matplotlib and vispy devs were discussing at scipy 2015 was the possibility of making a matplotlib backend out of some parts from vispy. It was attractive because the vispy folks were actively working on improving their opengl code and packaging to make it work on a wide variety of hardware and setups. They had supposedly even implemented a headless opengl mode, too, which was very important for us.
>
> Cheers!
> Ben Root
>
>
> On Thu, Sep 14, 2017 at 9:34 AM, Francesco Faccenda <[hidden email]> wrote:
> Thank you, Ben.
>
> unfortunately I don't have experience developing opengl neither, but I'd like to make an attempt riesuming this subject.
>
> I am starting from this: https://github.com/ChrisBeaumont/mplgl
>
> Can anyone confirm this is the last update we have for this project?
>
> Francesco Faccenda
>
> 2017-09-13 16:21 GMT+02:00 Benjamin Root <[hidden email]>:
> A bit of background regarding efforts in this area...
>
> A long time ago, some experiments were done to see if an opengl backend could be made for matplotlib. The results weren't that great, particularly for text rendering, so the effort was dropped. The core developers all agree that an opengl backend would be neat to have, but we all have limited, if any, experience developing opengl. Furthermore, such a backend would likely require a lot of rapid development and trial-n-error. So, we encouraged others to go develop a package or two separately, with the eye for bringing it back into matplotlib when it was ready. Glumpy and a few other projects were born from that prodding.
>
> VisPy was an attempt to consolidate the development efforts for those projects. The matplotlib devs had very fruitful discussions with some VisPy devs back at SciPy 2015, but the project became non-responsive shortly afterwards.
>
> Ben Root
>
>
> On Wed, Sep 13, 2017 at 3:31 AM, Francesco Faccenda <[hidden email]> wrote:
> Thank you Chris for your reply.
>
> I have to admit I already stumbled on VisPy while doing my research on the web. Still, I've got a lot of code already working with matplotlib. Indeed, not only I plot data with it, but i manage a lot of mpl events to provide the users usefool tools, like lines picking, tooltips, lines copy/paste, square selectors for multiple selections, context menu and so on. Moreover, I got matplotlib embedded on wxpython as well. While at the beginning few lines were managed and noone complained, now that big amout of data has to be displayed, the non-GPU core of the library is starting to show its limits.
>
> Since matplotlib is a reference library for this kind of  applications, I thought it deserved an update in this direction. If anyone is willing to do so, I'm available to discuss possible solutions and also provide any help I can give.
>
> Best regards,
> Francesco Faccenda
>
> 2017-09-13 0:46 GMT+02:00 Chris Barker <[hidden email]>:
> On Tue, Sep 12, 2017 at 8:47 AM, Francesco Faccenda <[hidden email]> wrote:
> But there’s a good news, I have a nice GPU available (an NVIDIA Tesla K40c), so I’d like to know if there is a way to make matplotlib run on it, or maybe wrap it on some GPU/CUDA wrapper and make it run smoothly.
>
>
> I tihnk you want VisPy:
>
> https://vispy.readthedocs.io/en/latest/
>
> It's a plotting package with a kinda like  matplotlib API, built on OpenGL.
>
> Unfortunately, it doesn't look like it's been updated in a while -- from teh docs. But the gitHub project is active:
>
> https://github.com/vispy/vispy
>
> So maybe it's only the docs that haven't been updated!
>
> But probably  a much better option than trying to shoehorn GPU rendering into MPL.
>
> The problem is that while MPL was designed to be "backend" independent -- so it is "easy" to plug in an alternative renderer, the rendering model is not really well suited to GPU rendering -- it would take a lot of refactoring to really be able to take advantage of the graphics card.
>
> -CHB
>
>
> --
>
> Christopher Barker, Ph.D.
> Oceanographer
>
> Emergency Response Division
> NOAA/NOS/OR&R            <a href="tel:%28206%29%20526-6959" value="+12065266959">(206) 526-6959   voice
> 7600 Sand Point Way NE   <a href="tel:%28206%29%20526-6329" value="+12065266329">(206) 526-6329   fax
> Seattle, WA  98115       <a href="tel:%28206%29%20526-6317" value="+12065266317">(206) 526-6317   main reception
>
> [hidden email]
>
>
> _______________________________________________
> Matplotlib-devel mailing list
> [hidden email]
> https://mail.python.org/mailman/listinfo/matplotlib-devel
>
>
>
>
>
>
> _______________________________________________
> Matplotlib-devel mailing list
> [hidden email]
> https://mail.python.org/mailman/listinfo/matplotlib-devel

_______________________________________________
Matplotlib-devel mailing list
[hidden email]
https://mail.python.org/mailman/listinfo/matplotlib-devel


_______________________________________________
Matplotlib-devel mailing list
[hidden email]
https://mail.python.org/mailman/listinfo/matplotlib-devel
Reply | Threaded
Open this post in threaded view
|

Re: [matplotlib-devel] Make matplotlib running on GPU/CUDA

Chris Barker - NOAA Federal
In reply to this post by Francesco Faccenda
On Wed, Sep 13, 2017 at 12:31 AM, Francesco Faccenda <[hidden email]> wrote:
I have to admit I already stumbled on VisPy while doing my research on the web. Still, I've got a lot of code already working with matplotlib. Indeed, not only I plot data with it, but i manage a lot of mpl events to provide the users usefool tools, like lines picking, tooltips, lines copy/paste, square selectors for multiple selections, context menu and so on. Moreover, I got matplotlib embedded on wxpython as well. While at the beginning few lines were managed and noone complained, now that big amout of data has to be displayed, the non-GPU core of the library is starting to show its limits.

Since matplotlib is a reference library for this kind of  applications, I thought it deserved an update in this direction.

Well, As I understand it, VisPY made some effort to be compatible with the MPL API -- but that is going to depend on how much you use the lower-level parts f the API -- things like the transform, etc. to take advantage of GPU rendering, all the transforms, etc needs to be pushed to the GPU, so the architecture (and API) needs to be quite different.
 
If anyone is willing to do so, I'm available to discuss possible solutions and also provide any help I can give.

As Ben pointed out, and I was trying to make clear -- it really isn't a matter of "just" writing an OpenGL backend -- there really needs to be a major restructuring.

And VisPy is pretty much that project. Whether it is feature complete, robust and maintained enough for your use-cases, I have no idea, but even if not -- you'll probably be better off contributing to that effort than starting all over with trying to make an GPU_based OPenGL back-end.

However -- maybe there is another option:

Taking full advantage of GPUs does require a full restructuring, but maybe there are other ways to get better performance -- for instance, optimizing the transform code, etc:

Using the GPU with PyCuda or [what the heck is the name of the more general GPU-using lib??]

using numba

Maybe there is still room for Cython, etc....

In short, profiling MPL carefully, to see where the performance bottlenecks are:

With modern hardware, actually rendering stuff is no longer the slow part of visualization. Rather, it's pushing data to the renderer, transforming data etc.

This is why to take advantage of the GPU, you need to do the transformations, etc on the GPU -- which the MPL architecture doesn't make easy by dropping in a new back-end.

Which is why VisPy built a new architecture from the bottom up.

-CHB


--

Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR&R            <a href="tel:(206)%20526-6959" value="+12065266959" target="_blank">(206) 526-6959   voice
7600 Sand Point Way NE   <a href="tel:(206)%20526-6329" value="+12065266329" target="_blank">(206) 526-6329   fax
Seattle, WA  98115       <a href="tel:(206)%20526-6317" value="+12065266317" target="_blank">(206) 526-6317   main reception

[hidden email]

_______________________________________________
Matplotlib-devel mailing list
[hidden email]
https://mail.python.org/mailman/listinfo/matplotlib-devel
Reply | Threaded
Open this post in threaded view
|

Re: [matplotlib-devel] Make matplotlib running on GPU/CUDA

tcaswell
Depending on the exact use case you can get pretty good mileage out of blitting (See http://matplotlib.org/api/animation_api.html#funcanimation for an explanation or how it is used in the widgets module).  

The best way to make things faster is to just do less work :)

Tom

On Thu, Sep 21, 2017 at 5:14 PM Chris Barker <[hidden email]> wrote:
On Wed, Sep 13, 2017 at 12:31 AM, Francesco Faccenda <[hidden email]> wrote:
I have to admit I already stumbled on VisPy while doing my research on the web. Still, I've got a lot of code already working with matplotlib. Indeed, not only I plot data with it, but i manage a lot of mpl events to provide the users usefool tools, like lines picking, tooltips, lines copy/paste, square selectors for multiple selections, context menu and so on. Moreover, I got matplotlib embedded on wxpython as well. While at the beginning few lines were managed and noone complained, now that big amout of data has to be displayed, the non-GPU core of the library is starting to show its limits.

Since matplotlib is a reference library for this kind of  applications, I thought it deserved an update in this direction.

Well, As I understand it, VisPY made some effort to be compatible with the MPL API -- but that is going to depend on how much you use the lower-level parts f the API -- things like the transform, etc. to take advantage of GPU rendering, all the transforms, etc needs to be pushed to the GPU, so the architecture (and API) needs to be quite different.
 
If anyone is willing to do so, I'm available to discuss possible solutions and also provide any help I can give.

As Ben pointed out, and I was trying to make clear -- it really isn't a matter of "just" writing an OpenGL backend -- there really needs to be a major restructuring.

And VisPy is pretty much that project. Whether it is feature complete, robust and maintained enough for your use-cases, I have no idea, but even if not -- you'll probably be better off contributing to that effort than starting all over with trying to make an GPU_based OPenGL back-end.

However -- maybe there is another option:

Taking full advantage of GPUs does require a full restructuring, but maybe there are other ways to get better performance -- for instance, optimizing the transform code, etc:

Using the GPU with PyCuda or [what the heck is the name of the more general GPU-using lib??]

using numba

Maybe there is still room for Cython, etc....

In short, profiling MPL carefully, to see where the performance bottlenecks are:

With modern hardware, actually rendering stuff is no longer the slow part of visualization. Rather, it's pushing data to the renderer, transforming data etc.

This is why to take advantage of the GPU, you need to do the transformations, etc on the GPU -- which the MPL architecture doesn't make easy by dropping in a new back-end.

Which is why VisPy built a new architecture from the bottom up.

-CHB


--

Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR&R            <a href="tel:(206)%20526-6959" value="+12065266959" target="_blank">(206) 526-6959   voice
7600 Sand Point Way NE   <a href="tel:(206)%20526-6329" value="+12065266329" target="_blank">(206) 526-6329   fax
Seattle, WA  98115       <a href="tel:(206)%20526-6317" value="+12065266317" target="_blank">(206) 526-6317   main reception

[hidden email]
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot_______________________________________________
Matplotlib-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel

_______________________________________________
Matplotlib-devel mailing list
[hidden email]
https://mail.python.org/mailman/listinfo/matplotlib-devel