c++ - Hello World CUDA compilation issues -
i'm using cuda example book , attempting compile first real example in book. i'm on osx 10.9.2:
my source is:
@punk ~/documents/projects/cuda$ /developer/nvidia/cuda-6.0/bin/nvcc hello.c nvcc warning : 'compute_10' , 'sm_10' architectures deprecated, , may removed in future release. hello.c:6:1: error: unknown type name '__global__' __global__ void kernel(void) { ^ hello.c:6:12: error: expected identifier or '(' __global__ void kernel(void) { ^ hello.c:10:3: error: use of undeclared identifier 'kernel' kernel<<<1,1>>>(); ^ hello.c:10:11: error: expected expression kernel<<<1,1>>>(); ^ hello.c:10:17: error: expected expression kernel<<<1,1>>>(); ^ hello.c:10:19: error: expected expression kernel<<<1,1>>>(); ^ 6 errors generated.
and source simply:
punk ~/documents/projects/cuda$ cat hello.c #include <cuda.h> #include <stddef.h> #include <stdio.h> //#include "common/book.h" __global__ void kernel(void) { } int main(void) { kernel<<<1,1>>>(); printf("oh hai\n"); return 0; }
i tested /developer/nvidia/cuda-6.0/samples/1_utilities/devicequery
example , built , ran fine.
any appreciated! tia!
rename file hello.cu
nvcc by default sends .c
or .cpp
files directly host compiler without doing device code inspection or compilation on them.
there various options change behavior.
Comments
Post a Comment