Ubuntu12.04 安装 CUDA 4.2 - XiZi's Blog

Ubuntu12.04 安装 CUDA 4.2

Xizi posted @ 2012年5月01日 21:33 in Develop with tags cuda ubuntu 4.2 12.04 , 6674 阅读

翻译自(http://d.hatena.ne.jp/iRiE/20120309/1331303439)

按照下列顺序进行安装

  1. Ubuntu 12.04
  2. NVIDIA 显卡驱动(devdriver_4.2_linux_64_295.41.run)
  3. cudatoolkit_4.2.9_linux_64_ubuntu11.04.run
  4. gpucomputingsdk_4.2.9_linux.run
  5. 代码编译依赖库

Ubuntu 12.04 安装

Ubuntu 的安装,网上教程不少,不会的自己百度一下。

NVIDIA 显卡驱动

sudo apt-get install nvidia-current

CUDA Toolkit

去NVIDIA的网站下载

sudo sh cudatoolkit_4.2.9_linux_64_ubuntu11.04.run

配置库,创建文件(/etc/ld.so.conf.d/cuda.conf)

## /etc/ld.so.conf.d/cuda.conf
/usr/local/cuda/lib64
/usr/local/cuda/lib

重新加载设置

sudo ldconfig

创建系统环境变量文件(/etc/profile.d/cuda.sh

## /etc/profile.d/cuda.sh
export PATH="/usr/local/cuda/bin:$PATH"
export LIBRARY_PATH="/usr/lib/nvidia-current:$LIBRARY_PATH"

修正"/usr/local/cuda/include/host_config.h"(话说这里还没实验,不知到需不需要)

--- host_config.orig.h  2012-01-27 17:20:57.689102815 +0900
+++ host_config.h       2012-01-27 17:29:32.037101532 +0900
@@ -79,7 +79,7 @@
 
 #if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ > 5)
 
-#error -- unsupported GNU version! gcc 4.6 and up are not supported!
+//#error -- unsupported GNU version! gcc 4.6 and up are not supported!
 
 #endif /* __GNUC__> 4 || (__GNUC__ == 4 && __GNUC_MINOR__ > 5) */

 

gpucomputingsdk

安装GPU_COMPUTING_SDK

sh gpucomputingsdk_4.2.9_linux.run

安装后,进入安装目录执行 make, 一般会出现以下错误。

../../lib/librendercheckgl_x86_64.a(rendercheck_gl.cpp.o): In function `CheckBackBuffer::checkStatus(char const*, int, bool)':
rendercheck_gl.cpp:(.text+0xfbb): undefined reference to `gluErrorString'

这是由于~/NVIDIA_GPU_Computing_SDK/C/common/common.mk 文件中,库文件的链接顺序问题引起的。这里主要受到库$(RENDERCHECKGLLIB)的影响,我们把这个库提前即可。

--- common.orig.mk      2012-01-27 14:34:13.129127766 +0900
+++ common.mk   2012-01-27 14:24:10.433129269 +0900
@@ -267,18 +267,18 @@
 
 # If dynamically linking to CUDA and CUDART, we exclude the libraries from the LIB
 ifeq ($(USECUDADYNLIB),1)
-     LIB += ${OPENGLLIB} $(PARAMGLLIB) $(RENDERCHECKGLLIB) ${LIB} -ldl -rdynamic 
+     LIB += $(RENDERCHECKGLLIB) ${OPENGLLIB} $(PARAMGLLIB) ${LIB} -ldl -rdynamic 
 else
 # static linking, we will statically link against CUDA and CUDART
   ifeq ($(USEDRVAPI),1)
-     LIB += -lcuda   ${OPENGLLIB} $(PARAMGLLIB) $(RENDERCHECKGLLIB) ${LIB} 
+     LIB += -lcuda   $(RENDERCHECKGLLIB) ${OPENGLLIB} $(PARAMGLLIB) ${LIB} 
   else
      ifeq ($(emu),1) 
          LIB += -lcudartemu
      else 
          LIB += -lcudart
      endif
-     LIB += ${OPENGLLIB} $(PARAMGLLIB) $(RENDERCHECKGLLIB) ${LIB}
+     LIB += $(RENDERCHECKGLLIB) ${OPENGLLIB} $(PARAMGLLIB) ${LIB}
   endif
 endif

其他编译所需依赖的安装

必须依赖安装包

sudo apt-get install g++ freeglut3-dev libxi-dev libxmu-dev

如果你还想用mpi,可以安装openmpi的包

sudo apt-get install openmpi-bin openmpi-dev

编译和测试sdk

cd ~/NVIDIA_GPU_Computing_SDK/C
make

测试

cd ~/NVIDIA_GPU_Computing_SDK/C/bin/linux/release
./nbody

 

P。S。

没看动说的啥,先放这里把。

由于64位系统的原因,如果编译的时候出现错误 “/usr/bin/ld: cannot find -lcutil”,你可以尝试创建链接来修正它 。

cd ~/NVIDIA_GPU_Computing_SDK/C/lib
for i in *_x86_64.a; do ln -sv $i ${i%_x86_64.a}.a; done

 

 

Avatar_small
zhumeng1989 说:
2012年8月15日 00:45

弄了半天,就靠你这个通过了,真是太感谢!

Avatar_small
Top Engineering Cons 说:
2021年1月24日 20:36

Thanks for sharing your thoughts and wisdom about web development. May you find more time in sharing informative posts in the future.

Engineering Consultants in Sharjah

Villa Design in Sharjah

Top Engineering Consultants in UAE 

Avatar_small
hassan 说:
2021年1月28日 22:40

General visits recorded here are the most easy system to esteem your imperativeness, which is the motivation behind why I am taking off to the site conventional, examining for new, interesting information. Many, favor your heart! Area Code 855

Avatar_small
dark web sites 说:
2021年5月20日 00:55

I appreciate your efforts in preparing this post. I really like your blog articles.

Avatar_small
agen baccarat online 说:
2021年6月13日 19:25

The thought of risking your hard earned money is often enough to discourage baccarat players from visiting the tables at a live or online baccarat casino. But the option to play baccarat online for fun changes everything.

Avatar_small
click 说:
2021年7月11日 21:08

I am hoping that you will continue writing this kind of blog. Thanks for sharing this information.

Avatar_small
Click Here 说:
2021年7月12日 19:07

The inherent desire to get more pleasure for little or nothing is the reason why people find gambling so pleasurable.

Avatar_small
BSEB 10th Question P 说:
2021年7月22日 20:15

Bihar School Education Board has released the 10th Question Papers for the year 2022. (BSEB). The question papers from prior years are available in pdf format. Students studying for Inter examinations should practise model or sample papers to gain a sense of <a
href="https://10thmodelquestionpaper.in/bihar-10th-model-paper-bseb-matric-important-question-paper/">BSEB 10th Question Paper 2022</a> the types of questions that will be asked. They will gain familiarity with the marking structure and amount of questions by solving BSEB 12th Question Paper 2022. Furthermore, completing these Question Papers in the allotted time will aid pupils in boosting their problem-solving speed.

Avatar_small
BSEB 10th Question P 说:
2021年7月22日 20:17

Bihar School Education Board has released the 10th Question Papers for the year 2022. (BSEB). The question papers from prior years are available in pdf format. Students studying for Inter examinations should practise model or sample papers to gain a sense of https://10thmodelquestionpaper.in/bihar-10th-model-paper-bseb-matric-important-question-paper/">BSEB 10th Question Paper 2022 the types of questions that will be asked. They will gain familiarity with the marking structure and amount of questions by solving BSEB 12th Question Paper 2022. Furthermore, completing these Question Papers in the allotted time will aid pupils in boosting their problem-solving speed.

Avatar_small
꽁머니 说:
2021年7月29日 18:37

Excellent article. I want to thank you for this informative read; I really appreciate sharing this great post. Keep up your work!

Avatar_small
Umzugsunternehmen Zü 说:
2021年8月10日 19:47

With our age of technology, there are countless ways to market your company and your product or services aside from the traditional business letters and paid space advertisements.

Avatar_small
ครีมซองเซเว่น 说:
2021年8月18日 01:30

I am hoping that you will continue writing this kind of blog. Thanks for sharing this information.

Avatar_small
Lee Roy strain 说:
2021年9月06日 19:58

Hi there! You make so many good points here that I read your article a couple of times. This is really nice content for your readers.

Avatar_small
matka result 说:
2021年10月16日 20:46

Also please do mention your idea and questions in the comment box it will help us to write more engaging and informative article for you.

Avatar_small
matka boss 说:
2021年11月06日 23:17

Hi there! You make so many good points here that I read your article a couple of times. This is really nice content for your readers.

Avatar_small
Delta 8 Area 52 说:
2022年4月15日 22:24

Thanks for taking the time to discuss this, I feel strongly about it and love learning more on this topic.

Avatar_small
dark web/deep web/d 说:
2022年8月21日 00:55

If you're not careful, you can fall victim to these scams and wind up wasting your time and even money. dark web links

Avatar_small
dark web/deep web/d 说:
2022年8月21日 01:49

Some of the programs and websites offering this service may try to sell you something, even if they aren't really legitimate. deep web

Avatar_small
dark web/deep web/d 说:
2022年8月21日 02:13

And if you don't have a lot of friends on any of these sites to recruit, then you can't expect to make money.  dark web sites

Avatar_small
dark web/deep web/d 说:
2022年8月21日 02:35

So can I make money with links? The answer is yes, you can but it's not easy. It takes time and effort and hence, not many people can do it. dark web links

Avatar_small
dark web/deep web/d 说:
2022年8月21日 02:53

The more links you have, the more visitors you can attract and the more money you can make. However, you need to make sure that you are only working with legitimate companies or individuals.  dark web

Avatar_small
dark web/deep web/d 说:
2022年8月21日 03:12

You will quickly find that there are hundreds of thousands of companies you can join and become an affiliate for. The key is to find the affiliate programs that offer the products or services that appeal to you and then concentrate your efforts on these companies. work from home jobs

Avatar_small
dark web/deep web/d 说:
2022年8月21日 03:28

When you have found an appropriate seller, the next step in your quest for success with affiliate marketing is to set up a simple website that displays the products or services offered by your selected companies. affiliate marketing success


登录 *


loading captcha image...
(输入验证码)
or Ctrl+Enter
Host by is-Programmer.com | Power by Chito 1.3.3 beta | © 2007 LinuxGem | Design by Matthew "Agent Spork" McGee