Skip to content

PySAGES installation notes

Yiheng Wu edited this page May 7, 2024 · 3 revisions

Collections of recipes for installing PySAGES.

Installation of HOOMD and PySAGES using a conda environment in a PC

Requirements:

  • A git installation
  • A conda installation (consider using miniforge instead of miniconda)
  • CUDA (optional) if you have a Nvidia GPU

Steps:

  1. Create new conda environment
    conda create -n pysages
  2. Activate your conda environment
    conda activate pysages
  3. Install hoomd
    conda install -c conda-forge hoomd
    or if you have a GPU
    conda install -c conda-forge hoomd=*=*gpu*
  4. Get and build hoomd-dlext
    git clone https://github.com/SSAGESLabs/hoomd-dlext
    cd hoomd-dlext
    ./build.sh

Installation of HOOMD and PySAGES on midway2

Load required modules:

module load python/anaconda-2021.05 
module load gcc/10.2.0 cmake/3.15 cuda/11.2 eigen/3.3

Steps:

  1. Create a conda environment

    conda create -n pysages
    source activate pysages
  2. Install HOOMD required libraries

    conda install -c conda-forge pybind11
    conda install python=3.8 
    #[Downgrade for numba. If pybind11 installs python=3.10; numba installation may fail.]
  3. Download HOOMD source

    curl -O https://glotzerlab.engin.umich.edu/Downloads/hoomd/hoomd-v2.9.7.tar.gz
    tar -zxvf hoomd-v2.9.7.tar.gz
    cd hoomd-v2.9.7.tar.gz
    mkdir build
    cd build
  4. Install HOOMD

    PYTHON_EXECUTABLE=$(which python3)
    HOOMD_ROOT=$(${PYTHON_EXECUTABLE} -c 'import site; print(site.getsitepackages()[0])')`
    cmake ../ \
        -DCMAKE_INSTALL_PREFIX=$HOOMD_ROOT \
        -DCOPY_HEADERS=ON \
        -DENABLE_CUDA=ON  \
        -DCMAKE_C_COMPILER=/software/gcc-10.2.0-el7-x86_64/bin/gcc\
        -DCMAKE_CXX_COMPILER=/software/gcc-10.2.0-el7-x86_64/bin/g++
    make -j 10 # On an interactive GPU node.
    make install
  5. Install HOOMD-dlext [currently minimum version is 3.16 (can be installed using source code or conda environment easily); midway2 max version is 3.15]

    git clone https://github.com/SSAGESLabs/hoomd-dlext
    source build.sh # Edit cuda path to cuda/11.2 on midway2
  6. Install other required libraries and JAX

    conda install numpy numba
    conda install -c conda-forge cupy
    conda install gsd matplotlib
    pip install --upgrade "jax[cuda11_pip]" -f https://storage.googleapis.com/jax-releases/jax_cuda_releases.html
  7. Install PySAGES

    git clone pysages
    cd to pysages
    pip install .

Installation of OpenMM and PySAGES using a conda environment on a Mac

Requirements:

  • A git installation
  • A conda installation

Steps:

  1. Create new conda environment
    conda create -n pysages python=3
  2. Activate your conda environment
    conda activate pysages
  3. Install OpenMM
    conda install -c conda-forge openmm
  4. Install other required libraries and JAX
    conda install -c conda-forge clang_osx-64
    conda install -c conda-forge clangxx_osx-64
    conda install -c conda-forge swig
    conda install -c conda-forge plum-dispatch
    conda install -c fastai fastcore
    conda install -c conda-forge numba
    pip install jax  
    pip install jaxlib
    pip install --upgrade jaxlib
  5. Install openmm-dlext
    git clone https://github.com/pabloferz/openmm-dlext
    cd openmm-dlext
    cmake -S . -B build
    cmake --build build --target install
  6. Install PySAGES
    git clone https://github.com/SSAGESLabs/PySAGES.git
    cd  PySAGES
    pip install .

Installation of OpenMM and PySAGES on midway2

Load required modules:

module load python/intel-2020.up1
module load gcc/10.2.0 cuda/11.2 

Steps:

  1. Create a conda environment

    conda create -n pysages-openmm
    source activate pysages-openmm
  2. Install OpenMM using conda

    conda install -c omnia openmm
  3. Install jaxlib and jax cuda with pip

    pip install jaxlib
    pip install --upgrade "jax[cuda11_pip]" -f https://storage.googleapis.com/jax-releases/jax_cuda_releases.html
  4. Download and install cmake/3.16 (may take few min)

    wget https://cmake.org/files/v3.16/cmake-3.16.0.tar.gz
    tar -zxvf cmake-3.16.0.tar.gz
    mkdir installed-files
    cmakeLocation=$(pwd)
    ./configure --prefix=$cmakeLocation/installed-files
    make install
  5. Install OpenMM-dlext [currently minimum version is 3.16]

    git clone https://github.com/SSAGESLabs/openmm-dlext.git
    $cmakeLocation/installed-files/bin/cmake -S . -B build
    $cmakeLocation/installed-files/bin/cmake --build build --target install
  6. Install PySAGES

    git clone pysages
    cd to pysages
    pip install .
  7. If it doesn't work, upgrade python (if prompted, upgrade openmm), then rerun jaxlib

    conda install python=3.9.10
    pip install --upgrade "jax[cuda11_pip]" -f https://storage.googleapis.com/jax-releases/jax_cuda_releases.html
  8. Re-install openmm-dlext.

    cd openmm-dlext
    rm -f -r build
    $cmakeLocation/installed-files/bin/cmake -S . -B build
    $cmakeLocation/installed-files/bin/cmake --build build --target install
  9. Re-install PySAGES

    cd pysages
    pip install .
  10. install cupy

    conda install cupy

Installation of PySAGES on midway3

This is a summary of this discussion and this discussion.

Steps:

  1. Load the modules:

    module load python/anaconda-2021.05
    module load pysages
    
  2. Then, if you want to use your own version of PySAGES, that environment can be cloned an modified with the following:

    conda create --clone pysages-0.4.0 --name mypysages   # clone the env
    conda activate mypysages
    cd PySAGES        # move to your local version of github.com/SSAGESLabs/PySAGES
    pip install -e .  # run inside pysages directory to get latest dev in editable mode
    pip install --upgrade jaxlib
    
  3. Then you are ready to submit PySAGES jobs.
    NOTE. In case you encounter a No GPU/TPU found, falling back to CPU error, upgrading both jax and jaxlib by using the following command (see here for details) should solve that:

    pip install --upgrade pip
    ### OLDER (seems not to work anymore)
    ### # Installs the wheel compatible with Cuda 11.4+ and cudnn 8.2+ (deprecated).
    ### pip install "jax[cuda11_cudnn82]" -f https://storage.googleapis.com/jax-releases/jax_cuda_releases.html
    # CUDA 11 installation (this works as of 2023-08-01)
    # Note: wheels only available on linux.
    pip install --upgrade "jax[cuda11_pip]" -f https://storage.googleapis.com/jax-releases/jax_cuda_releases.html