NOAA-EMC / GLDAS

0 stars 4 forks source link

Build gldas_model.fd failed on Hera #48

Open MingjingTong-NOAA opened 3 weeks ago

MingjingTong-NOAA commented 3 weeks ago

I'm trying to build GLDAS on Hera. After I updated the modulefiles for Hera, i was able to compile all the source code, except gldas_model.fd. The build fails at the link step.

_interp_agrmet_sw.o: In function interp_agrmet_sw_': interp_agrmet_sw.F:(.text+0x1c97): undefined reference toipolates_' interp_cmap.o: In function interp_cmap_': interp_cmap.F:(.text+0xa55): undefined reference toipolates_' retgdas.o: In function interp_gdas_': retgdas.F:(.text+0x1c4f): undefined reference to **polates0'** retgdas.F:(.text+0x1efc): undefined reference to `polates3' gmake: *** [Makefile.noah:54: ../gldasmodel] Error 1

The ip library linked is /scratch1/NCEPDEV/nems/role.epic/spack-stack/spack-stack-1.6.0/envs/gsi-addon-dev-rocky8/install/intel/2021.5.0/ip-4.3.0-ozyjvbg/lib64/libip_4.a

I tried to add 'use ip_mod, only: ipolates' in interp_agrmet_sw.F and add the path of the include file '-I/scratch1/NCEPDEV/nems/role.epic/spack-stack/spack-stack-1.6.0/envs/gsi-addon-dev-rocky8/install/intel/2021.5.0/ip-4.3.0-ozyjvbg/include_4', but I got

../obsrads/agrmet/interp_agrmet_sw.F(176): error #6285: There is no matching specific subroutine for this generic subroutine call. [IPOLATES] call ipolates (ip,ipopt,kgdsi,kgdso,mi,mo, & -------^ compilation aborted for ../obsrads/agrmet/interp_agrmet_sw.F (code 1) gmake: *** [Makefile.noah:107: interp_agrmet_sw.o] Error 1

MingjingTong-NOAA commented 3 weeks ago

@HelinWei-NOAA Can you help me with this issue or give me some suggestions to try? Thank you so much!

HelinWei-NOAA commented 3 weeks ago

@MingjingTong-NOAA Can you point me to your working directory on hera?

MingjingTong-NOAA commented 3 weeks ago

@HelinWei-NOAA my working directory is /scratch2/GFDL/gfdlscr/Mingjing.Tong/global_workflow/shield_workflow/sorc/gldas.fd. If you go into /scratch2/GFDL/gfdlscr/Mingjing.Tong/global_workflow/shield_workflow/sorc/gldas.fd/sorc/logs, you will find build_gldas_model.log_org, which is the log of the build without changing any source code. build_gldas_model.log is the log of the build with the "use ip_mod" changes in sorc/gldas_model.fd/baseforcing/gdas.20070502/retgdas.F and sorc/gldas_model.fd/obsprecips/cmap_0.5/interp_cmap.F. Here list all the changes I made to be able to build the gldas package on Hera.

On branch master Your branch is up to date with 'origin/master'.

Changes not staged for commit: (use "git add ..." to update what will be committed) (use "git restore ..." to discard changes in working directory) modified: modulefiles/gdas2gldas.hera.lua modified: modulefiles/gldas2gdas.hera.lua modified: modulefiles/gldas_forcing.hera.lua modified: modulefiles/gldas_model.hera.lua modified: modulefiles/gldas_post.hera.lua modified: modulefiles/gldas_rst.hera.lua modified: sorc/build_all_gldas.sh modified: sorc/gdas2gldas.fd/makefile modified: sorc/gldas2gdas.fd/makefile modified: sorc/gldas_model.fd/baseforcing/gdas.20070502/retgdas.F modified: sorc/gldas_model.fd/make/Makefile.noah modified: sorc/gldas_model.fd/obsprecips/cmap_0.5/interp_cmap.F

Thank you so much!

Hang-Lei-NOAA commented 2 weeks ago

@MingjingTong-NOAA It looks like a link problem. But you seems loading the correct library versions on hera. If glads previously build fine on Hera, just do the comparation to see the difference. other ways that you can try to solve is (1) add the ip library to building flags e.g. LDFLAGS. (2)Try to check if the ip library is correctly loaded in the script from the building log, and may need to adjust the link order. @HelinWei-NOAA Has the glads group successfully run the glads on hera after Rocky8 upgrades? If you have done so, perhaps, provide her a sample will be good.

HelinWei-NOAA commented 2 weeks ago

@Hang-Lei-NOAA GLDAS has been phased out for the next GFS implementation. We don't have anyone working on it any more. So we didn't try any run after Rocky8 upgrades.

HelinWei-NOAA commented 2 weeks ago

@MingjingTong-NOAA @Hang-Lei-NOAA If I added the ip library to LDFLAGS explicitly in makefile, The compiling for interp_agrmet_sw.F went through. So as @Hang-Lei-NOAA pointed out, definitely it is a link problem.

MingjingTong-NOAA commented 2 weeks ago

@Hang-Lei-NOAA I compared the build log with an old one, which was built before transition to Rocky8. The only difference I can see is the link part, because the location of the libraries has been changed. I also checked the module loaded and confirmed that ip/4.3.0 is loaded. I tried to explicitly add the ip library to building flags (LDFLAGS) in Makefile.noah or change the link order, but none of the works for me.

@HelinWei-NOAA Can you show me your working directory and the changes you made?

HelinWei-NOAA commented 2 weeks ago

@MingjingTong-NOAA Makefile.noah was created during the building process. Your change will be overridden. What I did is just not let the script recreate Makefile.noah.

MingjingTong-NOAA commented 2 weeks ago

@HelinWei-NOAA In my case, Makefile.noah is not overwritten. You can see that I added in /scratch2/GFDL/gfdlscr/Mingjing.Tong/global_workflow/shield_workflow/sorc/gldas.fd/sorc/gldas_model.fd/make/Makefile.noah the following line. LDFLAGS += -L/scratch1/NCEPDEV/nems/role.epic/spack-stack/spack-stack-1.6.0/envs/gsi-addon-dev-rocky8/install/intel/2021.5.0/ip-4.3.0-ozyjvbg/lib64/libip_4.a

After I compile it using build_gldas_model.sh, the Makefile.noah didn't change and what I added in Makefile.noah is reflected at the end of the log file /scratch2/GFDL/gfdlscr/Mingjing.Tong/global_workflow/shield_workflow/sorc/gldas.fd/sorc/logs/build_gldas_model.log

Did I misunderstand anything?