|
NEML2 2.1.0
|
Compiling the NEML2 core library requires
NEML2 is built upon and relies on a collection of third party libraries/packages. The build system will automatically search for necessary packages and download missing dependencies when appropriate.
Refer to dependency management for a list of dependent libraries/packages and more information on the search procedure.
First, obtain the NEML2 source code.
Then, configure and build NEML2.
The --preset option specifies a predefined configuration to be read by CMake. Build customization, available presets, and their usage scenario are discussed in build customization.
Optionally, NEML2 can be installed as a system library.
The --prefix option specifies the path where NEML2 will be installed. Write permission is needed for the installation path. The --component libneml2 option tells CMake to only install the libraries and runtime artifacts. NEML2 has two installable components:
NEML2 also offers a Python package which provides bindings for the primitive tensors and parsers for deserializing and running material models. Package source distributions are available on PyPI. Python wheel deployment is planned and currently under development.
To install the NEML2 Python package, first make sure Python development headers and libraries are installed. Then, install PyTorch and run the following command at the repository's root.
The installation will take a while, as it needs to build both the library and its bindings. Pass -v to see additional details. After installation from source, optionally generate Python stub files with
These stubs improve IDE autocomplete, type hints, and documentation generation for compiled bindings.
Once installed, the package can be imported in Python scripts using