Closed mjs2369 closed 9 months ago
it used to need the f2kcli module because it calls COMMAND_ARGUMENT_COUNT() and GET_COMMAND_ARGUMENT() which are defined in that module. maybe it compiles ok without them now but when it runs does it get the right values returned?
it used to need the f2kcli module because it calls COMMAND_ARGUMENT_COUNT() and GET_COMMAND_ARGUMENT() which are defined in that module. maybe it compiles ok without them now but when it runs does it get the right values returned?
The bit I'm confused about here then is that COMMAND_ARGUMENT_COUNT() and GET_COMMAND_ARGUMENT() are both Fortran intrinsics, so why do we need to write them ourselves in the f2kcli module and use them from there? https://gcc.gnu.org/onlinedocs/gfortran/COMMAND_005fARGUMENT_005fCOUNT.html https://gcc.gnu.org/onlinedocs/gfortran/GET_005fCOMMAND_005fARGUMENT.html
The function written in the f2kcli module for COMMAND_ARGUMENT_COUNT() simply calls iargc(). https://github.com/NCAR/DART/blob/74b4221e5f4e41e4de2980fc9ff8697ba4540a8b/models/wrf/WRF_DART_utilities/f2kcli.f90#L78C1-L97C42
And in this bit of documentation here it recommends just to use the intrinsic COMMAND_ARGUMENT_COUNT() instead of iargc because it is more portable. https://gcc.gnu.org/onlinedocs/gcc-4.2.4/gfortran/IARGC.html
Do you have an example of an old run of WRF_DART_utilities/add_pert_where_high_refl with the necessary files? There is no documentation for this program other than the list of command line args in the comments in the .f90 file. This would be super helpful for my testing
@nancycollins
ah - those intrinsics are new with Fortran 2003 and this code predates those routines being supported by all the compilers we had. if this builds without the f2kcli module on all the compilers we currently support then we should remove f2kcli as you did, and if there are any calls to iargc() or getarg() those should be changed to use the intrinsics. the files that seem to still be using iargc() are:
> find . -name "*f90" -exec fgrep -i iargc {} \; -print
integer, external :: iargc
./models/wrf/WRF_BC/pert_wrf_bc.f90
integer, external :: iargc
./models/wrf/WRF_BC/update_wrf_bc.f90
nargum=iargc()
./models/wrf/WRF_DART_utilities/advance_cymdh.f90
NARG = IARGC()
COMMAND_ARGUMENT_COUNT = IARGC()
ELSE IF (NUMBER > IARGC()) THEN
./models/wrf/WRF_DART_utilities/f2kcli.f90
!> versions of iargc() weren't standardized.
./assimilation_code/programs/advance_time/advance_time.f90
!if (iargc().ne.3) then
./observations/obs_converters/AIRS/L1_AMSUA_to_netcdf.f90
i just pushed a branch called pert_refl to github. it removes all the remaining references to iargc() and getarg() and uses the intrinsics, and removes unused references. in models/wrf/WRF_DART_utilities i added a "run_add_pert.sh" script and a text file "add_pert_test_input.txt" for testing the pert program. you will need to build all the wrf executables in the work dir, then change to ../WRF_DART_utilities, copy a wrfinput_d01 into that directory and then run "run_add_pert.sh". it should make a netcdf diff file that has tiny differences down in the lower left corner (using ncview on the diff file). i hope this helps.
Thanks Nancy! I'll try getting it to run.
I was able to successfully compile with all compilers (cce, intel, ifx, gfortran, nvhpc) with f2kcli removed. The f2kcli module consists of just these 2 subroutines, so this module can be removed from the repo.
In addition to the files you found these files for the NCEP obs_converter also use iargc: DART/observations/obs_converters/NCEP/prep_bufr/convert_bufr/grabbufr.f DART/observations/obs_converters/NCEP/prep_bufr/convert_bufr/arg_test.f DART/observations/obs_converters/NCEP/prep_bufr/convert_bufr/stat_test.f
This issue is directly related to #594
@nancycollins are you sure you have the commits pushed? I can see the new branch but there are no commits on it and the files you discussed are not there
ah, you're right, sorry! i didn't commit before i pushed. it's committed now. i also fixed up the convert_bufr directory that you found, and added -fallow-argument-mismatch to the NCEP build scripts for gfortran because these libs don't compile now without it. (this code is from NCEP and i'm reluctant to try to modify it because next time someone updates it those changes will be lost. it works even though there are arg mismatches in some of the calls.) let me know if i've missed something else!
Closed as completed via #619
:bug: Quickbuild failing for the wrf program WRF_DART_utilities/add_pert_where_high_refl with the cce compiler
Run
./quickbuild.sh WRF_DART_utilities/add_pert_where_high_refl
in DART/models/wrf/work with cce.quickbuild errors out
Error Message
Which model(s) are you working with?
wrf
Version of DART
v10.9.2 (latest)
Have you modified the DART code?
No
Build information
Please describe:
Derecho, cce
Potential solutions
Remove the following line: https://github.com/NCAR/DART/blob/74b4221e5f4e41e4de2980fc9ff8697ba4540a8b/models/wrf/WRF_DART_utilities/add_pert_where_high_refl.f90#L37 Don't think F2KCLI is actually used, and the program compiles successfully with this change.