HI! I’m newbie and I have a problem with Visual Studio 2008 and run my first program.
I use:
Win 7 64 bit
GeForce 9600 GT, drivers 196.21
Cuda 3.0
Visual Studio 2008 Professional
Below is a code which i try run:
[codebox]// moveArrays.cu
//
// demonstrates CUDA interface to data allocation on device (GPU)
// and data movement between host (CPU) and device.
#include <stdio.h>
#include <assert.h>
#include <cuda.h>
int main(void)
{
float *a_h, *b_h; // pointers to host memory
float *a_d, *b_d; // pointers to device memory
int N = 14;
int i;
// allocate arrays on host
a_h = (float *)malloc(sizeof(float)*N);
b_h = (float *)malloc(sizeof(float)*N);
// allocate arrays on device
cudaMalloc((void **) &a_d, sizeof(float)*N);
cudaMalloc((void **) &b_d, sizeof(float)*N);
// initialize host data
for (i=0; i<N; i++) {
a_h[i] = 10.f+i;
b_h[i] = 0.f;
}
// send data from host to device: a_h to a_d
cudaMemcpy(a_d, a_h, sizeof(float)*N, cudaMemcpyHostToDevice);
// copy data within device: a_d to b_d
cudaMemcpy(b_d, a_d, sizeof(float)*N, cudaMemcpyDeviceToDevice);
// retrieve data from device: b_d to b_h
cudaMemcpy(b_h, b_d, sizeof(float)*N, cudaMemcpyDeviceToHost);
// check result
for (i=0; i<N; i++)
assert(a_h[i] == b_h[i]);
// cleanup
free(a_h); free(b_h);
cudaFree(a_d); cudaFree(b_d);
}[/codebox]
When I try build solution I get a error:
fatal error LNK1104: cannot open file ‘.\Debug\test5.cu.obj’
I think, its beacuse in ./Debug there is not *.obj file. But why?
There are build logs:
[codebox]Build Log
Build started: Project: test5, Configuration: Debug|Win32
Command Lines
Creating temporary file "c:\ProgramData\NVIDIA Corporation\NVIDIA GPU Computing SDK\C\src\test5\test5\Debug\BAT00000410124660.bat" with contents
[
@echo off
echo “C:\CUDA\bin64\nvcc.exe” -ccbin “C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\bin” -I"C:\CUDA\include" -I"./" -I"…/…/common/inc" -I"…/…/…/shared/inc" -Xcompiler "/EHsc /W3 /nologo /O2 /Zi /MT " -maxrregcount=32 -gencode=arch=compute_10,code="sm_10,compute_10" -gencode=arch=compute_20,code="sm_20,compute_20" --compile -o “Debug\test5.cu.obj” “c:\ProgramData\NVIDIA Corporation\NVIDIA GPU Computing SDK\C\src\test5\test5\test5.cu”
“C:\CUDA\bin64\nvcc.exe” -gencode=arch=compute_10,code="sm_10,compute_10" -gencode=arch=compute_20,code="sm_20,compute_20" -ccbin “C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\bin” -I"C:\CUDA\include" -I"./" -I"…/…/common/inc" -I"…/…/…/shared/inc" -Xcompiler "/EHsc /W3 /nologo /O2 /Zi /MT " -maxrregcount=32 -gencode=arch=compute_10,code="sm_10,compute_10" -gencode=arch=compute_20,code="sm_20,compute_20" --compile -o “Debug\test5.cu.obj” “c:\ProgramData\NVIDIA Corporation\NVIDIA GPU Computing SDK\C\src\test5\test5\test5.cu”
if errorlevel 1 goto VCReportError
goto VCEnd
:VCReportError
echo Project : error PRJ0019: A tool returned an error code from “Compiling with CUDA Build Rule…”
exit 1
:VCEnd
]
Creating command line “”“c:\ProgramData\NVIDIA Corporation\NVIDIA GPU Computing SDK\C\src\test5\test5\Debug\BAT00000410124660.bat”“”
Creating temporary file “c:\ProgramData\NVIDIA Corporation\NVIDIA GPU Computing SDK\C\src\test5\test5\Debug\RSP00000510124660.rsp” with contents
[
/OUT:“C:\ProgramData\NVIDIA Corporation\NVIDIA GPU Computing SDK\C\src\test5\Debug\test5.exe” /INCREMENTAL /LIBPATH:“C:\CUDA\lib64” /LIBPATH:“…/…/…/common/lib” /MANIFEST /MANIFESTFILE:“Debug\test5.exe.intermediate.manifest” /MANIFESTUAC:“level=‘asInvoker’ uiAccess=‘false’” /DEBUG /PDB:“C:\ProgramData\NVIDIA Corporation\NVIDIA GPU Computing SDK\C\src\test5\Debug\test5.pdb” /SUBSYSTEM:CONSOLE /DYNAMICBASE /NXCOMPAT /MACHINE:X86 cudart.lib cUtil64D.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib
“.\Debug\test5.cu.obj”
“.\Debug\test5.exe.embed.manifest.res”
]
Creating command line “link.exe @“c:\ProgramData\NVIDIA Corporation\NVIDIA GPU Computing SDK\C\src\test5\test5\Debug\RSP00000510124660.rsp” /NOLOGO /ERRORREPORT:PROMPT”
Output Window
Compiling with CUDA Build Rule...
“C:\CUDA\bin64\nvcc.exe” -ccbin “C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\bin” -I"C:\CUDA\include" -I"./" -I"…/…/common/inc" -I"…/…/…/shared/inc" -Xcompiler "/EHsc /W3 /nologo /O2 /Zi /MT " -maxrregcount=32 -gencode=arch=compute_10,code="sm_10,compute_10" -gencode=arch=compute_20,code="sm_20,compute_20" --compile -o “Debug\test5.cu.obj” “c:\ProgramData\NVIDIA Corporation\NVIDIA GPU Computing SDK\C\src\test5\test5\test5.cu”
nvcc fatal : Visual Studio configuration file ‘(null)’ could not be found for installation at ‘C:/Program Files (x86)/Microsoft Visual Studio 9.0/VC/bin/…/…’
Linking…
LINK : fatal error LNK1104: cannot open file ‘.\Debug\test5.cu.obj’
Results
Build log was saved at "file://c:\ProgramData\NVIDIA Corporation\NVIDIA GPU Computing SDK\C\src\test5\test5\Debug\BuildLog.htm"
test5 - 1 error(s), 0 warning(s)[/codebox]
Do You know, what is a problem!
THANKS, THANKS, THANKS for all help!