Skip to content
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

Fix standalone MPAS builds under OSX #4395

Merged
merged 2 commits into from
Jul 16, 2021

Conversation

xylar
Copy link
Contributor

@xylar xylar commented Jul 12, 2021

This merge switches to the flag for including the standard c++ library (needed by SCORPIO) under OSX to -lc++, not -lstdc++.

OSX is also the most common platform where we use gfortran and clang compilers. OpenMPI on OSX does not support flags -cc=clang and -cxx=clang++. These flags also do not seem to be needed.

[BFB]

@xylar xylar added BFB PR leaves answers BFB mpas-framework labels Jul 12, 2021
@xylar
Copy link
Contributor Author

xylar commented Jul 12, 2021

This PR needs to be rebased after #4362 gets merged.

@xylar
Copy link
Contributor Author

xylar commented Jul 12, 2021

The gfortran-clang target was added to the Makefile in MPAS-Dev/MPAS#1087. There is no description of why the -cc=clang and -cxx=clang++ flags were needed, so I feel reasonably comfortable removing them.

Copy link
Contributor

@mark-petersen mark-petersen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With #4362 and this merged on top, MPAS-Ocean stand alone compiles with gnu debug and optimized on grizzly and passes nightly regression suite (other than those caused by other issues).

xylar added 2 commits July 13, 2021 17:09
These do not work with OpenMPI and do not seem to be necessary.
@xylar xylar force-pushed the mpas-framework/pio2-build-fix-osx branch from 5277ea4 to 4e1a555 Compare July 13, 2021 15:10
@xylar xylar marked this pull request as ready for review July 13, 2021 15:11
@xylar
Copy link
Contributor Author

xylar commented Jul 13, 2021

@mark-petersen, do you have an OSX machine you can test on? I don't really, just a MacInCloud for a few hours a day, which makes this tricky for me. It would be nice to have the ocean test suite tested on OSX, not just Grizzly.

@mark-petersen
Copy link
Contributor

On my local laptop I successfully, on compass master:

./conda/configure_compass_env.py --conda ~/miconda3
source load_dev_compass_1.0.0.sh

then on this branch:

make gfortran-clang USE_PIO2=true DEBUG=true

also tried USE_PIO2=false. But it fails on the PIO test. Do I need to compile my own PIO library? I thought it might come with the conda environment.

@xylar
Copy link
Contributor Author

xylar commented Jul 14, 2021

@mark-petersen, you need to create the conda environment with --mpi=mpich (preferred) or --mpi=openmpi (also fine). I just made a PR to try to clear this up in the documentation because @vanroekel had the same confusion: MPAS-Dev/compass#178

Copy link
Contributor

@matthewhoffman matthewhoffman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I compiled on my Mac and encountered no issues. These changes look appropriate.

Copy link
Contributor

@akturner akturner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested MPAS-Seaice and everything worked fine

@xylar
Copy link
Contributor Author

xylar commented Jul 14, 2021

Thanks very much @matthewhoffman and @akturner!

@mark-petersen
Copy link
Contributor

@xylar it's compiling with --mpi=mpich on conda. I'll report with the results of the nightly suite soon, but it looks like it is working!

@mark-petersen
Copy link
Contributor

@xylar, this is great. It almost works. So far these are successful:

./conda/configure_compass_env.py --conda ~/miconda3 --mpi=mpich
source load_dev_compass_1.0.0_mpich.sh
cd E3SM-Project/components/mpas-ocean
make gfortran-clang USE_PIO2=true DEBUG=true
cd ../../..
compass suite -s -c ocean -t nightly -w ~/runs/n/210714_test_OSX -f ocean.cfg

where I've set ocean_database_root path in ocean.cfg. Then

cd ~/runs/n/210714_test_OSX
compass run

And it tries to run through the suite, but it fails all except the mesh generation.

My problem seems to be MPI on my laptop. The simple version is this:

mpirun -n 1 ./ocean_model
Fatal error in MPI_Init: Other MPI error, error stack:
MPIR_Init_thread(159)..............:
MPID_Init(164).....................: channel initialization failed
MPIDI_CH3_Init(95).................:
MPID_nem_init(314).................:
MPID_nem_tcp_init(173).............:
MPID_nem_tcp_get_business_card(395):
GetSockInterfaceAddr(369)..........: gethostbyname failed, pn1808496.lanl.gov (errno 0)

have you seen that one before? That is probably some local problem. You should go ahead and merge this PR anyway.

@xylar
Copy link
Contributor Author

xylar commented Jul 15, 2021

@mark-petersen, the error message suggests to me that it might be a proxy issue. I'm not good at debugging issues with LANL proxy settings but @vanroekel may have some suggestions, since he has just been struggling with that on his new machine.

@xylar
Copy link
Contributor Author

xylar commented Jul 15, 2021

I was able to test this with OSX in combination with MPAS-Dev/compass#171 and it worked fine for me. The Mac I was testing on didn't have 8 cores to work with, causing some decomposition tests to fail. Other tests passed.

@mark-petersen
Copy link
Contributor

From a github issue pmodels/mpich#4710 (comment) I tried this:

export MPICH_INTERFACE_HOSTNAME=localhost
mpirun -host localhost -n 4./ocean_model

and it worked. I don't know why this is a problem for me and not others, but it must be either the OS version (mine is old at 10.13) or some network setup. It was the same with VPN on or off.

Regardless, please go ahead an merge this PR. It obviously works. Thanks for doing this, @xylar.

jonbob added a commit that referenced this pull request Jul 15, 2021
…4395)

Fix standalone MPAS builds under OSX

This merge switches to the flag for including the standard c++ library
(needed by SCORPIO) under OSX to -lc++, not -lstdc++. Note that these
changes only impact MPAS standalone builds and should not affect E3SM.

OSX is also the most common platform where we use gfortran and clang
compilers. OpenMPI on OSX does not support flags -cc=clang and
-cxx=clang++. These flags also do not seem to be needed.

[BFB]
@jonbob
Copy link
Contributor

jonbob commented Jul 15, 2021

merged to next

@jonbob jonbob merged commit f019c5a into E3SM-Project:master Jul 16, 2021
@jonbob
Copy link
Contributor

jonbob commented Jul 16, 2021

merged to master

@xylar xylar deleted the mpas-framework/pio2-build-fix-osx branch July 16, 2021 14:50
@xylar
Copy link
Contributor Author

xylar commented Jul 16, 2021

Awesome, thanks @jonbob!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
BFB PR leaves answers BFB mpas-framework
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants