In adition to these instructions, we also provide a complete step-by-step installation guide> for CIANNA and its dependencies on a fresh Ubuntu 20.04.
git clone https://github.com/Deyht/CIANNA.git
cd CIANNA
python3 -m pip install -v .
import CIANNA
CMAKE_ARGS="-D[OPTION]=[VALUE]" python3 -m pip install -v .
It is worth noting that this way of installing CIANNA requires cmake (at least version 3.16) to be available to the user. Please note that issues may arise depending on how python3 packages are handled or if cmake is installed both on the system and as a python package. In which case the easiest solution is to create a dedicated virtual environnment with "python3 -m venv ./[venv-name] then activate it with "source ./[venv-name]/bin/activate" and then perform the previously described installation (in this new virtual environment you may need to install numpy and other basic python packages).
git clone https://github.com/Deyht/CIANNA.git
cd CIANNA
cmake -B build
cmake --build build
import sys
sys.path.insert(0,glob.glob('path/to/CIANNA/build/')[-1])
import CIANNA
cmake -B build -D [OPTION1]=[value1] -D [OPTION2]=[value2] ...
cmake --build build
CIANNA is coded in C99 and requires at least a C compiler. Additionally, it supports several computing methods:
Note: verify that you updated your PATH and LD_LIBRARY_PATH with the appropriate elements for OpenBLAS and CUDA before compiling CIANNA.
Multiple arguments can be used simultaneously:
./compile.cp CUDA OPEN_MP BLAS PY_INTERF
These parameters allow the use of specific features; they do not enable them. For example, one can compile using all the arguments and choose to use CUDA or BLAS at execution time.
Python dependencies: building the python interface requires to have the setuptools package installed. It also requires the Numpy library.
First, check if any path or compile option needs to be adapted for your need in src/python_module_setup.py (GCC, CUDA, OpenBLAS, ...). Then, the interface can be built automatically by adding the PY_INTERF argument to the compile.cp command (re-compile with all arguments), or manually by going into the src directory and executing:
python3 python_module_setup.py build
To use the locally built interface, the explicit build path must be given to the Python script (see example).
To provide system-wide access to the framework (must also be done when using the PY_INTERF option), execute into the src directory:
sudo python3 python_module_setup.py install
The Python interface module has no dependency on main.c. Any Python code invoking CIANNA can be written without a new compilation.
To remove a system-wide install of CIANNA (e.g., to update to a new version), go to /usr/local/lib/pythonX.X/dist-packages/ (or the corresponding setuptools path for your distro), and delete any CIANNA-related files/directories.
We provide different Dockerfiles corresponding to the available compute methods.
To use these files, you must first install Docker. See .
To start the installation through one of the Dockerfile, use:
docker build -f cianna-cpu.Dockerfile -t cianna-cpu-precompiled-openblas:1.0 .
To run the installed docker, use:
docker run -it --init cianna-cpu:1.0
We recently added the option to install cianna through APT. It should work for Ubuntu from 20.04 to 24.04, although only minimal testing has been carried out so far. Note that this installation will allow access to CPU NAIV and CPU BLAS compute methods but it does not allow GPU CUDA at the moment.
sudo add-apt-repository ppa:dcornu/cianna
sudo apt update
sudo apt install cianna-cpu-blas
Once installed, you should be able to call "import CIANNA" in your Python scripts.