Installation#

To install gamdpy you need a computer with a Nvidia GPU, Python3, and the following software installed (Windows users: see below):

  1. the CUDA toolkit, and

  2. the numba python package with CUDA GPU support (install cudatoolkit).

Ensure that this is working before proceeding with the installation (see below):

python3 -c "import numba.cuda; print(numba.cuda.get_current_device().name)"

should execute without errors.

Linux#

Install with the Python Package Index (pip)#

Get the latest stable version with (recommended):

pip install gamdpy

Alternatively, the latest developers version (on GitHub) can be installed:

pip install git+https://github.com/ThomasBechSchroeder/gamdpy.git

From source (for developers)#

If you want to inspect or modify the source code, the package can installed by cloning the source code from GitHub to a local directory (change [some_directory] to the desired path):

cd [some_directory]
git clone https://github.com/ThomasBechSchroeder/gamdpy.git  # Clone latest developers version
cd gamdpy
python3 -m venv venv  # Create virtual enviroment
. venv/bin/activate   # ... and activate
pip install -e .      # Install gamdpy 

Update to a latest version by executing

git pull

in the gamdpy directory.

Windows (using WSL)#

The following show how to install gamdpy on windows using Windows Subsystem For Linux (WSL).

Install WSL#

Open PowerShell or Windows Command Prompt in administrator mode by right-clicking and selecting “Run as administrator”, enter the command

wsl --install

press enter and then restart your machine. The default installation is Ubuntu, for others check: https://learn.microsoft.com/en-us/windows/wsl/install

Install python and pip on WSL#

  • open Windows Command Prompt

  • in the tab bar click on “v” and select ubuntu

sudo apt-get update
sudo apt-get install python3
sudo apt-get install pip

Install miniconda#

See https://docs.anaconda.com/miniconda/

mkdir -p ~/miniconda3
wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O ~/miniconda3/miniconda.sh
bash ~/miniconda3/miniconda.sh -b -u -p ~/miniconda3
rm -rf ~/miniconda3/miniconda.sh
~/miniconda3/bin/conda init bash

Install cuda#

miniconda3/condabin/conda install cudatoolkit
sudo apt install nvidia-cuda-toolkit
  • modify .bashrc adding: export LD_LIBRARY_PATH="/usr/lib/wsl/lib/" from numba/numba#7104

Install gamdpy#

For the latest stable version,

pip install gamdpy

and for the latest developer version

pip install git+https://github.com/ThomasBechSchroeder/gamdpy.git

Windows (using Anaconda)#

Install Anaconda#

Install Anaconda: https://docs.anaconda.com/anaconda/install/windows/

Install gamdpy#

Finally, we install gamdpy (and pip) using Powershell Prompt in Anaconda

  • open Anaconda Powershell as admin (from search)

conda update -n base -c defaults conda
conda install anaconda::pip
conda install anaconda::git
conda config --set channel_priority flexible
conda install cudatoolkit

Then type

pip install gamdpy

for the stable release, or

pip install git+https://github.com/ThomasBechSchroeder/gamdpy.git

for the latest developers version.

Confirm that installation is successful#

In a Python terminal type

import gamdpy as gp
gp.get_default_sim().run()

This should run a short simulation within errors.

Known issues#

LinkerError: libcudadevrt.a not found#

A workaround to fix the error numba.cuda.cudadrv.driver.LinkerError: libcudadevrt.a not found is to make a symbolic link to the missing file. This can be done by running the something like the below in the terminal:

ln -s /usr/lib/x86_64-linux-gnu/libcudadevrt.a .

in the folder of the script. Note that the path to libcudadevrt.a to the file may vary depending on the system.