【提问】不可识别的字符转义序列???

月小夏 2010-05-04 04:59:33
我的机子ATI卡,32位windows,vs2005,装的是2.3版本的toolkit和sdk,编译任何例程的时候都会出现如下错误(emu模式):

1>Compiling with CUDA Build Rule...
1>"F:\CUDA For LR\CUDA TOOLKIT\bin\nvcc.exe" -m32 -arch sm_10 -ccbin "C:\Program Files\Microsoft Visual Studio 8\VC\bin" -deviceemu -D_DEVICEEMU -Xcompiler "/EHsc /W3 /nologo /O2 /Zi /MT " -maxrregcount=32 --compile -o "EmuRelease\vectorAdd.cu.obj" "f:\CUDA For LR\CUDA practice\vectorAdd\vectorAdd.cu"
1>vectorAdd.cu
1>tmpxft_00000308_00000000-3_vectorAdd.cudafe1.cpp
1>f:/CUDA For LR/CUDA practice/vectorAdd/vectorAdd.cu(152) : warning C4129: “D”: 不可识别的字符转义序列
1>f:/CUDA For LR/CUDA practice/vectorAdd/vectorAdd.cu(152) : warning C4129: “L”: 不可识别的字符转义序列
1>f:/CUDA For LR/CUDA practice/vectorAdd/vectorAdd.cu(152) : warning C4129: “L”: 不可识别的字符转义序列
1>f:/CUDA For LR/CUDA practice/vectorAdd/vectorAdd.cu(152) : warning C4129: “T”: 不可识别的字符转义序列
1>f:/CUDA For LR/CUDA practice/vectorAdd/vectorAdd.cu(49) : warning C4129: “D”: 不可识别的字符转义序列
1>f:/CUDA For LR/CUDA practice/vectorAdd/vectorAdd.cu(49) : warning C4129: “L”: 不可识别的字符转义序列
1>f:/CUDA For LR/CUDA practice/vectorAdd/vectorAdd.cu(49) : warning C4129: “L”: 不可识别的字符转义序列
1>f:/CUDA For LR/CUDA practice/vectorAdd/vectorAdd.cu(49) : warning C4129: “T”: 不可识别的字符转义序列
1>tmpxft_00000308_00000000-7_vectorAdd.ii
1>f:\cuda for lr\cuda toolkit\include\math_functions.h(939) : error C2059: 语法错误 : “}”
1>f:\cuda for lr\cuda toolkit\include\math_functions.h(939) : error C2143: 语法错误 : 缺少“;”(在“}”的前面)
。。。。(以下是近一百条说头文件错误的信息)


郁闷的是原来成功编译并运行过的,突然今天早上变成这样了。。。

请大家帮帮忙。。。


谢谢
...全文
1320 9 打赏 收藏 转发到动态 举报
写回复
用AI写文章
9 条回复
切换为时间正序
请发表友善的回复…
发表回复
月小夏 2010-05-07
  • 打赏
  • 举报
回复
沉了。。。沉了。。。已经决定重装了。。。
  • 打赏
  • 举报
回复
sdk装了吗?
月小夏 2010-05-05
  • 打赏
  • 举报
回复
但貌似跟具体的程序没太大关系,因为每个程序都是会出这样的错,并且报错的地方其实是最后一个大括号那里,找不到什么有用的信息。。。

请问有没有什么完整的vs20005+toolkit2.3的配置教程,我核对一下配置看看,另外我用的辅助配置工具是勇哥的wizard2.2,版本对么?
月小夏 2010-05-05
  • 打赏
  • 举报
回复
#include <stdio.h>
#include <cutil_inline.h>

// Variables
float* h_A;
float* h_B;
float* h_C;
float* d_A;
float* d_B;
float* d_C;
bool noprompt = false;

// Functions
void Cleanup(void);
void RandomInit(float*, int);
void ParseArguments(int, char**);

// Device code
__global__ void VecAdd(const float* A, const float* B, float* C, int N)
{
int i = blockDim.x * blockIdx.x + threadIdx.x;
if (i < N)
C[i] = A[i] + B[i];
}

// Host code
int main(int argc, char** argv)
{
printf("Vector addition\n");
int N = 50000;
size_t size = N * sizeof(float);
ParseArguments(argc, argv);

// Allocate input vectors h_A and h_B in host memory
h_A = (float*)malloc(size);
if (h_A == 0) Cleanup();
h_B = (float*)malloc(size);
if (h_B == 0) Cleanup();
h_C = (float*)malloc(size);
if (h_C == 0) Cleanup();

// Initialize input vectors
RandomInit(h_A, N);
RandomInit(h_B, N);

// Allocate vectors in device memory
cutilSafeCall( cudaMalloc((void**)&d_A, size) );
cutilSafeCall( cudaMalloc((void**)&d_B, size) );
cutilSafeCall( cudaMalloc((void**)&d_C, size) );

// Copy vectors from host memory to device memory
cutilSafeCall( cudaMemcpy(d_A, h_A, size, cudaMemcpyHostToDevice) );
cutilSafeCall( cudaMemcpy(d_B, h_B, size, cudaMemcpyHostToDevice) );

// Invoke kernel
int threadsPerBlock = 256;
int blocksPerGrid = (N + threadsPerBlock - 1) / threadsPerBlock;
VecAdd<<<blocksPerGrid, threadsPerBlock>>>(d_A, d_B, d_C, N);
cutilCheckMsg("kernel launch failure");
#ifdef _DEBUG
cutilSafeCall( cudaThreadSynchronize() );
#endif

// Copy result from device memory to host memory
// h_C contains the result in host memory
cutilSafeCall( cudaMemcpy(h_C, d_C, size, cudaMemcpyDeviceToHost) );

// Verify result
int i;
for (i = 0; i < N; ++i) {
float sum = h_A[i] + h_B[i];
if (fabs(h_C[i] - sum) > 1e-5)
break;
}
printf("%s \n", (i == N) ? "PASSED" : "FAILED");

Cleanup();
}

void Cleanup(void)
{
// Free device memory
if (d_A)
cudaFree(d_A);
if (d_B)
cudaFree(d_B);
if (d_C)
cudaFree(d_C);

// Free host memory
if (h_A)
free(h_A);
if (h_B)
free(h_B);
if (h_C)
free(h_C);

cutilSafeCall( cudaThreadExit() );

if (!noprompt) {
printf("\nPress ENTER to exit...\n");
fflush( stdout);
fflush( stderr);
getchar();
}

exit(0);
}

// Allocates an array with random float entries.
void RandomInit(float* data, int n)
{
for (int i = 0; i < n; ++i)
data[i] = rand() / (float)RAND_MAX;
}

// Parse program arguments
void ParseArguments(int argc, char** argv)
{
for (int i = 0; i < argc; ++i)
if (strcmp(argv[i], "--noprompt") == 0 ||
strcmp(argv[i], "-noprompt") == 0)
{
noprompt = true;
break;
}
}
月小夏 2010-05-05
  • 打赏
  • 举报
回复
装了的,运行SDK的程序也是类似这样的错,说不可识别转义序列
wwwcc123 2010-05-04
  • 打赏
  • 举报
回复
这个警告我也经常碰到,是什么原因
  • 打赏
  • 举报
回复
vectorAdd.cu的145-160行左右的代码?
月小夏 2010-05-04
  • 打赏
  • 举报
回复
没有啊,直接用的例程,而且不止一个例程,所有的程序基本都是这样的报错。。。环境变量也没错啊。。。不知道怎么会这样的。。。重新装了一遍toolkit和sdk,还是这样。。。
  • 打赏
  • 举报
回复
有无全角字符?

580

社区成员

发帖
与我相关
我的任务
社区描述
CUDA™是一种由NVIDIA推出的通用并行计算架构,该架构使GPU能够解决复杂的计算问题。 它包含了CUDA指令集架构(ISA)以及GPU内部的并行计算引擎。
社区管理员
  • CUDA编程社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧