Installation FAQs¶
How to install TRAK?¶
Our package is hosted on PyPI. The standard version of our package can be installed using
pip install traker
To install the version of our package which contains a fast, custom CUDA kernel for the JL projection step, use
pip install traker[fast]
pip will compile our CUDA kernel on your machine. For this to happen, you
need to have compatible versions of gcc and CUDA toolkit. See
the sections below for tips regarding this.
Confirm your TRAK installation using
>>> import trak
>>> trak.test_install(use_fast_jl=False)
and your fast_jl installation using
>>> trak.test_install(use_fast_jl=True)
How to install nvcc (CUDA toolkit)?¶
Note
Version required: CUDA >= 10.0.
Pick one option:
Some machines might already have been setup with the
CUDA toolkit. You can runnvcc --versionin a terminal and check if it already exists. If you have a compatible version then you can proceed with the
TRAKinstallation.If you are logged in an unversity/company shared cluster, there is most of the time a way to enable/load a version of
CUDA tookitwithout having to install it. On clusters usingmodulefile, the commandmodule availwill show you what is available to you. When in doubt, plese refer to the maintainers/documentation of your cluster.
Using
conda:conda install -c conda-forge cudatoolkit-dev
Note that the version of
CUDA toolkiton thecondaindex may be outdated.If you are root on your machine or feel confident with configuring the installation you can follow Nvidia instructions: https://docs.nvidia.com/cuda/cuda-quick-start-guide/index.html.
How to install gcc?¶
Note
Version required: If you have CUDA 11, you will need gcc
with version 7.5 <= version <= 10. For CUDA 12, you will
need gcc with version >= 7.5.
Pick one option:
Most Operating System come with gcc preinstalled. You can run
gcc --versionin a terminal to check if it’s the case on your machine and which version you have. If you have a compatible version then you can proceed with the
TRAKinstallation.If your operating ships with an incompatible compiler they usually let you install other version alongside what comes by default. Here is an example for ubuntu and gcc 10: 1. Add repository:
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
Update list of packages:
sudo apt update
Download/install
gcc 10:
sudo apt install gcc-10 g++-10
Enable the compiler before runing
pip install traker[fast]:
Note
This has to be done in the same terminal.
export CXX=g++10 CC=gcc-10
Running the tests¶
You can test your installation by running the following in a python shell:
>>> import trak
>>> trak.test_install(use_fast_jl=False)
>>> trak.test_install(use_fast_jl=True) # if you're using the fast version
If you want to run any of the tests in the tests directory, you need to
install the optional [tests] dependencies:
pip install traker[tests]
Then you can run the tests using
python -m pytest -sv tests/
Misc Q&A¶
Q: I’m using zsh and when running
pip install traker[fast],
I get
zsh: no matches found: traker[fast]
A: Make sure to escape the square brackets, i.e. run
pip install traker\[fast\]