What a great project! One of my favorite things to see is when people implement as much as possible themselves. It really makes a big difference to have control over what is going on. And it is great for educational purposes of course.
I'm definitely going to be looking at this. Hope you had fun making it.
> I don't see many other people using Vulkan for GPGPU, and there may be many good reasons for that, but I wanted to try something a bit different.
A big reason is that C++ for Vulkan (SPIR-V) isn't quite there, while CUDA does C, C++20 (minus modules currently), Fortran, Haskell, Java, C#, Julia, Python JITs, and anything else that might target PTX.
SPIR was a late response after Khronos realized the world wasn't willing to be stuck with C for GPGPU, and the tooling is still catching up to PTX.
Very nice project, congratulations! Have you done any performance comparisons with tensorflow or pytorch?
Lots of C++ inference code out there but this does training as well - impressive.
That reminds me of a small project I did to classify drawings of cats and dogs 10 years ago with machine learning https://jeena.net/catdog but no neural networks back then, just things like Canny edge detector, Hough transform, k-nearest neighbor, etc.
Very cool. I always find doing these kinds of toy projects is a great way of dipping your toes in the deep end of a new subject.
Huh. I wanted to do the same for many years, but you have actually done first. Cool!
Can you comment :
how well does Vulcan api fit Neural Net primitives [ matmul / relu / backprop / tensor arrays ] ?
Also.. do you think the in-browser WebGPU api, the successor to webGL, is a good api for NN ?
I liked the original post title that left me momentarily confused going "why is CNN writing articles in C++?????"
What is a CNN?
Interestingly, I have a similar project with C# for the higher-level pieces, and Direct3D 11 GPU API instead of Vulkan: https://github.com/Const-me/Cgml
> don't see many other people using Vulkan for GPGPU, and there may be many good reasons for that
I think the main of these reasons is nVidia’s contributions to the ecosystem. It’s much easier to call library functions implemented by cuDNN or cuBLAS first-party library, than it is to write and dispatch compute shaders to multiply these matrices.
However, for use cases when hardware costs are substantial compared to software development costs, using Vulkan or D3D can be a reasonable thing to do. nVidia is too greedy, in the EULA of their drivers they forbid to use GeForce GPUs in data centres. For people who need GPGPU on their servers, that paragraph of text sometimes makes nVidia hardware an order of magnitude more expensive than AMD hardware.