-
Notifications
You must be signed in to change notification settings - Fork 13
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
Align update of nextSIM-DG and XIOS calendars #757
base: develop
Are you sure you want to change the base?
Conversation
954b07d
to
b8975d7
Compare
38e2e5c
to
0ca57ad
Compare
core/test/XiosReadWrite_test.cpp
Outdated
xios_handler.close_context_definition(); | ||
// FIXME: Why do we need to re-set the calendar timestep and start here? | ||
// These are already set in the Xios constructor and the test fails if the following two | ||
// lines are moved above the close_context_definition. | ||
xios_handler.setCalendarTimestep(Duration("P0-0T01:30:00")); | ||
xios_handler.setCalendarStart(TimePoint("2023-03-17T17:11:00Z")); |
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 currently in discussion with the XIOS developers on why this is occurring. Apparently the MFE I provided works fine in XIOS3. (I'm using XIOS2 at revision 2638.)
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 considered updating to XIOS3 but found that some of the demos hang with that so figured it'd be better to address this specific issue first.
Fixed the issue above locally with a hack as in fe1c9b2. My latest commit triggered the Docker image to be rebuilt so hopefully it will work in there, too.
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.
Okay so initially the test suite with XIOS failed but then once the Docker image had built, I re-triggered it and it passed!
test-ubuntu-mpi-noxios: | ||
|
||
runs-on: ubuntu-22.04 | ||
container: | ||
image: ghcr.io/nextsimhub/nextsimdg-dev-env:latest | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- name: build and compile with MPI but not XIOS | ||
run: | | ||
. /opt/spack-environment/activate.sh | ||
mkdir -p build && cd build | ||
cmake -DENABLE_MPI=ON -DENABLE_XIOS=OFF -DCMAKE_CXX_COMPILER="$(which mpic++)" .. | ||
make -j 4 | ||
|
||
- name: run MPI tests | ||
run: | | ||
. /opt/spack-environment/activate.sh | ||
apt update | ||
apt install -y wget | ||
cd build | ||
(cd core/test && wget "ftp://ftp.nersc.no/nextsim/netCDF/partition_metadata_1.nc") | ||
for component in core physics dynamics | ||
do | ||
cd $component/test | ||
for file in $(find test* -maxdepth 0 -type f) | ||
do | ||
echo $file | ||
nprocs=$(echo $file | sed -r "s/.*MPI([0-9]+)/\1/") | ||
mpirun --allow-run-as-root --oversubscribe -n $nprocs ./$file | ||
done | ||
cd - | ||
done | ||
|
||
test-ubuntu-mpi-xios: |
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.
Note that this change is the same as the one in #758.
@@ -227,7 +227,7 @@ ModelState ParaGridIO::readForcingTimeStatic( | |||
std::vector<double> timeVec(timeDim.getSize()); | |||
timeVar.getVar(timeVec.data()); | |||
// Get the index of the largest TimePoint less than the target. | |||
targetTIndex = std::find_if(begin(timeVec), end(timeVec), [time](double t) { | |||
targetTIndex = std::find_if(std::begin(timeVec), std::end(timeVec), [time](double 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.
This is required to avoid compile errors about begin
and end
being overloaded and it not being clear which version to use.
@@ -37,7 +37,6 @@ static const std::map<int, std::string> keyMap = { { Xios::ENABLED_KEY, "xios.en | |||
//! Enable XIOS in the 'config' | |||
void enableXios() | |||
{ | |||
Configurator::clearStreams(); |
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 change is important when you set up XIOS after you've already configured other parts of nextSIM-DG.
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 XIOS handler living in ModelMetadata
feels out of place. Perhaps define it as a singleton in Xios.hpp
/.cpp
?
@@ -117,6 +129,9 @@ class ModelMetadata { | |||
#ifdef USE_MPI | |||
const std::string bboxName = "bounding_boxes"; | |||
#endif | |||
#ifdef USE_XIOS | |||
Xios* xiosHandler = nullptr; |
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.
Is ModelMetadata
the best place for the XIOS handler? It doesn't (instinctively) feel like metadata data to me. Perhaps implementing the infrastructure necessary to return an Xios
singleton.
Also, wherever it ends up, might a smarter pointer be better than a raw pointer?
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 way I currently have it set up in #751 is that multiple classes (ParaGridIO
and ModelMetadata
) have pointers to it. A singleton would make sense in general, yes. It might make test files containing multiple tests that use XIOS a little trickier to set up, but that's not really the important thing. I'll look into how to implement it. Also good point on using smart pointers.
Align update of nextSIM-DG and XIOS calendars
Fixes #756
Fixes #740
Refinement of #751
Task List
Change Description
This PR adds functionality for incrementing XIOS' calendar and hooks it up in the
ModelMetadata::incrementTime
method.More specifically:
Xios::incrementCalendar
.Xios::updateCalendar
andXios::setCalendarStep
(for consistency withXios::getCalendarStep
.Test Description
The new method is used in the XIOS read/write test. Unfortunately, I found a bug in XIOS (see comments below). However, this is fixed with a minor hack in the
install-xios.sh
script. We should be able to avoid this hack when we update to XIOS3 (see #761).Pre-Request Checklist