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

Avoid compiler warning and compilation restart for KPP/fullchem/gckpp_Jacobian.F90 #1657

Merged
merged 3 commits into from Feb 17, 2023

Conversation

yantosca
Copy link
Contributor

When compiling the KPP/fullchem mechanism generated with KPP 3.0.0, we often get this compiler warning:

   48 | SUBROUTINE Jac_SP ( V, F, RCT, JVS )
      | 
note: variable tracking size limit exceeded with ‘-fvar-tracking-assignments’, retrying without

This indicates that the compilation is being restarted because the optimizer cannot keep track of the number of variable definitions in gckpp_Jacobian.F90. This causes compilation to take longer.

To avoid this, we have added code to the KPP/fullchem/CMakeLists.txt to prevent this compiler warning when KPP/fullchem/gckpp_Jacobian.F90 is being compiled. The code is only activated when building the Release or RelWithDebugInfo build types, as these options invoke the GNU Fortran optimizer, whereas Debug does not.

KPP/fullchem/gckpp_Jacobian.F90
- Since the fullchem mechanism was rebuilt with KPP 3.0.0, a compiler
  warning is triggered that there are too many variables to keep track
  for certain debug information.  We have added code to the CMakeLists.txt
  file in KPP/fullchem to disable this compilation feature when
  creating the "release" build with GNU Fortran.  This should save
  compilation time, as when the warning is encountered, the compilatio
  of the KPP/fullchem code is restarted.

Signed-off-by: Bob Yantosca <yantosca@seas.harvard.edu>
@yantosca yantosca added category: Bug Something isn't working topic: Build Related to makefiles or the build sequence labels Feb 16, 2023
@yantosca yantosca added this to the 14.1.1 milestone Feb 16, 2023
@yantosca yantosca self-assigned this Feb 16, 2023
@yantosca
Copy link
Contributor Author

Compiling with make VERBOSE=1 shows that the proper flag (-f-no-var-tracking-assignments) is applied to only KPP/fullchem/gckpp_Jacobian.F90.

... etc not shown ...
-fdefault-real-8 -fdefault-double-8 -cpp -w -std=legacy -fautomatic -fno-align-commons -fconvert=big-endian
-fno-range-check -mcmodel=medium -fbacktrace -g -DLINUX_GFORTRAN -ffree-line-length-none -O3
-funroll-loops -fopenmp -fno-var-tracking-assignments
-c /local/ryantosca/GC/rundirs/epa-kpp/test_build/CodeDir/src/GEOS-Chem/KPP/fullchem/gckpp_Jacobian.F90
-o CMakeFiles/KPP.dir/gckpp_Jacobian.F90.o

@yantosca
Copy link
Contributor Author

GEOS-Chem Classic integration tests all passed

==============================================================================
GEOS-Chem Classic: Execution Test Results

GCClassic #19bdf09 GEOS-Chem submod update: Merge PR #1643 and PR #1644 into 14.1.1
GEOS-Chem #6afa713f6 Avoid compiler warning and compilation restart for gckpp_Jacobian.F90
HEMCO     #16541aa Update changelog for version release

Using 24 OpenMP threads
Number of execution tests: 26

Submitted as SLURM job: 42518927
==============================================================================
 
Execution tests:
------------------------------------------------------------------------------
gc_05x0625_NA_47L_merra2_CH4........................Execute Simulation....PASS
gc_05x0625_NA_47L_merra2_fullchem...................Execute Simulation....PASS
gc_4x5_47L_merra2_fullchem..........................Execute Simulation....PASS
gc_4x5_47L_merra2_fullchem_TOMAS15..................Execute Simulation....PASS
gc_4x5_47L_merra2_fullchem_TOMAS40..................Execute Simulation....PASS
gc_4x5_merra2_aerosol...............................Execute Simulation....PASS
gc_4x5_merra2_carbon................................Execute Simulation....PASS
gc_4x5_merra2_CH4...................................Execute Simulation....PASS
gc_4x5_merra2_CO2...................................Execute Simulation....PASS
gc_4x5_merra2_fullchem..............................Execute Simulation....PASS
gc_4x5_merra2_fullchem_aciduptake...................Execute Simulation....PASS
gc_4x5_merra2_fullchem_APM..........................Execute Simulation....PASS
gc_4x5_merra2_fullchem_benchmark....................Execute Simulation....PASS
gc_4x5_merra2_fullchem_complexSOA...................Execute Simulation....PASS
gc_4x5_merra2_fullchem_complexSOA_SVPOA.............Execute Simulation....PASS
gc_4x5_merra2_fullchem_LuoWd........................Execute Simulation....PASS
gc_4x5_merra2_fullchem_marinePOA....................Execute Simulation....PASS
gc_4x5_merra2_fullchem_RRTMG........................Execute Simulation....PASS
gc_4x5_merra2_Hg....................................Execute Simulation....PASS
gc_4x5_merra2_metals................................Execute Simulation....PASS
gc_4x5_merra2_POPs_BaP..............................Execute Simulation....PASS
gc_4x5_merra2_tagCH4................................Execute Simulation....PASS
gc_4x5_merra2_tagCO.................................Execute Simulation....PASS
gc_4x5_merra2_tagO3.................................Execute Simulation....PASS
gc_4x5_merra2_TransportTracers......................Execute Simulation....PASS
gc_4x5_merra2_TransportTracers_LuoWd................Execute Simulation....PASS
 
Summary of test results:
------------------------------------------------------------------------------
Execution tests passed: 26
Execution tests failed: 0
Execution tests not yet completed: 0

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%  All execution tests passed!  %%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

run/GCHP/createRunDir.sh
- The "Created ${rundir}" sentence was being printed out twice.  This
  was causing issues in the GCHP integration tests because the
  "create_rundir" script in test/shared/commonFunctionsForTests.sh
  looks for this output to get the absolute path of the run directory.
  This was causing text replacement in the ./setCommonRunSettings.sh
  script not to be done correctly.  Now fixed.

Signed-off-by: Bob Yantosca <yantosca@seas.harvard.edu>
@yantosca
Copy link
Contributor Author

GCHP integration tests failed due to a bug in the run/GCHP/createRunDir.sh script. The run directory path was printed twice, which confused a grep command used by the create_rundir function in test/shared/commonFunctionsForTests.sh. This duplicate print statement has been removed, which fixes the issue. GCHP integration tests have been restarted.

@@ -61,3 +61,17 @@ target_compile_options(KPP
$<$<STREQUAL:"${CMAKE_Fortran_COMPILER_ID}","Intel">:-r8>
$<$<STREQUAL:"${CMAKE_Fortran_COMPILER_ID}","GNU">:-fdefault-real-8 -fdefault-double-8>
)

# FOR GFORTRAN ONLY: Disable variable tracking for gckpp_Jacobian.F90 in the
# KPP/fullchem mechanism generated with KPP 3.0.0. This will avoid a compiler
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we should remove the version number so that the text doesn't get outdated.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @lizziel. I can do that.

Copy link
Contributor

@lizziel lizziel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added a comment just as a suggestion. I tested this update out and my gfortran build no longer had the warning message.

@yantosca
Copy link
Contributor Author

GCHP execution tests all passed except tagO3. There is an outstanding issue in that simulation that we need to address,
but it shouldn't prevent us from merging.

==============================================================================
GCHP: Execution Test Results

GCClassic #646fce2 Fixed MAPL bug preventing restarting stretched grid simulations
GEOS-Chem #5cf1ae03a Remove duplicate "Created rundir" printout in run/GCHP/createRunDir.sh
HEMCO     #cf7d4ed GEOS-only updates by Christoph Keller

Number of execution tests: 5

Submitted as SLURM job: 42707332
==============================================================================
 
Execution tests:
------------------------------------------------------------------------------
gchp_merra2_fullchem................................Execute Simulation....PASS
gchp_merra2_fullchem_benchmark......................Execute Simulation....PASS
gchp_merra2_fullchem_RRTMG..........................Execute Simulation....PASS
gchp_merra2_tagO3...................................Execute Simulation....FAIL
gchp_merra2_TransportTracers........................Execute Simulation....PASS
 
Summary of test results:
------------------------------------------------------------------------------
Execution tests passed: 4
Execution tests failed: 1
Execution tests not yet completed: 0

KPP/fullchem/CMakeLists.txt
- Removed "3.0.0" from comment so as not to "peg" this modification
  to a specific version of KPP.

CHANGELOG.md
- Updated accordingly

Signed-off-by: Bob Yantosca <yantosca@seas.harvard.edu>
@yantosca yantosca merged commit a688a3f into dev/14.1.1 Feb 17, 2023
@yantosca yantosca deleted the bugfix/gfortran-compile-flags branch February 17, 2023 17:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category: Bug Something isn't working topic: Build Related to makefiles or the build sequence
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants