IGAnets is a novel approach to combine the concept of deep operator learning with the mathematical framework of isogeometric analysis.
IGAnets requires a C++20 compiler, CMake, and LibTorch (the C++ API of PyTorch).
Supported CMake flags:
-
-DIGANET_BUILD_CPUONLY=ONbuilds IGAnets in CPU mode even if CUDA, ROCm, etc. is found (defaultOFF). -
-DIGANET_BUILD_DOCS=ONbuilds the documentation (defaultOFF). To build the documentation you need Doxygen and Sphinx installed on your system. -
-DIGANET_BUILD_PCH=ONbuilds IGAnets with precompiled headers (defaultON). -
-DIGANET_OPTIONAL="module1[branch];module2[branch];..."builds optional modules (defaultNONE)Optional modules are downloaded into the directory
optional. If the current IGAnets checkout is a git repository (i.e. if CMake finds the directory.git) optional modules are also checked out as git repositories. Otherwise, CMake downloads the ZIP archive of the optional module.The following optional modules are available:
- Examples
examples[main] - Unit tests
unittests[main] - Performance tests
perftests[main] - Python bindings
python[main] - MATLAB bindings
matlab[main]
If
[branch]is not given then[main]is assumed by default. There might exist further optional modules that are not visible publicly. - Examples
-
-DIGANET_WITH_GISMO=ONcompiles IGAnets with support for the open-source Geometry plus Simulation Modules library G+Smo enabled (defaultOFF). -
-DIGANET_WITH_MATPLOT=ONcompiles IGAnets with support for the open-source library Matplot-cpp enabled (defaultOFF). Note that this option can cause compilation errors with GCC. -
-DIGANET_WITH_MPI=ONcompiles IGAnets with MPI support enabled (defaultOFF). -
-DIGANET_WITH_OPENMP=ONcompiles IGAnets with OpenMP support enabled (defaultON). Note that this option can cause compilation errors with Clang.
-
Install prerequisites (CMake and LibTorch)
apt-get install build-essential cmake unzip wget
yum install make cmake gcc gcc-c++ unzip wget
Pre-compiled versions of LibTorch are available at PyTorch.org.
wget https://download.pytorch.org/libtorch/cpu/libtorch-shared-with-deps-2.13.0%2Bcpu.zip -O libtorch.zip unzip libtorch.zip -d $HOME/ rm -f libtorch.zip export TORCH_DIR=${HOME}/libtorch/share/cmake/Torch
Note that there might be a newer LibTorch version available than indicated in the above code snippet.
Alternatively, you can install LibTorch from PyPI using
pipand set theTORCH_DIRenvironment variable:python3 -m venv $HOME/.venv/torch-cpu source $HOME/.venv/torch-cpu/bin/activate pip install torch export TORCH_DIR="$(python3 -c \ 'from pathlib import Path; import torch; print(Path(torch.__file__).parent / "share" / "cmake" / "Torch")')"
-
Configure
cmake .. -DTorch_DIR=${TORCH_DIR} -
Compile
make -j 8
Depending on the number of cores of your CPU you may want to change 8 to a different number.
-
Install prerequisites (CMake and LibTorch)
brew install cmake pytorch
-
Configure
cmake .. -DTorch_DIR=/opt/homebrew/Cellar/pytorch/2.13.0/share/cmake/Torch
Note that the specific version of PyTorch might be different on your system.
-
Compile
make -j 8
Depending on the number of cores of your CPU you may want to change 8 to a different number.
-
Install the CUDA-enabled version of LibTorch either through PyTorch.org
wget https://download.pytorch.org/libtorch/cu126/libtorch-shared-with-deps-2.13.0%2Bcu126.zip -O libtorch.zip unzip libtorch.zip -d $HOME/ rm -f libtorch.zip export TORCH_DIR=${HOME}/libtorch/share/cmake/Torch
or from PyPI
python3 -m venv $HOME/.venv/torch-cuda source $HOME/.venv/torch-cuda/bin/activate pip install torch --index-url https://download.pytorch.org/whl/cu126 export TORCH_DIR="$(python3 -c \ 'from pathlib import Path; import torch; print(Path(torch.__file__).parent / "share" / "cmake" / "Torch")')"
Note that the version must be compatible with the CUDA version installed on your system.
-
Configure and compile
All further steps are the same as described above (Linux)
-
Install the ROCm-enabled version of LibTorch either through PyTorch.org
wget https://download.pytorch.org/libtorch/rocm7.2/libtorch-shared-with-deps-2.13.0%2Brocm7.2.zip -O libtorch.zip unzip libtorch.zip -d $HOME/ rm -f libtorch.zip export TORCH_DIR=${HOME}/libtorch/share/cmake/Torch
or from PyPI
python3 -m venv $HOME/.venv/torch-rocm source $HOME/.venv/torch-rocm/bin/activate pip install torch --index-url https://download.pytorch.org/whl/rocm7.2 export TORCH_DIR="$(python3 -c \ 'from pathlib import Path; import torch; print(Path(torch.__file__).parent / "share" / "cmake" / "Torch")')"
Note that the version must be compatible with the ROCm version installed on your system.
-
Configure and compile
All further steps are the same as described above (Linux)
-
Install the Intel GPU drivers and PyTorch version as described here. If you do not own an Intel GPU, you can create a free account at the Intel Tiber AI Cloud, which provides free access to Intel data-center GPUs for testing purposes.
-
Install the XPU-enabled version of PyTorch in a virtual python environment
python3 -m venv $HOME/.venv/torch-xpu source $HOME/.venv/torch-xpu/bin/activate pip install torch --index-url https://download.pytorch.org/whl/xpu export TORCH_DIR="$(python3 -c \ 'from pathlib import Path; import torch; print(Path(torch.__file__).parent / "share" / "cmake" / "Torch")')"
-
Configure
cmake .. -DTorch_DIR=${TORCH_DIR}Note that on the latest Intel Tiber AI Cloud installation, ZLib is not found by default. This can be corrected by calling CMake with the additional parameters
-DZLIB_LIBRARY=/usr/lib/x86_64-linux-gnu/libz.so.1 -DZLIB_INCLUDE_DIR=/usr/include
-
Install the Intel Extensions for PyTorch as described here.
-
Add the CMake option
-DIPEX_DIR=<path/to/IPEX/installation>