우분투 18.04 LTS에서 CUDA 9.0을 다운로드받으면서 torch7을 빌드해야 했다.

 

$ cd ~/torch

$ ./install.sh

 

이 명령어로 빌드를 하던 도중에 아래와 같은 에러가 발생했다.

 

 

#error -- unsupported GNU version! gcc versions later than 6 are not supported!

 

$ sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-6 10

$ sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-6 10

 

위 명령어로 해결하였다.

 

하지만 또 다른 에러가 발생했다.

 

#error: more than one operator "!=" matches these operands

 

$ export TORCH_NVCC_FLAGS="-D__CUDA_NO_HALF_OPERATORS__"

 

이렇게 하면 정상적으로 빌드가 될 것이다.

[ref link]

gist.github.com/andyweizhao/639e94b60c166f57964aafedeb465e90

 

cuda 9.0 complete installation procedure for ubuntu 18.04 LTS

cuda 9.0 complete installation procedure for ubuntu 18.04 LTS - cuda_installation_on_ubuntu_18.04

gist.github.com

 

여기서 쭈욱 따라하면 된다.

 

#!/bin/bash
## This gist contains step by step instructions to install cuda v9.0 and cudnn 7.3 in ubuntu 18.04

### steps ####
# verify the system has a cuda-capable gpu
# download and install the nvidia cuda toolkit and cudnn
# setup environmental variables
# verify the installation
###

### to verify your gpu is cuda enable check
lspci | grep -i nvidia

### gcc compiler is required for development using the cuda toolkit. to verify the version of gcc install enter
gcc --version

# first get the PPA repository driver
sudo add-apt-repository ppa:graphics-drivers/ppa

# install other import packages
sudo apt-get install g++ freeglut3-dev build-essential libx11-dev libxmu-dev libxi-dev libglu1-mesa libglu1-mesa-dev

# CUDA 9 requires gcc 6
sudo apt install gcc-6
sudo apt install g++-6

# downoad one of the "runfile (local)" installation packages from cuda toolkit archive 
wget https://developer.nvidia.com/compute/cuda/9.0/Prod/local_installers/cuda_9.0.176_384.81_linux-run

# make the download file executable
chmod +x cuda_9.0.176_384.81_linux-run 
sudo ./cuda_9.0.176_384.81_linux-run --override

# answer following questions while installation begin
# You are attempting to install on an unsupported configuration. Do you wish to continue? y
# Install NVIDIA Accelerated Graphics Driver for Linux-x86_64 384.81? y
# Install the CUDA 9.0 Toolkit? y

# Refer to https://linuxconfig.org/how-to-install-the-nvidia-drivers-on-ubuntu-18-04-bionic-beaver-linux
# Detect the model of nvidia graphic card and recommended driver
ubuntu-drivers devices
sudo ubuntu-drivers autoinstall

# set up symlinks for gcc/g++
sudo ln -s /usr/bin/gcc-6 /usr/local/cuda/bin/gcc
sudo ln -s /usr/bin/g++-6 /usr/local/cuda/bin/g++

# setup your paths
echo 'export PATH=/usr/local/cuda-9.0/bin:$PATH' >> ~/.bashrc
echo 'export LD_LIBRARY_PATH=/usr/local/cuda-9.0/lib64:$LD_LIBRARY_PATH' >> ~/.bashrc
source ~/.bashrc

# install cuDNN v7.3.0
# in order to download cuDNN you have to regeistered here https://developer.nvidia.com/developer-program/signup
# then download cuDNN v7.3 form https://developer.nvidia.com/cudnn
CUDNN_TAR_FILE="cudnn-9.0-linux-x64-v7.3.0.29"
wget https://developer.nvidia.com/compute/machine-learning/cudnn/secure/v7.2.1/prod/9.0_20180806/${CUDNN_TAR_FILE}
tar -xzvf ${CUDNN_TAR_FILE}

# copy the following files into the cuda toolkit directory.
sudo cp -P cuda/include/cudnn.h /usr/local/cuda-9.0/include
sudo cp -P cuda/lib64/libcudnn* /usr/local/cuda-9.0/lib64/
sudo chmod a+r /usr/local/cuda-9.0/lib64/libcudnn*

# finally, to verify the installation, check
nvidia-smi
nvcc -V

 

혹시 우분투 18.04 LTS 에서 쿠다 10.1을 설치해야 한다면,

[ref link]

mibolee.tistory.com/34

 

[Ubuntu 18.04 LTS] CUDA 10.1 설치

[ref link] gist.github.com/Mahedi-61/2a2f1579d4271717d421065168ce6a73 CUDA 10.1 Installation on Ubuntu 18.04 CUDA 10.1 Installation on Ubuntu 18.04. GitHub Gist: instantly share code, notes, and sni..

mibolee.tistory.com

 

+ Recent posts