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.5.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.5-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (6.5 MB view details)

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

neml2-2.1.5-cp314-cp314-macosx_11_0_arm64.whl (5.1 MB view details)

Uploaded CPython 3.14macOS 11.0+ ARM64

neml2-2.1.5-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (6.5 MB view details)

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

neml2-2.1.5-cp313-cp313-macosx_11_0_arm64.whl (5.1 MB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

neml2-2.1.5-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (6.5 MB view details)

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

neml2-2.1.5-cp312-cp312-macosx_11_0_arm64.whl (5.1 MB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

neml2-2.1.5-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (6.5 MB view details)

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

neml2-2.1.5-cp311-cp311-macosx_11_0_arm64.whl (5.1 MB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

neml2-2.1.5-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (6.5 MB view details)

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

neml2-2.1.5-cp310-cp310-macosx_11_0_arm64.whl (5.1 MB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

File details

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

File metadata

  • Download URL: neml2-2.1.5.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.5.tar.gz
Algorithm Hash digest
SHA256 612c8b332783b62460a0334e737f7662f7ae3823296be4cb265437e724ac503b
MD5 c15fb1d2a7771abea96d05dab2d6ee5e
BLAKE2b-256 52b8d00c309c7201f8a480c09dbe92e38c799e72921395223dd604a9d831eedd

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for neml2-2.1.5-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 60c76c36f870d7ee8c6bbe4b9f3dbf85ffeb023bcc569340d05d06a882634cb8
MD5 3d8bbe85931432244ccb38ee0d7bb029
BLAKE2b-256 bea81df6efc535e7b010a3402cfc574de5cb3b8b68c93a090d3d49cfb34ea61c

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for neml2-2.1.5-cp314-cp314-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 6caba2e609ad4e1616fba57237085e0971230e7e6d893ad10e790d72bc0a800f
MD5 f76e24186874639f3452ac38b391e5f9
BLAKE2b-256 cb9017c85c6dd6b37cd0b4ec674bd263a0a6eb0a29b4a994389380a3923a8eac

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for neml2-2.1.5-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 55bfae64585e9f04226da6d61e19363e4a41c8d904c49088e9796e51c931c094
MD5 896e23f964eaaf67d22a012ff7a98deb
BLAKE2b-256 34cd807503357f83d8e1864de9da31c6f1e3673524b32e2a2c01f3a1d4b28a9d

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for neml2-2.1.5-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 12f9d0567feff8918b3a841c9b825a5ad7d56845989e51c44b416c2661853e50
MD5 c22375896cb324d5ee55d1b1d473aa89
BLAKE2b-256 f89b9a1f80d984d0d0b5d761309465272df28bc8d1741c570173af6ded24bba7

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for neml2-2.1.5-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 2039f7a9ba9fad75198f07f369af860360272d8a91071869b690518ea3eb2389
MD5 9c68775a48e27f0c328ca10469c783a0
BLAKE2b-256 473cc7777f66b0ec4e620c28d52dca705dc74a641affdc14cdc98ffcb9e2bdaf

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for neml2-2.1.5-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 b68209dc3f057b1a545c8c8b8abf32d62b7383a799ff5b32db62080fd442a098
MD5 cf0982b5cb79452320f0f4ab07effd89
BLAKE2b-256 5c7335d1a363cf5c9a5b782eabcbe12c5cbf388a46dd62c2acd87a5cd7389b50

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for neml2-2.1.5-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 7a0e93ecb5f2f5b46865749a494ea40c6075d1ebbe4d8cf83ddb940f8f6c5f5c
MD5 0ab765c4db8d24a752011904159e8945
BLAKE2b-256 752446c3390c45c6de7935e7a3ee7c0386aa648cb480b2ec8bebc46f004543c7

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for neml2-2.1.5-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 c0c68176160bce34f74bf6f20166e1efbed95d6f92f9138014a2d229c3e73939
MD5 4854236cd4c26b2b3c891a9ff3bbc09a
BLAKE2b-256 46a6f79c38eb5df8366f9c986197081a6075d7541f5d371212dd031c4610c846

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for neml2-2.1.5-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 bca1e67020e6aaf0b0f823e93b24e7af057d53ffb3870cfd0756fb0115a0d11f
MD5 c9aa36edddafeaf9460c6a1014edb531
BLAKE2b-256 069d6d40de85a478d9207566817c6e8e2c5137002f346ac8af778e89f905bc0d

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for neml2-2.1.5-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 6cb5cdab5033a2bdbcaeb5eff1686106f929583f8d83aa20fd0176e75b5c876f
MD5 236b2852feb0c7e5a76ba24f0cec3a9d
BLAKE2b-256 4d0e43a0fbf81e466089bda85a930797e8632fd15b61fb6a258254ace8a1b19c

See more details on using hashes here.

Provenance

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