歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
Linux教程網 >> Linux基礎 >> 關於Linux >> Install cuda and optimus on Kali Linux

Install cuda and optimus on Kali Linux

日期:2017/3/1 16:13:45   编辑:關於Linux

It’s a hard job to install cuda and optumus on Kali Linux,I tried all day and finally success,this is how it words.

Install cuda and nvidia driver
It’s really simple,and it may take some time,it’s not the latest version,but it works.

apt-get update

apt-get install nvidia-detect nvidia-libopencl1 nvidia-opencl-common nvidia-support nvidia-opencl-icd nvidia-visual-profiler nvidia-glx nvidia-installer-cleanup nvidia-kernel-common nvidia-smi nvidia-alternative nvidia-opencl-dev libglx-nvidia-alternatives nvidia-kernel-dkms nvidia-cuda-toolkit nvidia-vdpau-driver nvidia-xconfig glx-alternative-nvidia libgl1-nvidia-alternatives nvidia-settings libgl1-nvidia-glx xserver-xorg-video-nvidia libcublas4 libcudart4 libcufft4 libnpp4 libnvidia-compiler libcuda1 libcuinj4 libnvidia-ml1 libxvmcnvidia1 libcusparse4 libcurand4 python-pycuda-doc python-pycuda-headers python-pycuda nvidia-cuda-doc nvidia-cuda-gdb
During the process,there are some information to confirm,just press ok.After that,we need to add these to the /root/.bashrc

PATH=$PATH:/usr/lib/nvidia-cuda-toolkit/bin.
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/lib/nvidia-cuda-toolkit/lib:/lib
export PATH
export LD_LIBRARY_PATH
Reboot the computer.

Install pyrit-cuda
The wo will compile a pyrit with cuda,download the source from here.

https://code.google.com/p/pyrit/downloads/list

We nedd both pyrit-0.4.0.tar.gz and cpyrit-cuda-0.4.0.tar.gz,and wo need soom lib and tools to complete the compile.

atp-get install libpcap-dev python2.7-dev
Decompress the pyrit-0.4.0.tar.gz,and install

tar -xzvf pyrit-0.4.0.tar.gz
cd pyrit-0.4.0
python setup.py build
python setup.py install
Decompress the cpyrit-cuda-0.4.0.tar.gz

tar -xzvf cpyrit-cuda-0.4.0.tar.gz
cd cpyrit-cuda-0.4.0
Here wo nedd edit the setup.py,line 35,edit it from

for path in ('/usr/local/cuda', '/opt/cuda'):
to

for path in ('/usr/local/cuda','/usr/lib/nvidia-cuda-toolkit','/opt/cuda'):
So the nvcc could be found during the process,then install

python setup.py build
python setup.py install
After that ,We can try it

pyrit list_cores
You should find the CUDA-Device

#1: 'CUDA-Device #1 'GeForce 8400 GS''
#2: 'CPU-Core (SSE2)'
#3: 'CPU-Core (SSE2)'
#4: 'CPU-Core (SSE2)'
#5: 'CPU-Core (SSE2)'
#6: 'CPU-Core (SSE2)'
#7: 'CPU-Core (SSE2)'
#8: 'CPU-Core (SSE2)'
Install optimus
Get the apt-key

wget -O - http://suwako.nomanga.net/suwako.asc | apt-key add -
Edit the source of Bumblebee to the /etc/apt/source.list

deb http://suwako.nomanga.net/debian sid main contrib
deb-src http://suwako.nomanga.net/debian sid main
Then install

apt-get update
apt-get install bumblebee bumblebee-nvidia
Add the root to the bumblebee group

adduser root bumblebee
Reboot,and you can run

glxspheres
optirun glxspheres
You will find out the fps is different.

Copyright © Linux教程網 All Rights Reserved