1 | #!/bin/bash |
---|
2 | # script to download and install the latest version of IOIPSL |
---|
3 | # using ifort |
---|
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 | source ../../ARCH/arch-MesoPSL.env |
---|
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-ifort.env |
---|
43 | # echo "export NETCDF_HOME=$NETCDF_HOME" >> arch-ifort.env |
---|
44 | # # arch.fcm file |
---|
45 | # echo '%COMPILER ifort' > arch-ifort.fcm |
---|
46 | # echo '%LINK ifort' >> arch-ifort.fcm |
---|
47 | # echo '%AR ar' >> arch-ifort.fcm |
---|
48 | # echo '%MAKE make' >> arch-ifort.fcm |
---|
49 | # echo '%FPP_FLAGS -P -traditional' >> arch-ifort.fcm |
---|
50 | # echo '%BASE_FFLAGS -real-size 64 -ip -mkl=parallel -fp-model precise -align common' >> arch-ifort.fcm |
---|
51 | # echo '%PROD_FFLAGS -O3' >> arch-ifort.fcm |
---|
52 | # echo '%DEV_FFLAGS -O2' >> arch-ifort.fcm |
---|
53 | # echo '%DEBUG_FFLAGS -fpe0 -g -no-ftz -check -traceback -ftrapuv -fp-stack-check -O0' >> arch-ifort.fcm |
---|
54 | # echo '%MPI_FFLAGS ' >> arch-ifort.fcm |
---|
55 | # echo '%OMP_FFLAGS ' >> arch-ifort.fcm |
---|
56 | # echo '%BASE_LD ' >> arch-ifort.fcm |
---|
57 | # echo '%MPI_LD ' >> arch-ifort.fcm |
---|
58 | # echo '%OMP_LD ' >> arch-ifort.fcm |
---|
59 | # # arch.path file |
---|
60 | # #echo "NETCDF_INCDIR=\"-I$NETCDF_HOME/include\"" > arch-ifort.path |
---|
61 | # #echo "NETCDF_LIBDIR=\"-L$NETCDF_HOME/lib\"" >> arch-ifort.path |
---|
62 | # #echo 'NETCDF_LIB="-lnetcdff"' >> arch-ifort.path |
---|
63 | # echo "NETCDF_LIBDIR=\"-L/obs/bcharnay/NETCDF_ifort/lib\"" > arch-ifort.path |
---|
64 | # echo "NETCDF_INCDIR=\"-I/obs/bcharnay/NETCDF_ifort/include\"" >> arch-ifort.path |
---|
65 | # echo 'NETCDF_LIB="-lnetcdf -lnetcdff"' >> arch-ifort.path |
---|
66 | |
---|
67 | # echo '' >> arch-ifort.path |
---|
68 | # echo 'HDF5_INCDIR=""' >> arch-ifort.path |
---|
69 | # echo 'HDF5_LIBDIR=""' >> arch-ifort.path |
---|
70 | # echo 'HDF5_LIB=""' >> arch-ifort.path |
---|
71 | # echo '' >> arch-ifort.path |
---|
72 | # echo 'MPI_INCDIR=""' >> arch-ifort.path |
---|
73 | # echo 'MPI_LIBDIR=""' >> arch-ifort.path |
---|
74 | # echo 'MPI_LIB=""' >> arch-ifort.path |
---|
75 | cp ../../ARCH/arch-MesoPSL.env . |
---|
76 | cp ../../ARCH/arch-MesoPSL.path . |
---|
77 | cp ../../LMDZ.COMMON/arch/arch-MesoPSL.fcm . |
---|
78 | |
---|
79 | ## 3. build ioipsl: |
---|
80 | cd .. |
---|
81 | ./makeioipsl_fcm -arch MesoPSL -job 8 > makeioipsl.out 2>&1 |
---|
82 | |
---|
83 | ## 4. Check if the library was indeed built: |
---|
84 | whereami=`pwd -P` |
---|
85 | if [[ -f lib/libioipsl.a ]] |
---|
86 | then |
---|
87 | echo "OK: ioipsl library is in ${whereami}/lib" |
---|
88 | else |
---|
89 | echo "Something went wrong... check messages in ${whereami}/makeioipsl.out" |
---|
90 | exit |
---|
91 | fi |
---|
92 | |
---|
93 | ## 5. Comply with old setup and make appropriate links |
---|
94 | cd ../LMDZ.COMMON/ioipsl |
---|
95 | mkdir modipsl |
---|
96 | cd modipsl |
---|
97 | # lib + module files |
---|
98 | mkdir lib |
---|
99 | cd lib |
---|
100 | ln -s ../../../../IOIPSL/lib/libioipsl.a . |
---|
101 | ln -s ../../../../IOIPSL/inc/* . |
---|
102 | cd .. |
---|
103 | # rebuild utility |
---|
104 | mkdir bin |
---|
105 | cd bin |
---|
106 | ln -s ../../../../IOIPSL/bin/* . |
---|
107 | |
---|