Live data from Hacker News

Ask HN: Best place to learn GPU programing?

news.ycombinator.com

21–30 of 57 posts

Re: Ask HN: Best place to learn GPU programing?

#21
post #17

Earlier quoted context omitted.

I looked into it before, but thought its too slow and its more like for people having no idea about computers before, sorry these are purley my feeling alone.So asked for more advance tutorial here !?

You can just skip the first lessons, the chapter "Squaring Numbers Using CUDA Part 1" has some code. Then the third lesson some more advanced techniques (actually they are really basic, but you might not have heard about them if you're not into parallel programming or networking hardware). I recommend it btw.

Thanks, sure will give it a try !!

Re: Ask HN: Best place to learn GPU programing?

#22
post #6

what does "GPU programming" mean? Does it mean you've never done anything GPU related ever and you want to start at "put a triangle on the screen" with OpenGL or WebGL? Does it mean some thing like GPGPU, you want to use GPUs to do computation? Does it mean something like Vulkan/DX12/Metal, you want do low level stuff? Maybe someone can give answers to all of those questions but they're arguably different things and…

Hello, sorry for my vague question, I want learn CUDA so I can increase performance of an existing framework, pure performance and throughput time in consideration. And no I dont have no prior experience on working with GPU's before.

> increase performance of an existing framework

Cautionary tale following...

I don't know the background on this but your goal might not be realistic, unless the rest of the framework architected in a GPU friendly way.

I was once hired for such a project (some scientific applications in chemistry). They had a clear idea what needed to be improved, their Python framework called into C code for some non-trivial matrix operations. This was at the top of the profile so making it faster would have improved the overall performance.

However, each matrix operation was just tens to hundreds of kilobytes in size. Doing them with the GPU was 100x faster, but the latency of getting the data to the GPU and back eliminated any gains.

It's clear that doing these on the GPU would have improved overall performance if the operations could be batched. But the framework was tens of thousands of LOC of scientist-written Python code that was mission critical and could not be rewritten in the time and budget we had.

GPU programming is high throughput at the expense of high latency. It is very difficult to retrofit into a CPU-only framework or application. You need to consider memory management and synchronization for the GPU from ground up.

Re: Ask HN: Best place to learn GPU programing?

#23
post #16

My advice: learn OpenCL, but not OpenGL. The API is much simpler, and very applicable. Maps on CUDA quite well too.

I am looking into performance optimization in a data processing framework would COpenGL help ? or should I just learn CUDA from the links others suggested !?

OpenGL is most likely not what you want.

For compute, your choices are CUDA, OpenCL, or compute shaders in Vulkan or D3D. CUDA is most likely the best choice if a single vendor API is acceptable.

Re: Ask HN: Best place to learn GPU programing?

#24
post #22

Earlier quoted context omitted.

Hello, sorry for my vague question, I want learn CUDA so I can increase performance of an existing framework, pure performance and throughput time in consideration. And no I dont have no prior experience on working with GPU's before.

> increase performance of an existing framework Cautionary tale following... I don't know the background on this but your goal might not be realistic, unless the rest of the framework architected in a GPU friendly way. I was once hired for such a project (some scientific applications in chemistry). They had a clear idea what needed to be improved, their Python framework called into C code for some non-trivial matrix…

Thanks for the insight, Well I am working on a research project, to redesign a CPU architecture framework into a GPU one, and luckly I am working on real time batch processed data, so as of now have some plans as to what should go on GPU and I want to try it out myself and see if there are ways to cut of those bus tranmsion latencies between CPU and GPU. Not sure how exaclty but I just started kearning CUDA now, one more thing how will I know if I should use OpenCL or CUDA ?

Re: Ask HN: Best place to learn GPU programing?

#26
post #19

Earlier quoted context omitted.

I am working on a data processing framework project so I dont think I have a months time so as of now I started reading http://analog.nik.uni-obuda.hu/ParhuzamosProgramozasuHardver...

ah ok then you're better off learning OpenCL, if you don't have access to a beefy graphics card just rent one by the hour off of amazon. You can prototype on your laptops CPU then run the real simulation on a remote machine.

thats an issue I already have NVIDIA Corporation GM107 [GeForce GTX 750 Ti] (rev a2) to work on. but why OpenCL and not CUDA ?

Re: Ask HN: Best place to learn GPU programing?

#29
post #9

Get a book on linear algebra, a book on C/C++, and download the OpenGL spec and build a graphics pipeline that can render a textured polygon, then add lights, shadows, animations... this will take you a month perhaps.

One month, sure :D Realistically, if you have no GPU or OpenGL experience, to build something like that, lightning, shadows.. And to really understand what is happening, in one month maybe if already know C++/your language of choice well, you can grasb the idea of how to draw a triangle with maybe some lightning.

Shadows, animation, no way in a month. The whole OpenGL stack is pretty complex.

My suggestion would be the same though, but maybe reserve one year to really just grind the basics until you have a clear understanding of what is happening.

On the other hand, if you just want CUDA, there are frameworks for that for enabling parallel calculations without having to understand graphics programming.

Re: Ask HN: Best place to learn GPU programing?

#30
I'm afraid there isn't a single best place. What is important first is to learn how GPU architecture is different from traditional before you start learning Cuda or linear algebra. Take a look at these sources for absolute beginners.

https://thebookofshaders.com/

http://duriansoftware.com/joe/An-intro-to-modern-OpenGL.-Tab...

http://learnopengl.com/

edit: also when you are ready to pick a language and start writing code, i advise using the universal OpenGL over Cuda.

Post reply on HN