Live data from Hacker News

Unifying the CUDA Python Ecosystem

developer.nvidia.com

41–50 of 62 posts

Re: Unifying the CUDA Python Ecosystem

#41

Just for contrast its interesting to look at an example of writing a similar kernel in Julia: https://juliagpu.gitlab.io/CUDA.jl/tutorials/introduction/ I don't think it's possible to achieve something like this in python because of how it's interpreted (but it sounds a bit like what another comment mentioned where the python was compiled to C)

JAX and TensorFlow functions both would convert some Python code to equivalent XLA code or a TF graph.

Re: Unifying the CUDA Python Ecosystem

#42
post #2

About 8 years ago an NVIDIA developer released a tool called Copperhead that let you write CUDA kernels in straight Python that were then compiled to C, no "C-in-a-string" like is shown here. I always thought it was so elegant and had great potential, and I introduced a lot of people in my circle to it, but then it seems NVIDIA buried it. This blog post is great, and we need these kind of tools for sure, but we also…

In the IP world, there are some-hidden gems that disappear with no trace one day.

I worked for a client that had this wonderful Python dsl that compiled to Verilog and VHDL. It was much easier to use than writing the stuff the old way. Much more composable too, not to mention tooling.

They created that by forking an open source project dating back to Python 2.5 that I could never find again.

Imagine if that stuff would still be alive today. You could have a market for paid pypi.org instances providing you with pip installable IP components you can compose and customize easily.

But in this market, sharing is not really a virtue.

Re: Unifying the CUDA Python Ecosystem

#43
Am I the only one who thinks that the API looks terrible? Lots of cryptic and hard-to-remember names (`cuMemcpyDtoHAsync`), no proper error and log handling, manual building of command line arguments (`opts = [b"--fmad=false", b"--gpu-architecture=compute_75"]` – wat), …

And, knowing Nvidia, the documentation will probably be terrible and anything but beginner-friendly, too.

I mean, if you want to improve upon the CUDA ecosystem why not start with the low-hanging fruit first?

Re: Unifying the CUDA Python Ecosystem

#44

Am I the only one who thinks that the API looks terrible? Lots of cryptic and hard-to-remember names (`cuMemcpyDtoHAsync`), no proper error and log handling, manual building of command line arguments (`opts = [b"--fmad=false", b"--gpu-architecture=compute_75"]` – wat), … And, knowing Nvidia, the documentation will probably be terrible and anything but beginner-friendly, too. I mean, if you want to improve upon the CU…

While those names are vestiges of the history, I would be curious how you would name cuMemcpyDtoHAsync?

They have lots of functions [1] to name and I usually find they did a good job given the low level of the language and its proximity with the hardware and low level programming.

I do not know for python but CUDA on C++ has error handling!

As for the command line: think as you were programming for a specific architecture with its associated API

[1] https://docs.nvidia.com/cuda/cuda-runtime-api/index.html

Re: Unifying the CUDA Python Ecosystem

#45
post #2

About 8 years ago an NVIDIA developer released a tool called Copperhead that let you write CUDA kernels in straight Python that were then compiled to C, no "C-in-a-string" like is shown here. I always thought it was so elegant and had great potential, and I introduced a lot of people in my circle to it, but then it seems NVIDIA buried it. This blog post is great, and we need these kind of tools for sure, but we also…

Closest thing to mind is Numba's cuda JIT compilation : https://numba.pydata.org/numba-doc/latest/cuda/index.html

Then you have Cudapy : https://github.com/oulgen/CudaPy

But in my opinion, the most future proof solutions are higher level frameworks like Numpy, Jax and Tensorflow. TensorFlow and Jax can JIT compile Python functions to GPU (tf.function).

Re: Unifying the CUDA Python Ecosystem

#46
Is this something that could be built on top of MLIR Python Bindings [1]? I don't know enough about any of these projects, but I worry that NVIDIA will be doing something proprietary and against an open ecosystem. It seems like you could build the entire python toolchain on top of python with MLIR bindings and support numpy acceleration that way. Just curious if this is the right thinking?

[1] https://mlir.llvm.org/docs/Bindings/Python/

Re: Unifying the CUDA Python Ecosystem

#47
post #2

About 8 years ago an NVIDIA developer released a tool called Copperhead that let you write CUDA kernels in straight Python that were then compiled to C, no "C-in-a-string" like is shown here. I always thought it was so elegant and had great potential, and I introduced a lot of people in my circle to it, but then it seems NVIDIA buried it. This blog post is great, and we need these kind of tools for sure, but we also…

I’m so glad you liked it. It was a labor of love and I was super proud of it. Means a lot to me that you would still remember it.

I flatter myself to think that some ideas from that project have lived on in Tensorflow and PyTorch, etc. But the project itself wrapped up when I decided to focus on DL, and it would take a lot of work to bring it back to life.

Re: Unifying the CUDA Python Ecosystem

#48
post #17

Earlier quoted context omitted.

No, the high electricity cost in my country + the noise pollution in the house + how much I generally earn from the machine + my views on burning the world speculatively, discourage me from mining crypto. Perhaps my position might change in future, but for now, I'd probably rather make the GPU accessible to those open-source distributed grids that train chess engines or compute deep-space related thingies :)

I am not convinced that training AI to win at chess is any more moral than mining crypto. And the block chain is about as open-source as you can get.

Sure it is. With a chess AI you’re driving forward progress in neural networks, machine learning, and technology in general which pushes forward humanity in ways that are too numerous to count (even if you don’t buy into AI hype). With mining crypto, you’re hashing a bunch of things against a bunch of other things to make some imaginary things that people only assign value to because other people assign value to, in a tautology, ad infinitum. It’s a scourge on the environment and a waste of great minds, to the extent that those minds are devising new crypto, not to the extent that they’re buying a mining rig to mine crypto.

Re: Unifying the CUDA Python Ecosystem

#49
post #2

About 8 years ago an NVIDIA developer released a tool called Copperhead that let you write CUDA kernels in straight Python that were then compiled to C, no "C-in-a-string" like is shown here. I always thought it was so elegant and had great potential, and I introduced a lot of people in my circle to it, but then it seems NVIDIA buried it. This blog post is great, and we need these kind of tools for sure, but we also…

In the IP world, there are some-hidden gems that disappear with no trace one day. I worked for a client that had this wonderful Python dsl that compiled to Verilog and VHDL. It was much easier to use than writing the stuff the old way. Much more composable too, not to mention tooling. They created that by forking an open source project dating back to Python 2.5 that I could never find again. Imagine if that stuff wou…

Sounds like nmigen might be a good open source successor to the project that you describe: https://github.com/nmigen/nmigen There are lots of open-source (n)migen components available through the litex framework: https://github.com/enjoy-digital/litex

Re: Unifying the CUDA Python Ecosystem

#50
post #2

About 8 years ago an NVIDIA developer released a tool called Copperhead that let you write CUDA kernels in straight Python that were then compiled to C, no "C-in-a-string" like is shown here. I always thought it was so elegant and had great potential, and I introduced a lot of people in my circle to it, but then it seems NVIDIA buried it. This blog post is great, and we need these kind of tools for sure, but we also…

I’m so glad you liked it. It was a labor of love and I was super proud of it. Means a lot to me that you would still remember it. I flatter myself to think that some ideas from that project have lived on in Tensorflow and PyTorch, etc. But the project itself wrapped up when I decided to focus on DL, and it would take a lot of work to bring it back to life.

I am not a CUDA dev, but it feels so good you, authors are around :) Cool!
Post reply on HN