Are you imagining this running inside a cuda kernel? If yes, the problem with doing anything of the kind is that, even if you run your kernel with one warp and mask all but one thread, you still then need round trips to the cpu to do io, and you need to dynamically load code, both of which the gpu is quite bad about.
If no, it is probably doable if a bit hard to generate kernels on the fly.
> We have a physics engine and we want to allow users to write custom c++ functions that can be linked in at run-time. We'd like to allow our users to swap in their own custom integration or timestep methods for example.
Can't you achieve that with plain old dlopen etc? I suppose name mangling can be bit of pita if you want to have truly c++ interfaces instead of extern c ones.
Re:Inspector – A drop-anywhere C++ REPL
by watmough on Monday February 12, 2018 @09:01PM
(#16364171)
Hopefully this is relevant, but you can certainly kick off nvcc -ptx in a shell to generate ptx files, then just load those in through driver calls.
I'm totally planning to do something like this for some bulk data processing I have in mind.
You probably want to use libcling directly instead.
Re:Inspector – A drop-anywhere C++ REPL
by saagarjha on Monday February 12, 2018 @04:11PM
(#16362196)
From the source code, it looks like that's what this program is using as well.
Hence "directly", I read it as.
As an aside, do you know if it is possible to use this to JIT C++ for CUDA kernels?