1 | #!/bin/bash |
---|
2 | # script to download and install the latest version of IOIPSL |
---|
3 | # using pgf90 |
---|
4 | # You'll probably have to change path to NetCDF library |
---|
5 | # below to adapt this script to your computer. |
---|
6 | |
---|
7 | #0. Preliminary stuff |
---|
8 | if (( $# == 0 )) |
---|
9 | then |
---|
10 | # default behavior: get latest version of IOIPSL |
---|
11 | rev="HEAD" |
---|
12 | else |
---|
13 | # but otherwise the first argument of the script can be the version to use |
---|
14 | if (( $# == 1 )) |
---|
15 | then |
---|
16 | rev=$1 |
---|
17 | else |
---|
18 | echo "Error, invalid script arguments" |
---|
19 | echo "Usage:" |
---|
20 | echo "$0 rev" |
---|
21 | echo " where optional rev is the IOIPSL revision number" |
---|
22 | exit |
---|
23 | fi |
---|
24 | fi |
---|
25 | |
---|
26 | # Where is the NetCDF library root located? Hopefully nf-config can tell us |
---|
27 | # but you might need an appropriate "module load netcdf***" beforehand |
---|
28 | NETCDF_HOME=$(nf-config --prefix) |
---|
29 | |
---|
30 | # cleanup possible previous attempt: |
---|
31 | \rm -rf ../../IOIPSL modipsl |
---|
32 | |
---|
33 | # 1. Get IOIPSL |
---|
34 | # move up at same level as LMDZ.COMMON , etc. |
---|
35 | cd ../.. |
---|
36 | svn co --username icmc_users --password icmc2022 --non-interactive --revision $rev http://forge.ipsl.jussieu.fr/igcmg/svn/IOIPSL/trunk IOIPSL |
---|
37 | |
---|
38 | # 2. Set correct settings: make some arch.* files |
---|
39 | # Ideally these arch files should be the same as the GCM's |
---|
40 | # arch.env file (add any suitable module load here) |
---|
41 | cd IOIPSL/arch |
---|
42 | echo "" > arch-pgf90.env |
---|
43 | echo "export NETCDF_HOME=$NETCDF_HOME" >> arch-pgf90.env |
---|
44 | # arch.fcm file |
---|
45 | echo '%COMPILER pgf90' > arch-pgf90.fcm |
---|
46 | echo '%LINK pgf90' >> arch-pgf90.fcm |
---|
47 | echo '%AR ar' >> arch-pgf90.fcm |
---|
48 | echo '%MAKE make' >> arch-pgf90.fcm |
---|
49 | echo '%FPP_FLAGS -P -traditional' >> arch-pgf90.fcm |
---|
50 | echo '%BASE_FFLAGS -i4 -r8' >> arch-pgf90.fcm |
---|
51 | echo '%PROD_FFLAGS -O2 -Munroll -Mnoframe -Mautoinline -Mcache_align' >> arch-pgf90.fcm |
---|
52 | echo '%DEV_FFLAGS -Mbounds' >> arch-pgf90.fcm |
---|
53 | echo '%DEBUG_FFLAGS -g -traceback -Mbounds -Mchkfpstk -Mchkstk -Ktrap=denorm,divz,fp,inv,ovf' >> arch-pgf90.fcm |
---|
54 | echo '%MPI_FFLAGS ' >> arch-pgf90.fcm |
---|
55 | echo '%OMP_FFLAGS ' >> arch-pgf90.fcm |
---|
56 | echo '%BASE_LD ' >> arch-pgf90.fcm |
---|
57 | echo '%MPI_LD ' >> arch-pgf90.fcm |
---|
58 | echo '%OMP_LD ' >> arch-pgf90.fcm |
---|
59 | # arch.path file |
---|
60 | echo "NETCDF_INCDIR=\"-I$NETCDF_HOME/include\"" > arch-pgf90.path |
---|
61 | echo "NETCDF_LIBDIR=\"-L$NETCDF_HOME/lib\"" >> arch-pgf90.path |
---|
62 | echo 'NETCDF_LIB="-lnetcdff"' >> arch-pgf90.path |
---|
63 | echo '' >> arch-pgf90.path |
---|
64 | echo 'HDF5_INCDIR=""' >> arch-pgf90.path |
---|
65 | echo 'HDF5_LIBDIR=""' >> arch-pgf90.path |
---|
66 | echo 'HDF5_LIB=""' >> arch-pgf90.path |
---|
67 | echo '' >> arch-pgf90.path |
---|
68 | echo 'MPI_INCDIR=""' >> arch-pgf90.path |
---|
69 | echo 'MPI_LIBDIR=""' >> arch-pgf90.path |
---|
70 | echo 'MPI_LIB=""' >> arch-pgf90.path |
---|
71 | |
---|
72 | ## 3. build ioipsl: |
---|
73 | cd .. |
---|
74 | ./makeioipsl_fcm -arch pgf90 -job 8 > makeioipsl.out 2>&1 |
---|
75 | |
---|
76 | ## 4. Check if the library was indeed built: |
---|
77 | whereami=`pwd -P` |
---|
78 | if [[ -f lib/libioipsl.a ]] |
---|
79 | then |
---|
80 | echo "OK: ioipsl library is in ${whereami}/lib" |
---|
81 | else |
---|
82 | echo "Something went wrong... check messages in ${whereami}/makeioipsl.out" |
---|
83 | exit |
---|
84 | fi |
---|
85 | |
---|
86 | ## 5. Comply with old setup and make appropriate links |
---|
87 | cd ../LMDZ.COMMON/ioipsl |
---|
88 | mkdir modipsl |
---|
89 | cd modipsl |
---|
90 | # lib + module files |
---|
91 | mkdir lib |
---|
92 | cd lib |
---|
93 | ln -s ../../../../IOIPSL/lib/libioipsl.a . |
---|
94 | ln -s ../../../../IOIPSL/inc/* . |
---|
95 | cd .. |
---|
96 | # rebuild utility |
---|
97 | mkdir bin |
---|
98 | cd bin |
---|
99 | ln -s ../../../../IOIPSL/bin/* . |
---|
100 | |
---|