source: trunk/LMDZ.MARS/util/compile @ 3325

Last change on this file since 3325 was 3071, checked in by abierjon, 14 months ago

Mars GCM:
Add an example of setup in util/compile to compile utilitary programs on Adastra supercomputer.
Warning: on Adastra, you need to add the netcdf library path to LD_LIBRARY_PATH before running the executable
(export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$NETCDF_DIR/lib)

AB

  • Property svn:executable set to *
File size: 3.6 KB
Line 
1# The following script can be used to compile one of the utilities
2# program. Example of use :
3# > compile concat
4# > compile zrecast
5## BUT first you must customize this script to your personal settings:
6# 1) set up the correct environment; e.g. environment variable
7#    NETCDF_HOME should point to your NetCDF distribution root directory
8#    (and possibly you might need to "module load ..." a few things)
9# 2) put the appropriate compiler and compiler options
10#    in variables COMPILER and COMPILER_OPTIONS
11# 3) Note that when you will run the executable, you might need to
12#    also add the paths to the used libraries (e.g. $NETCDF_HOME/lib)
13#    in environment variable LD_LIBRARY_PATH (most often the "module load ..."
14#    command does this, so you should run it before running the executable)
15
16# Setup: (see at the end of this script for real world examples)
17# possibly source some modules here and adapt variables below:
18NETCDF_HOME="/path/to/the/NetCDF/root/directory"
19COMPILER="gfortran"
20COMPILER_OPTIONS="-O2"
21
22# Compilation:
23# (on some very old systems the Fortran NetCDF library is included
24#  in the C library and "-lnetcdff" should be replaced with "-lnetcdf")
25
26code=$1.F90 # default
27# some programs need to compile external modules
28if [[ "$code" == aeroptical.F90 ]]
29then
30  code="aeropt_mod.F90 $code"
31fi
32
33$COMPILER $COMPILER_OPTIONS $code \
34-I$NETCDF_HOME/include \
35-L$NETCDF_HOME/lib -lnetcdff \
36-o $1.e
37
38#
39# Example of a setup on a simple Linux system where the netcdf library
40# is in a personal location /home/myacount/netcdf directory:
41# NETCDF_HOME=/home/myaccount/netcdf
42# COMPILER="gfortran"
43# COMPILER_OPTIONS="-O2"
44# And of course the LD_LIBRARY_PATH environment variable should contain
45# path "/home/myaccount/netcdf/lib" to be able to run the executable
46#
47# Example of a setup on LMD CentOS7 machines using gfortran and NetCDF 4.5:
48# module purge
49# module load gnu/7.2.0
50# module load netcdf4/4.5.0-gfortran72
51# NETCDF_HOME=/opt/netcdf45/gfortran72
52# COMPILER="gfortran"
53# COMPILER_OPTIONS="-O2"
54# And of course modules above need be loaded before running the executable
55#
56# Example of a setup on the Ciclad cluster using ifort and NetCDF 4.3
57# module purge
58# module load intel/15.0.6.233
59# module load netcdf4/4.3.3.1-ifort
60# NETCDF_HOME=/opt/netcdf43/ifort
61# COMPILER="ifort"
62# COMPILER_OPTIONS="-O2 -ip"
63# And of course modules above need be loaded before running the executable
64#
65# Example of a setup on the Occigen supercomputer
66# module purge
67# module load intel/17.0
68# module load intelmpi/2017.0.098
69# module load hdf5/1.8.17
70# module load netcdf/4.4.0_fortran-4.4.2
71# NETCDF_HOME=$NETCDFHOME
72# COMPILER="ifort"
73# COMPILER_OPTIONS="-O2 -ip"
74# And of course modules above need be loaded before running the executable
75#
76# Example of a setup on the Irene-Rome supercomputer
77# module unload netcdf-c netcdf-fortran hdf5 flavor perl hdf5 boost blitz mpi gnu
78# module load flavor/buildcompiler/intel/20
79# module load flavor/hdf5/parallel
80# module load netcdf-fortran/4.4.4
81# module switch hdf5/1.8.20
82# NETCDF_HOME=$NETCDFFORTRAN_ROOT
83# COMPILER="ifort"
84# COMPILER_OPTIONS="-O2 -ip"
85# And of course modules above need be loaded before running the executable
86#
87# Example of a setup on the Adastra supercomputer with ifort
88# module purge
89# module load PrgEnv-intel/8.4.0
90# module load cray-hdf5-parallel/1.12.2.1
91# module load cray-netcdf-hdf5parallel/4.9.0.1
92# NETCDF_HOME=$NETCDF_DIR
93# COMPILER="ifort"
94# COMPILER_OPTIONS="-O2 -ip"
95# And of course modules above need be loaded before running the executable
96# + on Adastra, add the netcdf library path to LD_LIBRARY_PATH before running the executable:
97# export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$NETCDF_DIR/lib
98
Note: See TracBrowser for help on using the repository browser.