Skip to content

Commit

Permalink
Merge branch 'main' into dholladay00/robust_JWL
Browse files Browse the repository at this point in the history
  • Loading branch information
Yurlungur authored Nov 30, 2023
2 parents 6c2ab77 + 6968515 commit aea04a9
Show file tree
Hide file tree
Showing 66 changed files with 3,624 additions and 2,432 deletions.
21 changes: 13 additions & 8 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,23 @@ variables:
SINGULARITY_EOS_CUDA_VERSION: "11.6.0"
SINGULARITY_EOS_BUILD_TYPE: "RelWithDebInfo"
SINGULARITY_EOS_SPACK_SPEC: "singularity-eos@main+mpi+hdf5+python+tests%gcc@${SINGULARITY_EOS_GCC_VERSION} ^openmpi@${SINGULARITY_EOS_OPENMPI_VERSION}"
COLOR_CYAN: '\033[1;36m'
COLOR_PLAIN: '\033[0m'
COLOR_CYAN: "\e[1;36m"
COLOR_PLAIN: "\e[0m"
# set to different spack upstream for testing
SINGULARITY_EOS_TEMP_SPACK_DIR: ""
# uncomment for debugging the CI and persist the Spack installation
# SPACK_USER_CACHE_PATH: "${CI_PROJECT_DIR}/spack-local"
# DEVEL_SPACK_CHECKOUT: "${CI_PROJECT_DIR}/spack"

before_script:
- echo "Running on $(hostname)"
- section() { echo $'\e[0K'"section_$1:$(date +%s):$2"$'\r\e[0K'"${3+${COLOR_CYAN}$3${COLOR_PLAIN}}"; }
- export PYTHONNOUSERSITE=1
- export SPACK_DISABLE_LOCAL_CONFIG=true
- export SPACK_USER_CACHE_PATH=${SPACK_USER_CACHE_PATH:-/tmp/spack-local}
- export DEVEL_SPACK_CHECKOUT=${DEVEL_SPACK_CHECKOUT:-/tmp/spack}
- export SINGULARITY_EOS_SPACK_DIR=${SINGULARITY_EOS_TEMP_SPACK_DIR:=$XCAP_OSS_SPACK_DIR}
- echo -e "\e[0Ksection_start:`date +%s`:spack_init[collapsed=true]\r\e[0K${COLOR_CYAN}Creating Spack instance at ${DEVEL_SPACK_CHECKOUT}${COLOR_PLAIN}"
- section start "spack_init[collapsed=true]" "Creating Spack instance at ${DEVEL_SPACK_CHECKOUT}"
- |
rsync -rpl \
--exclude=".git" \
Expand All @@ -39,7 +41,7 @@ before_script:
- source ${DEVEL_SPACK_CHECKOUT}/share/spack/setup-env.sh
- spack --version
- spack compiler list
- echo -e "\e[0Ksection_end:`date +%s`:spack_init\r\e[0K"
- section end spack_init

##########################
# Build Matrix Variables #
Expand Down Expand Up @@ -81,6 +83,9 @@ before_script:
#################

.job: &job_def
id_tokens:
SITE_ID_TOKEN:
aud: https://asc-git.lanl.gov
tags:
- darwin-slurm-shared
variables:
Expand All @@ -106,17 +111,17 @@ before_script:
- |
if [[ "${CI_COMMIT_BRANCH}" == "${CI_DEFAULT_BRANCH}" ]];
then
echo -e "\e[0Ksection_start:`date +%s`:spack_build[collapsed=true]\r\e[0K${COLOR_CYAN}Building via Spack${COLOR_PLAIN}"
section start "spack_build[collapsed=true]" "Building via Spack"
mkdir -p spack_build_env
spack env create spack_build_env
spack env activate spack_build_env
spack repo add spack-repo
spack config add upstreams:default:install_tree:${SINGULARITY_EOS_SPACK_DIR}/opt/spack/
spack dev-build -j $(nproc) ${SINGULARITY_EOS_SPACK_SPEC}
spack env deactivate
echo -e "\e[0Ksection_end:`date +%s`:spack_build\r\e[0K"
section end spack_build
fi
- echo -e "\e[0Ksection_start:`date +%s`:spack_env[collapsed=true]\r\e[0K${COLOR_CYAN}Creating Spack environment${COLOR_PLAIN}"
- section start "spack_env[collapsed=true]" "Creating Spack environment"
- mkdir -p spack_env
- spack env create spack_env
- spack env activate spack_env
Expand All @@ -125,7 +130,7 @@ before_script:
- spack spec -I ${SINGULARITY_EOS_SPACK_SPEC}
- spack add ${SINGULARITY_EOS_SPACK_SPEC}
- spack install -j $(nproc) --show-log-on-error --no-checksum --yes-to-all -u cmake
- echo -e "\e[0Ksection_end:`date +%s`:spack_env\r\e[0K"
- section end spack_env
- |
if [[ -n ${SINGULARITY_USE_CUDA} ]];
then
Expand Down
28 changes: 27 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,23 @@
# Changelog

## Current develop
- [[PR269]](https://github.com/lanl/singularity-eos/pull/269) Add SAP Polynomial EoS

### Fixed (Repair bugs, etc)

### Added (new features/APIs/variables/...)

### Changed (changing behavior/API/variables/...)

### Infrastructure (changes irrelevant to downstream codes)

### Removed (removing behavior/API/varaibles/...)

## Release 1.8.0
Date: 11/28/2023

### Fixed (Repair bugs, etc)
- [[PR278]](https://github.com/lanl/singularity-eos/pull/278) Fixed EOSPAC unit conversion errors for scalar lookups
- [[PR316]](https://github.com/lanl/singularity-eos/pull/316) removed `fmax-errors=3` from `singularity-eos` compile flags
- [[PR296]](https://github.com/lanl/singularity-eos/pull/296) changed `CMAKE_SOURCE_DIR` to `PROJECT_SOURCE_DIR` to fix downstream submodule build
- [[PR291]](https://github.com/lanl/singularity-eos/pull/291) package.py updates to reflect new CMake options
- [[PR290]](https://github.com/lanl/singularity-eos/pull/290) Added target guards on export config
Expand All @@ -20,8 +34,15 @@
- [[PR228]](https://github.com/lanl/singularity-eos/pull/228) added untracked header files in cmake
- [[PR215]](https://github.com/lanl/singularity-eos/pull/215) and [[PR216]](https://github.com/lanl/singularity-eos/pull/216) fix duplicate definition of EPS and fix CI
- [[PR232]](https://github.com/lanl/singularity-eos/pull/228) Fixed uninitialized cmake path variables
- [[PR308]](https://github.com/lanl/singularity-eos/pull/308) spack builds +fortran now compile via correct blocking out of interfaces via preprocessor ifdef

### Added (new features/APIs/variables/...)
- [[PR269]](https://github.com/lanl/singularity-eos/pull/269) Add SAP Polynomial EoS
- [[PR278]](https://github.com/lanl/singularity-eos/pull/278) Added EOSPAC option functionality in class constructor
- [[PR278]](https://github.com/lanl/singularity-eos/pull/278) Added a new function for returning the minimum energy as a function of density for an EOS (only EOSPAC at the moment)
- [[PR278]](https://github.com/lanl/singularity-eos/pull/278) Added a new Fortran API for simple pressure and bulk moduli lookups
- [[PR306]](https://github.com/lanl/singularity-eos/pull/306) Added generic Evaluate method
- [[PR304]](https://github.com/lanl/singularity-eos/pull/304) added a Newton-Raphson root find for use with the Helmholtz EoS
- [[PR265]](https://github.com/lanl/singularity-eos/pull/265) Add missing UnitSystem modifier combinations to variant and EOSPAC
- [[PR279]](https://github.com/lanl/singularity-eos/pull/279) added noble-abel EoS
- [[PR274]](https://github.com/lanl/singularity-eos/pull/274) added a stiffened gas EoS
Expand All @@ -38,15 +59,20 @@
- [[PR177]](https://github.com/lanl/singularity-eos/pull/177) added EOSPAC vector functions

### Changed (changing behavior/API/variables/...)
- [[PR311]](https://github.com/lanl/singularity-eos/pull/311) Refactor EOSBuilder for flexibility and extensibility
- [[PR310]](https://github.com/lanl/singularity-eos/pull/310) Speed up and clean up tests
- [[PR295]](https://github.com/lanl/singularity-eos/pull/295) Add fast logs to singularity-eos
- [[PR246]](https://github.com/lanl/singularity-eos/pull/246) Update CMake with upstream changes
- [[PR223]](https://github.com/lanl/singularity-eos/pull/223) Update ports-of-call and add portable error handling
- [[PR234]](https://github.com/lanl/singularity-eos/pull/234) update ports-of-call to correct for undefined behavior in error handling
- [[PR219]](https://github.com/lanl/singularity-eos/pull/219) Removed static analysis from re-git pipeline
- [[PR233]](https://github.com/lanl/singularity-eos/pull/233) Exposed entropy for the EOS type (now required for future EOS)
- [[PR308]](https://github.com/lanl/singularity-eos/pull/308) Fortran initialization interface functions no longer require modifier arrays, they are optional parameters.

### Infrastructure (changes irrelevant to downstream codes)
- [[PR190]](https://github.com/lanl/singularity-eos/pull/190) update CI on re-git
- [[PR245]](https://github.com/lanl/singularity-eos/pull/245) Separating get_sg_eos to other files. Build/compilation improvements, warning fixes/suppression.
- [[PR308]](https://github.com/lanl/singularity-eos/pull/308) Added a fortran test.

### Removed (removing behavior/API/varaibles/...)
- [[PR293]](https://github.com/lanl/singularity-eos/pull/293) Removing PTofRE function. This will no longer be callable downstream.
Expand Down
32 changes: 21 additions & 11 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ endif()
# declare the project name
project(
singularity-eos
VERSION 1.7.0
VERSION 1.8.0
LANGUAGES NONE)

list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake")
Expand Down Expand Up @@ -84,8 +84,9 @@ cmake_dependent_option(
"SINGULARITY_BUILD_TESTS;SINGUALRITY_BUILD_STELLARCOLLAPSE2SPINER" OFF)
cmake_dependent_option(SINGULARITY_TEST_PYTHON "Test the Python bindings" ON
"SINGULARITY_BUILD_TESTS;SINGULARITY_BUILD_PYTHON" OFF)
cmake_dependent_option(SINGULARITY_TEST_HELMHOLTZ "Test the Helmholtz equation of state" ON
"SINGULARITY_BUILD_TESTS;SINGULARITY_USE_HELMHOLTZ" OFF)
cmake_dependent_option(
SINGULARITY_TEST_HELMHOLTZ "Test the Helmholtz equation of state" ON
"SINGULARITY_BUILD_TESTS;SINGULARITY_USE_HELMHOLTZ" OFF)

# modify flags options
option(SINGULARITY_BETTER_DEBUG_FLAGS "Better debug flags for singularity" ON)
Expand All @@ -96,6 +97,12 @@ option(SINGULARITY_USE_SINGLE_LOGS
"Use single precision logs. Can harm accuracy." OFF)
option(SINGULARITY_USE_TRUE_LOG_GRIDDING
"Use grids that conform to log spacing." OFF)
# TODO(JMM): Should this automatically be activated when true log gridding is
# off?
cmake_dependent_option(
SINGULARITY_USE_HIGH_RISK_MATH
"Use integer aliased logs, may not be portable" OFF
"NOT SINGULARITY_USE_TRUE_LOG_GRIDDING" OFF)

# misc options
option(SINGULARITY_FORCE_SUBMODULE_MODE "Submodule mode" OFF)
Expand Down Expand Up @@ -231,6 +238,10 @@ endif()
if(SINGULARITY_USE_SINGLE_LOGS)
target_compile_definitions(singularity-eos PUBLIC SINGULARITY_USE_SINGLE_LOGS)
endif()
if(SINGULARITY_USE_HIGH_RISK_MATH)
target_compile_definitions(singularity-eos
PUBLIC SINGULARITY_USE_HIGH_RISK_MATH)
endif()

if(SINGULARITY_TEST_SESAME)
target_compile_definitions(singularity-eos PRIVATE SINGULARITY_TEST_SESAME)
Expand Down Expand Up @@ -365,23 +376,22 @@ foreach(_header ${EOS_HEADERS})
list(APPEND _headers singularity-eos/${_header})
endforeach()

foreach(_mod ${EOS_MODS})
list(APPEND _install_mods ${CMAKE_CURRENT_BINARY_DIR}/${_mod})
endforeach()

foreach(_src ${EOS_SRCS})
list(APPEND _srcs singularity-eos/${_src})
endforeach()

target_sources(singularity-eos PRIVATE ${_srcs} ${_headers})

# make sure .mods are placed in build path, and installed along with includes
if(SINGULARITY_USE_FORTRAN)
# Turn on preprocessor for fortran files
set_target_properties(singularity-eos PROPERTIES Fortran_PREPROCESS ON)
# make sure .mods are placed in build path, and installed along with includes
set_target_properties(singularity-eos PROPERTIES Fortran_MODULE_DIRECTORY
${CMAKE_CURRENT_BINARY_DIR})
${CMAKE_CURRENT_BINARY_DIR}/fortran)
target_include_directories(
singularity-eos INTERFACE $<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}>
singularity-eos INTERFACE $<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/fortran>
$<INSTALL_INTERFACE:include/singularity-eos/eos>)
set_target_properties(singularity-eos PROPERTIES Fortran_PREPROCESS ON)
endif() # SINGULARITY_USE_FORTRAN

target_include_directories(
Expand Down Expand Up @@ -438,7 +448,7 @@ target_compile_options(
-use_fast_math
> # release
> # cuda
PUBLIC -fmax-errors=3)
)

target_link_options(singularity-eos PRIVATE ${xlfix})

Expand Down
129 changes: 0 additions & 129 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,135 +9,6 @@ A collection of closure models and tools useful for multiphysics codes.

More complete documentation is available [here](https://lanl.github.io/singularity-eos/).

## Components

- `eos` contains the analytic and tabular equation of state infrastructure
- `eospac-wrapper` is a wrapper for eospac
- `closure` contains mixed cell closure models. Currently pressure-temperature equilibrium is supported. Requires `eos`.
- `sesame2spiner` converts sesame tables to spiner tables
- `stellarcollaspe2spiner` converts tables found on stellarcollapse.org to spiner tables

## To Build

At its most basic:
```bash
git clone --recursive [email protected]:lanl/singularity-eos.git
cd singularity-eos
mkdir bin
cd bin
cmake ..
make
```

### To Make tests

Then, in the singularity-eos root directory:
```bash
mkdir -p bin
cd bin
cmake -DSINGULARITY_BUILD_TESTS=ON ..
make -j
make test
```

### Build Options

A number of options are avaialable for compiling:

| Option | Default | Comment |
| --------------------------------- | ------- | ------------------------------------------------------------------------------------ |
| SINGULARITY_USE_HDF5 | ON | Enables HDF5. Required for SpinerEOS, StellarCollapseEOS, and sesame2spiner |
| SINGULARITY_USE_FORTRAN | ON | Enable Fortran API for equation of state |
| SINGULARITY_USE_KOKKOS | OFF | Uses Kokkos as the portability backend. Currently only Kokkos is supported for GPUs. |
| SINGULARITY_USE_EOSPAC | OFF | Link against EOSPAC. Needed for sesame2spiner and some tests. |
| SINGULARITY_USE_CUDA | OFF | Target nvidia GPUs via cuda. Currently requires Kokkos. |
| SINGULARITY_USE_KOKKOSKERNELS | OFF | Use Kokkos Kernels for linear algebra. Needed for mixed cell closure models on GPU |
| SINGULARITY_BUILD_CLOSURE | ON | Builds mixed cell closure machinery for multi-material problems |
| SINGULARITY_BUILD_TESTS | OFF | Build test infrastructure. |
| SINGULARITY_BUILD_PYTHON | OFF | Build Python bindings |
| SINGULARITY_TEST_SESAME | OFF | Test the Sesame table readers |
| SINGULARITY_TEST_STELLAR_COLLAPSE | OFF | Test the Stellar Collapse table readers |
| SINGULARITY_TEST_PYTHON | OFF | Test the Python bindings |
| SINGULARITY_BUILD_SESAME2SPINER | OFF | Builds the conversion tool sesame2spiner which makes files readable by SpinerEOS |
| SINGULARITY_BUILD_STELLARCOLLAPSE2SPINER | OFF | Builds the conversion tool stellarcollapse2spiner which optionally makes stellar collapse files faster to read |
| SINGULARITY_INVERT_AT_SETUP | OFF | For tests, pre-invert eospac tables. |
| SINGULARITY_BETTER_DEBUG_FLAGS | ON | Enables nicer GPU debug flags. May interfere with in-tree builds as a submodule |
| SINGULARITY_HIDE_MORE_WARNINGS | OFF | Makes warnings less verbose. May interfere with in-tree builds as a submodule |
| SINGULARITY_SUBMODULE_MODE | OFF | Sets cmake flags for in-tree builds |

#### Dependency overriding

`singularity-eos` will do it's utmost to import all it's dependencies with as little user prompts as possible.
However, there may be situations where `singularity-eos` cannot find either an install or a source tree of a dependency.
Furthermore, users may wish to use a modified dependency that `singularity-eos` lacks the foreknowledge to know how to find or otherwise does not utilize.
Therefore the `singularity-eos` build system provides an "override" option for dependencies.

| Option | Default | Comment |
| --------------------------------- | ------- | ------------------------------------------------------------------------------------ |
| SINGULARITY_PKG_INSTALL_DIR | empty | Specifies a path where a CMake install of `PKG` is located |
| SINGULARITY_PKG_IMPORT_DIR | empty | Specifies a path where a CMake source tree of `PKG` is located |

Notes on using these options:

- These options are intended for `singularity-eos` developers. Users are encouraged to let `singularity-eos` use it's own build system to find and configure dependencies
- `PKG` should be in all uppercase, for example `-DSINGULARITY_KOKKOSKERNELS_IMPORT_DIR=...`
- Dashes in package names should be given as underscores, e.g. for `ports-of-call`, use `-DSINGULARITY_PORTS_OF_CALL_INSTALL_DIR=...`
- `_INSTALL_DIR` points to a directory where the package has been installed by CMake. It expects to find a CMake configuration file in a standard location. If this option is specified and the configuration file cannot be found at that location, the build will produce and error and halt
- `_IMPORT_DIR` points to a directory that is the top-level of a source-tree of `PKG`. The directory will be imported into the build "as-though" it was an "in-tree" directory
- using `_IMPORT_DIR` will only check for the existence of a top-level `CMakeLists.txt` file. It does no other evaluation on the directory (e.g. there is no check that this path points to the "correct" package source)
- `_INSTALL_DIR` and `_IMPORT_DIR` cannot be used for the same package

### Building on Darwin power9 nodes with the IBM xl compiler

```bash
git clone --recursive https://gitlab.lanl.gov/singularity/singularity-eos.git
cd singularity-eos
mkdir bin && cd bin
source /usr/projects/eap/dotfiles/.bashrc xl reset
module switch ibm/xlc-16.1.1.5-xlf-16.1.1.5 ibm/xlc-16.1.1.7-xlf-16.1.1.7-gcc-7.4.0
export FC="xlf_r -F/usr/projects/opt/ppc64le/ibm/xlf-16.1.1.7/xlf/16.1.1/etc/xlf.cfg.rhel.7.8.gcc.7.4.0.cuda.10.1"
module load cmake/3.17.3
cd /build/directory
cmake -DCMAKE_BUILD_TYPE=Release -DSINGULARITY_USE_KOKKOS=ON -DSINGULARITY_USE_HDF5=ON -DSINGULARITY_USE_EOSPAC=ON -DSINGULARITY_EOSPAC_INSTALL_DIR=/usr/projects/eap/spack/spack-develop_20191010/opt/spack/linux-rhel7-power9le/xl_r-16.1.1.7-plain/eospac-6.4.0beta.2-mp6hd267l4iokwr6ght2kp5ukk5zc6vq -DSINGULARITY_BUILD_TESTS=ON ..
make -j
make test
```

## Formatting

This project is formatted with `clang-format` using `clang-format`
version 12. If contributing, please run clang-format on the files
you modify.

To run formatting automatically, call `make format_singularity-eos`
at the build step. Cmake automatically makes a target.

You can also call the bash script `format.sh` in the `utils/scripts`
directory as
```bash
utils/scripts/format.sh
```
The script optionally sets the `clang-format` binary from an
environment variable, e.g.,
```bash
CFM=clang-format=12 utils/scripts/format.sh
```

## Units

singularity-eos, prior to unit modifiers, always uses CGS units internally. For
concreteness, the internal units of each quantity are:

| Quantity | Alternate names | Units |
| ------------------------- | -------------------- | ------------- |
| Mass density | rho | g cm^-3 |
| Temperature | temperature | K |
| Specific Internal Energy | sie, Internal Energy | erg g^-1 |
| Pressure | | erg cm^-3 |
| Specific Heat | | erg g^-1 K^-1 |
| Bulk Modulus | | erg cm^-3 |
| Gruneisen Parameter | | |

## Copyright

© 2021-2023. Triad National Security, LLC. All rights reserved. This
Expand Down
7 changes: 4 additions & 3 deletions cmake/install.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,10 @@ foreach(file ${_install_headers})
endforeach() # file

# install the fortran modules NB: cmake doesn't provide a clean way to handle
# mods
install(FILES ${_install_mods}
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/singularity-eos/eos)
if(SINGULARITY_USE_FORTRAN)
install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/fortran/
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/singularity-eos/eos)
endif()

# ----------------------------------------------------------------------------#
# local export
Expand Down
Loading

0 comments on commit aea04a9

Please sign in to comment.