Setting up the Environment

Hi all,

I’m trying to set up my paths to allow compiling to work. Ideally I would like to be able to compile in both Visual C++ express and at the command line but at present neither is working. I was wondering if someone could tell me if my environment variables are correct. I’ve listed them below:

Visual Studio

I have added the following to the VC++ Directories section in options

Executable Files :

C:\CUDA\Bin

Include Files:

C:\CUDA\include

C:\CUDA\SDK\common\inc

Library Files:

$(CUDA_LIBRARIES) cuda.lib cudart.lib

C:\CUDA\lib

My guess is this is not correct but please let me know!

In the system environment variables I have set the following:

CUDA_BIN_PATH C:\CUDA\bin

CUDA_INC_PATH C:\CUDA\include

CUDA_LIB_PATH C:\CUDA\lib

CUDA_LIBRARIES C:\CUDA\SDK\common\inc

PATH C:\CUDA\bin

VC_INCLUDE C:\Program Files\Microsoft Visual Studio 8\VC\include

These are all variables I have added to try and get compilation to work but I still get errors related to files not being found (when i compile simpleCUFFT it can’t find standard C libraries (stdio.h etc) and cutil.h.

Find below my error messages at a command prompt:

"C:\CUDA\bin/../include/driver_types.h", line 48: error: could not open source

          file "limits.h"

  #include <limits.h>

                     ^

"C:\CUDA\bin/../include/driver_types.h", line 49: error: could not open source

          file "stddef.h"

  #include <stddef.h>

                     ^

"C:\CUDA\bin/../include/common_functions.h", line 49: error: could not open

          source file "time.h"

  #include <time.h>

                   ^

"C:\CUDA\bin/../include/math_functions.h", line 385: error: could not open

          source file "math.h"

  #include <math.h>

                   ^

"C:\CUDA\bin/../include/math_functions.h", line 386: error: could not open

          source file "stdlib.h"

  #include <stdlib.h>

                     ^

"simpleCUFFT.cu", line 33: error: could not open source file "stdlib.h"

  #include <stdlib.h>

                     ^

"simpleCUFFT.cu", line 34: error: could not open source file "stdio.h"

  #include <stdio.h>

                    ^

"simpleCUFFT.cu", line 35: error: could not open source file "string.h"

  #include <string.h>

                     ^

"simpleCUFFT.cu", line 36: error: could not open source file "math.h"

  #include <math.h>

                   ^

"C:\CUDA\bin/../include/cufft.h", line 44: error: could not open source file

          "stdio.h"

  #include <stdio.h>

                    ^

"simpleCUFFT.cu", line 40: error: could not open source file "cutil.h"

  #include <cutil.h>

                    ^

11 errors detected in the compilation of "simpleCUFFT.cu".

Any help would be much appreciated.

Thank you,

Chris Morrison

Without the seeing the actual compile lines, it’s hard to say.

Try putting the paths in your environment variables in quotes.

Assuming you mean what Visual Studio is executing according to the property pages of the project->Configuration Properties->CUDA->Command line is

nvcc.exe -ccbin “C:\Program Files\Microsoft Visual Studio 8\VC\bin” -c -Xcompiler "/EHsc /W3 /nologo /Wp64 /O2 /Zi /MT " -o Debug\simpleCUFFT.obj simpleCUFFT.vcproj

The directories I have listed above (for environment variables) are pretty straightforward to understand and all the stuff is at these locations.

THanks,

Chris

Ok I’m pretty sure my mistake is with my path environments now (i wasn’t using the visual C++ command prompt and using it removed most errors). I’m using it now and i only get the following errors which I still can’t seem to solve

Y:\CUDA\Examples\fft\NVIDIA CUDA SDK\projects\simpleCUFFT>nvcc simpleCUFFT.cu

"simpleCUFFT.cu", line 121: error: identifier "CUFFT_DATA_C2C" is undefined

      cufftPlan1d(&plan, new_size, CUFFT_DATA_C2C, 1);

                                   ^

"simpleCUFFT.cu", line 124: error: identifier "cufftExecute" is undefined

      cufftExecute(plan, d_signal, d_signal, -1);

      ^

2 errors detected in the compilation of "C:\DOCUME~1\CHRISM~1\LOCALS~1\Temp/tmpx

ft_00000260_00000000-3.ii".

Those errors come from the API difference from 0.8 and 0.9.

CUFFT_DATA_C2C is now CUFFT_C2C

cufftExecute is now cufftExecC2C

That should work

Your right, that did fix these two problems. I can’t get the SDK to install on my machine (Ancient win2k box with no nvidia card) so i had to install it on a colleagues computer and try to manually copy across the files and settings. This caused me to accidentally download 0.8 rather than 0.9. I have now moved to 0.9.

I still think though that my problem is with my environment. I regularly get the error saying could not find cutil.h at the command prompt which I have fixed, for the short term, by copying the file into my project directory. This then compiles fine but then the linker doesnt work

C:\CUDA\SDK\projects\BlackScholes>nvcc BlackScholes.cu

tmpxft_00000120_00000000-8.i

tmpxft_00000120_00000000-9.obj : error LNK2019: unresolved external symbol __imp

__cutCheckCmdLineFlag referenced in function _main

tmpxft_00000120_00000000-9.obj : error LNK2019: unresolved external symbol __imp

__cutDeleteTimer referenced in function _main

tmpxft_00000120_00000000-9.obj : error LNK2019: unresolved external symbol __imp

__cutGetTimerValue referenced in function _main

tmpxft_00000120_00000000-9.obj : error LNK2019: unresolved external symbol __imp

__cutStopTimer referenced in function _main

tmpxft_00000120_00000000-9.obj : error LNK2019: unresolved external symbol __imp

__cutStartTimer referenced in function _main

tmpxft_00000120_00000000-9.obj : error LNK2019: unresolved external symbol __imp

__cutResetTimer referenced in function _main

tmpxft_00000120_00000000-9.obj : error LNK2019: unresolved external symbol __imp

__cutCreateTimer referenced in function _main

a.exe : fatal error LNK1120: 7 unresolved externals

and in visual studio i get the following error.

------ Build started: Project: BlackScholes, Configuration: Debug Win32 ------

Performing Custom Build Step

'C:\CUDA\bin' is not recognized as an internal or external command,

operable program or batch file.

Project : error PRJ0019: A tool returned an error code from "Performing Custom Build Step"

Build log was saved at "file://c:\CUDA\SDK\projects\BlackScholes\Debug\BuildLog.htm"

BlackScholes - 1 error(s), 0 warning(s)

========== Build: 0 succeeded, 1 failed, 0 up-to-

Thank you for your help,

Chris