source: trunk/LMDZ.COMMON/ioipsl/install_ioipsl_gfortran.bash @ 2757

Last change on this file since 2757 was 2657, checked in by emillour, 3 years ago

Update IOIPSL install scripts : add user/passwd to the subversion checkout.
EM

  • Property svn:executable set to *
File size: 3.4 KB
Line 
1#!/bin/bash
2# script to download and install the latest version of IOIPSL
3# using gfortran
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
8if (( $# == 0 ))
9then
10  # default behavior: get latest version of IOIPSL
11  rev="HEAD"
12else
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
24fi
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
28NETCDF_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.
35cd ../..
36svn 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)
41cd IOIPSL/arch
42echo "" > arch-gfortran.env
43echo "export NETCDF_HOME=$NETCDF_HOME" >> arch-gfortran.env
44# arch.fcm file
45echo '%COMPILER            gfortran' > arch-gfortran.fcm
46echo '%LINK                gfortran' >> arch-gfortran.fcm
47echo '%AR                  ar' >> arch-gfortran.fcm
48echo '%MAKE                make' >> arch-gfortran.fcm
49echo '%FPP_FLAGS           -P -traditional' >> arch-gfortran.fcm
50echo '%BASE_FFLAGS         -c -fdefault-real-8 -fdefault-double-8 -ffree-line-length-none -fno-align-commons -fcray-pointer' >> arch-gfortran.fcm
51echo '%PROD_FFLAGS         -O3' >> arch-gfortran.fcm
52echo '%DEV_FFLAGS          -O -Wall -fbounds-check' >> arch-gfortran.fcm
53echo '%DEBUG_FFLAGS        -ffpe-trap=invalid,zero,overflow -fbounds-check -g3 -O0 -fstack-protector-all -finit-real=snan -fbacktrace' >> arch-gfortran.fcm
54echo '%MPI_FFLAGS          ' >> arch-gfortran.fcm
55echo '%OMP_FFLAGS          ' >> arch-gfortran.fcm
56echo '%BASE_LD             ' >> arch-gfortran.fcm
57echo '%MPI_LD              ' >> arch-gfortran.fcm
58echo '%OMP_LD              ' >> arch-gfortran.fcm
59# arch.path file
60echo "NETCDF_INCDIR=\"-I$NETCDF_HOME/include\"" > arch-gfortran.path
61echo "NETCDF_LIBDIR=\"-L$NETCDF_HOME/lib\"" >> arch-gfortran.path
62echo 'NETCDF_LIB="-lnetcdff"' >> arch-gfortran.path
63echo '' >> arch-gfortran.path
64echo 'HDF5_INCDIR=""' >> arch-gfortran.path
65echo 'HDF5_LIBDIR=""' >> arch-gfortran.path
66echo 'HDF5_LIB=""' >> arch-gfortran.path
67echo '' >> arch-gfortran.path
68echo 'MPI_INCDIR=""' >> arch-gfortran.path
69echo 'MPI_LIBDIR=""' >> arch-gfortran.path
70echo 'MPI_LIB=""' >> arch-gfortran.path
71
72## 3. build ioipsl:
73cd ..
74./makeioipsl_fcm -arch gfortran -job 8 > makeioipsl.out 2>&1
75
76## 4. Check if the library was indeed built:
77whereami=`pwd -P`
78if [[ -f lib/libioipsl.a ]] 
79  then
80  echo "OK: ioipsl library is in ${whereami}/lib"
81else
82  echo "Something went wrong... check messages in ${whereami}/makeioipsl.out"
83  exit
84fi
85
86## 5. Comply with old setup and make appropriate links
87cd ../LMDZ.COMMON/ioipsl
88mkdir modipsl
89cd modipsl
90# lib + module files
91mkdir lib
92cd lib
93ln -s ../../../../IOIPSL/lib/libioipsl.a .
94ln -s ../../../../IOIPSL/inc/* .
95cd ..
96# rebuild utility
97mkdir bin
98cd bin
99ln -s ../../../../IOIPSL/bin/* .
100
Note: See TracBrowser for help on using the repository browser.