[847] | 1 | #!/bin/bash |
---|
[2412] | 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. |
---|
[847] | 6 | |
---|
| 7 | #0. Preliminary stuff |
---|
[2412] | 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 |
---|
[847] | 25 | |
---|
[2412] | 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) |
---|
[847] | 29 | |
---|
[2412] | 30 | # cleanup possible previous attempt: |
---|
| 31 | \rm -rf ../../IOIPSL modipsl |
---|
[847] | 32 | |
---|
[2412] | 33 | # 1. Get IOIPSL |
---|
| 34 | # move up at same level as LMDZ.COMMON , etc. |
---|
| 35 | cd ../.. |
---|
[3425] | 36 | svn co --username icmc_users --password icmc2022 --non-interactive --revision $rev http://forge.ipsl.fr/igcmg/svn/IOIPSL/trunk IOIPSL |
---|
[847] | 37 | |
---|
[2412] | 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 '' >> arch-ifort.path |
---|
| 64 | echo 'HDF5_INCDIR=""' >> arch-ifort.path |
---|
| 65 | echo 'HDF5_LIBDIR=""' >> arch-ifort.path |
---|
| 66 | echo 'HDF5_LIB=""' >> arch-ifort.path |
---|
| 67 | echo '' >> arch-ifort.path |
---|
| 68 | echo 'MPI_INCDIR=""' >> arch-ifort.path |
---|
| 69 | echo 'MPI_LIBDIR=""' >> arch-ifort.path |
---|
| 70 | echo 'MPI_LIB=""' >> arch-ifort.path |
---|
[847] | 71 | |
---|
[2811] | 72 | # 2.1 Switch ksh to bash in IOIPSL |
---|
| 73 | cd .. |
---|
| 74 | sed -i -e s:'/bin/ksh':"/bin/bash":1 ins_m_prec |
---|
| 75 | |
---|
[847] | 76 | ## 3. build ioipsl: |
---|
[2412] | 77 | ./makeioipsl_fcm -arch ifort -job 8 > makeioipsl.out 2>&1 |
---|
[847] | 78 | |
---|
[2412] | 79 | ## 4. Check if the library was indeed built: |
---|
| 80 | whereami=`pwd -P` |
---|
| 81 | if [[ -f lib/libioipsl.a ]] |
---|
[847] | 82 | then |
---|
[2412] | 83 | echo "OK: ioipsl library is in ${whereami}/lib" |
---|
[847] | 84 | else |
---|
[2412] | 85 | echo "Something went wrong... check messages in ${whereami}/makeioipsl.out" |
---|
| 86 | exit |
---|
[847] | 87 | fi |
---|
[2412] | 88 | |
---|
| 89 | ## 5. Comply with old setup and make appropriate links |
---|
| 90 | cd ../LMDZ.COMMON/ioipsl |
---|
| 91 | mkdir modipsl |
---|
| 92 | cd modipsl |
---|
| 93 | # lib + module files |
---|
| 94 | mkdir lib |
---|
| 95 | cd lib |
---|
| 96 | ln -s ../../../../IOIPSL/lib/libioipsl.a . |
---|
| 97 | ln -s ../../../../IOIPSL/inc/* . |
---|
| 98 | cd .. |
---|
| 99 | # rebuild utility |
---|
| 100 | mkdir bin |
---|
| 101 | cd bin |
---|
| 102 | ln -s ../../../../IOIPSL/bin/* . |
---|
| 103 | |
---|