# Coupled OpenIFS+NEMO4.2+XIOS+OASIS freezes

**URL:** <https://nemo-ocean.discourse.group/t/coupled-openifs-nemo4-2-xios-oasis-freezes/454>\
**Category:** v4.2.x\
**Tags:** OASIS, XIOS\
**Created:** [9 March 2023 18:10 UTC](https://nemo-ocean.discourse.group/t/coupled-openifs-nemo4-2-xios-oasis-freezes/454 "2023-03-09T18:10:51Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![joakim](https://yyz2.discourse-cdn.com/free1/user_avatar/nemo-ocean.discourse.group/joakim/32/139_2.png) [@joakim](https://nemo-ocean.discourse.group/u/joakim)\
**Post date:** [9 March 2023 18:10 UTC](https://nemo-ocean.discourse.group/t/coupled-openifs-nemo4-2-xios-oasis-freezes/454/1 "2023-03-09T18:10:51Z")

</div>

Good evening

I have started to upgrade from NEMO 3.6 to NEMO 4.2 in my coupled model. This also means upgrading XIOS from 2.5 to the latest trunk.

Unfortunately the new model freezes during the “definition” phase of OASIS, i.e. the first time step. The model has 4 executables, “oifs” (OpenIFS), “oceanx” (NEMO), “xios.x” (XIOS) and “rnfma” (runoff scheme). I have added a print statement before “OASIS\_ENDDEF” in OpenIFS, NEMO and runoff mapper and know for sure that the models reach that point.  
XIOS however, does not seem to reach OASIS\_ENDDEF, and so the whole coupled model freezes.

After adding a lot of print statements to client.cpp and server.cpp in XIOS I have figured out that the failing line is when oasis\_init\_comp is called within the function “CServer::Initialize”, but no error message is raised.

One might assume it’s a bug in XIOS, but surely other groups have used NEMO 4.x with new XIOS for coupled runs?  
So I’m thinking it’s either my settings (iodef.xml etc) or compilers/MPI.

Has anyone else managed to run NEMO 4.x in coupled mode with XIOS in server mode?  
If so, would it be possible to get some advice on which XIOS revision works and what settings to use in iodef.xml?  
Any help here is much appreciated.

I’m using Intel compilers and Intel MPI 2019.5, and I’m using basically the same iodef.xml as I was for NEMO 3.6.

Full version names are: OpenIFS 43r3v2, NEMO 4.2.0, XIOS trunk (a few days old) and OASIS-MCT5.0.

Many thanks  
Joakim Kjellsson, GEOMAR

---

<div class="post-metadata">

**Author:** ![smasson](https://avatars.discourse-cdn.com/v4/letter/s/eb9ed0/32.png) [@smasson](https://nemo-ocean.discourse.group/u/smasson)\
**Post date:** [9 March 2023 20:22 UTC](https://nemo-ocean.discourse.group/t/coupled-openifs-nemo4-2-xios-oasis-freezes/454/2 "2023-03-09T20:22:25Z")

</div>

I would first try to run the coupled model without xios (suppress key\_xios when compiling NEMO) to really make sure the problem is coming (or not) from xios.  
If you have any issue with the output files when you don’t use xios, define nn\_write == -1 in namelist\_cfg so NEMO will not write any output.

---

<div class="post-metadata">

**Author:** ![joakim](https://yyz2.discourse-cdn.com/free1/user_avatar/nemo-ocean.discourse.group/joakim/32/139_2.png) [@joakim](https://nemo-ocean.discourse.group/u/joakim)\
**Post date:** [11 March 2023 07:58 UTC](https://nemo-ocean.discourse.group/t/coupled-openifs-nemo4-2-xios-oasis-freezes/454/3 "2023-03-11T07:58:54Z")

</div>

Good evening, Sebastian

Thanks very much for your reply. I followed this suggestion and re-compiled both OpenIFS and NEMO without XIOS, and this version runs. It passes OASIS\_ENDDEF, then OASIS generates the remapping files, and I start getting some netcdf output from each NEMO task.

I then took the very same configuration, re-compiled with XIOS, and same freezing again.  
So I’m confident that the problem comes from XIOS.

The traceback from XIOS points to OASIS on line 254 in mod\_oasis\_auxiliary\_routines.F90 which says:  
CALL mpi\_intercomm\_create(mpi\_comm\_local, 0, mpi\_comm\_global, &  
mpi\_root\_global(il), tag, new\_comm, ierr)

I think this is when XIOS sets up communication with NEMO. Could there be some setting for XIOS or NEMO that I’m missing?

/Joakim

---

<div class="post-metadata">

**Author:** ![joakim](https://yyz2.discourse-cdn.com/free1/user_avatar/nemo-ocean.discourse.group/joakim/32/139_2.png) [@joakim](https://nemo-ocean.discourse.group/u/joakim)\
**Post date:** [15 March 2023 12:46 UTC](https://nemo-ocean.discourse.group/t/coupled-openifs-nemo4-2-xios-oasis-freezes/454/4 "2023-03-15T12:46:39Z")

</div>

Dear Sebastian

I’m happy to report that the problem has been solved after getting some input from Julien Derouillat at IPSL.

Apparently, the order in which “CALL oasis\_enddef” and “CALL xios\_context\_initialize” needs to be done has changed since XIOS trunk 1587.  
Both NEMO 4.2 and OpenIFS are written as:

CALL oasis\_enddef  
…  
CALL xios\_context\_initialize

but since XIOS trunk version 1587, one needs to do

CALL xios\_oasis\_enddef  
CALL oasis\_enddef  
…  
CALL xios\_context\_initialize

and also set “call\_oasis\_enddef” to “true” in iodef.xml.

I made these changes and that solved the deadlock. Now OpenIFS and NEMO can couple via OASIS and also do I/O via XIOS.  
Let me know if I should share these changes with the community.

Best wishes  
Joakim

PS. This is all explained here: [https://forge.ipsl.jussieu.fr/ioserver/raw-attachment/wiki/WikiStart/Joint\_usage\_OASIS3-MCT\_XIOS.pdf](https://forge.ipsl.jussieu.fr/ioserver/raw-attachment/wiki/WikiStart/Joint_usage_OASIS3-MCT_XIOS.pdf)
