-
Notifications
You must be signed in to change notification settings - Fork 148
Ubuntu compiler environment
Rob Cermak edited this page Mar 1, 2016
·
22 revisions
These instructions closely follow the instructions outlined for GFDL's HPC platforms with
Execute the following commands to install the compilation prerequisites on an Ubuntu machine:
sudo apt-get install csh
sudo apt-get install make
sudo apt-get install gfortran
sudo apt-get install openmpi-bin
sudo apt-get install libopenmpi-dev
sudo apt-get install libnetcdf-dev
sudo apt-get install netcdf-bin
The following commands make use of a file build/gnu/env
that can contain any local environment changes need for compilation:
mkdir -p build/gnu
echo > build/gnu/env
To build the Makefile use:
mkdir -p build/gnu/shared/repro/
(cd build/gnu/shared/repro/; rm -f path_names; \
../../../mkmf/bin/list_paths ../../../../src/FMS; \
../../../mkmf/bin/mkmf -t ../../../mkmf/templates/linux-gnu.mk -p libfms.a -c "-Duse_libMPI -Duse_netCDF -DSPMD" path_names)
To build the FMS library (libfms.a):
(cd build/gnu/shared/repro/; source ../../env; make NETCDF=3 REPRO=1 FC=mpif90 CC=mpicc libfms.a -j)
Notice the addition of FC=mpif90
and CC=mpicc
above, which is necessary to find the MPI header files.
To create the Makefile for compiling MOM6:
mkdir -p build/gnu/ocean_only/repro/
(cd build/gnu/ocean_only/repro/; rm -f path_names; \
../../../mkmf/bin/list_paths ./ ../../../../src/MOM6/{config_src/dynamic,config_src/solo_driver,src/{*,*/*}}/ ; \
../../../mkmf/bin/mkmf -t ../../../mkmf/templates/linux-gnu.mk -o '-I../../shared/repro' -p 'MOM6 -L../../shared/repro -lfms' -c "-Duse_libMPI -Duse_netCDF -DSPMD" path_names)
To build the MOM6 executable:
(cd build/gnu/ocean_only/repro/; source ../../env; make NETCDF=3 REPRO=1 FC=mpif90 LD=mpif90 MOM6 -j)
This time note the addition of LD=mpif90
.
For any example in ocean_only/
that does NOT have an INPUT/
directory, e.g. double_gyre:
cd ocean_only/double_gyre/
mkdir RESTART
mpirun -np 4 ../../build/gnu/ocean_only/repro/MOM6