Skip to main content

GPU-enabled vectorized material modeling library

Project description

Logo Logo

Documentation C++ backend testing Python package testing PyPI

Overview

The New Engineering Material model Library, version 2

NEML2 is an offshoot of NEML, an earlier material modeling code developed at Argonne National Laboratory. Like its predecessor, NEML2 provides a flexible, modular way to build material models from smaller blocks. Unlike its predecessor, NEML2 vectorizes the material update to efficiently run on GPUs. In addition, NEML2 models can use PyTorch as the backend to provide first-class support for automatic differentiation, operator fusion, lazy tensor evaluation, inference mode, etc.

NEML2 is provided as open source software under a MIT license.

Disclaimer

NEML2 is not a database of material models. There are many example material models in the library for testing and verification purposes. These models do not represent the response of any actual material.

Quick installation

Python package (recommended): Pre-built wheels are available on PyPI:

pip install neml2

C++ library: Clone the repository, configure with CMake, and build:

git clone -b main https://github.com/applied-material-modeling/neml2.git
cmake --preset release -S neml2
cmake --build --preset release

Refer to the installation guide for more detailed instructions and finer control over various dependencies as well as other build customization.

Once NEML2 is installed, refer to the getting started guide for commonly used APIs.

Features and design philosophy

Vectorization

NEML2 models can be vectorized, meaning that a large batch of material models can be evaluated simultaneously. The vectorized models can be evaluated on either CPUs or GPUs/other accelerators. Moreover, NEML2 provides a unified implementation and user interface, for both developers and end users, that work on all supported devices.

The table below compares three approaches for solving the same problem: a crystal plasticity simulation using the Taylor method, with 50,000 grains and 250 load steps. The first approach is using NEML (the predecessor of NEML2) which is a CPU-only, fully threaded library. The second and the third approaches use NEML2, evaluating the same model on CPU and GPU (CUDA), respectively.

Device Wall time (s) Specs
NEML CPU 42,500 Intel Xeon Gold 6346 CPU with 32 threads
NEML2 CPU 15,000 Intel Xeon Gold 6346 CPU with 32 threads
NEML2 GPU 68 1 NVIDIA RTX A5000 GPUs
34 2 NVIDIA RTX A5000 GPUs

NEML2 is more than 2x faster than NEML on CPU, owing to more comprehensive threading and vectorization as well as Just-In-Time compilation. In this case, GPUs further speed up the calculation by more than 400 times.

Multiphysics coupling

NEML2 is not tied to any underlying problem physics, e.g., solid mechanics, heat transfer, fluid dynamics, electromagnetics, etc. Current modules cover thermal and mechanical material models, but the framework can be used to implement a wider range of constitutive models. For coupled problems, NEML2 will return the exact, coupled Jacobian entries required to achieve optimal convergence. NEML2 can be used together with MOOSE, a Multiphysics finite element framework, to solve partial differential equations.

Modularity and flexibility

NEML2 material models are modular – they are built up from smaller pieces into a complete model. NEML2 offers an extremely flexible way of composing models. Each individual model only defines the forward operator (and optionally its derivative) with a given set of inputs and outputs. When a set of models are composed together to form a composite model, dependencies among different models are automatically detected, registered, and resolved. The user has complete control over how NEML2 evaluates a set of models.

Extensibility

The library is structured so that adding a new feature to an existing material model should be as simple as possible and require as little code as possible. In line with this philosophy, the library only requires new components to provide a few partial derivatives, and NEML2 uses this information to automatically assemble the overall Jacobian using chain rule and provide the algorithmic tangent needed to integrate the model into an implicit finite element framework. Moreover, in NEML2, implementations can forgo providing these partial derivatives, and NEML2 will calculate them with automatic differentiation.

Friendly user interfaces

There are three general ways of interfacing with NEML2 material models: the compiled C++ library, the Python package, and the runner. In all interfaces, creation and archival of NEML2 models rely on input files written in the hierarchical HIT format. NEML2 models created using the Python bindings are fully interoperable with PyTorch tensors and modules, meaning that NEML2 material models can seamlessly work with popular machine learning frameworks developed using PyTorch.

Strict quality assurance

NEML2 is developed under a strict quality assurance program. Because the NEML2 distributions do not provide full, parameterized models for any actual materials, ensuring the quality of the library is a verification problem – testing to make sure that NEML2 is correctly implementing the mathematical models – rather than a validation problem of comparing the results of a model to an experiment. In NEML2, this verification is done with extensive unit testing. Additional regression tests are set up for each combination of material model to ensure result consistency across releases.

Citing NEML2

@article{neml2_softwarex_2025,
  title = {NEML2: An efficient and modular multiphysics constitutive modeling library for hybrid computing environments},
  journal = {SoftwareX},
  volume = {31},
  pages = {102302},
  year = {2025},
  issn = {2352-7110},
  doi = {https://doi.org/10.1016/j.softx.2025.102302},
  url = {https://www.sciencedirect.com/science/article/pii/S2352711025002687},
  author = {Tianchen Hu and Mark C. Messner},
  keywords = {Constitutive model, GPU, Multiphysics}
}
@techreport{neml2osti2440430,
  author      = {Tianchen Hu and Mark C.  Messner and Daniel Schwen and Lynn B.  Munday and Dewen Yushu},
  title       = {NEML2: A High Performance Library for Constitutive Modeling},
  institution = {Argonne National Laboratory (ANL), Argonne, IL (United States); Idaho National Laboratory (INL), Idaho Falls, ID (United States)},
  doi         = {10.2172/2440430},
  url         = {https://www.osti.gov/biblio/2440430},
  place       = {United States},
  year        = {2024},
  month       = {09}
}
@misc{neml2osti1961125,
  author = {MESSNER, MARK and HU, TIANCHEN and US DOE NE-NEAMS},
  title  = {NEML2 - THE NEW ENGINEERING MATERIAL MODEL LIBRARY, VERSION 2},
  doi    = {10.11578/dc.20230314.1},
  url    = {https://www.osti.gov/biblio/1961125},
  place  = {United States},
  year   = {2023},
  month  = {01}
}

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

neml2-2.1.4.tar.gz (9.2 MB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

neml2-2.1.4-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (6.3 MB view details)

Uploaded CPython 3.14manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

neml2-2.1.4-cp314-cp314-macosx_11_0_arm64.whl (5.0 MB view details)

Uploaded CPython 3.14macOS 11.0+ ARM64

neml2-2.1.4-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (6.3 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

neml2-2.1.4-cp313-cp313-macosx_11_0_arm64.whl (5.0 MB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

neml2-2.1.4-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (6.3 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

neml2-2.1.4-cp312-cp312-macosx_11_0_arm64.whl (5.0 MB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

neml2-2.1.4-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (6.3 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

neml2-2.1.4-cp311-cp311-macosx_11_0_arm64.whl (5.0 MB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

neml2-2.1.4-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (6.3 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

neml2-2.1.4-cp310-cp310-macosx_11_0_arm64.whl (5.0 MB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

File details

Details for the file neml2-2.1.4.tar.gz.

File metadata

  • Download URL: neml2-2.1.4.tar.gz
  • Upload date:
  • Size: 9.2 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for neml2-2.1.4.tar.gz
Algorithm Hash digest
SHA256 2a2caf447e7f8af1b2c863dcec7826322b71f8332a9d9118a2fe8cf2f2874104
MD5 4dad65e47ebbd0b6e5a60e82f04ddcc6
BLAKE2b-256 adf3c514eaac9a4a0928db1f0112e544565c79dbbabe69c22949d6747647dfcd

See more details on using hashes here.

Provenance

The following attestation bundles were made for neml2-2.1.4.tar.gz:

Publisher: python.yml on applied-material-modeling/neml2

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file neml2-2.1.4-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for neml2-2.1.4-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 66fd46639d026110e9b938123d6666e316e4923a60fee36bef3dde7ebf98b9d2
MD5 7f4879347bc3972c4b5bb255dd61c4fd
BLAKE2b-256 5e57bb9530ea2d65947d93631285e0ad2e8cdefe94983ec8792987636d254fce

See more details on using hashes here.

Provenance

The following attestation bundles were made for neml2-2.1.4-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl:

Publisher: python.yml on applied-material-modeling/neml2

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file neml2-2.1.4-cp314-cp314-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for neml2-2.1.4-cp314-cp314-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 3d9132f6e2c9c12fd3ef3e0353946a42bc869c9947209f9abe836d7979694d0c
MD5 b3dc89f33ee3190285bec9283a6d026e
BLAKE2b-256 c0ea092bba6bff578c964c568db19ef1b784775e2513eab8dcbcb90c3dec83b0

See more details on using hashes here.

Provenance

The following attestation bundles were made for neml2-2.1.4-cp314-cp314-macosx_11_0_arm64.whl:

Publisher: python.yml on applied-material-modeling/neml2

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file neml2-2.1.4-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for neml2-2.1.4-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 29bff650cdba85c04133b15940fe2c1bbf078cdb3abf8fc1b8897aba0affbdf9
MD5 55f108b6de61cd02a6959b196cf27e8b
BLAKE2b-256 b2cb936b475e84dd459722f627a1d61e20c7dd75b6e3399adec191e59327d86c

See more details on using hashes here.

Provenance

The following attestation bundles were made for neml2-2.1.4-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl:

Publisher: python.yml on applied-material-modeling/neml2

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file neml2-2.1.4-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for neml2-2.1.4-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 a2d79e1aef4c0d8558bb01c0592b6a7cc09c38e9065d281ff23cca910ff73d54
MD5 e9d0b20bead6b1dd7d26462c3f1be85f
BLAKE2b-256 bf4f9fcf612aec66727cf43874dcb77072059267ac06c2866ac3818d6e5a38e9

See more details on using hashes here.

Provenance

The following attestation bundles were made for neml2-2.1.4-cp313-cp313-macosx_11_0_arm64.whl:

Publisher: python.yml on applied-material-modeling/neml2

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file neml2-2.1.4-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for neml2-2.1.4-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 fa5024899f273d7cb1d9286a47a9b25a56a5a352247952ec741525cdae882ffc
MD5 af34e2736aef516b15bc50f87a07250a
BLAKE2b-256 9d0e2f4f686859a334f8cd8df5203f04be685f2edb1d80d17d44ea6aaf5f6897

See more details on using hashes here.

Provenance

The following attestation bundles were made for neml2-2.1.4-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl:

Publisher: python.yml on applied-material-modeling/neml2

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file neml2-2.1.4-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for neml2-2.1.4-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 4fac05ffb549023e7cacd60a0106ee05f279ed09c79ed9303c4396939d2c91bf
MD5 1b329df59d8454a455a377ea15a14736
BLAKE2b-256 80344c5bc33ac54005091912685e203bdd66b99c74fcfe961b5e83fd5b61af41

See more details on using hashes here.

Provenance

The following attestation bundles were made for neml2-2.1.4-cp312-cp312-macosx_11_0_arm64.whl:

Publisher: python.yml on applied-material-modeling/neml2

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file neml2-2.1.4-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for neml2-2.1.4-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 a2ca4194464d4504c58da4fd191f6992ce29c6c32d9906a3801830a419b8ccda
MD5 34b19392f303a2759b58903e13d22f69
BLAKE2b-256 8936c6b621e5f8b7b98cb6a204ab08b737e40e6718c445a311fcdb3b31326513

See more details on using hashes here.

Provenance

The following attestation bundles were made for neml2-2.1.4-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl:

Publisher: python.yml on applied-material-modeling/neml2

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file neml2-2.1.4-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for neml2-2.1.4-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 a0b05005d68ac18a2568ffa133e541b998c6e90f3a1a3e06282b57c32ddfda83
MD5 27684eefef5b0b36a5c0fe97e60ac146
BLAKE2b-256 96f31a126689ff306441329cfca8a21c9b5180e511e35f344759411fb383b861

See more details on using hashes here.

Provenance

The following attestation bundles were made for neml2-2.1.4-cp311-cp311-macosx_11_0_arm64.whl:

Publisher: python.yml on applied-material-modeling/neml2

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file neml2-2.1.4-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for neml2-2.1.4-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 65aa5563d173a9078ff13a701d80eb585359a45e0b6d73b032863587579353ad
MD5 a422ca12d54153894d3427b8304ac313
BLAKE2b-256 e787861dc52eabfa2397374d8098878b4ac001d1899eaa1d47db8b752debcc9f

See more details on using hashes here.

Provenance

The following attestation bundles were made for neml2-2.1.4-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl:

Publisher: python.yml on applied-material-modeling/neml2

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file neml2-2.1.4-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for neml2-2.1.4-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 a85bbf464abf9bf8faeaed73d17c9fe276289391fad726513f9593520f22c1ca
MD5 9efbe12ed027549499a4cb6dc7243162
BLAKE2b-256 def07252c5c8457cf578fb1d9eab6cef8445e9e2b8944e82af9f69dd598205be

See more details on using hashes here.

Provenance

The following attestation bundles were made for neml2-2.1.4-cp310-cp310-macosx_11_0_arm64.whl:

Publisher: python.yml on applied-material-modeling/neml2

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page