MCHEP is a highly parallelizable Monte Carlo integration routine. Specifically, it supports multi-threads/cores parallelization, Single Instruction Multiple Data (SIMD) instructions, and GPU acceleration. Currently, it implements two adaptive multidimensional integrations, namely VEGAS and VEGAS+ (with adaptive stratified sampling) as presented in the paper arXiv:2009.05112.
To install the C/C++ APIs, you first need to install cargo and cargo-c.
Then, in order to also properly install the C++ header, you need to define the environment variable:
export CARGO_C_MCHEP_INSTALL_PREFIX=${prefix}
where ${prefix} is the path to where the library will be installed. Then run the
following command:
cargo cinstall --release --prefix=${prefix} --manifest-path mchep_capi/Cargo.tomlFinally, you need to set the environment variables:
export LD_LIBRARY_PATH=${prefix}/lib:$LD_LIBRARY_PATH
export PKG_CONFIG_PATH=${prefix}/lib/pkgconfig:$PKG_CONFIG_PATH
and check that mchep is properly found in the PKG_CONFIG_PATH:
pkg-config mchep_capi --libsThe following benchmark compares MCHEP against the CUBA library across different integrand complexities, simulating typical High Energy Physics (HEP) workloads:
Left plot: Integration throughput (evaluations per millisecond) vs. computational cost per evaluation. MCHEP with SIMD+AVX consistently outperforms both MCHEP scalar and CUBA across all complexity levels.
Right plot: Speedup factor of MCHEP implementations compared to CUBA Vegas. MCHEP SIMD+AVX achieves 4-6x speedup over CUBA for typical HEP workloads.
| QCD Complexity | Typical Cost (FLOPS) | MCHEP Scalar (evals/ms) | MCHEP SIMD+AVX (evals/ms) | CUBA (evals/ms) | Speedup vs CUBA |
|---|---|---|---|---|---|
| LO | ~10k | 2,500 | 7,500 | 1,800 | 4.2x |
| NLO | ~1M | 48 | 153 | 34 | 4.5x |
| NNLO | ~10M | 5 | 18 | 5 | 3.9x |
Combined with multi-core parallelization (16 cores), MCHEP can reduce month-long calculations to days. See benchmark details for comprehensive comparisons.
| Feature | Rust API | C/C++ API | Python API | |||
|---|---|---|---|---|---|---|
| Vegas | VegasPlus | Vegas | VegasPlus | Vegas | VegasPlus | |
| Multi-threaded (Rayon) | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
| SIMD | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
| GPU | ✓ | ✓ | ||||
| MPI | ✓ | ✓ | ✓ | |||
| MPI+SIMD | ✓ | ✓ | ||||
- SIMD Integration Tutorial - How to use SIMD acceleration with the C/C++ API
- Benchmark Results - Extensive performance comparison with CUBA library
