- mongodb - 在 MongoDB mapreduce 中,如何展平值对象?
- javascript - 对象传播与 Object.assign
- html - 输入类型 ="submit"Vs 按钮标签它们可以互换吗?
- sql - 使用 MongoDB 而不是 MS SQL Server 的优缺点
在过去的 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 (\VC\bin\amd64) 所需的所有目录。
这是我在尝试以 64 位编译时收到的错误消息:
1>------ Build started: Project: New, Configuration: Release x64 ------
1>Compiling with CUDA Build Rule...
1>"C:\CUDA\bin64\nvcc.exe" -arch sm_10 -ccbin "C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\bin" -Xcompiler "/EHsc /W3 /nologo /O2 /Zi /MT " -maxrregcount=32 --compile -o "x64\Release\template.cu.obj" "c:\Documents and Settings\All Users\Application Data\NVIDIA Corporation\NVIDIA GPU Computing SDK\C\src\CUDA_Walkthrough_DeviceKernels\template.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 '.\x64\Release\template.cu.obj'
1>Build log was saved at "file://c:\Documents and Settings\Administrator\My Documents\Visual Studio 2008\Projects\New\New\x64\Release\BuildLog.htm"
1>New - 1 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
这是我试图以 64 位编译/运行的简单代码:
#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\n",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("\n");
}
printf("\n");
cudaFree(d_A);
cudaFree(d_B);
cudaFree(d_C);
free(h_A);
free(h_B);
free(h_C);
mypause();
return 0;
}
最佳答案
我解决了这个问题
注意:我这样做是因为:
关于c++ - CUDA 链接错误 - Visual Express 2008 - 由于(空)配置文件导致 nvcc 致命,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2970493/
我已经在我的电脑上安装了 CUDA 工具包,但似乎有些东西坏了。 nvcc 无法编译,像这样的简单 hello-world 也无法编译: #include int main(int argc, ch
我想知道,为什么 NVCC 无法为小矩阵 (N=4) 展开以下 Cholesky 分解内核。 template __device__ inline void choleskyKernel2(T* C)
我将 cuda sdk 5.0 安装到/opt 甚至编译了所有示例,但我无法执行 nvcc。这是一些控制台输出: 我正在使用 linux mint 13。 最佳答案 更新 我对 .bash_profi
我想将我的 CUDA 代码组织成单独的目标文件,以便在编译结束时进行链接,就像在 C++ 中一样。为此,我希望能够声明一个指向 __constant__ 的外部指针。内存在头文件中,并将定义放在 .c
NVCC 对设备代码的优化效果如何?它是否进行了诸如常量折叠和公共(public)子表达式消除之类的优化? 例如,它会减少以下内容: float a = 1 / sqrtf(2 * M_PI); fl
我正在尝试在 CUDA 中做这样的事情: char_sig=code[k][1] & 0b00000010; 而且 NVCC 编译器一直给我错误预期的“;” 相同的代码适用于 GCC C 编译器。我注
我正在尝试在 CUDA 中做这样的事情: char_sig=code[k][1] & 0b00000010; 而且 NVCC 编译器一直给我错误预期的“;” 相同的代码适用于 GCC C 编译器。我注
这个问题已经有答案了: Using CUDA with Visual Studio 2017 (9 个回答) 已关闭 6 年前。 我一直在尝试让 CUDA 在我的电脑上运行。我尝试干净(重新)安装最新
为什么编译器不做一些可以在内核中完成的简单优化?我有以下矩阵乘法代码: __global__ void matrixMultiply(float * A, float * B, float * C,
我刚刚开始在 CUDA 上编码,我试图将我的代码管理到一堆不同的文件中,但我的一个宏由于某种原因不会接受传递的参数。 错误是: addkernel.cu(19): error: identifier
请原谅我的菜鸟。我们的研究小组最近购买了一台服务器,其中装有 2 个 NVIDIA Tesla 单元,我负责设置它。 服务器单元正在运行 Rocks 6.0。 所以我根据以下说明安装从 NVIDIA
我希望 NVCC 将以下警告视为错误: warning : calling a __host__ function("foo") from a __host__ __device__ function
我有一个项目正在使用 CUDA 运行。由于各种原因,它需要编译一个可执行文件,无论是否支持 GTK,无需重新编译所有相关文件。在 C 下,我通过将对象的基本版本编译为 *.o 来完成此操作。和对象的
我在带有 GTX 570(计算能力 2.0)的 Ubuntu 10.10 上使用 CUDA 4.0,以及 GCC 编译器套件。据我了解,在编译过程中,CUDA 编译器驱动程序 nvcc 拆分了 .cu
我正在尝试在我的 GPU 上测量峰值单精度触发器,因为我正在修改 PTX 文件以在寄存器上执行连续的 MAD 指令。不幸的是,编译器正在删除所有代码,因为它实际上没有任何用处,因为我没有执行任何数据加
我需要从命令行使用 nvcc 编译 cuda .cu 文件。该文件是“vectorAdd_kernel.cu”并包含以下代码: extern "C" __global__ void VecAdd_ke
我正在尝试使用 nvcc 编译一个 .cu 程序,但每次我尝试在 Unix 中编译后,我的命令都不再有效。我得到一个错误: “命令”:找不到命令。 这是为什么呢?每次编译后我都必须注销/退出。 [编辑
我正在尝试将 nvcc 与最简单的示例一起使用,但它无法正常工作。我正在编译并执行来自 https://devblogs.nvidia.com/easy-introduction-cuda-c-and
在我的 mac(Snow Leopard) 上更新 CUDA 后,nvidia 的 nvcc 编译器在编译时表现得很奇怪: nvcc batched_gemm.cu 我收到以下编译错误,我不知道如何
我正在尝试编译一些 CUDA,我希望显示编译器警告。相当于: g++ fish.cpp -Wall -Wextra 除了 NVCC 不理解这些,你必须通过它们: nvcc fish.cu --comp
我是一名优秀的程序员,十分优秀!