[cfe-dev] CUDA support for clang

Adarsh adarsh.hv99 at gmail.com
Tue Jan 31 21:03:56 PST 2012


Hi,
I am trying to convert a simple CUDA program to LLVM IR using clang 3.0. The
program is as follows,
#include<stdio.h>
#nclude<clang/test/SemaCUDA/cuda.h>

__global__ void kernfunc(int *a)
 {
*a=threadIdx.x+blockIdx.x*blockDim.x;
}

int main()
{
int *h_a,*d_a,n;
                                        
n=sizeof(int);
h_a=(int*)malloc(n);
*h_a=5;

cudaMalloc((void*)&d_a,n);
cudaMemcpy(d_a,h_a,n,cudaMemcpyHostToDevice);
kernelfunc<<<1,1>>>(d_a);
cudaMemcpy(h_a,d_a,n,cudaMemcpyDeviceToHost);

printf("%d",*h_a);
return 0;
}


What additional header files should be included? What part of the code is
currently not supported by clang 3.0?
Thank you:)


--
View this message in context: http://clang-developers.42468.n3.nabble.com/CUDA-support-for-clang-tp3705635p3705635.html
Sent from the Clang Developers mailing list archive at Nabble.com.



More information about the cfe-dev mailing list