Unable to create a simple Cuda program using Xcode!

I use Xcode 3.2 on Mac OS 10.6 to create a very simple HelloWorld program for CUDA but it cannot build .. any ideas !!!

this is the code:

    #include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#include <CUDA/CUDA.h>

__device__ char napis_device[14];

__global__ void helloWorldOnDevice(void){
 napis_device[0]='H';
 napis_device[1]='e';
 napis_device[2]='l';
 napis_device[3]='l';
 napis_device[4]='o';
 napis_device[5]=' ';
 napis_device[6]='W';
 napis_device[7]='o';
 napis_device[8]='r';
 napis_device[9]='l';
 napis_device[10]='d';
 napis_device[11]='\n';

}



int main (int argc, char * const argv[]) {
    helloWorldOnDevice<<<1,1>>> ();
 cudaThreadSynchronize();
 char napis_host[14];
 const char *symbol="napis device";
 cudaMemcpyFromSymbol (napis_host, symbol, sizeof(char)*13, 0, cudaMemcpyDeviceToHost);

     return 0;
}

The error helloWorldOnDevice <1,1 →> () appears on this line;

Expected primary expression before the '<' token !!!!!!

0
source share
1 answer

You compile your program using gcc with Xcode. Instead, use the nvcc compiler to compile CUDA code. Usually I used a Makefile to tell that * .cu will be compiled by nvcc and * .cpp by gcc, then link the created objects to the executable.

+2
source

All Articles