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

Issues to compile ESM4 #4

Open
JFA-Mbule opened this issue Apr 22, 2021 · 10 comments
Open

Issues to compile ESM4 #4

JFA-Mbule opened this issue Apr 22, 2021 · 10 comments

Comments

@JFA-Mbule
Copy link

JFA-Mbule commented Apr 22, 2021

Hello, my name is Jaime a new user. I'm trying to run the ESM4 model from GFDL and, I found some issues with the compilation process. The problem was found in the general Makefile.

I made some changes in the codes to compile. The changes allowed me to compile all subfolders in ESM4/exec/. So, the error is in the generation of the executable (esm4.1.x file). However, to examine the general Makefile and the mpp.F90 file, I found that the issue is in

<esm4.1.x: coupler/libcoupler.a atmos_dyn/libatmos_dyn.a sis2/libsis2.a atmos_cubed_sphere/libatmos_cubed_sphere.a mom6/libmom6.a icebergs/libicebergs.a lm4P/liblm4P.a atmos_phys/libatmos_phys.a fms/libfms.a
$(LD) $^ $(LDFLAGS) -o $@  $(STATIC_LIBS) >". 

The gnu.mk is not creating esm4.1.x in the general Makefile becouse the fms/libfms.a (mpp.o): in the funtion "_mpp_mod_MOD_get_peset": is not defined for this reference to "mpi_comm_create_group"

In summary the error is:

/home/jaime/ESM4_original/src/atmos_phys/atmos_param/clubb/CLUBB_core/lapack_wrap.F90:720: Undefined reference to "disnan_"
/usr/bin/ld: fms/libfms.a(mpp.o): in the funtion "__mpp_mod_MOD_get_peset":
mpp.F90:(.text+0x5134): Undefined reference to "mpi_comm_create_group_"
collect2: error: ld returned 1 exit status
make: *** [Makefile:22: esm4.1.x] Erro 1

Another information dealing with the error says that:

make [1]: Leaving the '/ home / jaime / ESM4_original / exec / coupler' directory

mpif90 coupler / libcoupler.a atmos_dyn / libatmos_dyn.a sis2 / libsis2.a atmos_cubed_sphere / libatmos_cubed_sphere.a mom6 / libmom6.a icebergs / libicebergs.a lm4P / liblm4P.a atmos_phys / libatmos_phys / libatmos_phys-lib.mos -L / usr / lib / x86_64-linux-gnu -lnetcdff -Wl, -Bsymbolic-functions -Wl, -z, clock -Wl, -z, now -lnetcdf -lnetcdf -ldl -lm -o esm4.1.x "

which seems to me that some command is not being appropriate to connect the files.

please, someone could tell me the real reason for this and how can I resolve it?
In addition, someone could tell me if is possible to create the executable (esm4.1.x file) in another way? once I've already managed to compile for other subfolders.

please someone help me!

I'm run on my laptop, Linux-ubuntu-gnu operational system.

@thomas-robinson
Copy link
Member

Please make with the option CLUBB=off

make gcc=on CLUBB=off

Add any other options you see fit. They are listen in the gnu.mk file.

I doubt you will be able to run ESM4 on a laptop. It requires a lot of compute power. Let me know if you get it to work.

@JFA-Mbule
Copy link
Author

I made this option, but the problem still persists. Is it a conflict between the flags?

I will try to run small experiments.

@thomas-robinson
Copy link
Member

Are you using the most up-to-date code? What is the exact make command you are using?

@JFA-Mbule
Copy link
Author

I think so. I'm using the code that cloning on the website.

The first I compile using only "make OPENMP=on". I also tested the other README options, but none worked, so I made any changes to the commands by adding CC = gcc and the
CXX = g ++. Afterwards I just gave "make" it compiled the subfolders, but it didn't generate the executable.

Oh, I was forgetting it, I also changed/removed the "static" command from the affinity.c file.

@thomas-robinson
Copy link
Member

It sounds like there are a bunch of edits and updates that you've made. You should only need to update gnu.mk if you aren't using mpif90 and mpicc. I compile with one of the gcc 10 compilers and mpich built with that compiler.

I suggest maybe starting over (fresh clone), editing the gnu.mk with the correct mpi compilers, and then doing

make gcc=on CLUBB=off

By compiling with CLUBB=off you will remove the lapack dependencies. If you want to run CLUBB, then that is a separate issue.

Don't set CC=gcc, you should use an mpi C compiler like mpicc. You should set it in the gnu.mk file.

If that doesn't work, let me know the libraries that aren't being linked.

@JFA-Mbule
Copy link
Author

Right, I will do that!

@JFA-Mbule
Copy link
Author

My compiler is gcc 9.3.0. I have MPI installed, so I don't understand why the errors below. Is it the version of gcc?

I didn't change anything I just cloned and gave the "make gcc=on CLUBB=off" as suggested and then I had the errors below.

mpicc -DINTERNAL_FILE_NML -Duse_libMPI -Duse_netCDF -Duse_netCDF -DHAVE_SCHED_GETAFFINITY -D__IFC -I/usr/include -I/usr/include/hdf5/serial -O2 -c /home/jaime/ESM4_Model_GFDL/src/FMS/affinity/affinity.c
f95: error: unrecognized command line option ‘-fallow-invalid-boz’
f95: error: unrecognized command line option ‘-fallow-argument-mismatch’; did you mean ‘-Wno-argument-mismatch’?
make[1]: *** [Makefile:151: platform.o] Erro 1
make[1]: ** Esperando que outros processos terminem.
f95: error: unrecognized command line option ‘-fallow-invalid-boz’
f95: error: unrecognized command line option ‘-fallow-invalid-boz’
f95: error: unrecognized command line option ‘-fallow-invalid-boz’
f95: error: unrecognized command line option ‘-fallow-invalid-boz’
f95: error: unrecognized command line option ‘-fallow-argument-mismatch’; did you mean ‘-Wno-argument-mismatch’?
make[1]: *** [Makefile:119: mersennetwister.o] Erro 1
f95: error: unrecognized command line option ‘-fallow-invalid-boz’
f95: error: unrecognized command line option ‘-fallow-invalid-boz’
f95: error: unrecognized command line option ‘-fallow-argument-mismatch’; did you mean ‘-Wno-argument-mismatch’?
f95: error: unrecognized command line option ‘-fallow-invalid-boz’
make[1]: *** [Makefile:153: quicksort.o] Erro 1
f95: error: unrecognized command line option ‘-fallow-invalid-boz’
f95: error: unrecognized command line option ‘-fallow-argument-mismatch’; did you mean ‘-Wno-argument-mismatch’?
f95: error: unrecognized command line option ‘-fallow-argument-mismatch’; did you mean ‘-Wno-argument-mismatch’?
make[1]: *** [Makefile:123: monin_obukhov_inter.o] Erro 1
make[1]: *** [Makefile:177: tridiagonal.o] Erro 1
f95: error: unrecognized command line option ‘-fallow-argument-mismatch’; did you mean ‘-Wno-argument-mismatch’?
f95: error: unrecognized command line option ‘-fallow-argument-mismatch’; did you mean ‘-Wno-argument-mismatch’?
f95: error: unrecognized command line option ‘-fallow-argument-mismatch’; did you mean ‘-Wno-argument-mismatch’?
make[1]: *** [Makefile:161: sat_vapor_pres_k.o] Erro 1
f95: error: unrecognized command line option ‘-fallow-argument-mismatch’; did you mean ‘-Wno-argument-mismatch’?
make[1]: *** [Makefile:29: cloud_interpolator.o] Erro 1
make[1]: *** [Makefile:65: drifters_io.o] Erro 1
make[1]: *** [Makefile:63: drifters_input.o] Erro 1
/home/jaime/ESM4_Model_GFDL/src/FMS/affinity/affinity.c:46:14: error: static declaration of ‘gettid’ follows non-static declaration
46 | static pid_t gettid(void)
| ^~~~~~
In file included from /usr/include/unistd.h:1170,
from /home/jaime/ESM4_Model_GFDL/src/FMS/affinity/affinity.c:33:
/usr/include/x86_64-linux-gnu/bits/unistd_ext.h:34:16: note: previous declaration of ‘gettid’ was here
34 | extern __pid_t gettid (void) __THROW;
| ^~~~~~
make[1]: *** [Makefile:13: affinity.o] Erro 1
make[1]: Saindo do diretório '/home/jaime/ESM4_Model_GFDL/exec/fms'
make: *** [Makefile:25: fms/libfms.a] Erro 2

@thomas-robinson
Copy link
Member

the file gnu.mk FFLAGS on line 85 has the options -fallow-argument-mismatch and -fallow-invalid-boz which are included for gcc10. If you are using gcc 9.3.0 you should remove those options from line 85.

@JFA-Mbule
Copy link
Author

Hi, Thomas-Robinson

I made the changes, however, It was still complaining about some libraries (lapark and mpichfort). I added these flags to the line 171 of gnu.mk file, making it look like "LDFLAGS + = $ (LIBS) -lmpichfort -lnetcdff -llapack". In addition, I had to remove the "static" from affinity.c for it to work, following the discussions I found here (NOAA-GFDL/FMS#426).

Doing this, the compilation worked and generated the file esm4.1.x with the size of 74.2 MB. However, as I said, I've been trying other options before, and one of them was using the file linux-gnu.mk and linux-ubuntu-trusty-gnu.mk. Using the file linux-ubuntu-trusty-gnu.mk, of course with the addition of the flags above, the file esm4.1.x was generated, but with a size of 86.7 MB.

Do you have any idea why this difference occur? Besides, could you tell me what is the size of the esm4.1.x file normally?

Thanks!

@JFA-Mbule
Copy link
Author

JFA-Mbule commented Jun 10, 2022 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants