Mygpu.cu(12): error: unrecognized token

Dear all,

Thank U all for your help so that I am able to configure Cuda on 2 machines with GPU enabled.

Now I’m trying to run a simple code on a system, but don’t know why it results in the below error :

[root@cuda1 ~]# nvcc mygpu.cu
mygpu.cu(12): error: unrecognized token

mygpu.cu(12): error: expected an expression

mygpu.cu(12): error: unrecognized token

mygpu.cu(12): error: unrecognized token

4 errors detected in the compilation of “/tmp/tmpxft_0000683d_00000000-4_mygpu.cpp1.ii”.
[root@cuda1 ~]# vim mygpu.cu

Below is my simple code that I’m trying . Please guide me how to resolve this.

#include <stdio.h>
#include<stdlib.h>
#include “/usr/local/cuda/include/cuda.h”
#include “/usr/local/cuda/include/cuda_runtime.h”
int main( void ) {
cudaDeviceProp prop;
int count;

cudaGetDeviceCount( &count);

for (int i=0; i< count; i++) {

** cudaGetDeviceProperties( ?, i);**

   printf( " --- General Information for device %d ---

", i );
printf( "Name: %s
", prop.name );
printf( "Compute capability: %d.%d
", prop.major, prop.minor );
printf( "Clock rate: %d
", prop.clockRate );
printf( "Device copy overlap: " );

   if (prop.deviceOverlap)
         printf( "Enabled

" );
else
printf( "Disabled
" );
printf( "Kernel execition timeout : " );

   if (prop.kernelExecTimeoutEnabled)
         printf( "Enabled

" );
else
printf( "Disabled
" );

   printf( " --- Memory Information for device %d ---

", i );
printf( "Total global mem: %ld
", prop.totalGlobalMem );
printf( "Total constant Mem: %ld
", prop.totalConstMem );
printf( "Max mem pitch: %ld
", prop.memPitch );
printf( "Texture Alignment: %ld
", prop.textureAlignment );
printf( " — MP Information for device %d —
", i );
printf( "Multiprocessor count: %d
",
prop.multiProcessorCount );
printf( "Shared mem per mp: %ld
", prop.sharedMemPerBlock );
printf( "Registers per mp: %d
", prop.regsPerBlock );
printf( "Threads in warp: %d
", prop.warpSize );
printf( "Max threads per block: %d
",
prop.maxThreadsPerBlock );
printf( "Max thread dimensions: (%d, %d, %d)
",
prop.maxThreadsDim[0], prop.maxThreadsDim[1],
prop.maxThreadsDim[2] );
printf( "Max grid dimensions: (%d, %d, %d)
",
prop.maxGridSize[0], prop.maxGridSize[1],
prop.maxGridSize[2] );
printf( "
" );
}
}

After some R&D I resolve the above issue but facing new one :

[root@cuda1 ~]# nvcc mygpu1.cu
sh: nvopencc: command not found
[root@cuda1 ~]#

[root@cuda1 ~]# nv
nvcc nvcc.profile_test nvidia-installer nvidia-smi nvidia-xconfig
nvcc.profile nvidia-bug-report.sh nvidia-settings nvidia-uninstall
[root@cuda1 ~]# nv

I check in /usr/local/cuda/bin & there is no nvopencc so i think i need to install it.

But Can Someone Pls tell me hw to do this in my Cent OS system ( linux based)

Thanks & best Regards

Adarsh Sharma