← Modern Nuclear Data Processing · Learning AMPX by example

Learning AMPX · step 1

Building AMPX from the public SCALE source

How the AMPX used on this site was built from SCALE-Public on a Linux machine (WSL) with no root access: every dependency in the home directory, the CMake options that decide whether the processing modules are built at all, and how to run an input.

Most of this work, including this page, was generated with AI (Claude, Anthropic) under the direction of Ian H; it has not been independently reviewed. The scripts and notes quoted here are in the endfb81-cov56 repository.

Source scale-public, commit 7feaa5d (19 Sept 2023) Compilers GCC/gfortran 13.3, CMake 3.28 Root access none
In short
  1. Install the libraries in a conda environment, plus bison 3.4.2 from source.
  2. Build Trilinos 13.2 (not 14).
  3. Configure SCALE-Public with SCALE_USE_Qt=ON, the unreachable submodules off, and flex on.
  4. Make, install, and run inputs with scalerte -m.

What you get

The source is the public SCALE repository, code.ornl.gov/scale/code/scale-public ("open source components in SCALE 7.0 beta3"), under the AMPX open-source licence. Its installed bin/ directory here holds 103 programs, among them:

KindSome of the programs
Driverscalerte: runs an input of =module … end blocks
Point datapolident_new, broaden, tgel, funccalc, pickeze, zest, tomato, charmin
Resonance self-shieldingpurm, purm_up (continuous energy); prude, fabulous (multigroup)
Distributions, thermal scatteringy12, jamaican_new
Librariesplatinum_new, ce_simonize (continuous energy); x10, jergens (multigroup); puff_iv (covariances)
CheckingCELibraryReader (SCALE's continuous-energy data loader), cetestlib, cereader
Two of everything

jamaican and platinum are the legacy Fortran modules, which write the old binary format. The HDF5 continuous-energy format of SCALE 6.3/7 needs jamaican_new and platinum_new.

Dependencies, all in the home directory

WhatVersionHow
HDF5 (with Fortran and HL), Qt, OpenBLAS, flex1.10.5 · 5.15.8 · 0.3.34 · 2.6.4a conda-forge environment (~/ampx-env)
OpenGL headers (for Qt5Gui)1.7.0libgl-devel, libegl-devel added to the same environment with --freeze-installed
bison3.4.2the exact version SCALE asks for, not on conda-forge: GNU source, signature checked against the GNU keyring, installed into the environment (its examples race under parallel make; finished with make -j1)
Trilinos13.2.0built from source, package subset below
CompilersGCC 13.3 · CMake 3.28the system's
Python with six3.11Anaconda's: a release-information script needs six, which the conda environment's Python lacked

Trilinos 13.2, not 14

Trilinos 14.4 was tried first and failed: SCALE's Nemesis package uses Tpetra interfaces that 14.x removed. 13.2 is the version family of SCALE's own continuous integration. The configure script, run from an empty build directory:

configure_trilinos13.shin the repository
SRC=$HOME/Trilinos-trilinos-release-13-2-0
ENV=$HOME/ampx-env
INSTALL_PATH=$HOME/trilinos13-install

cmake \
-D CMAKE_Fortran_FLAGS="-fallow-argument-mismatch -fallow-invalid-boz" \
-D CMAKE_INSTALL_PREFIX:FILEPATH=${INSTALL_PATH} \
-D CMAKE_BUILD_TYPE=RELEASE \
-D TPL_ENABLE_MPI=OFF \
-D TPL_BLAS_LIBRARIES="${ENV}/lib/libopenblas.so" \
-D TPL_LAPACK_LIBRARIES="${ENV}/lib/libopenblas.so" \
-DTrilinos_ENABLE_ALL_PACKAGES=OFF \
-DTrilinos_ENABLE_TESTS=OFF \
-DTrilinos_ENABLE_EXAMPLES=OFF \
-DTPL_ENABLE_Boost=OFF \
-DTPL_ENABLE_Netcdf=OFF \
-DTrilinos_ENABLE_KokkosCore=ON \
-DTrilinos_ENABLE_TeuchosComm=ON \
-DTrilinos_ENABLE_TeuchosParameterList=ON \
-DTrilinos_ENABLE_TeuchosNumerics=ON \
-DTrilinos_ENABLE_Tpetra=ON \
-DTrilinos_ENABLE_Amesos2=ON \
-DTrilinos_ENABLE_Anasazi=ON \
-DTrilinos_ENABLE_Shards=ON \
-DTrilinos_ENABLE_Intrepid=ON \
-DTrilinos_ENABLE_Ifpack2=ON \
-DTrilinos_ENABLE_Stratimikos=ON \
-DBUILD_SHARED_LIBS=ON \
-DTpetra_ENABLE_DEPRECATED_CODE=ON \
-DCMAKE_CXX_FLAGS="-include cstdint" \
"$@" ${SRC}

The package list follows the scale-public README. The two highlighted lines are the additions: Tpetra's deprecated code switched on, and -include cstdint for the older C++ code under GCC 13. The two gfortran flags relax argument and BOZ checks that newer gfortran versions enforce.

Configure SCALE-Public for AMPX

configure_ampx.shin the repository
SRC=$HOME/scale-public
ENV=$HOME/ampx-env
INSTALL_PATH=$HOME/ampx-install

cmake \
-DCMAKE_PREFIX_PATH="$HOME/trilinos13-install;${ENV}" \
-DHDF5_ROOT=${ENV} \
-DBLAS_LIBRARIES=${ENV}/lib/libopenblas.so \
-DLAPACK_LIBRARIES=${ENV}/lib/libopenblas.so \
-DSCALE_USE_MCNP=OFF \
-DSCALE_USE_MPI=OFF \
-DSCALE_DEBUG=OFF \
-DSCALE_BUILD_TESTS=OFF \
-DSCALE_USE_SWIG_Python:BOOL=OFF \
-DSCALE_USE_SWIG_Fortran:BOOL=OFF \
-DCMAKE_INSTALL_PREFIX=${INSTALL_PATH} \
-DCMAKE_BUILD_TYPE=RELEASE \
-DCMAKE_Fortran_FLAGS="-fallow-argument-mismatch -fallow-invalid-boz" \
-DCMAKE_CXX_FLAGS="-DAMPX_WITHOUT_GNDS" \
-DSCALE_USE_Qt=ON \
-DSCALE_USE_GNDS=OFF \
-DSCALE_USE_SuperLU=OFF \
-DSCALE_GIT_SUBMODULE=OFF \
-DSCALE_USE_FLEX=ON \
-DFLEX_EXECUTABLE=${ENV}/bin/flex \
-DBISON_EXECUTABLE=${ENV}/bin/bison \
-DPYTHON_EXECUTABLE=$HOME/anaconda3/bin/python3 \
"$@" ${SRC}

Then make and make install in the build directory. The highlighted options are the ones that needed thought:

SCALE_USE_Qt=ON is required

The AMPX module driver library (ampxdriver: polident_new, broaden, y12, x10, puff_iv and the rest) links Qt Core and the Qt solutions (Qt5Gui/Widgets). With Qt off, CMake skips it without an error and only the utilities are built. The first build here had Qt off and had to be redone.

Running an input

shellfrom the build notes
export LD_LIBRARY_PATH=$HOME/trilinos13-install/lib:$HOME/ampx-env/lib:$LD_LIBRARY_PATH
~/ampx-install/bin/scalerte -m input.inp

For long jobs on a shared machine, the continuous-energy project ran every input through this wrapper:

run_ampx.shin the repository
# run an AMPX input with a low OOM priority and a memory cap (the CANDU campaign must not be hit)
echo 1000 > /proc/self/oom_score_adj
ulimit -v ${AMPX_VMEM_KB:-3000000}
export OPENBLAS_NUM_THREADS=1 OMP_NUM_THREADS=1
export LD_LIBRARY_PATH=$HOME/trilinos13-install/lib:$HOME/ampx-env/lib
exec timeout ${AMPX_TIMEOUT:-7200} $HOME/ampx-install/bin/scalerte -m "$@"
Why each line
  • oom_score_adj=1000: if memory runs out, the kernel kills this job first, not other work on the machine.
  • ulimit -v: a hard cap on the address space. A module's virtual size can be much larger than its resident memory: jamaican_new stopped at a 1.4 GB cap with a peak of 654 MB resident. Set the cap at about twice the memory you expect the job to use.
  • OPENBLAS_NUM_THREADS=1: OpenBLAS reserves large buffers per thread, which a ulimit -v cap turns into failures.
Big-endian units

scalerte makes gfortran read and write units 21–26, 33, 77–80, 88 and 89 big-endian. Keep your own files off those units. X10 always reads its group structure from unit 77, so it needs a byte-swapped copy of group.bounds; with the little-endian file there, X10 crashed.

A first test

The quickest end-to-end test is the single-temperature B-11 input on the next page: eleven module blocks and six shell blocks, about a minute, ending in a SCALE continuous-energy nuclide file. For the covariance chain, the U-235 example in the covariance repository (u235.inp) runs POLIDENT through PUFF-IV in about 12 minutes.