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: |
---|
18 | NETCDF_HOME="/path/to/the/NetCDF/root/directory" |
---|
19 | COMPILER="gfortran" |
---|
20 | COMPILER_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 | |
---|
26 | code=$1.F90 # default |
---|
27 | # some programs need to compile external modules |
---|
28 | if [[ "$code" == aeroptical.F90 ]] |
---|
29 | then |
---|
30 | code="aeropt_mod.F90 $code" |
---|
31 | fi |
---|
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 environement 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 | # |
---|
75 | # Example of a setup on the Irene-Rome supercomputer |
---|
76 | # module unload netcdf-c netcdf-fortran hdf5 flavor perl hdf5 boost blitz mpi gnu |
---|
77 | # module load flavor/buildcompiler/intel/20 |
---|
78 | # module load flavor/hdf5/parallel |
---|
79 | # module load netcdf-fortran/4.4.4 |
---|
80 | # module load hdf5/1.8.20 |
---|
81 | # NETCDF_HOME=$NETCDFFORTRAN_ROOT |
---|
82 | # COMPILER="ifort" |
---|
83 | # COMPILER_OPTIONS="-O2 -ip" |
---|
84 | |
---|