[英]Error while compiling hello world program in mpi in C on openSUSE
[英]Error while compiling Hello world program for CUDA
我正在使用Ubuntu 12.10,並成功安裝了CUDA 5.0及其示例工具包。 我還運行了sudo apt-get install nvidia-cuda-toolkit
以下是我的CUDA的hello world程序:
#include <stdio.h> /* Core input/output operations */
#include <stdlib.h> /* Conversions, random numbers, memory allocation, etc. */
#include <math.h> /* Common mathematical functions */
#include <time.h> /* Converting between various date/time formats */
#include <cuda.h> /* CUDA related stuff */
__global__ void kernel(void) {
}
/* MAIN PROGRAM BEGINS */
int main(void) {
/* Dg = 1; Db = 1; Ns = 0; S = 0 */
kernel<<<1,1>>>();
/* PRINT 'HELLO, WORLD!' TO THE SCREEN */
printf("\n Hello, World!\n\n");
/* INDICATE THE TERMINATION OF THE PROGRAM */
return 0;
}
/* MAIN PROGRAM ENDS */
當我使用nvcc -g hello_world_cuda.cu -o hello_world_cuda.x
編譯時,發生以下錯誤
/tmp/tmpxft_000033f1_00000000-13_hello_world_cuda.o: In function `main':
/home/adarshakb/Documents/hello_world_cuda.cu:16: undefined reference to `cudaConfigureCall'
/tmp/tmpxft_000033f1_00000000-13_hello_world_cuda.o: In function `__cudaUnregisterBinaryUtil':
/usr/include/crt/host_runtime.h:172: undefined reference to `__cudaUnregisterFatBinary'
/tmp/tmpxft_000033f1_00000000-13_hello_world_cuda.o: In function `__sti____cudaRegisterAll_51_tmpxft_000033f1_00000000_4_hello_world_cuda_cpp1_ii_b81a68a1':
/tmp/tmpxft_000033f1_00000000-1_hello_world_cuda.cudafe1.stub.c:1: undefined reference to `__cudaRegisterFatBinary'
/tmp/tmpxft_000033f1_00000000-1_hello_world_cuda.cudafe1.stub.c:1: undefined reference to `__cudaRegisterFunction'
/tmp/tmpxft_000033f1_00000000-13_hello_world_cuda.o: In function `cudaError cudaLaunch<char>(char*)':
/usr/lib/nvidia-cuda-toolkit/include/cuda_runtime.h:958: undefined reference to `cudaLaunch'
collect2: ld returned 1 exit status
我還要確保我使用的是gcc和g ++版本4.4(作為4.7,CUDA存在一些問題)
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.