Difference between revisions of "Compiling MOM6"

(Imported from Wikispaces)
 
(Fixed error in formatting from relocating from old site.)
Line 1: Line 1:
 +
 
There will be an easier method for compiling MOM6 on raijin in the future, in the mean time here are the instructions for building the ocean-only version:
 
There will be an easier method for compiling MOM6 on raijin in the future, in the mean time here are the instructions for building the ocean-only version:
  
=Load appropriate models=  
+
= Load appropriate models =
  
<syntaxhighlight lang=bash>
+
&nbsp;
 +
<syntaxhighlight lang="bash">
 
module load intel-fc/17.0.1.132
 
module load intel-fc/17.0.1.132
 
module load intel-cc/17.0.1.132
 
module load intel-cc/17.0.1.132
Line 10: Line 12:
 
</syntaxhighlight>
 
</syntaxhighlight>
  
=Download source code=  
+
= Download source code =
  
<syntaxhighlight lang=bash>
+
&nbsp;
 +
<syntaxhighlight lang="bash">
 
git clone --recursive https://github.com/NOAA-GFDL/MOM6-examples.git MOM6-examples
 
git clone --recursive https://github.com/NOAA-GFDL/MOM6-examples.git MOM6-examples
 
</syntaxhighlight>
 
</syntaxhighlight>
  
==Copy mkmf template==  
+
== Copy mkmf template ==
  
<syntaxhighlight lang=bash>
+
&nbsp;
 +
<syntaxhighlight lang="bash">
 
cd MOM6-examples
 
cd MOM6-examples
 
cp /short/public/aph502/mom6/mkmf.template.nci .
 
cp /short/public/aph502/mom6/mkmf.template.nci .
 
</syntaxhighlight>
 
</syntaxhighlight>
  
=Shared Libraries=  
+
= Shared Libraries =
  
==Make build directory==  
+
== Make build directory ==
<syntaxhighlight lang=bash>
+
 
 +
&nbsp;
 +
<syntaxhighlight lang="bash">
 
mkdir -p build/shared/opt
 
mkdir -p build/shared/opt
 
cd build/shared/opt
 
cd build/shared/opt
 
</syntaxhighlight>
 
</syntaxhighlight>
==Create file paths==  
+
 
<syntaxhighlight lang=bash>
+
== Create file paths ==
 +
 
 +
&nbsp;
 +
 
 
cat > make_paths<<EOF
 
cat > make_paths<<EOF
 
rm -f path_names path_names.html
 
rm -f path_names path_names.html
Line 38: Line 47:
 
chmod a+x make_paths
 
chmod a+x make_paths
 
./make_paths
 
./make_paths
[[code format="bash"]]
+
</syntaxhighlight>
 +
 
 
==Create Makefile==  
 
==Create Makefile==  
 +
<syntaxhighlight lang="bash">
 
[[code format="bash"]]
 
[[code format="bash"]]
 
cat > make_make<<EOF
 
cat > make_make<<EOF
Line 47: Line 58:
 
./make_make
 
./make_make
 
</syntaxhighlight>
 
</syntaxhighlight>
==Compile==  
+
 
<syntaxhighlight lang=bash>
+
== Compile ==
 +
 
 +
&nbsp;
 +
<syntaxhighlight lang="bash">
 
cat > make_shared<<EOF
 
cat > make_shared<<EOF
 
make NETCDF=4 OPT=1 libfms.a -j
 
make NETCDF=4 OPT=1 libfms.a -j
Line 57: Line 71:
 
cd ../../../
 
cd ../../../
 
</syntaxhighlight>
 
</syntaxhighlight>
=MOM ocean_only=
 
  
==Make build directory==  
+
You have no compiled the FMS library, continue to the next section to compile the MOM6 executable.
<syntaxhighlight lang=bash>
+
 
 +
= MOM ocean_only =
 +
 
 +
== Make build directory ==
 +
 
 +
&nbsp;
 +
<syntaxhighlight lang="bash">
 
mkdir -p build/ocean_only/opt
 
mkdir -p build/ocean_only/opt
 
cd build/ocean_only/opt
 
cd build/ocean_only/opt
 
</syntaxhighlight>
 
</syntaxhighlight>
==Create file paths==  
+
 
<syntaxhighlight lang=bash>
+
== Create file paths ==
 +
 
 +
&nbsp;
 +
<syntaxhighlight lang="bash">
 
cat > make_paths<<EOF
 
cat > make_paths<<EOF
 
rm -f path_names path_names.html
 
rm -f path_names path_names.html
Line 73: Line 95:
 
./make_paths
 
./make_paths
 
</syntaxhighlight>
 
</syntaxhighlight>
==Create Makefile==  
+
 
<syntaxhighlight lang=bash>
+
== Create Makefile ==
 +
 
 +
&nbsp;
 +
<syntaxhighlight lang="bash">
 
cat > make_make<<EOF
 
cat > make_make<<EOF
 
../../../src/mkmf/bin/mkmf -t ../../../mkmf.template.nci -o '-I../../shared/opt' -p 'MOM6 -L../../shared/opt -lfms' -c "-Duse_libMPI -Duse_netCDF -DSPMD" path_names
 
../../../src/mkmf/bin/mkmf -t ../../../mkmf.template.nci -o '-I../../shared/opt' -p 'MOM6 -L../../shared/opt -lfms' -c "-Duse_libMPI -Duse_netCDF -DSPMD" path_names
Line 81: Line 106:
 
./make_make
 
./make_make
 
</syntaxhighlight>
 
</syntaxhighlight>
==Compile==  
+
 
<syntaxhighlight lang=bash>
+
== Compile ==
 +
 
 +
&nbsp;
 +
<syntaxhighlight lang="bash">
 
cat > make_mom<<EOF
 
cat > make_mom<<EOF
 
make NETCDF=4 OPT=1 MOM6 -j
 
make NETCDF=4 OPT=1 MOM6 -j
Line 90: Line 118:
 
./make_mom
 
./make_mom
 
</syntaxhighlight>
 
</syntaxhighlight>
[[Category:mom]][[Category:mom6]][[Category:compile]]
+
 
 +
[[Category:Mom]] [[Category:Mom6]] [[Category:Compile]]

Revision as of 23:31, 1 April 2019

There will be an easier method for compiling MOM6 on raijin in the future, in the mean time here are the instructions for building the ocean-only version:

Load appropriate models

 

module load intel-fc/17.0.1.132
module load intel-cc/17.0.1.132
module load openmpi/1.10.7
module load netcdf/4.3.3.1

Download source code

 

git clone --recursive https://github.com/NOAA-GFDL/MOM6-examples.git MOM6-examples

Copy mkmf template

 

cd MOM6-examples
cp /short/public/aph502/mom6/mkmf.template.nci .

Shared Libraries

Make build directory

 

mkdir -p build/shared/opt
cd build/shared/opt

Create file paths

 

cat > make_paths<<EOF rm -f path_names path_names.html ../../../src/mkmf/bin/list_paths ../../../src/FMS/ EOF chmod a+x make_paths ./make_paths </syntaxhighlight>

Create Makefile

[[code format="bash"]]
cat > make_make<<EOF
../../../src/mkmf/bin/mkmf -t ../../../mkmf.template.nci -p libfms.a -c "-Duse_libMPI -Duse_netCDF -DSPMD" path_names
EOF
chmod a+x make_make
./make_make

Compile

 

cat > make_shared<<EOF
make NETCDF=4 OPT=1 libfms.a -j
EOF
chmod a+x make_shared
./make_shared

cd ../../../

You have no compiled the FMS library, continue to the next section to compile the MOM6 executable.

MOM ocean_only

Make build directory

 

mkdir -p build/ocean_only/opt
cd build/ocean_only/opt

Create file paths

 

cat > make_paths<<EOF
rm -f path_names path_names.html
../../../src/mkmf/bin/list_paths ../../../src/MOM6/{config_src/dynamic,config_src/solo_driver,src/{*,*/*}}/
EOF
chmod a+x make_paths
./make_paths

Create Makefile

 

cat > make_make<<EOF
../../../src/mkmf/bin/mkmf -t ../../../mkmf.template.nci -o '-I../../shared/opt' -p 'MOM6 -L../../shared/opt -lfms' -c "-Duse_libMPI -Duse_netCDF -DSPMD" path_names
EOF
chmod a+x make_make
./make_make

Compile

 

cat > make_mom<<EOF
make NETCDF=4 OPT=1 MOM6 -j

EOF
chmod a+x make_mom
./make_mom