在过去的 2 周里,我一直在广泛地寻找可能的解决方案来解决我的错误.我已经成功安装了 Cuda 64 位编译器(工具)和 SDK 以及 64 位版本的 Visual Studio Express 2008 和带有 Framework 3.5 的 Windows 7 SDK.我正在使用 Windows XP 64 位.我已确认 VSE 能够以 64 位编译,因为我使用以下网站上的步骤提供了所有 64 位选项:(因为 Visual Express 本身并不包含 64 位软件包)>
http://jenshuebel.wordpress.com/2009/02/12/visual-c-2008-express-edition-and-64-bit-targets/
在与上述链接相同的页面上的用户评论中可以找到 64 位安装的注册表更新.
我已经确认了 64 位编译能力,因为x64"可以从工具->选项->VC++ 目录"下的下拉菜单中获得,并且在 64 位编译不会导致整个项目被跳过".我已经包含了 64 位 cuda 工具、64 SDK 和 Visual Express (VCinamd64) 所需的所有目录.
这是我尝试在 64 位编译时收到的错误消息:
1>------ 构建开始:项目:新建,配置:发布 x64 ------1> 使用 CUDA 构建规则编译...1>"C:CUDAin64
vcc.exe" -arch sm_10 -ccbin "C:Program Files (x86)Microsoft Visual Studio 9.0VCin" -Xcompiler "/EHsc/W3/nologo/O2/Zi/MT " -maxrregcount=32 --compile -o "x64Release emplate.cu.obj" "c:Documents and SettingsAll UsersApplication DataNVIDIA CorporationNVIDIA GPU Computing SDKCsrcCUDA_Walkthrough_DeviceKernels emplate.cu"1>nvcc 致命:在C:/Program Files (x86)/Microsoft Visual Studio 9.0/VC/bin/../.."中找不到用于安装的 Visual Studio 配置文件(null)"1>链接...1> 链接:致命错误 LNK1181:无法打开输入文件 '.x64Release emplate.cu.obj'1>生成日志保存在file://c:Documents and SettingsAdministratorMy DocumentsVisual Studio 2008ProjectsNewNewx64ReleaseBuildLog.htm"1> 新 - 1 个错误,0 个警告========== 构建:0 成功,1 失败,0 最新,0 跳过 ==========
这是我尝试在 64 位中编译/运行的简单代码:
#include #include #include #include <math.h>#include 无效我的暂停(){printf("按[回车]继续……");fflush (标准输出);获取字符();}__global__ void VecAdd1_Kernel(float* A, float* B, float* C, int N){int i = blockDim.x*blockIdx.x+threadIdx.x;如果(i<N)C[i] = A[i] + B[i];//结果应该是一个 250s 的 16x1 数组}__global__ void VecAdd2_Kernel(float* B, float* C, int N){int i = blockDim.x*blockIdx.x+threadIdx.x;如果(i<N)C[i] = C[i] + B[i];//结果应该是一个 400s 的 16x1 数组}int main(){整数 N = 16;浮动 A[16];浮动 B[16];size_t size = N*sizeof(float);for(int i=0; i
我通过
解决了这个问题注意:我这样做是因为:
I've been searching extensively for a possible solution to my error for the past 2 weeks. I have successfully installed the Cuda 64-bit compiler (tools) and SDK as well as the 64-bit version of Visual Studio Express 2008 and Windows 7 SDK with Framework 3.5. I'm using windows XP 64-bit. I have confirmed that VSE is able to compile in 64-bit as I have all of the 64-bit options available to me using the steps on the following website: (since Visual Express does not inherently include the 64-bit packages)
http://jenshuebel.wordpress.com/2009/02/12/visual-c-2008-express-edition-and-64-bit-targets/
The registry updates for 64-bit installation are found in a user comment on the same page as the above link.
I have confirmed the 64-bit compile ability since the "x64" is available from the pull-down menu under "Tools->Options->VC++ Directories" and compiling in 64-bit does not result in the entire project being "skipped". I have included all the needed directories for 64-bit cuda tools, 64 SDK and Visual Express (VCinamd64).
Here's the error message I receive when trying to compile in 64-bit:
1>------ Build started: Project: New, Configuration: Release x64 ------
1>Compiling with CUDA Build Rule...
1>"C:CUDAin64
vcc.exe" -arch sm_10 -ccbin "C:Program Files (x86)Microsoft Visual Studio 9.0VCin" -Xcompiler "/EHsc /W3 /nologo /O2 /Zi /MT " -maxrregcount=32 --compile -o "x64Release emplate.cu.obj" "c:Documents and SettingsAll UsersApplication DataNVIDIA CorporationNVIDIA GPU Computing SDKCsrcCUDA_Walkthrough_DeviceKernels emplate.cu"
1>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/../..'
1>Linking...
1>LINK : fatal error LNK1181: cannot open input file '.x64Release emplate.cu.obj'
1>Build log was saved at "file://c:Documents and SettingsAdministratorMy DocumentsVisual Studio 2008ProjectsNewNewx64ReleaseBuildLog.htm"
1>New - 1 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
Here's the simple code I'm trying to compile/run in 64-bit:
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <cuda.h>
void mypause ()
{
printf ( "Press [Enter] to continue . . ." );
fflush ( stdout );
getchar();
}
__global__ void VecAdd1_Kernel(float* A, float* B, float* C, int N)
{
int i = blockDim.x*blockIdx.x+threadIdx.x;
if (i<N)
C[i] = A[i] + B[i]; //result should be a 16x1 array of 250s
}
__global__ void VecAdd2_Kernel(float* B, float* C, int N)
{
int i = blockDim.x*blockIdx.x+threadIdx.x;
if (i<N)
C[i] = C[i] + B[i]; //result should be a 16x1 array of 400s
}
int main()
{
int N = 16;
float A[16];float B[16];
size_t size = N*sizeof(float);
for(int i=0; i<N; i++)
{
A[i] = 100.0;
B[i] = 150.0;
}
// Allocate input vectors h_A and h_B in host memory
float* h_A = (float*)malloc(size);
float* h_B = (float*)malloc(size);
float* h_C = (float*)malloc(size);
//Initialize Input Vectors
memset(h_A,0,size);memset(h_B,0,size);
h_A = A;h_B = B;
printf("SUM = %f
",A[1]+B[1]); //simple check for initialization
//Allocate vectors in device memory
float* d_A;
cudaMalloc((void**)&d_A,size);
float* d_B;
cudaMalloc((void**)&d_B,size);
float* d_C;
cudaMalloc((void**)&d_C,size);
//Copy vectors from host memory to device memory
cudaMemcpy(d_A,h_A,size,cudaMemcpyHostToDevice);
cudaMemcpy(d_B,h_B,size,cudaMemcpyHostToDevice);
//Invoke kernel
int threadsPerBlock = 256;
int blocksPerGrid = (N+threadsPerBlock-1)/threadsPerBlock;
VecAdd1(blocksPerGrid, threadsPerBlock,d_A,d_B,d_C,N);
VecAdd2(blocksPerGrid, threadsPerBlock,d_B,d_C,N);
//Copy results from device memory to host memory
//h_C contains the result in host memory
cudaMemcpy(h_C,d_C,size,cudaMemcpyDeviceToHost);
for(int i=0; i<N; i++) //output result from the kernel "VecAdd"
{
printf("%f ", h_C[i] );
printf("
");
}
printf("
");
cudaFree(d_A);
cudaFree(d_B);
cudaFree(d_C);
free(h_A);
free(h_B);
free(h_C);
mypause();
return 0;
}
I solved the problem by
Note: I did this because:
这篇关于CUDA 链接错误 - Visual Express 2008 - 由于(空)配置文件导致 nvcc 致命的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!