-
Notifications
You must be signed in to change notification settings - Fork 151
Description
Summary
When building WRF 4.6.1 & 4.7.1 with WRF-Hydro coupling, selecting Intel compilers (ifort, ifx, icx) during ./configure did not produce a valid Hydro configuration. The root cause was missing and unreachable compiler stanzas in Hydro’s configuration script. This prevented successful builds with Intel’s oneAPI compilers, even though top-level WRF recognized them.
Investigation Timeline
- Running WRF ./configure
File:
WRF-4.7.1/configure
Description:
Presents the list of compiler options (1–83) for Linux x86_64 builds.
Observations:
Options 15, 16, 66, 78 correspond to Intel compilers (ifort/icc or ifx/icx).
WRF generated correct configure.wrf entries for ifort and ifx.
When Hydro was triggered (building WRF-HYDRO), configuration failed for ifx.
2. Reviewing Generated WRF Config Files
Files:
WRF-4.7.1/configure.wrf
WRF-4.7.1/hydro/macros
WRF-4.7.1/hydro/Makefile
Description:
These files contain the final compiler/linker settings.
Observations:
With Intel selections, configure.wrf correctly showed ifort or ifx.
However, Hydro’s generated files (macros, Makefile) were either incomplete or missing required Intel flags.
3. Inspecting Hydro Configuration Scripts
Files in Hydro directory:
WRF-4.7.1/hydro/configure
WRF-4.7.1/hydro/wrf_hydro_config
hydro/configure
: small wrapper that invokes the Perl helper.
hydro/wrf_hydro_config (Perl script):
Original content supported only:
pgi
aix
gfortran
ifort
No handling for "intel".
Multiple unconditional lines like:
print "Error : option not defined. \n";
exit(1);
appeared after each stanza, which caused the script to exit before reaching any new checks appended at the bottom.
4. Debugging the Perl Script
File modified:
WRF-4.7.1/hydro/wrf_hydro_config
Debug step: inserted temporary print statements to check what ./configure passed into $x and $paropt.
Example:
print "DEBUG: raw x='$x', paropt='$paropt'\n";
Observation:
For Intel options (66, 78), $x was passed as "intel" or "ifort".
Confirmed Hydro never matched intel because no stanza existed.
Root Cause
Missing stanza for "intel" compilers in wrf_hydro_config.
Premature exit statements after the ifort block prevented appended intel checks at the bottom of the script from executing.
Fix Implemented
File Modified:
WRF-4.7.1/hydro/wrf_hydro_config
Changes:
Removed unconditional exit(1) blocks between stanzas.
Added a new stanza for Intel compilers before the final error fallback.
if($x =~ "intel") {
if($paropt eq 'serial') {
print "Error : option not defined. \n";
exit(1);
}
else {
system("./configure 3");
exit(0);
}
}
Final Fallback:
Left a single unconditional error handler at the very bottom:
print "Error : option not defined. \n";
exit(1);
Outcome
Intel compilers (ifort, ifx/icx) are now recognized by Hydro’s config system.
Builds using WRF options 15, 16, 66, 78 succeed.
Generated Hydro files (hydro/macros, hydro/Makefile) are written correctly.
The new intel stanza is required — it was not present in the original script.
Files Examined
Top-level WRF configure system
WRF-4.7.1/configure
WRF-4.7.1/configure.wrf
Hydro configuration system
WRF-4.7.1/hydro/configure
WRF-4.7.1/hydro/wrf_hydro_config (modified)
WRF-4.7.1/hydro/macros
WRF-4.7.1/hydro/Makefile
Recommendation
Upstream should update WRF-4.7.1/hydro/wrf_hydro_config to include explicit handling of "intel" compilers, in parallel with the existing ifort block, and remove redundant premature error exits. This ensures full compatibility with Intel oneAPI compilers across all supported Hydro builds.
#!/usr/bin/perl
#input argument: Compiler/System sequential/parallel
#This is called by WRF configuration only.
if($#ARGV ne 1) {
print("Error: No such configuration for Hydro \n");
exit(1);
}
$x = lc(shift(@ARGV));
$paropt = lc(shift(@ARGV));
print("Configure option for Hydro : $x $paropt \n");
if($x =~ "pgi") {
if($paropt eq 'serial') {
# system("./configure 1");
print "Error : option not defined in WRF-Hyro. \n";
exit(1);
}
else {system("./configure 1"); exit(0);}
}
if($x =~ "aix") {
print "Error : option not defined. \n";
exit(1);
if($paropt eq 'serial') { system("./configure 3");}
else {system("./configure 4");}
}
if($x =~ "gfortran") {
if($paropt eq 'serial') {
# system("./configure 5");
print "Error : option not defined in WRF-Hyro. \n";
exit(1);
}
else {system("./configure 2"); exit(0);}
}
if($x =~ "ifort") {
if($paropt eq 'serial') {
#system("./configure 7");
print "Error : option not defined. \n";
exit(1);
}
else {system("./configure 3"); exit(0);}
}
if($x =~ "intel") {
if($paropt eq 'serial') {
#system("./configure 7");
print "Error : option not defined. \n";
exit(1);
}
else {system("./configure 3"); exit(0);}
}
print "Error : option not defined. \n";
exit(1);
I am not sure how to create a pull request so if you can make one after testing this fix and reference this issue that would be helpful