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.1.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.1-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (995.6 kB view details)

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

neml2-3.0.1-cp314-cp314-macosx_11_0_arm64.whl (961.5 kB view details)

Uploaded CPython 3.14macOS 11.0+ ARM64

neml2-3.0.1-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (995.4 kB view details)

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

neml2-3.0.1-cp313-cp313-macosx_11_0_arm64.whl (961.1 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

neml2-3.0.1-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (995.5 kB view details)

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

neml2-3.0.1-cp312-cp312-macosx_11_0_arm64.whl (961.0 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

neml2-3.0.1-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (994.6 kB view details)

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

neml2-3.0.1-cp311-cp311-macosx_11_0_arm64.whl (960.6 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

neml2-3.0.1-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (992.9 kB view details)

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

neml2-3.0.1-cp310-cp310-macosx_11_0_arm64.whl (959.2 kB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

File details

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

File metadata

  • Download URL: neml2-3.0.1.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.1.tar.gz
Algorithm Hash digest
SHA256 ff29225cf0d6d2a4aaf2a24384d5b628f5cca6133072ad9de3c5519b6a5bfe61
MD5 ac4bff97eda1f3cc21c81f49f3f4b697
BLAKE2b-256 1373f94a17f9efb1f796c114334f3e96164f06f850b328a8e6c420b939e1e887

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for neml2-3.0.1-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 5f7464bd11e4d37c6cf13e885c6e606ee155e904c8cb21e5532cc0b4c2f130eb
MD5 05bbc1aa2ae249f4d7f481087a7bf672
BLAKE2b-256 3ca700493fe549dd701b89f9e8f44f80f2ebcf0b0f6c45d195c6a4e932618c85

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for neml2-3.0.1-cp314-cp314-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 28b3c14c0c25a8d5c5a9a6d8942c7e19e0fafe51cc19a5012064df27275fce60
MD5 fc0e0f048245ee8e4ee1000333795656
BLAKE2b-256 00a6d45c43f4b36ac51cf0d9f02a2c0198754fc64b68e5674ad804250d1f90e2

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for neml2-3.0.1-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 87ad334f77688c9cc1247baf4c43a8e1997fbf20c55d76fbe77a038583029ae6
MD5 006a518cdfce13a75ea8c2b299c61972
BLAKE2b-256 b0f2f5025d731a1703118214e2ec16156e53752f43bf13f13d389e53490e2094

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for neml2-3.0.1-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 b01866beaef4e504c94f1bc61795d602eaf7844e55e660af3facf007028eaf1c
MD5 c82b8700ea2ad0b52ecac0022d156025
BLAKE2b-256 1fde684bfdc1db9b318c2faf39b95a036e506cd76d7ee089a5e8c5240cc40e3c

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for neml2-3.0.1-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 fe01ccbd7ce300df478f87c7f0f155d1ed64203de9f10f6f106f4e57dfcddf44
MD5 aba71495f97d296201dd01523a22d23e
BLAKE2b-256 9a79973ceb0a0e3f693968171e91a38ec2bfeefe91a4c21f6b92a86bef69a703

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for neml2-3.0.1-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 0b795784e040b8d6d0029cf69468f646f091bea202f19b24bcd7e2fe3467ec62
MD5 689aa8c16ff84ae767cb8097f1655f73
BLAKE2b-256 1bb4efa037a47ffda4114e81b4f9525d858120ef07d771953916e0cfdffc8d2d

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for neml2-3.0.1-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 8f3ae026ceb42d092ff8912dcb60814c1d16fcb9d0a8133524a6c0d83463d5c8
MD5 4af45b1e9ac946fe87440fac6611cbc4
BLAKE2b-256 7850c07631c42bd9fabef7ed44c9360704a447b5a3f5995f1c131f6ba8f1fbe3

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for neml2-3.0.1-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 cff542a1b5099b0a64d5363c9747301f6bfdb79fd58a6a49fd84a2b0159c529d
MD5 683177aeb53665850020e5414c025d1e
BLAKE2b-256 67e1f180de13e40a9b27720e6ad62160f7ce6459252b5ee77450ca88b5eaea87

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for neml2-3.0.1-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 411b500e6858bee78a5c6c4eff355f328c86909fb0dc075d345dac00c4b57c6b
MD5 4ea0d565e086575126de1e62fefe814d
BLAKE2b-256 38518173b84deccf9c633e4bcd4b32df677ed43dcc61e83c7f094f83a07928f3

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for neml2-3.0.1-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 8874439dbc216fbc50b94dbd16edf7eb6fae8908216c2e1c5f55502469b57523
MD5 5a5efe1cfd380ce980068e0266c59d30
BLAKE2b-256 f957aa05843ec73ddb27efaf59cbf880011bcb7b2cf15e82d29d53612fd5ac19

See more details on using hashes here.

Provenance

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