Skip to main content

peclet.dem — performance-portable XPBD Discrete Element Method (Kokkos + ArborX)

Project description

peclet-dem (peclet.dem)

PyPI version Python License: MIT CI DOI

Performance-portable Discrete Element Method (DEM) particle simulation: an XPBD solver with SDF-based point-shell collision detection. Built on Kokkos + ArborX, so the same source runs on CUDA, HIP (AMD/LUMI), and OpenMP backends (selected at build time by the install prefix). Optional MPI for domain partitioning, with nanobind Python bindings (zero-copy, via scikit-build-core) for scripting and visualization.

The CUDA implementation was retired (2026-06): the Kokkos peclet.dem module was validated against it before the CUDA sources were removed. Restore point: git tag pre-cuda-retirement.

Features

  • Hybrid XPBD Solver: Two-pass velocity/position solver for stable high-density packing.
  • SDF Collision: Point-shell collision detection using Signed Distance Fields (supports analytic shapes like hollow cylinders).
  • Periodicity: Full periodic boundary conditions (Ghost Particles).
  • Python Bindings: Control simulation logic, data initialization, and export entirely from Python.
  • MPI Support: Optional Multi-GPU/Node support via domain decomposition.

Folder Structure

├── CMakeLists.txt              # Build configuration (find_package Kokkos + ArborX)
├── src                         # Kokkos sources (header-only, namespace peclet::dem)
│   ├── dem_bindings.cpp        # nanobind module entry point (the `peclet.dem` module)
│   ├── sim.hpp                 # Simulation facade + the demStep XPBD substep
│   ├── integration.hpp         # Time integration & prediction
│   ├── broadphase_arborx.hpp   # ArborX BVH broad-phase
│   ├── narrowphase.hpp         # Narrow-phase point-shell-vs-SDF collision
│   ├── solver_velocity.hpp     # Velocity solver kernels
│   ├── solver_position.hpp     # Position solver kernels (XPBD overlap removal)
│   ├── solver_friction.hpp     # Coulomb friction cluster
│   ├── output_sdf.hpp          # SDF/VTI grid generation (Eikonal)
│   ├── shapes_portable.hpp     # Analytic shapes (sphere / hollow cylinder / box)
│   ├── io.hpp                  # LAMMPS-dump + SDF-VTI export
│   └── mpi_halo.hpp            # Distributed particle halo (core), gated PECLET_DEM_MPI
├── tests                       # C++ unit tests: kokkos/ (kernels), arborx/, kokkos_mpi/
├── docs                        # Documentation
└── *.py                        # Python verification/example scripts (verify_*.py)

Prerequisites

  • Linux
  • CMake >= 3.24
  • Kokkos 5.x + ArborX (C++20) — provisioned by ../tools/bootstrap_deps.sh into ../extern/install/<backend> (nvidia-cuda / host-openmp / lumi-hip). A hard build dependency.
  • nanobind + scikit-build-core (found via the active Python interpreter; see pyproject.toml)
  • a backend compiler: nvcc (CUDA) on PATH, hipcc (ROCm), or just a host C++ compiler (OpenMP)
  • Python >= 3.10
  • MPI (optional, -DDEM_MPI=ON) — OpenMPI or MPICH

Build Instructions

python -m venv .venv && source .venv/bin/activate && pip install nanobind numpy
export PATH=/usr/local/cuda-13.2/bin:$PATH        # if building the CUDA backend

# Canonical: build + install the module via scikit-build-core
CMAKE_PREFIX_PATH="$PWD/../extern/install/nvidia-cuda" pip install .

# Or a dev cmake build (nanobind is found via the active interpreter, no cmakedir needed):
cmake -B build -S . -DCMAKE_PREFIX_PATH="$PWD/../extern/install/nvidia-cuda"
cmake --build build -j$(nproc)

Swap the prefix to ../extern/install/host-openmp for the OpenMP backend. -DDEM_MPI=ON links MPI and exposes the distributed step (init_mpi / enable_mpi_step / step_mpi), including dynamic load balancing — enable_mpi_step(..., rebalance_every=N) or an explicit rebalance() re-decomposes by particle count (weighted ORB) and migrates ownership so each rank keeps a near-equal share.

The compiled peclet.dem extension is placed in build/peclet/dem/; run scripts with build/ on PYTHONPATH (import peclet.dem).

Running Simulations

Example scripts are provided in the root directory:

# Add build artifact to python path if needed (or symlink it)
export PYTHONPATH=$PYTHONPATH:$(pwd)/build

# Run a verification script
python verify_packing_hollow_cylinders.py

Output & Visualization

The simulation supports two primary output formats:

1. LAMMPS + STL (Ovito)

For particle visualization (especially non-spherical shapes), we use the LAMMPS dump format combined with an STL mesh.

  1. Generate Output: The simulation writes dump.custom.* files.
  2. Generate Shape: Run python generate_particles.py to create particle_shape.stl.
  3. Visualize:
    • Open Ovito.
    • Load the dump.custom.* sequence.
    • Add a Particle Types modifier.
    • Set the shape visualization to Mesh/User-defined and load particle_shape.stl.
    • Ovito will automatically scale the mesh by the particle radius.

See docs/visualization.md for a detailed guide.

2. VTI (ParaView)

For visualizing fields (like the Signed Distance Field or occupancy grids), the simulation exports VTI files (.vti).

  1. Generate Output: Use Simulation.export_sdf("filename.vti", resolution=...).
  2. Visualize:
    • Open ParaView.
    • Load the .vti file.
    • Use "Volume" representation or "Slice" filter to inspect the field.

Status

The single-GPU engine is complete and validated: it reaches stable high-density (random close) packing, and energy is conserved to ~0.3% (see docs/packing_investigation.md). Friction is stabilized for spheres; body-body tangential friction is a known follow-up (currently weaker than ideal). Active work is at-scale multi-GPU/MPI tuning.

[!NOTE] The distributed (MPI) step is validated against the single-rank result (tests/kokkos_mpi, np=1,2,4 on OpenMP + CUDA) and supports dynamic load rebalancing; remaining MPI work is at-scale multi-GPU tuning.

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

peclet_dem-0.3.0.tar.gz (409.6 kB view details)

Uploaded Source

Built Distributions

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

peclet_dem-0.3.0-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (695.6 kB view details)

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

peclet_dem-0.3.0-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (695.7 kB view details)

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

peclet_dem-0.3.0-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (695.4 kB view details)

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

peclet_dem-0.3.0-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (695.8 kB view details)

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

File details

Details for the file peclet_dem-0.3.0.tar.gz.

File metadata

  • Download URL: peclet_dem-0.3.0.tar.gz
  • Upload date:
  • Size: 409.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for peclet_dem-0.3.0.tar.gz
Algorithm Hash digest
SHA256 4dbd545921e604a06b3b5db2f4c3f64b4e80fdd64ea220fd94fbfd207f485c8d
MD5 d028a107ee998cc7e3f099cab100fdb6
BLAKE2b-256 d5af7f434c881a4ee164153259ea4989edcef2fb031ec6981cb42fda743e12f4

See more details on using hashes here.

Provenance

The following attestation bundles were made for peclet_dem-0.3.0.tar.gz:

Publisher: release.yml on computational-chemical-engineering/peclet-dem

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

File details

Details for the file peclet_dem-0.3.0-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for peclet_dem-0.3.0-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 464c13a89406c39d51fa37b520390542ed509e70614cbccb8d3b18b22b139315
MD5 e9570b08f2447383c75fd640a207e64d
BLAKE2b-256 7f7693f1de24187f96e445adca78c60d158733de6ee1f73586dd6e9d8e572b9c

See more details on using hashes here.

Provenance

The following attestation bundles were made for peclet_dem-0.3.0-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl:

Publisher: release.yml on computational-chemical-engineering/peclet-dem

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

File details

Details for the file peclet_dem-0.3.0-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for peclet_dem-0.3.0-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 7da667d3edfbc0dddf54ecbedaa2a00dce6dd3b35adbbb7e685a7fbff7a5560c
MD5 918fe8a36c6c0dad815bfd8089f07fdb
BLAKE2b-256 929c06a05c086c0be0d0f3ba55a426f120e10d758689f16b584d0d87c096576a

See more details on using hashes here.

Provenance

The following attestation bundles were made for peclet_dem-0.3.0-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl:

Publisher: release.yml on computational-chemical-engineering/peclet-dem

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

File details

Details for the file peclet_dem-0.3.0-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for peclet_dem-0.3.0-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 3cd28ed12f98cf89b50e50a578adb1c0be2064daab6e2dcfab13649e48b912a6
MD5 1dac1b3a780fe47fbbef512bc6978e5e
BLAKE2b-256 4a91472e3bfbbedae9fa27ffa3dcf281913da741a921523c76c12965183d771f

See more details on using hashes here.

Provenance

The following attestation bundles were made for peclet_dem-0.3.0-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl:

Publisher: release.yml on computational-chemical-engineering/peclet-dem

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

File details

Details for the file peclet_dem-0.3.0-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for peclet_dem-0.3.0-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 f91609d2f431863e06904346103352459a9866b7502eb03e86bc9ea9a78fa9db
MD5 c14f6f3a8d1313b0cf6e15d733132b1e
BLAKE2b-256 681298202f3418fed1c7fea287999e903c33de74810823069d8043026c7aef71

See more details on using hashes here.

Provenance

The following attestation bundles were made for peclet_dem-0.3.0-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl:

Publisher: release.yml on computational-chemical-engineering/peclet-dem

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