visual profiler V3.2 on debian
本來想用visual profiler看一下程式上還有那邊可以修改的
沒想到v3.2的cuda toolkit竟然開不了!出現缺少
GLIBCXX_3.4.11 not found (required by computeprof)
突然就傻了,之前記得是可以用的
然後跑去NVIDIA的論壇看看,找到解答了
解決辦法
不過我還是自已寫一遍下來吧,以後要用可以翻比較快
1.
$/usr/local/cuda/computeprof/bin/computeprof &
$computeprof: /usr/lib/libstdc++.so.6: version `GLIBCXX_3.4.11' not found (required by computeprof)
如果出現上面的訊息
先到debain的網站下載libstdc++.so.6
debian官方網站
2.
#dpkg -x libstdc++6_4.4.4-8_amd64.deb /tmp
#cp /tmp/usr/lib/libstdc++.so.* /usr/local/cuda/computeprof/bin/
這樣一來就應該可以使用了
沒想到v3.2的cuda toolkit竟然開不了!出現缺少
GLIBCXX_3.4.11 not found (required by computeprof)
突然就傻了,之前記得是可以用的
然後跑去NVIDIA的論壇看看,找到解答了
解決辦法
不過我還是自已寫一遍下來吧,以後要用可以翻比較快
1.
$/usr/local/cuda/computeprof/bin/computeprof &
$computeprof: /usr/lib/libstdc++.so.6: version `GLIBCXX_3.4.11' not found (required by computeprof)
如果出現上面的訊息
先到debain的網站下載libstdc++.so.6
debian官方網站
2.
#dpkg -x libstdc++6_4.4.4-8_amd64.deb /tmp
#cp /tmp/usr/lib/libstdc++.so.* /usr/local/cuda/computeprof/bin/
這樣一來就應該可以使用了
常用的NVCC指令
1。-deviceemu
用cpu模擬模式。常用於debug,但是要小心threads數目。單純就是software contral
2。-use_fast_math
將可以用GPU硬體算數學涵數都用GPU計算
3。-maxrregcount N
限制每一個threads所用的register大小。if kernel超過了,就會存在local memory
4。--ptxas-options=-v
回報用的memory量。
5。-arch sm_xx xx是CUDA版本(滿多涵數都要指定版本)
指定compiler的版本
6。-l + lib名稱 ex:-lcublas
連結標頭檔
7。-l
指定尋找的lib路徑
8。-I
指定尋找的標頭檔路徑
2010/11/27 更新部分
nvcc -g -I/home/zcli/NVIDIA_GPU_Computing_SDK/C/common/inc -L/home/zcli/NVIDIA_GPU_Computing_SDK/C/common/lib/linux cudaapi.cu -lrt /home/zcli/NVIDIA_GPU_Computing_SDK/C/lib/libcutil_x86_64.a
今天在試cutil.h一些計時的api時,一直undefine reference,一整個快發瘋,不是連結lib path跟header path就好了嗎?看了一個下午的網路,還是搞不懂為什麼...
大概知道就是我沒有連結到lib ,加了-lrt那段,意思好像是靜態連結資料庫的作法,實際作用完全搞不懂。再找機會來研究研究。
另外補充一下,可以直接打-lcutil_x86_64,就編過了....好像是因為cudatookit在3.0版的名稱改變了T_T
其他有用到再打上來>"<
用cpu模擬模式。常用於debug,但是要小心threads數目。單純就是software contral
2。-use_fast_math
將可以用GPU硬體算數學涵數都用GPU計算
3。-maxrregcount N
限制每一個threads所用的register大小。if kernel超過了,就會存在local memory
4。--ptxas-options=-v
回報用的memory量。
5。-arch sm_xx xx是CUDA版本(滿多涵數都要指定版本)
指定compiler的版本
6。-l + lib名稱 ex:-lcublas
連結標頭檔
7。-l
指定尋找的lib路徑
8。-I
指定尋找的標頭檔路徑
2010/11/27 更新部分
nvcc -g -I/home/zcli/NVIDIA_GPU_Computing_SDK/C/common/inc -L/home/zcli/NVIDIA_GPU_Computing_SDK/C/common/lib/linux cudaapi.cu -lrt /home/zcli/NVIDIA_GPU_Computing_SDK/C/lib/libcutil_x86_64.a
今天在試cutil.h一些計時的api時,一直undefine reference,一整個快發瘋,不是連結lib path跟header path就好了嗎?看了一個下午的網路,還是搞不懂為什麼...
大概知道就是我沒有連結到lib ,加了-lrt那段,意思好像是靜態連結資料庫的作法,實際作用完全搞不懂。再找機會來研究研究。
另外補充一下,可以直接打-lcutil_x86_64,就編過了....好像是因為cudatookit在3.0版的名稱改變了T_T
其他有用到再打上來>"<
關於#include引用方式
在 CUDA_NVIDIA_GPU_Computing_SDK 中,有部分API可以使用可以偵錯很方便
都在cutil.h 中,但是在nvcc的library path 與 include path中是沒有預設的。
(我猜是因為SDK可以用可以不用裝,而且每個人裝的路徑不同)
因此可以從nvcc_2.0.pdf中查到一些option,可以用,下例中紅色的部分。
詳細內容可以在~/NVIDIA_GPU_Computing_SDK/C/common/inc中找到
//include project file
#include
int main(){
int msize = 100;
//allocate memory
float *h_a;
h_a = (float*)malloc(msize*sizeof(float));
float *d_a;
cudaMalloc((void**)&d_a,msize*sizeof(float));
//test API....
CUDA_SAFE_CALL(cudaMemcpy(d_a,h_a,msize*sizeof(float),cudaMemcpyHostToDevice));
//free memory
free(h_a);
cudaFree(d_a);
return 0;
}
因為沒有library與headfile所以如下:
nvcc -g -I/home/zcli/NVIDIA_GPU_Computing_SDK/C/common/inc -L/home/zcli/NVIDIA_GPU_Computing_SDK/C/common/lib/linux cudaapi.cu
都在cutil.h 中,但是在nvcc的library path 與 include path中是沒有預設的。
(我猜是因為SDK可以用可以不用裝,而且每個人裝的路徑不同)
因此可以從nvcc_2.0.pdf中查到一些option,可以用,下例中紅色的部分。
詳細內容可以在~/NVIDIA_GPU_Computing_SDK/C/common/inc中找到
//include project file
#include
int main(){
int msize = 100;
//allocate memory
float *h_a;
h_a = (float*)malloc(msize*sizeof(float));
float *d_a;
cudaMalloc((void**)&d_a,msize*sizeof(float));
//test API....
CUDA_SAFE_CALL(cudaMemcpy(d_a,h_a,msize*sizeof(float),cudaMemcpyHostToDevice));
//free memory
free(h_a);
cudaFree(d_a);
return 0;
}
因為沒有library與headfile所以如下:
nvcc -g -I/home/zcli/NVIDIA_GPU_Computing_SDK/C/common/inc -L/home/zcli/NVIDIA_GPU_Computing_SDK/C/common/lib/linux cudaapi.cu
CUDA "unspecified launch failure"
本文章取自:http://www.herikstad.net/2009/05/cuda-unspecified-launch-failure.html
The error "unspecified launch failure" usually means the same as "segment fault" for host code. Check that your code does not try to access any areas outside the arrays being used. A common mistake is using 'the whole idx' instead of just the thread id to access shared memory. Here's an example:
will give you an error and should look like this:
__global__ void kernel(float *in,float *out){
//declare share memory
//extern is use kernel set memory size
extern __shared__ float tempsa[];
//set global index
int globalIdx = blockIdx.x*blockDim.x+threadIdx.x;
tempsa[threadIdx.x]= in[globalIdx];
__syncthreads();
out[globalIdx] = tempsa[threadIdx.x];
__syncthreads();
return ;
}
The error "unspecified launch failure" usually means the same as "segment fault" for host code. Check that your code does not try to access any areas outside the arrays being used. A common mistake is using 'the whole idx' instead of just the thread id to access shared memory. Here's an example:
int idx = blockIdx.x * blockDim.x + threadIdx.x;
shared[idx] = input[idx];will give you an error and should look like this:
int idx = blockIdx.x * blockDim.x + threadIdx.x;
int tid = threadIdx.x;
shared[tid] = input[idx];注意:shared memory 的 index 只能用threadIdx。 因為shared memory load data 是以一個 half-warp load。My kernel... __global__ void kernel(float *in,float *out){
//declare share memory
//extern is use kernel set memory size
extern __shared__ float tempsa[];
//set global index
int globalIdx = blockIdx.x*blockDim.x+threadIdx.x;
tempsa[threadIdx.x]= in[globalIdx];
__syncthreads();
out[globalIdx] = tempsa[threadIdx.x];
__syncthreads();
return ;
}
Install CUDAtoolkit and SDK
1. Install g++ and some dev stuff
#apt-get install g++ (I needed it for compiling the SDK examples)
#apt-get install mesa-common-dev libgl1-mesa-dev libglu1-mesa-dev libxi-dev libxmu-dev glutg3-dev libglut-dev (for SDK)
(完全不知道第二個安裝的是什麼,nvidia cuda 安裝說明也沒有寫,但是debian的光碟有這些)
2. Install the cudatoolkit(default install paht [/usr/src],auto make dir cuda)
#sh cudatoolkit_3.0_linux_64_ubuntu9.04.run
3.add path for cudatookit
#export PATH=/usr/local/cuda/bin:$PATH
#export LD_LIBRARY_PATH=/usr/local/cuda/lib:$LD_LIBRARY_PATH (for 64-bit: export
LD_LIBRARY_PATH=/usr/local/cuda/lib64:$LD_LIBRARY_PATH)
or add in user .brashrc file
#source ~/.brashrc
4.check
#nvcc --version
install cudatookit END
5.intsall SDK
#sh gpucomputingsdk3.0_linux.run(default [/home/USER/NVIDIA_GPU_Computing_SDK])
6. Go to /home/USER/NVIDIA_GPU_Computing_SDK/C and run 'make'
#cd USER/NVIDIA_GPU_Computing_SDK/C
#make
(some warnings will be shown, but the examples will run
After the compilation you find the binarys in [/home/USER/NVIDIA_GPU_Computing_SDK/C/bin])
7.source code in /home/USER/NVIDIA_GPU_Computing_SDK/C/src
END
備註:
此文章參考 NVIDIA forums
作者為:Lucas
版塊:CUDA in linux
#apt-get install g++ (I needed it for compiling the SDK examples)
#apt-get install mesa-common-dev libgl1-mesa-dev libglu1-mesa-dev libxi-dev libxmu-dev glutg3-dev libglut-dev (for SDK)
(完全不知道第二個安裝的是什麼,nvidia cuda 安裝說明也沒有寫,但是debian的光碟有這些)
2. Install the cudatoolkit(default install paht [/usr/src],auto make dir cuda)
#sh cudatoolkit_3.0_linux_64_ubuntu9.04.run
3.add path for cudatookit
#export PATH=/usr/local/cuda/bin:$PATH
#export LD_LIBRARY_PATH=/usr/local/cuda/lib:$LD_LIBRARY_PATH (for 64-bit: export
LD_LIBRARY_PATH=/usr/local/cuda/lib64:$LD_LIBRARY_PATH)
or add in user .brashrc file
#source ~/.brashrc
4.check
#nvcc --version
install cudatookit END
5.intsall SDK
#sh gpucomputingsdk3.0_linux.run(default [/home/USER/NVIDIA_GPU_Computing_SDK])
6. Go to /home/USER/NVIDIA_GPU_Computing_SDK/C and run 'make'
#cd USER/NVIDIA_GPU_Computing_SDK/C
#make
(some warnings will be shown, but the examples will run
After the compilation you find the binarys in [/home/USER/NVIDIA_GPU_Computing_SDK/C/bin])
7.source code in /home/USER/NVIDIA_GPU_Computing_SDK/C/src
END
備註:
此文章參考 NVIDIA forums
作者為:Lucas
版塊:CUDA in linux
NVIDIA Display driver install for Debian
Prepare intsall some softwares:
apt-get install gcc-4.1
apt-get install emacs
1.check the linux version ( In my case )
#cat /proc/version
Linux versoin 2.6.26-2-amd64 (Debian 2.6.26-24)(dannf@debian.org)(gcc
version 4.1.3 20080704 (prerelease) (Debian 4.1.2-25) #1 SMP Sun Jun 20
20:16:30 UTC 2010
2.Download the NVIDIA_Driver for my case,and place /root
3.install the source files for my kernel
#apt-cache search linux-source*
#apt-get install install linux-source-2.6.26
#apt-cache search linux-headers*
#apt-get install install linux-headers-2.6.26-2-amd64
4.untar and make link (if don't link step,when install driver will specify
the kernel path)
#tar xjvf /usr/src/linux-source-2.6.26.tar.bz2
#ln -s /usr/src/linux-source-2.6.26 /usr/src/linux
#ln -s /usr/src/linux-headers-2.6.26-2-amd64 /usr/src/headers
5.Set the environment variable CC to the gcc version of that one used to
compile the kernel
#export CC="gcc-4.1"
6.install NVIDIA driver
#/etc/init.d/gdm stop
#sh devdriver_3.0_linux_64_195.36.15.run
in some web , i see a article , choose update NO,other choose YES.I don't
why
#shutdown -r now(reboot)
END....
7.but my xwindow appear error....
#emacs /etc/X11/xorg.conf
in Screen section part
add
Option "NoPowerConnectorCheck"
save and leave
8.restart X
#/etc/init.d/gdm restart
9.if see Mark "NVIDAI",when start Xwindow
success!
TURE END.........
破英文,用力笑吧= =
備註:
此文章參考 NVIDIA forums
作者為:Lucas
版塊:CUDA in linux
apt-get install gcc-4.1
apt-get install emacs
1.check the linux version ( In my case )
#cat /proc/version
Linux versoin 2.6.26-2-amd64 (Debian 2.6.26-24)(dannf@debian.org)(gcc
version 4.1.3 20080704 (prerelease) (Debian 4.1.2-25) #1 SMP Sun Jun 20
20:16:30 UTC 2010
2.Download the NVIDIA_Driver for my case,and place /root
3.install the source files for my kernel
#apt-cache search linux-source*
#apt-get install install linux-source-2.6.26
#apt-cache search linux-headers*
#apt-get install install linux-headers-2.6.26-2-amd64
4.untar and make link (if don't link step,when install driver will specify
the kernel path)
#tar xjvf /usr/src/linux-source-2.6.26.tar.bz2
#ln -s /usr/src/linux-source-2.6.26 /usr/src/linux
#ln -s /usr/src/linux-headers-2.6.26-2-amd64 /usr/src/headers
5.Set the environment variable CC to the gcc version of that one used to
compile the kernel
#export CC="gcc-4.1"
6.install NVIDIA driver
#/etc/init.d/gdm stop
#sh devdriver_3.0_linux_64_195.36.15.run
in some web , i see a article , choose update NO,other choose YES.I don't
why
#shutdown -r now(reboot)
END....
7.but my xwindow appear error....
#emacs /etc/X11/xorg.conf
in Screen section part
add
Option "NoPowerConnectorCheck"
save and leave
8.restart X
#/etc/init.d/gdm restart
9.if see Mark "NVIDAI",when start Xwindow
success!
TURE END.........
破英文,用力笑吧= =
備註:
此文章參考 NVIDIA forums
作者為:Lucas
版塊:CUDA in linux
訂閱:
文章 (Atom)