Getting Started

Building the Python Module#

Ferrolith requires a C++17 compiler, CUDA (tested with 12.5), and NetCDF. All other dependencies (Eigen, H2Lib, AMGCL, pybind11) are fetched automatically by CMake.

cmake -B build -DFERROLITH_PYTHON=ON
cmake --build build -j$(nproc)

To manually set the GPU architecture:

cmake -B build -DFERROLITH_PYTHON=ON \
    -DFERROLITH_FIND_CUDA_ARCH=OFF \
    -DFERROLITH_SET_CUDA_ARCHS="61;75"

The compiled module is placed in build/python/. Add it to your Python path:

export PYTHONPATH=build/python:$PYTHONPATH

Quick Start#

The simplest way to compute a demagnetizing field is with DemagFieldFK: