These instructions install a python command line interface to mandrake. If you are not comfortable with using the terminal, or just want to have a quick look, try our web version (and see documenation on Web app).

Installing manually

You will need to install the dependencies, which are listed in environment.yml. We would still recommend using conda to do this:

conda create -n mandrake_env python
conda env update -n mandrake_env --file environment.yml
conda activate mandrake_env

You can then install by running:

python install

If you have the CUDA toolkit installed and nvcc on your path, this will also compile the GPU code:

-- CUDA found, compiling both GPU and CPU code

By default the code will be built for CUDA SM versions 70 (V100), 75 (20xx series), 80 (A100) and 86 (30xx series). If you need more help on getting the GPU code to work, please see the page in the pp-sketchlib docs, which uses the same build procedure.

Developer notes

Install the debug build (which can be stepped through with gdb and cuda-gdb) by running:

python install --debug

To run:

cuda-gdb python
set args <args>

To run without installing, run:

python build

and add the following lines to the top of each python module file:

import os, sys
sys.path.insert(0, os.path.dirname(__file__) + '/../build/lib.macosx-10.9-x86_64-3.9')
sys.path.insert(0, os.path.dirname(__file__) + '/../build/lib.linux-x86_64-3.9')

To change the compiler used, edit the following part of

cmake_args = ['-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=' + extdir,
          '-DPYTHON_EXECUTABLE=' + sys.executable,

To profile the GPU code, uncomment the lines under ‘Set these to profile’ in CMakeLists.txt (there are three of these, two at the top, one in the CUDA section) and reinstall. Run nsight-systems with:

nsys profile -o sce_<hash> -c cudaProfilerApi --trace cuda,osrt,openmp mandrake <args>

nsight-compute with:

ncu -c 10 -o sce_<hash> --set full --target-processes all mandrake <args>