4 ms·
Over the weekend I dipped my toes into the GPU compute waters a bit, tried to get to grips with the massive tangle of competing and co-operating technologies, a
by Joeboy 7y ago
Over the weekend I dipped my toes into the GPU compute waters a bit, tried to get to grips with the massive tangle of competing and co-operating technologies, and tentatively concluded that OpenCL was probably as good a place as any to start learning, in 2020.
Interested to hear opinions on whether that was a reasonable conclusion, and whether this makes a difference to it.
- skohan 7y agoIt depends what you need to do with it. If you're doing something like image processing or dealing a lot with matricies/linear algebra, Vulkan's compute support is quite good and the compatibility story is great, but GLSL/HLSL might not be ideal depending on your use-case.
- VHRanger 7y agoExcept Vulkan is a giant pain in the ass to set up. Just getting through the Vulkan tutorial is a weekend long affair.
- whatshisface 7y agoSurely once one person has gone through the Vulkan tutorial, everyone else can copy them?
- skohan 7y agoThe problem is that Vulkan's power comes from specificity: in other words you can plan your resources and executions for exactly your use case which gives great performance with little overhead. The trade-off is because everything is so hand-tailored, it's very difficult to generalize, so just copy-pasting an implementation is only useful if you want to do exactly the same thing.
- pjmlp 7y agoNo, Vulkan follows the learning path of OpenGL. Instead of having a nice SDK like the proprietaty APIs do, you are expected to go hunting for books and online tutorials about third party libraries so that you can go through all basic steps of loading shaders, textures, font files, gui frameworks and display something. Also in the process you will implement your own scene graph and material support. Consider it the rite of passage into Khronos' land, which every graphics programming student throughout the world has to go through. Yes, there is LunarG SDK, however it is quite anemic versus what VS + DirectXTK, XCode + MetalKit, PS4 SDK, Switch SDK offer as out of the box experience.
- whatshisface 7y agoHonestly if Vulkan followed the path of OpenGL it would be about 100x easier than it really is!
- jfkebwjsbx 7y agoIf you really want to understand what is going on, those SDKs are useless at best, though. They are fine to get some complex features working specially early on, yes, but not for learning.
- pjmlp 7y agoYet that is one of the biggest complains in the latest Vulkan survey, lack of support for learning. Those SDKs allow plenty of wanna be game developers to just be doing rotating cubes in less than a couple of minutes and go from there. Sit in a room trying to go through NeHe tutorials and watch students motivation slowly fade away.
- jfkebwjsbx 7y agoIt depends on what you are trying to achieve. If you are trying to teach gamedev, then I agree it is a pain. However, if you teach a general graphics course in a CS curriculum, then the slow, spec-like approach is way better. Regardless I never liked the NeHe tutorials for some reason. I did them when fixed pipeline was a thing and they bore me a lot, yeah... but when I learnt modern GL properly it was way better. Seeing a cube rotate is irrelevant to motivation as long as you understand what you are doing, in my experience.
- indeyets 7y agoCouldn't it be solved with a universal template? Something like bootstrapper for computation applications?
- pjmlp 7y agoIt could be sorted out with a friendly begginers SDK, but Khronos sees that as responsibility for the partners, they just do specs.
- skohan 7y agoBut once you get competent it's like having super powers
- Joeboy 7y agoI think I mostly just want to assuage my embarrassment about being a computer programmer with no idea how to use most of the computing power in modern computers. Edit: And ideally I'd like to be able to learn on my "Intel Integrated Graphics" laptop, although I don't care about performance there. Maybe I should be looking into something that can target SPIR-V via LLVM, or something? Don't know what good options currently exist for for that. I'm generally a bit lost, if that's not already obvious.
- jjoonathan 7y ago> ideally I'd like to be able to learn on my "Intel Integrated Graphics" laptop NO. Rent a cloud server or buy an old computer with a discrete GPU. Don't even try winging it. This is not x86 land where everything works everywhere. Not even close. NVIDIA/CUDA is what everyone does, AMD/OpenCL is like shooting yourself in the foot, and Intel Integrated / OpenCL is like shooting yourself in the head. Yes, really. Last time I encountered Intel Integrated, I spent an entire weekend trying to port a relatively trivial shader. It would compile and run, but the output was always very wrong. Needless to say, the tooling was no help, and remember this is GPU land where you don't have printf, but I eventually discovered the problem: 8 bit floats. Yes, 8 bit floats are a thing in Intel Integrated land. No, it didn't give me any warning it was using them. "You asked for a float, you got a float, what's the problem?" I imagine an intel engineer saying. Because I'm a stubborn SOB I didn't learn my lesson there and I soldiered on -- next bug was a silent pageout issue. Does this sound like fun? If so, go for it. If not, buy a discrete GPU. AMD might be OK these days, they've been working on their problems, but once bitten twice shy, so my recommendation is to buy something with an NVIDIA GPU and consider the green tax an investment in your mental health.
- skohan 7y ago> Yes, really. Last time I encountered Intel Integrated, I spent an entire weekend trying to port a relatively trivial shader. What are you talking about? What API were you using? I use Vulkan to target multiple GPU architectures and I have never had a problem with compatibility or shader behavior, even with very complex multi-pipeline processes. In general, if your code doesn't throw validation warnings, it will do what you expect on any hardware.
- jjoonathan 7y ago~5 years ago I burned myself badly by choosing OpenCL and AMD cards as a compute platform. I expected the OpenCL ecosystem to be at rough parity with the CUDA ecosystem in terms of features and performance. That couldn't have been further from the case. I wound up selling my cards, eating the spread + shipping + 10% ebay fees, and switching teams. Just bite the bullet and pay the green tax. It's cheaper than your health and sanity.
- frozenport 7y agoIt's a pretty bad place. Requires a lot of boilerplate, hard to use debugger, and has less features than CUDA.
- belval 7y agoWhile if closed source is a dealbreaker for you, I can understand your conclusion, but otherwise just use CUDA. It is better in simply all the ways that matter, with a simpler API and a lot more resources.
- Joeboy 7y agoHaving to buy a new laptop is a dealbreaker for me, which I think I would have to in order to learn CUDA on it.
- short_sells_poo 7y agoYou are honestly better off renting a cheap spot priced GPU instance than trying to do anything on a laptop, doubly so if said laptop GPU is not even supported by CUDA. Otherwise your whole learning experience is going to be an exercise in frustration with almost zero tangible output.