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.6.tar.gz (11.4 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.6-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (6.8 MB view details)

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

neml2-2.1.6-cp314-cp314-macosx_11_0_arm64.whl (5.3 MB view details)

Uploaded CPython 3.14macOS 11.0+ ARM64

neml2-2.1.6-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (6.7 MB view details)

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

neml2-2.1.6-cp313-cp313-macosx_11_0_arm64.whl (5.3 MB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

neml2-2.1.6-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (6.7 MB view details)

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

neml2-2.1.6-cp312-cp312-macosx_11_0_arm64.whl (5.3 MB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

neml2-2.1.6-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (6.7 MB view details)

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

neml2-2.1.6-cp311-cp311-macosx_11_0_arm64.whl (5.3 MB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

neml2-2.1.6-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (6.7 MB view details)

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

neml2-2.1.6-cp310-cp310-macosx_11_0_arm64.whl (5.2 MB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

File details

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

File metadata

  • Download URL: neml2-2.1.6.tar.gz
  • Upload date:
  • Size: 11.4 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.6.tar.gz
Algorithm Hash digest
SHA256 04ed3e6d6de28cac73856156eded7d3ad54f8f4e401644010cd7a2c1d4281c2b
MD5 6b1e867f0f3d8c4c0859b2064657e22d
BLAKE2b-256 c5008f9c1613b7e9b464ae6c18931446daa84d3bf42ea9f485c74ead0778d73f

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for neml2-2.1.6-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 304ded54655411db00b90632dbbdf4f2ba4adf0441e6758d3c9a2e2e3163f3f1
MD5 be04773f8b5c34c5d72c0fc8f6bbb0b4
BLAKE2b-256 40116c79ade1547548a8f8da13fb88c0acf78cd9b8f502bc2c20b72e263b4b3b

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for neml2-2.1.6-cp314-cp314-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 2d195573dbd2c34bae90c3a4073bcfbe8bff5d4f33d27237527f14a35c3f22bd
MD5 9f87793c5918ebc4fa7f80b6513354fc
BLAKE2b-256 1a524642a2b6b751ad540cd297341744e1c1c473c41e789ab2d62a2d00ed6e53

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for neml2-2.1.6-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 c1264f85b1b7083c11f38c034b8d63b22df1b7adea3d41086be9d17e89fdf612
MD5 19120e1ac04657cdb90520e0fbc7ea92
BLAKE2b-256 6a39d69ff78a50b8e5286677a2965df5e95a3f7512a15f24cc469af51068bb5c

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for neml2-2.1.6-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 7620199fb203ddc86836bacb158d0e280f74006e48da864b1f1f78bf7b995c43
MD5 5264fe5cfc5c7c416703628aa7ef4d54
BLAKE2b-256 d7bbb65e9eae2e727d1926c2f2a1b59bf8d198ba5721dd35a3cd7c0adaaa9345

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for neml2-2.1.6-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 4ecefb71c55854b62805c95cf3cbe0492bf699708bcec431355b01ee605bdb23
MD5 b301bb323a5762bd3974ea65c483162d
BLAKE2b-256 50adf4c2d02c512197ed0a77f638847cef106e6975333873100e83db772abe25

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for neml2-2.1.6-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 da17924c756969f78265d7649a278b8c5cbd3fe94d77151a8ead511fd4e40f3e
MD5 4e379bcae647fd575784128b46a5304b
BLAKE2b-256 d41873112597c8021624e8feff7612ab83a333206f11f5b21ec09903206fbe03

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for neml2-2.1.6-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 7b4ded365f2d1934ff88e0d6f063a41ffee18653f188e09fc5d17894bb40fc79
MD5 1425067c240cd2fe988e0918d9e84860
BLAKE2b-256 44b359d79ab0d619f3da3ea7966fe37284cd42a5fedd4e4e1d6682fbbf31d834

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for neml2-2.1.6-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 5ba74e703151474021ff0e398527e3dad8f7c93d759bef8e205ceddefdc52ba4
MD5 705a66f4c0cad2c9c1005d53fd9eb1c6
BLAKE2b-256 a693d76da602a3bb6666911673a4eacf4aa807e8b72700cec12798b00191b684

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for neml2-2.1.6-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 68f209d4e28aed2e44718d0699e19a4a11551074722bffb5aa9e84570dddd5cf
MD5 e9432faab330497967dc062802a8fe6a
BLAKE2b-256 832fc6aaed34e5df1953da193d7d176d1523d5a244f083c24085a00dd9916457

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for neml2-2.1.6-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 e057a0a7faa7ef1e87436ab094039d4fdc9a972bf88f89901743dcb7bd7094d3
MD5 f14586c7e041e619b3758f9694985e26
BLAKE2b-256 3968b54e26c10867aaf99631b88e81f66133d3b5ab9dfc6f5796814fcb5c6168

See more details on using hashes here.

Provenance

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