Skip to content

Princeton Stellar

Bharat Medasani edited this page May 19, 2023 · 4 revisions

This page provides steps to install VMEC and simsopt on Princeton University's stellar machine. stellar does not expose system python and does not provide python modules. It only provides anaconda modules.

Conda virtual environment

  1. Load anaconda module. For this step, we are using anaconda3/2021.5 module

    module load anaconda3/2021.5
    
  2. Create a conda virtual environment with python version 3.9. Let us call it sims_gcc_py39 indicating that we are using python 3.9 and gcc compiler.

    conda create -n sims_gcc_py39 python=3.9
    
  3. Activate the newly created virtual environment

    conda activate sims_gcc_py39
    
  4. We need to delete a couple of libraries that come with anaconda and clash with system libraries. First find out the location of the sims_gcc_py39 virtual environment, by typing which python. The output should be of type <VE_ROOT>/bin/python, where <VE_ROOT> denotes the root directory of the virtual environment. Then issue the below commands

    rm <VE_ROOT>/lib/libcrypto.*
    

    NOTE

    Do not forget to substitute <VE_ROOT> with the root directory of the virtual environment.


VMEC

  1. Download the package
    git clone https://github.com/hiddenSymmetries/VMEC2000.git
    cd VMEC2000
    

Dependencies

GCC compilers

  1. Load all the required compilers and libraries by running
    module load openmpi/gcc/4.1.0 hdf5/gcc/1.10.6 netcdf/gcc/hdf5-1.10.6/4.7.4
    
  2. We use Intel MKL release in 2021. On stellar you can load Intel MKL module separately from Intel compilers, which will populate MKLROOT environment variable automatically.
    module load intel-mkl/2021.1.1
    
  3. Copy the relevant cmake config file from cmake/machines folder.
    cp cmake/machines/stellar_gcc.json cmake_config_file.json
    

Compile, and test

  1. First, install python dependencies

    pip install setuptools wheel scikit-build cmake  ninja numpy f90wrap
    
  2. Build the python wheel

    python setup.py bdist_wheel
    
  3. Install the built wheel

    pip install dist/*.whl
    
  4. Test the installation by loading the installed vmec package

    python -c "import vmec; print('Success')"
    

    If vmec is successfully installed, the above command should print Success.

SIMSOPT

For installing simsopt, follow all the steps related to loading modules and activating the conda virtual environment if not done already. We are going to use gcc to compile simsopt.

  1. If still in VMEC folder, move out of the VMEC folder and download the simsopt package
    git clone https://github.com/hiddenSymmetries/simsopt.git
    cd simsopt
    
  2. Instead of using pip to compile and install simsopt in one step, we use two steps for conda virtual environemnts. First install all the required build dependencies specified in pyproject.toml manually.
    pip install "setuptools>=45" wheel numpy cmake ninja "setuptools_scm[toml]>=6.0"
    
  3. Then build the simsopt wheel. If simsopt wheels are built before, delete them by deleting the build and dist folders. Before building the wheel, set the environment variable CI to True. This reduces the optimization level because PPPL cluster has heterogenous hardware and we want the compiled code to work on all nodes.
    python setup.py bdist_wheel
    
  4. The wheel built with the above command resides in dist folder. Make sure there is only one file in dist folder. However it is not a strict requirement. Install the newly built wheel by running
    pip install dist/simsopt*.whl
    
    This command assumes there is only one file with whl extension in the dist folder. If there are multiple whl files, specify the full name of the whl file.

Miscellaneous

We need mpi4py package to run VMEC from python. On stellar we need to explicitly point to MPI compiler wrappers to compile mpi4py

CC=mpicc CXX=mpicxx pip install --no-cache-dir mpi4py