-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Analytic electron EOS and zsplit modifier #444
Conversation
…plit and IdealElectron modles
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jhp-lanl @jdolence @pdmullen @chadmeyer this is now ready for review.
.github/workflows/formatting.yml
Outdated
@@ -9,7 +9,7 @@ on: | |||
jobs: | |||
formatting: | |||
name: Check Formatting | |||
runs-on: ubuntu-latest | |||
runs-on: ubuntu-noble |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Latest is now 24.04 which does not support clang-format-12. For now, just pin to older Ubuntu. WIll resolve the dependency issue long term in a formal single MR in the new year. See #446
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is now ubuntu-22.04. Must use version number, not version name.
# jmm: updated Dec 17, 2024 to avoid build errors on modern gcc | ||
GIT_TAG v3.7.1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Catch2 v3.0.1 does not compile on ubuntu 24.04. Update to 3.7.1 to rescue it.
CMakeLists.txt
Outdated
# Suppresses annoying ABI notes. See: | ||
# https://stackoverflow.com/questions/52020305/what-exactly-does-gccs-wpsabi-option-do-what-are-the-implications-of-supressi | ||
$<$<CXX_COMPILER_ID:GNU>:-Wno-psabi> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
GCC outputs these ABI notes. When compiling with -Werr those notes cause compilation to fail, but the notes explain gcc bugs, and are not singularity-eos problems. In the way we build singularity-eos (via spack or in-tree), ABI incompatibilities will never impact us.
// JMM: Use VA_ARGS to capture more complex template types | ||
#define SG_ADD_BASE_CLASS_USINGS(...) \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The problem here is that preprocessor macros interpret commas as separate arguments. This allows us to pass classes with multiple template arguments through the macro transparently.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice addition!
} \ | ||
} | ||
|
||
#define SG_ADD_MODIFIER_MEAN_METHODS(t_) \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
split these out into separate modifier methods in preparation for isotopics.
template <typename Indexer_t = Real *> | ||
PORTABLE_FORCEINLINE_FUNCTION Real GetScale_(Indexer_t &&lambda) const { | ||
Real Z = GetIonizationState_(lambda); | ||
if constexpr (ztype == ZSplitComponent::Electrons) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Notice the if constexpr here, which makes this a compile-time switch rather than runtime. We could make it runtime, but I chose not to. The trade-off here is that run-time would make the variant smaller. But compile time increases performance.
…ng time, for unclear reasons
Github updated the latest ubuntu runner to 24.04. This breaks everything. Actions taken:
|
OK in addition to the timeout, the full fortran interface was running out of memory in the linker phase. Additional actions taken:
|
@@ -40,7 +40,7 @@ jobs: | |||
-DSINGULARITY_USE_SPINER_WITH_HDF5=OFF \ | |||
-DSINGULARITY_FORCE_SUBMODULE_MODE=ON \ | |||
-B build . | |||
cmake --build build | |||
cmake --build build --parallel 4 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
builds the python bits faster. Speeds up doc build time by a factor of 4ish
@@ -9,7 +9,7 @@ on: | |||
jobs: | |||
formatting: | |||
name: Check Formatting | |||
runs-on: ubuntu-latest | |||
runs-on: ubuntu-22.04 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Needed until we update clang-format to clang-17
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changes in this file required to deal with out-of-memory failure when linking the full fortran interface.
@@ -21,13 +21,15 @@ jobs: | |||
- name: install dependencies | |||
run: | | |||
sudo apt-get update -y -qq | |||
sudo apt-get install -y --allow-downgrades --allow-remove-essential --allow-change-held-packages -qq build-essential gfortran libhdf5-serial-dev | |||
sudo apt-get install -y --allow-downgrades --allow-remove-essential --allow-change-held-packages -qq build-essential gfortran libhdf5-serial-dev binutils-gold |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
binutils-gold
gets us use the gold linker developed by google specifically for big C++ projects. It seems to be much faster and more memory efficient. Generically I don't know if we want to rely on it, but honestly I was very impressed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll defer to @rbberger @dholladay00 and @mauneyc-LANL on their opinions here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah i think for now we don't need to change it elsewhere. In this particular CI test, this, GNU ld is too memory inefficient and the test doesn't finish without gold.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I could totally be wrong, but I have a bit of a hunch that among all the changes made, only the switch to Release
is required. Should we be minimalistic here, or you are quite happy with binutils-gold
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was actually impressed by binutils-gold
. The build time is also just faster with it on, so I'd like to leave it as this test takes about 10 minutes. That said, I'm fine removing it if (a) that still works and (b) people feel strongly.
ulimit -m unlimited | ||
ulimit -v unlimited |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure if this does anything inside a docker container, but it doesn't hurt.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But we could also be minimalistic if desirable... see above. No strong feelings here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll leave it. In worst case it does nothing.
-DSINGULARITY_PLUGINS=$(pwd)/../example/plugin \ | ||
-DCMAKE_LINKER=ld.gold \ | ||
-DCMAKE_BUILD_TYPE=Release \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Compared to the default build type, which is RelWithDebInfo
, this drops debug symbols, shrinking the memory footprint during link stage.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm surprised that's such a huge memory hit to be honest. Honestly though, I find that if I really need debug symbols, I'm compiling with full Debug
anyway so I'm okay with this change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah. I agree. Is also only for this test. The default build is still "RelWithDebInfo."
.. | ||
#-DSINGULARITY_TEST_PYTHON=ON \ | ||
#-DSINGULARITY_TEST_STELLAR_COLLAPSE=ON \ | ||
#.. | ||
make | ||
make -j4 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
parallel build.
# `-Wclass-memaccess now default with -Wall but we explicitly | ||
# manage this ourselves in our serialization routines. | ||
$<$<AND:$<CXX_COMPILER_ID:GNU>,$<COMPILE_LANGUAGE:CXX>>:-Wno-class-memaccess> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is apparently a new warning. Since we sometimes build with -Werr
its also an error. I am silencing it as memcpy
is an intrinsic part of the serialization infrastructure and the heuristic that normally justifies warning doesn't apply in our case. We have introspection about the trivial and non-trivial copy properties of our data and we manage it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ping @rbberger just so you're aware
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ping @rbberger so you're aware
Tests now passing on github and re-git. |
Looks good to me, tests added. The applicability of the Z-split is still not clear to me but that's something we will work on separately. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Non-blocking comments.
@@ -21,13 +21,15 @@ jobs: | |||
- name: install dependencies | |||
run: | | |||
sudo apt-get update -y -qq | |||
sudo apt-get install -y --allow-downgrades --allow-remove-essential --allow-change-held-packages -qq build-essential gfortran libhdf5-serial-dev | |||
sudo apt-get install -y --allow-downgrades --allow-remove-essential --allow-change-held-packages -qq build-essential gfortran libhdf5-serial-dev binutils-gold |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I could totally be wrong, but I have a bit of a hunch that among all the changes made, only the switch to Release
is required. Should we be minimalistic here, or you are quite happy with binutils-gold
?
ulimit -m unlimited | ||
ulimit -v unlimited |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But we could also be minimalistic if desirable... see above. No strong feelings here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor changes
// JMM: Use VA_ARGS to capture more complex template types | ||
#define SG_ADD_BASE_CLASS_USINGS(...) \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice addition!
Co-authored-by: Jeff Peterson <[email protected]>
Co-authored-by: Jeff Peterson <[email protected]>
I completely agree. Not something to tackle now, but definitely something to keep in mind |
Thanks all! Merged. 🎊 |
PR Summary
In this MR I implement an analytic electron EOS---this is essentially an ideal gas but with a Gruneisen coefficient set by the the degrees of freedom of an electron and a specific heat that scales with ionization state divided by mean atomic mass. The idea here is that you pass in ion density and electron temperature. The ionization state is also passed in through the lambda.
I am also in the process of implementing the z split as a modifier, which splits an equation of state into a component from the ions and a component from the electrons. The z split will be two modifiers, one EOS for electrons and one for ions. Both applied to a single EOS split it into two. z split is exact for an ideal gas but not for anything else, but it is commonly used. I'm not done with this yet, so it might not be in the diff yet, depending on when you look at the MR.
Note that in the case of nuclear burning, EOS's will also need to be potentially modified by a mass scale, as per our
ScaledEOS
modifier.I will cover adding electron or ion sub-tables of tabulated Sesame EOS's in a subsequent MR.
PR Checklist
make format
command after configuring withcmake
.If preparing for a new release, in addition please check the following:
when='@main'
dependencies are updated to the release version in the package.py