Skip to content

Installation

Shinya Morino edited this page Jun 2, 2019 · 27 revisions

Installation for Ubuntu 16.04/18.04 and CentOS(RHEL) 7

Sqaod requires native libraries installed by using apt/yum, and a python package installed by pip. If you want to run CUDA-based solvers, installation of NVIDIA GPU driver and additional native libraries are required.

If you are using Linux distros other than Ubuntu 16.04/18.04 and CentOS(RHEL) 7, please visit Build from source.

1. Clean up previous installation

If you already installed sqaod from source, clean up native libraries at first.

find /usr/lib | grep libsqaodc
# if you find libraries, remove them.
find /usr/lib | grep libsqaodc | sudo xargs rm -f

If you installed alpha versions (alpha1, alpha2) of libsqaod, uninstall them first, and remove apt-repository setting.

# removing older packages if you installed.
sudo apt-get remove libsqaodc-cuda-9-0
sudo apt-get remove libsqaodc-avx2
sudo apt-get remove libsqaodc

# remove apt-repository setting.
sudo rm -f /etc/sources.list.d/sqaod.list

2. Installing native libraries

Ubuntu 16.04/18.04

Please run followings.

sudo apt-get update
sudo apt-get install apt-transport-https apt-utils

# adding apt repository setting.
 
. /etc/lsb-release
echo "deb [arch=amd64] https://shinmorino.github.io/sqaod/ubuntu ${DISTRIB_CODENAME} multiverse" | \
   sudo tee /etc/apt/sources.list.d/sqaod.list

# install repository key.
curl -s -L https://shinmorino.github.io/sqaod/gpgkey | sudo apt-key add -

# update and install sqaodc native library.
sudo apt-get update
sudo apt-get install libsqaodc

CentOS(RHEL) 7

Please run followings.

sudo curl -s -L https://shinmorino.github.io/sqaod/rpm/centos7/sqaod.repo > /etc/yum.repos.d/sqaod.repo
sudo yum install libsqaodc

3. Installing NVIDIA Driver and the CUDA-based native library.

If you want to run CUDA-based solvers, you should have NVIDIA GPU and NVIDIA driver installed on your machine.
GPUs of compute capabiity 3.5 (2nd gen Kepler) or later is required. Recommendation is Maxwell(compute capability 5.0) or later. Please visit CUDA GPUs to check compute capability of GPUs.

Ubuntu 16.04/18.04

To install NVIDIA driver, run followings.

distribution=$(. /etc/os-release;echo $ID${VERSION_ID//.})
echo "deb http://developer.download.nvidia.com/compute/cuda/repos/${distribution}/x86_64 /" | \
   sudo tee /etc/apt/sources.list.d/cuda.list
sudo apt-key adv --fetch-keys http://developer.download.nvidia.com/compute/cuda/repos/${distribution}/x86_64/7fa2af80.pub
sudo apt-get update
sudo apt-get install cuda-drivers

After driver installation, run followings to install CUDA-based native libraries.

# install CUDA native library if you need CUDA-based solvers.
sudo apt-get install libsqaodc-cuda-9-0
  • Note1: Names of CUDA library packages are formatted as "libsqaodc-cuda-<MajorVer>-<MinorVer>". If you use CUDA 10-0-based native librariy, package name is libsqaodc-cuda-10-0. Please visit Supported platforms and versions to check supported CUDA versions.
  • Note2: Beta2 Update1 for Ubuntu 16.04 had a package compiled with CUDA 9.2, but these are removed in Version 1.0. If you installed libsqaodc-cuda-9-2, please move to libsqaodc-cuda-9-0(only on Ubuntu 16.04) or libsqaodc-cuda-10-0.

CentOS(RHEL) 7

To install NVIDIA driver, please visit CUDA downloads, and download 'rpm(network)' or 'rpm(local)' package.
After downloading a rpm package, run followings. (Please install dkms from EPEL before installing cuda-drivers.)
Here, CUDA 10.0, rpm(network) package is assumed.

sudo rpm -i cuda-repo-rhel7-10.0.130-1.x86_64.rpm
sudo yum clean all
sudo yum install cuda-drivers

After driver installation, run followings to install CUDA-based native library.

sudo yum install libsqaodc-cuda-10-0

4. installing python package

Python 2.7/3.5/3.6/3.7.

To install sqaod python package, use pip as shown below.

pip install -U sqaod

(You can add '--global-option build_ext' to force recompile)

Python 3.3/3.4 (Should work. Not tested.)

Please install libsqaodc developer package.

Ubuntu
sudo apt-get install libsqaodc-dev
CentOS(RHEL) 7
sudo yum install libsqaodc-devel

After installation of the developer package, run pip to install sqaod.

pip install -U sqaod

5. Running examples

Python examples are in sqaod/sqaodpy/examples. The below is an example to run dense graph annealer.

curl -s -L -O  https://raw.githubusercontent.com/shinmorino/sqaod/master/sqaodpy/example/dense_graph_annealer.py
python dense_graph_annealer.py

6. Using libraries of your choice.

Sqaod has sse2 and avx2 versions of native libraries. From Beta2 Update1, default is avx2 version. On Haswell CPUs or later, avx2 version is the recommendation for better performance.
To switch ther version, please use update-alternative on Ubuntu or alternative on CentOS(RHEL).
Below is an example on Ubuntu.

 $ sudo update-alternatives --config libsqaodc.so.1
 There are 2 choices for the alternative libsqaodc.so.1 (providing /usr/lib/libsqaodc.so.1).

   Selection    Path                                    Priority   Status
 ------------------------------------------------------------
 * 0            /usr/lib/libsqaodc-avx2/libsqaodc.so.1   50        auto mode
   1            /usr/lib/libsqaodc-avx2/libsqaodc.so.1   50        manual mode
   2            /usr/lib/libsqaodc-sse2/libsqaodc.so.1   20        manual mode
 
 Press <enter> to keep the current choice[*], or type selection number: