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

Chemistry preprocessor compiler fixes for Cori #3045

Merged
merged 3 commits into from
Aug 8, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
109 changes: 109 additions & 0 deletions components/cam/chem_proc/inputs/pp_linoz_mam4_resus_mom_soag.inp
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
BEGSIM
output_unit_number = 7
output_file = linoz_mam4_resus_mom_soag.doc
procout_path = ../output/
src_path = ../bkend/
procfiles_path = ../procfiles/cam/
sim_dat_path = ../output/
sim_dat_filename = linoz_mam4_resus_mom_soag.dat

Comments
E3SMv1 DECK chemistry.
End Comments

SPECIES

Solution
O3
H2O2, H2SO4, SO2, DMS -> CH3SCH3, SOAG -> C
so4_a1 -> NH4HSO4
pom_a1 -> C, soa_a1 -> C, bc_a1 -> C
dst_a1 -> AlSiO5, ncl_a1 -> NaCl
mom_a1 -> C8520H11360O8520
num_a1 -> H
so4_a2 -> NH4HSO4
soa_a2 -> C, ncl_a2 -> NaCl
mom_a2 -> C8520H11360O8520
num_a2 -> H
dst_a3 -> AlSiO5, ncl_a3 -> NaCl
so4_a3 -> NH4HSO4
bc_a3 -> C, pom_a3 -> C
soa_a3 -> C
mom_a3 -> C8520H11360O8520
num_a3 -> H
pom_a4 -> C, bc_a4 -> C
mom_a4 -> C8520H11360O8520
num_a4 -> H
End Solution

Fixed
M, N2, O2, H2O, OH, NO3, HO2, cnst_O3 -> O3
End Fixed

Col-int
O3 = 0.
O2 = 0.
End Col-int

End SPECIES

Solution Classes
Explicit
O3
End Explicit
Implicit
H2O2, H2SO4, SO2, DMS, SOAG
so4_a1, pom_a1
soa_a1, bc_a1, dst_a1, ncl_a1
mom_a1
num_a1
so4_a2, soa_a2, ncl_a2, mom_a2, num_a2
dst_a3, ncl_a3, so4_a3
bc_a3, pom_a3, soa_a3, mom_a3, num_a3
pom_a4, bc_a4, mom_a4, num_a4
End Implicit
End Solution Classes

CHEMISTRY
Photolysis
[jh2o2] H2O2 + hv ->
End Photolysis

Reactions
[usr_HO2_HO2] HO2 + HO2 -> H2O2
H2O2 + OH -> H2O + HO2 ; 2.9e-12, -160
[usr_SO2_OH] SO2 + OH -> H2SO4
DMS + OH -> SO2 ; 9.6e-12, -234.
[usr_DMS_OH] DMS + OH -> .5 * SO2 + .5 * HO2
DMS + NO3 -> SO2 + HNO3 ; 1.9e-13, 520.
End Reactions

Ext Forcing
SO2 <- dataset
so4_a1 <- dataset
so4_a2 <- dataset
pom_a4 <- dataset
bc_a4 <- dataset
num_a1 <- dataset
num_a2 <- dataset
num_a4 <- dataset
SOAG <- dataset
End Ext Forcing

END CHEMISTRY

SIMULATION PARAMETERS

Version Options
model = cam
machine = intel
architecture = hybrid
vec_ftns = on
multitask = on
namemod = on
modules = on
End Version Options

END SIMULATION PARAMETERS

ENDSIM
5 changes: 4 additions & 1 deletion components/cam/chem_proc/src/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -140,11 +140,14 @@ ifeq ($(COMPILER),xlf95)
FFLAGS := -g -c -qarch=auto -qnosave -qfree=f90 -qmoddir=$(OBJ_DIR) -I $(OBJ_DIR) -qstrict -O3
endif
ifeq ($(COMPILER),gfortran)
FFLAGS := -g -c -ffree-form
FFLAGS := -g -c -ffree-form -J $(OBJ_DIR)
Copy link
Contributor

Choose a reason for hiding this comment

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

I do not know about this -J flag. The code works without this new addition. Is there a reason this was added?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The -J flag controls where the intermediate compiled files go. Without the -J flag they clogged up the src directory. The -J flag puts them in a separate directory $(OBJ_DIR), which I think has been the historical place for them. Hence, it is not strictly necessary, but it is valuable and increases consistency across different compilers without any downside. Hence, I recommend we keep it in the PR.

Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks! It works for gfortran but it doesn't do anything if we use Intel. Line 143 above (# FFLAGS := -g -c -ffree-form) is not doing anything. Is it okay if I remove it?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, you can remove the commented line. I was keeping it while I was testing new options. Since I ended up just adding an extra option (-J) there seems little value in keeping the original line around. Can you remove it? Or do you need me to do it?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I just removed the commented out line, for clarity.

endif
ifeq ($(COMPILER),g95)
FFLAGS := -g -c -ffree-form
endif
ifeq ($(COMPILER),ftn)
FFLAGS := -f free
endif

#------------------------------------------------------------------------
#------------------------------------------------------------------------
Expand Down
3 changes: 2 additions & 1 deletion components/cam/chem_proc/src/cam_chempp/mozpp.main.f
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,8 @@ program mozart_pp
sim_dat_filename = 'sim.dat'
sim_dat_filespec = trim(sim_dat_path) // 'sim.dat'
cpp_dir = ' '
cpp_opts = '-P -C -I.'
! cpp_opts = '-P -C -I.' ! -C causes problems on Cori
cpp_opts = '-P -I. -traditional-cpp' ! Works on Cori (2019-07-15)
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we can just remove the -C flag. Also, we should just get rid of the commented-out line.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Did you diff the fortran files to those archived in src/chemistry ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

My personal preference is to leave in (as comments) things that may be relevant to getting the pre-processor to work an another machine. It is a cheap alternative to IF statements for different machines.

Copy link
Contributor

Choose a reason for hiding this comment

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

Agreed. Lets keep it the way it is.


!-----------------------------------------------------------------------
! ... Assign default input, output units
Expand Down
44 changes: 44 additions & 0 deletions components/cam/chem_proc/src/make_chempp.cori
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
#!/bin/csh

### This version Cori 2017-07-206.

set exenam=cam_chempp
set objdir=OBJ

rm -f ../bin/$exenam
rm -f $objdir/*

mkdir -p $objdir
mkdir -p ../bin

# When running the eventual binary it wants to write into a various
# directories, but it dies if those directories don't exist. The easy
# solution is to create the default directories here. This will fail
# if a non-standard directory is used, but this seems pretty safe.
mkdir -p ../tmp
mkdir -p ../output

#gmake COMPILER=lf95 DEBUG=TRUE EXENAME=cam_chempp

###For Cori:
module unload PrgEnv-pgi
module unload PrgEnv-cray
module unload PrgEnv-gnu
module unload PrgEnv-intel

#module load PrgEnv-pgi
#gmake COMPILER=pgf95 DEBUG=TRUE EXENAME=cam_chempp

#module load PrgEnv-pgi
#gmake COMPILER=gfortran DEBUG=TRUE EXENAME=cam_chempp

#module load PrgEnv-intel
#gmake COMPILER=ifort DEBUG=TRUE EXENAME=cam_chempp

#module load PrgEnv-cray
#gmake COMPILER=ftn DEBUG=TRUE EXENAME=cam_chempp

module load PrgEnv-gnu
gmake COMPILER=gfortran DEBUG=TRUE EXENAME=cam_chempp

# --- end of file ---