so i could compile the SDK examples at the begining after i instaled the SDK but they didn’t run because of the mising dll “cudart64_30_13.dll” wich i can’t find on my pc.
After i’ve tried to set the rule from “\NVIDIA Corporation\NVIDIA CUDA SDK\common†for the build of “*.cu” files and tryied to create a new project to test it.
When tryied to compile it i sow that the proget had only one option for " win32" so i added the “x64”.
Now everyting compiles (even .cu files) but i get link errors :
1>------ Rebuild All started: Project: test_cuda, Configuration: Release x64 ------
1>Deleting intermediate and output files for project ‘test_cuda’, configuration ‘Release|x64’
1>Compiling with CUDA Build Rule…
1>“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 “x64\Release\main.cu.obj” “c:\Users\avi\Documents\Visual Studio 2008\Projects\test_cuda\test_cuda\main.cu”
1>main.cu
1>tmpxft_00000488_00000000-6_main.compute_10.cudafe1.gpu
1>tmpxft_00000488_00000000-10_main.compute_10.cudafe2.gpu
1>main.cu
1>tmpxft_00000488_00000000-3_main.compute_20.cudafe1.gpu
1>tmpxft_00000488_00000000-14_main.compute_20.cudafe2.gpu
1>main.cu
1>tmpxft_00000488_00000000-6_main.compute_10.cudafe1.cpp
1>tmpxft_00000488_00000000-20_main.compute_10.ii
1>Linking…
1>main.cu.obj : error LNK2001: unresolved external symbol __cudaUnregisterFatBinary
1>main.cu.obj : error LNK2001: unresolved external symbol __cudaRegisterFatBinary
1>main.cu.obj : error LNK2001: unresolved external symbol cudaFree
1>main.cu.obj : error LNK2001: unresolved external symbol cudaMemcpy
1>main.cu.obj : error LNK2001: unresolved external symbol cudaMalloc
1>C:\Users\avi\Documents\Visual Studio 2008\Projects\test_cuda\x64\Release\test_cuda.exe : fatal error LNK1120: 5 unresolved externals
1>Build log was saved at “file://c:\Users\avi\Documents\Visual Studio 2008\Projects\test_cuda\test_cuda\x64\Release\BuildLog.htm”
1>test_cuda - 6 error(s), 0 warning(s)
========== Rebuild All: 0 succeeded, 1 failed, 0 skipped ==========
and i can’t find the .lib file i need or are there any other errors that i’ve made???
here is the code i’ve tried to compile:
#include <stdio.h>
#include <assert.h>
#include <cuda.h>
#include <iostream>
#include <cuda_runtime.h>
#include <npp.h>
#include <device_launch_parameters.h>
using namespace std;
int main(void)
{
cout<<"running";
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);
return 0;
}