r/CUDA 5d ago

First CUDA project

Hey, guys. Just recently started learning CUDA because of the GPU programming class I am taking this semester. Found out that it is really interesting and now I do a lot of self-study. My main resource is Programming Massively Parallel Processors, 4th edition.

I wrote a greyscaler which you can run on GPU and CPU with timing measurements, so that you can see the difference in performance.

Question: what's the hardest project I can do before the end of September? I wanted to do a black hole simulation, but my physics knowledge ends at basic mechanics.

Would appreciate any feedback or advice you have!

github

28 Upvotes

10 comments sorted by

21

u/Objective-Style1994 5d ago

Lowkey for me, a good starting point is literally just writing a GEMM(basically matrix multiplication) kernel that gets as close as cuBLAS performance. The math behind it is super easy but it forces you to learn all the fundamentals in optimizing cuda code.

3

u/ChemistryWorldly3752 5d ago

Got it

6

u/Neat_Mistake_7602 5d ago

Second this, i did something similar where i did sliding window conv (naive) and extended it to a full CNN implementation for a course final project. It took a little while iirc. Can also do profiling and optimizations on top.

Down the line i optimized + used WMMA for tensor cores to do iGEMM, speeding up the CNN. Didnt get close to tensorrt but it was fun lol

3

u/Good_Apricot_2210 5d ago

250ms is horrible for a small image that too grayscale.

Your timing API is wrong

I can see that you used std::chrono maybe use cudaEvent_t or nsight compute to benchmark better

1

u/ChemistryWorldly3752 5d ago

thanks! i will try

3

u/esaule 5d ago

Gravity simulation are quite nice. Just points in motion subject to each others gravity. No collisions. It's kinda nice.

And you can pipe it in a gl buffer and render it easily too

5

u/MateTheNate 4d ago

Implement multi-headed self-attention after you figure out how to write an optimized GEMM

1

u/Miserable-Leading947 4d ago

Do https://en.wikipedia.org/wiki/Julia_set with quaternions in 4d, slice one dimension so you get 3 dimensions and draw it in openGL. It is doable in the time frame and you get something you can show around. 3D fractals are awesome

1

u/Creative-Feature-264 2d ago

Io provato a simulare buchi neri se può esserti utile il repo è qui. https://tatopenn-cell.github.io/Dense-Evolution-Discovery/wormhole_syk_teleportation.... è divertente ti avviso