Build in a conda environment¶
Creating a dedicated Conda environment is a best practice that ensures the dependencies are managed effectively. This isolation prevents conflicts between packages and allows for a clean workspace. In the following section, we’ll guide you through the process of setting up a Conda environment and installing FastDDM to get your project up and running smoothly.
Install miniconda¶
Download and install miniconda3 from the Anaconda website.
Create an environment config YAML file¶
Create a fastddm-env.yml file and write the following content in it (select your operating
system).
name: fddm-env
channels:
- defaults
- conda-forge
dependencies:
- gcc
- gxx
- python>=3.8
- pip
Warning
If you install with CUDA support, ensure that your gcc and g++ versions are
compatible with your CUDA Toolkit. Refer to the official CUDA documentation
for the supported compiler versions.
When using a conda environment, you can specify the compatible versions in your
fastddm-env.yml file. For example, for CUDA 12.9, the maximum supported GCC version is
14. Set both gcc=14 and gxx=14 in your environment file if needed.
Create the environment by running the following command in your terminal
$ conda env create -f fastddm-env.yml
Activate the environment
$ conda activate fddm-env
Export the environment variables
$ conda env config vars set CC=$CONDA_PREFIX/bin/gcc
$ conda env config vars set CXX=$CONDA_PREFIX/bin/g++
To compile the C++ core, also set the corresponding flag
$ conda env config vars set ENABLE_CPP=ON
To compile the CUDA core, set the corresponding flag
$ conda env config vars set ENABLE_CUDA=ON
Path to the CUDA Toolkit should also be exported
$ conda env config vars set CUDACXX=/usr/local/cuda_version/bin/nvcc
Deactivate and reactivate the environment to make the changes effective
$ conda deactivate
$ conda activate fddm-env
From the fastddm project root directory (see Building from source on how to get the source code),
install the package and the test dependencies
$ pip3 install ."[test]"
Finally, run the tests from the project source directory
$ pytest -v
name: fddm-env
channels:
- defaults
dependencies:
- clang
- clangxx
- python>=3.8
- pip
Create the environment by running the following command in your terminal
$ conda env create -f fastddm-env.yml
Activate the environment
$ conda activate fddm-env
Export the environment variables
$ conda env config vars set CC=$CONDA_PREFIX/bin/clang
$ conda env config vars set CXX=$CONDA_PREFIX/bin/clang++
To compile the C++ core, also set the corresponding flag
$ conda env config vars set ENABLE_CPP=ON
Deactivate and reactivate the environment to make the changes effective
$ conda deactivate
$ conda activate fddm-env
From the fastddm project root directory (see Building from source on how to get the source code),
install the package and the test dependencies
$ pip3 install ."[test]"
Finally, run the tests from the project source directory
$ pytest -v
name: fddm-env
channels:
- defaults
dependencies:
- python>=3.8
- pip
For Windows, you will still need to install Visual Studio Community Edition with the
Desktop development with C++ option enabled (see Building from source).
Create the environment by running the following command in your miniconda PowerShell terminal
$ conda env create -f fastddm-env.yml
Activate the environment
$ conda activate fddm-env
To compile the C++ core, set the corresponding flag
$ conda env config vars set ENABLE_CPP=ON
Deactivate and reactivate the environment to make the changes effective
$ conda deactivate
$ conda activate fddm-env
From the fastddm project root directory (see Building from source on how to get the source code),
install the package and the test dependencies
$ pip3 install ."[test]"
Finally, run the tests from the project source directory
$ pytest -v
Notes on CUDA¶
As of today, we could not find a way to automatically build the package from source using the
cudatoolkit-dev distributed on conda-forge.
We recommend following the instructions given in Building from source to install the package in the conda
environment using the system CUDA Toolkit.
We welcome contributions on this matter!