mom-ocean / MOM5

The Modular Ocean Model
https://mom-ocean.github.io/
GNU Lesser General Public License v3.0
82 stars 95 forks source link

Fix the build of affinity.c on newer glibc #346

Closed martin-g closed 3 years ago

martin-g commented 3 years ago

Hello,

I am trying to build the project on Ubuntu 20.04.2 ARM64.

Running ./MOM_compile.csh --platform ubuntu --type MOM_solo fails with several errors, one of which is:

/home/ubuntu/git/2021.H2/MOM5/src/shared/mpp/affinity.c:12:14: error: static declaration of ‘gettid’ follows non-static declaration
   12 | static pid_t gettid(void)
      |              ^~~~~~
In file included from /usr/include/unistd.h:1170,
                 from /home/ubuntu/git/2021.H2/MOM5/src/shared/mpp/affinity.c:6:
/usr/include/aarch64-linux-gnu/bits/unistd_ext.h:34:16: note: previous declaration of ‘gettid’ was here
   34 | extern __pid_t gettid (void) __THROW;
      |                ^~~~~~
make: *** [Makefile:17: affinity.o] Error 1

I've borrowed the solution from https://github.com/ncbi/ncbi-vdb/issues/21#issuecomment-549140609

martin-g commented 3 years ago

After fixing this the next errors are:

f951: Warning: Nonexistent include directory ‘/usr/include/mpich2’ [-Wmissing-include-dirs]
/home/ubuntu/git/2021.H2/MOM5/src/mom5/ocean_core/ocean_types.F90:36:6:

   36 |   use coupler_types_mod,only: coupler_2d_bc_type
      |      1
Fatal Error: Cannot open module file ‘coupler_types_mod.mod’ for reading at (1): No such file or directory
compilation terminated.
/home/ubuntu/git/2021.H2/MOM5/src/mom5/ocean_tracers/ocean_tpm_util.F90:21:4:

   21 | use field_manager_mod, only: fm_string_len, fm_path_name_len
      |    1
Fatal Error: Cannot open module file ‘field_manager_mod.mod’ for reading at (1): No such file or directory
compilation terminated.
make: *** [Makefile:323: ocean_tpm_util.o] Error 1
make: *** Waiting for unfinished jobs....
make: *** [Makefile:337: ocean_types.o] Error 1
/home/ubuntu/git/2021.H2/MOM5/src/ocean_shared/generic_tracers/FMS_coupler_util.F90:11:4:

   11 | use coupler_types_mod, only : coupler_2d_bc_type, ind_flux, ind_deltap, ind_kw
      |    1
Fatal Error: Cannot open module file ‘coupler_types_mod.mod’ for reading at (1): No such file or directory
compilation terminated.
/home/ubuntu/git/2021.H2/MOM5/src/mom5/ocean_core/ocean_parameters.F90:77:6:

   77 |   use fms_mod,  only: open_namelist_file, check_nml_error, close_file
      |      1
Fatal Error: Cannot open module file ‘fms_mod.mod’ for reading at (1): No such file or directory
compilation terminated.
make: *** [Makefile:16: FMS_coupler_util.o] Error 1
make: *** [Makefile:263: ocean_parameters.o] Error 1
/home/ubuntu/git/2021.H2/MOM5/src/mom5/ocean_param/gotm-4.0/turbulence/turbulence.F90:623:9:

  623 |    num = 1.0D-6
      |         1
Warning: Change of value in conversion from ‘REAL(16)’ to ‘REAL(8)’ at (1) [-Wconversion]
/home/ubuntu/git/2021.H2/MOM5/src/mom5/ocean_param/gotm-4.0/turbulence/turbulence.F90:627:9:

  627 |    nuh = 1.0D-6
      |         1
Warning: Change of value in conversion from ‘REAL(16)’ to ‘REAL(8)’ at (1) [-Wconversion]
/home/ubuntu/git/2021.H2/MOM5/src/mom5/ocean_param/gotm-4.0/turbulence/turbulence.F90:631:9:

  631 |    nus = 1.0D-6
      |         1
Warning: Change of value in conversion from ‘REAL(16)’ to ‘REAL(8)’ at (1) [-Wconversion]
/home/ubuntu/git/2021.H2/MOM5/src/mom5/ocean_param/gotm-4.0/util/time.F90:151:0:

  151 |          start='2000-01-01 00:00:00'
      | 
Warning: array subscript 0 is outside array bounds of ‘character(kind=1)[1:19]’ [-Warray-bounds]
/home/ubuntu/git/2021.H2/MOM5/src/mom5/ocean_param/gotm-4.0/util/time.F90:151:0: Warning: array subscript 0 is outside array bounds of ‘character(kind=1)[1:19]’ [-Warray-bounds]
/home/ubuntu/git/2021.H2/MOM5/src/mom5/ocean_param/gotm-4.0/util/time.F90:36:0:

   36 |    character(len=19), public           :: start
      | 
note: while referencing ‘start’
Make failed to create lib_ocean.a

But I have no idea what to do about this missing mod.

russfiedler commented 3 years ago

Hi,

The problem here is that the compiler can't find your MPI installation. It thinks it's MPICH2 and is in /usr/include/mpich2. It's only a warning but could be pointing to a bigger problem. You'll need to customise your environs.ubuntu and mkmf.template.ubuntuhttps://github.com/mom-ocean/MOM5/blob/master/bin/mkmf.template.ubuntu to fix the paths.

Cheers, Russ


From: Martin Grigorov @.> Sent: Wednesday, 28 July 2021 9:30 PM To: mom-ocean/MOM5 @.> Cc: Subscribed @.***> Subject: Re: [mom-ocean/MOM5] Fix the build of affinity.c on newer glibc (#346)

After fixing this the next errors are:

f951: Warning: Nonexistent include directory ‘/usr/include/mpich2’ [-Wmissing-include-dirs]

/home/ubuntu/git/2021.H2/MOM5/src/mom5/ocean_core/ocean_types.F90:36:6:

36 | use coupler_types_mod,only: coupler_2d_bc_type

  |      1

Fatal Error: Cannot open module file ‘coupler_types_mod.mod’ for reading at (1): No such file or directory

compilation terminated.

/home/ubuntu/git/2021.H2/MOM5/src/mom5/ocean_tracers/ocean_tpm_util.F90:21:4:

21 | use field_manager_mod, only: fm_string_len, fm_path_name_len

  |    1

Fatal Error: Cannot open module file ‘field_manager_mod.mod’ for reading at (1): No such file or directory

compilation terminated.

make: *** [Makefile:323: ocean_tpm_util.o] Error 1

make: *** Waiting for unfinished jobs....

make: *** [Makefile:337: ocean_types.o] Error 1

/home/ubuntu/git/2021.H2/MOM5/src/ocean_shared/generic_tracers/FMS_coupler_util.F90:11:4:

11 | use coupler_types_mod, only : coupler_2d_bc_type, ind_flux, ind_deltap, ind_kw

  |    1

Fatal Error: Cannot open module file ‘coupler_types_mod.mod’ for reading at (1): No such file or directory

compilation terminated.

/home/ubuntu/git/2021.H2/MOM5/src/mom5/ocean_core/ocean_parameters.F90:77:6:

77 | use fms_mod, only: open_namelist_file, check_nml_error, close_file

  |      1

Fatal Error: Cannot open module file ‘fms_mod.mod’ for reading at (1): No such file or directory

compilation terminated.

make: *** [Makefile:16: FMS_coupler_util.o] Error 1

make: *** [Makefile:263: ocean_parameters.o] Error 1

/home/ubuntu/git/2021.H2/MOM5/src/mom5/ocean_param/gotm-4.0/turbulence/turbulence.F90:623:9:

623 | num = 1.0D-6

  |         1

Warning: Change of value in conversion from ‘REAL(16)’ to ‘REAL(8)’ at (1) [-Wconversion]

/home/ubuntu/git/2021.H2/MOM5/src/mom5/ocean_param/gotm-4.0/turbulence/turbulence.F90:627:9:

627 | nuh = 1.0D-6

  |         1

Warning: Change of value in conversion from ‘REAL(16)’ to ‘REAL(8)’ at (1) [-Wconversion]

/home/ubuntu/git/2021.H2/MOM5/src/mom5/ocean_param/gotm-4.0/turbulence/turbulence.F90:631:9:

631 | nus = 1.0D-6

  |         1

Warning: Change of value in conversion from ‘REAL(16)’ to ‘REAL(8)’ at (1) [-Wconversion]

/home/ubuntu/git/2021.H2/MOM5/src/mom5/ocean_param/gotm-4.0/util/time.F90:151:0:

151 | start='2000-01-01 00:00:00'

  |

Warning: array subscript 0 is outside array bounds of ‘character(kind=1)[1:19]’ [-Warray-bounds]

/home/ubuntu/git/2021.H2/MOM5/src/mom5/ocean_param/gotm-4.0/util/time.F90:151:0: Warning: array subscript 0 is outside array bounds of ‘character(kind=1)[1:19]’ [-Warray-bounds]

/home/ubuntu/git/2021.H2/MOM5/src/mom5/ocean_param/gotm-4.0/util/time.F90:36:0:

36 | character(len=19), public :: start

  |

note: while referencing ‘start’

Make failed to create lib_ocean.a

But I have no idea what to do about this missing mod.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHubhttps://github.com/mom-ocean/MOM5/pull/346#issuecomment-888235553, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ADA6AB7AJTCBYGPBHDPXR4DTZ7S37ANCNFSM5BEE6PBQ.

aidanheerdegen commented 3 years ago

Hi @martin-g

Your first error has been fixed in the latest update to FMS (https://github.com/mom-ocean/MOM5/pull/345) which is why your PR now has a conflict.

The GitHub Actions CI runs on ubuntu-20.04 (admittedly amd64 not not ARM64)

You can see a MOM-solo build here:

https://github.com/mom-ocean/MOM5/pull/345/checks?check_run_id=3188236344

The CI yaml config is here:

https://github.com/mom-ocean/MOM5/blob/master/.github/workflows/CI.yml

which should have enough information about the required dependencies to try and emulate that and see if it works for you.

martin-g commented 3 years ago

Thank you for the pointers! I will re-test by following the steps from CI.yml!

martin-g commented 3 years ago

By the way are you interested on extending the CI to Linux ARM64 ? It could be easily done by using self-hosted runner. Oracle Cloud provides free ARM64 VMs and the installation of GitHub Runner is just a click away. Please check https://blogs.oracle.com/cloud-infrastructure/post/announcing-github-actions-arm-runners-for-the-arm-compute-platform-on-oracle-cloud-infrastructure for more information. In short: you need to create an account at OCI and then click the "Deploy at Oracle Cloud" image in that article. Once the runner is provisioned you need to add ARM64 label to the list in CI.yml. I could provide a PR for the changes in CI.yml!