[cfe-dev] Clang and CUDA with C++11 features
Peter Colberg
peter at colberg.org
Thu Jun 14 09:52:29 PDT 2012
On Thu, Jun 14, 2012 at 09:40:05AM -0700, Sean Silva wrote:
> Oh, yeah. idk why but I got the impression that you were trying to get it
> to work while keeping the cuda call syntax (I haven't done any cuda
> programming, but the alternative to the cuda call syntax in the example you
> gave seemed painful to write), even though you explicitly said "Is there a
> way to disable parsing of the CUDA call syntax <<< >>>?"
The CUDA kernel execution syntax is really just syntactic sugar, and
not needed for CUDA programming. My example code using cudaConfigure,
cudaSetupArgument and cudaLaunch seems impractical at first, but with
a C++ wrapper it becomes very convenient to use:
cuda::function<void (int, int*)> f = &kernel_function;
cuda::configure(blocks, threads);
f(args...);
With nvcc and C++98, I was using the following wrapper. It's not the
nicest code, but it will look better with C++11 and variadic templates
to implement cuda::function.
http://git.colberg.org/cuda-wrapper.git/plain/cuda_wrapper/function.hpp
Anyway, the kernel launching is only a side issue ;-).
Peter
More information about the cfe-dev
mailing list