Scientific computing and parallel computing C++23/C++26

Ola Fosheim Grøstad ola.fosheim.grostad at gmail.com
Thu Jan 20 08:36:32 UTC 2022


On Thursday, 20 January 2022 at 08:20:58 UTC, Nicholas Wilson 
wrote:
>  Now you've confused me. You can select which implementation to 
> use at runtime with e.g. CPUID or more sophisticated methods. 
> LDC targeting DCompute can produce multiple objects with the 
> same compiler invocation, i.e. you can get CUDA for any set of 
> SM version, OpenCL compatible SPIR-V which you can get per GPU, 
> inspect its hardware characteristics and then select which of 
> your kernels to run.

Yes, so why do you need compile time features?

My understanding is that the goal of nvc++ is to compile to CPU 
or GPU based on what pays of more for the actual code. So it will 
not need any annotations (it is up to the compiler to choose 
between CPU/GPU?). Bryce suggested that it currently only targets 
one specific GPU, but that it will target multiple GPUs for the 
same executable in the future.

The goal for C++ parallelism is to make it fairly transparent to 
the programmer. Or did I misunderstand what he said?

My viewpoint is that if one are going to take a performance hit 
by not writing the shaders manually one need to get maximum 
convenience as a payoff.

It should be an alternative for programmers that cannot afford to 
put in the extra time to support GPU compute manually.


>> If you have to do the unrolling in D, then a lot of the 
>> advantage is lost and I might just as well write in a shader 
>> language...
>
> D can be your compute shading language for Vulkan and with a 
> bit of work whatever you'd use HLSL for, it can also be your 
> compute kernel language substituting for OpenCL and CUDA.

I still don't understand why you would need static if/static 
for-loops? Seems to me that this is too hardwired, you'd be 
better off with compiler unrolling hints (C++ has these) if the 
compiler does the wrong thing.


> Same caveats apply for metal (should be pretty easy to do: need 
> Objective-C support in LDC, need Metal bindings).

Use clang to compile the objective-c code to object files and 
link with it?





More information about the Digitalmars-d mailing list