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-3.0.2.tar.gz (1.1 MB view details)

Uploaded Source

Built Distributions

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

neml2-3.0.2-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (1.0 MB view details)

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

neml2-3.0.2-cp314-cp314-macosx_11_0_arm64.whl (970.4 kB view details)

Uploaded CPython 3.14macOS 11.0+ ARM64

neml2-3.0.2-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (1.0 MB view details)

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

neml2-3.0.2-cp313-cp313-macosx_11_0_arm64.whl (969.9 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

neml2-3.0.2-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (1.0 MB view details)

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

neml2-3.0.2-cp312-cp312-macosx_11_0_arm64.whl (969.9 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

neml2-3.0.2-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (1.0 MB view details)

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

neml2-3.0.2-cp311-cp311-macosx_11_0_arm64.whl (969.5 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

neml2-3.0.2-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (1.0 MB view details)

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

neml2-3.0.2-cp310-cp310-macosx_11_0_arm64.whl (968.0 kB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

File details

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

File metadata

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

File hashes

Hashes for neml2-3.0.2.tar.gz
Algorithm Hash digest
SHA256 0f06806d40333eb983c81e95eb6ceef548077e1cc977b48ca36f8394bc684f31
MD5 4c4aea4b60a5dac2c4455f6fcb141085
BLAKE2b-256 c3d6299df70cbdd0c7f769129d90b5bbb01999c955e96d3f0694670f478512e3

See more details on using hashes here.

Provenance

The following attestation bundles were made for neml2-3.0.2.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-3.0.2-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for neml2-3.0.2-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 1edb2ff5ba3f1edf8b47d4caa62bb98b2a32830a1fbeb27dd1b357bcba3a94d2
MD5 88c145d1708b95d01de28508f1140af1
BLAKE2b-256 35f1105cd6eb9c9f14606f7a9efc53bb8ef5a4435389485d0bdf335b6092f86d

See more details on using hashes here.

Provenance

The following attestation bundles were made for neml2-3.0.2-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-3.0.2-cp314-cp314-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for neml2-3.0.2-cp314-cp314-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 b46fd6c0da5e8fcd3dd65864fa4532e01bdfd5e8a038504e07fabf615b3a11e7
MD5 a63be84e471545da9301650fe9e17c7c
BLAKE2b-256 f5e84b1cdcbf112bbc112e32c8d3a9d05d3d104e287d7c3437f5a5cae98de68f

See more details on using hashes here.

Provenance

The following attestation bundles were made for neml2-3.0.2-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-3.0.2-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for neml2-3.0.2-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 64feb556556169dd7a77a3ba55d0a4d47e5dc77be7bcb82a30ced3e77fae864e
MD5 a8652e1adb19884bf48d9db06e96ebfb
BLAKE2b-256 163939d21ffbb89b0b1003da2c58d12d661d3221c85cd90d86dfe5d7950cf4f0

See more details on using hashes here.

Provenance

The following attestation bundles were made for neml2-3.0.2-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-3.0.2-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for neml2-3.0.2-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 4bfe4ff3caf4f83a046014bb6cb26afd9c935e68585b3656aa2c3c2b7b80f3b9
MD5 822dc9421bb7cbfb07472230fd2bb75e
BLAKE2b-256 78f91522d1d2d3bb6a0a493af1c5d87294873c89daccca25fd7c127f86fa5a4f

See more details on using hashes here.

Provenance

The following attestation bundles were made for neml2-3.0.2-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-3.0.2-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for neml2-3.0.2-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 95ef2db4e014ddea1ed13aa2ecbee1386136c37918380aaa74dc5c6e11ca90ae
MD5 40be784e6a58e68b6622a2c414fdf726
BLAKE2b-256 4bb232bff1d9d0e666272a9ebe5860f36c33bf1f94083a5e98fc697b792ab1e5

See more details on using hashes here.

Provenance

The following attestation bundles were made for neml2-3.0.2-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-3.0.2-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for neml2-3.0.2-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 e0666e2b573d82cbd671a4f0a09ccf5a9f776baab331e810cbeb71ed95178c27
MD5 d7369ba44cf2458f7b14200ea2621845
BLAKE2b-256 83fb25715c9bf4abc134a1af5ee18e6a62682641441ead4a692a1c6a867ee4ec

See more details on using hashes here.

Provenance

The following attestation bundles were made for neml2-3.0.2-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-3.0.2-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for neml2-3.0.2-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 7c5d5bcaddd32ffe5a165d0dc0fdc4a450c2324a00231475299c5062e349c129
MD5 80c1ee02a588f7be9394f8eee839a4ca
BLAKE2b-256 908dc3493ef03a207aa96603920548b90fd1f9364e52865d0174ad39d20d6fce

See more details on using hashes here.

Provenance

The following attestation bundles were made for neml2-3.0.2-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-3.0.2-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for neml2-3.0.2-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 d0c983f5e9a8295f350f66fd4594b68bf634181882b227ffac01628daad4cd7f
MD5 e1be6abf07a272b61f16d3cfbeb66275
BLAKE2b-256 e99b7da1622dfea2938a334898e8613c72c0221169bf88a3bbf34224b6d4b6e6

See more details on using hashes here.

Provenance

The following attestation bundles were made for neml2-3.0.2-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-3.0.2-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for neml2-3.0.2-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 55b9c8e474867caaa273a6ec8149a3134263cd799d7bed3ffc7483244b4cffa9
MD5 3cfb5cd3dcb5e7a34e439ace7cfae89f
BLAKE2b-256 18e6869c055da49fa2bc5cda9a5b7d0363eb0b6122dcd8acc8d49c08c6909b37

See more details on using hashes here.

Provenance

The following attestation bundles were made for neml2-3.0.2-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-3.0.2-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for neml2-3.0.2-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 293c95183d6ac2094d7cc9db6c561728d1f190a6a8191e9222967f1d7f2163a8
MD5 5703a57b7374c1bb1e04f387629ae0a7
BLAKE2b-256 b2f999e1df45220fc5b6bc6b0a2768b30e97c784f095fae473006c42ddb2b7b6

See more details on using hashes here.

Provenance

The following attestation bundles were made for neml2-3.0.2-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