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

Build gldas_model.fd failed on Hera #48

Open
MingjingTong-NOAA opened this issue Jun 11, 2024 · 9 comments
Open

Build gldas_model.fd failed on Hera #48

MingjingTong-NOAA opened this issue Jun 11, 2024 · 9 comments

Comments

@MingjingTong-NOAA
Copy link

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 to ipolates'
interp_cmap.o: In function interp_cmap_': interp_cmap.F:(.text+0xa55): undefined reference to ipolates_'
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: ../gldas_model] 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
Copy link
Author

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

@HelinWei-NOAA
Copy link
Collaborator

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

@MingjingTong-NOAA
Copy link
Author

@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
Copy link
Collaborator

@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
Copy link
Collaborator

@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
Copy link
Collaborator

@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
Copy link
Author

@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
Copy link
Collaborator

@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
Copy link
Author

@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?

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

3 participants