[4410] | 1 | #!/bin/bash |
---|
| 2 | ######################################################################### |
---|
| 3 | # Defaults |
---|
| 4 | ######################################################################### |
---|
| 5 | hostname=`hostname` |
---|
| 6 | install_dir=$(pwd) |
---|
| 7 | netcdf_home="/usr/local/netcdf" |
---|
| 8 | hdf5_home="/usr/local/hdf5" |
---|
| 9 | if [ -d /usr/lib64/openmpi ] ; then |
---|
| 10 | mpi_home="/usr/lib64/openmpi" |
---|
| 11 | else |
---|
| 12 | mpi_home="/usr" |
---|
| 13 | fi |
---|
| 14 | arch="local" |
---|
| 15 | xios_rev="1786" |
---|
| 16 | ######################################################################### |
---|
| 17 | # Options |
---|
| 18 | ######################################################################### |
---|
| 19 | while (($# > 0)) |
---|
| 20 | do |
---|
| 21 | case $1 in |
---|
| 22 | "-h") cat <<........fin |
---|
| 23 | $0 [ -prefix path ] where (path) to install |
---|
| 24 | (default: $install_dir) |
---|
| 25 | [ -netcdf path ] top directory of the netcdf library |
---|
| 26 | (default: $netcdf_home) |
---|
| 27 | [ -hdf5 path ] top directory of the hdf5 library |
---|
| 28 | (default: $hdf5_home) |
---|
| 29 | [ -MPI path ] top directory of the MPI library |
---|
| 30 | (default: $mpi_home) |
---|
| 31 | [ -rev number ] XIOS revision |
---|
| 32 | (default: $xios_rev) |
---|
| 33 | [ -arch ARCH ] Use ARCH file (provided by XIOS) |
---|
| 34 | (default: make/use a local arch file) |
---|
| 35 | ........fin |
---|
| 36 | exit ;; |
---|
| 37 | "-prefix") install_dir=$2 ; shift ; shift ;; |
---|
| 38 | "-netcdf") netcdf_home=$2 ; shift ; shift ;; |
---|
| 39 | "-hdf5" ) hdf5_home=$2 ; shift ; shift ;; |
---|
| 40 | "-MPI") mpi_home=$2 ; shift ; shift ;; |
---|
| 41 | "-rev") xios_rev=$2 ; shift ; shift ;; |
---|
| 42 | "-arch") arch=$2 ; shift ; shift ;; |
---|
| 43 | *) echo "Error, bad argument $1" ; $0 -h ; exit |
---|
| 44 | esac |
---|
| 45 | done |
---|
| 46 | |
---|
| 47 | # Install directory (get full path) |
---|
| 48 | mkdir -p $install_dir |
---|
| 49 | install_dir=$(cd $install_dir ; pwd -P ) |
---|
| 50 | |
---|
| 51 | # Download XIOS |
---|
| 52 | cd $install_dir |
---|
| 53 | #svn co --revision $xios_rev http://forge.ipsl.jussieu.fr/ioserver/svn/XIOS/trunk XIOS |
---|
| 54 | #XIOS 2.5 branch |
---|
| 55 | #svn co --revision $xios_rev http://forge.ipsl.jussieu.fr/ioserver/svn/XIOS/branchs/xios-2.5 XIOS |
---|
| 56 | svn co --revision $xios_rev http://forge.ipsl.jussieu.fr/ioserver/svn/XIOS2/branches/xios-2.5 XIOS |
---|
| 57 | |
---|
| 58 | # Make arch files, if necesary: |
---|
| 59 | if [ "$arch" = "local" ] ; then |
---|
| 60 | cd $install_dir/XIOS/arch |
---|
| 61 | # arch-local.env |
---|
| 62 | echo 'export MPI_LIB="-L'${mpi_home}'/lib -lmpi"' > arch-local.env |
---|
| 63 | echo '' >> arch-local.env |
---|
| 64 | echo 'export NETCDFC='${netcdf_home} >> arch-local.env |
---|
| 65 | echo 'export NETCDFC_LIB=$NETCDFC/lib' >> arch-local.env |
---|
| 66 | echo 'export NETCDFC_INC=$NETCDFC/include' >> arch-local.env |
---|
| 67 | echo '' >> arch-local.env |
---|
| 68 | echo 'export NETCDFF='${netcdf_home} >> arch-local.env |
---|
| 69 | echo 'export NETCDFF_LIB=$NETCDFF/lib' >> arch-local.env |
---|
| 70 | echo 'export NETCDFF_INC=$NETCDFF/include' >> arch-local.env |
---|
| 71 | echo '' >> arch-local.env |
---|
| 72 | echo 'export NETCDFCXX='${netcdf_home} >> arch-local.env |
---|
| 73 | echo 'export NETCDFCXX_LIB=$NETCDFCXX/lib' >> arch-local.env |
---|
| 74 | echo 'export NETCDFCXX_INC=$NETCDFCXX/include' >> arch-local.env |
---|
| 75 | |
---|
| 76 | # arch-local.fcm |
---|
| 77 | echo '%CCOMPILER '${mpi_home}'/bin/mpicc' > arch-local.fcm |
---|
| 78 | echo '%FCOMPILER '${mpi_home}'/bin/mpif90' >> arch-local.fcm |
---|
| 79 | echo '%LINKER '${mpi_home}'/bin/mpif90' >> arch-local.fcm |
---|
| 80 | echo '' >> arch-local.fcm |
---|
| 81 | if [ ${hostname:0:5} = cicla ] ; then |
---|
| 82 | echo '%BASE_CFLAGS -w -ansi' >> arch-local.fcm |
---|
| 83 | else |
---|
| 84 | echo '%BASE_CFLAGS -w -ansi -std=c++03' >> arch-local.fcm |
---|
| 85 | fi |
---|
| 86 | echo '%PROD_CFLAGS -O3 -D BOOST_DISABLE_ASSERTS' >> arch-local.fcm |
---|
| 87 | echo '%DEV_CFLAGS -g -O2' >> arch-local.fcm |
---|
| 88 | echo '%DEBUG_CFLAGS -g -DBZ_DEBUG' >> arch-local.fcm |
---|
| 89 | echo '' >> arch-local.fcm |
---|
| 90 | echo '%BASE_FFLAGS -D__NONE__ -ffree-line-length-none' >> arch-local.fcm |
---|
| 91 | echo '%PROD_FFLAGS -O3' >> arch-local.fcm |
---|
| 92 | echo '%DEV_FFLAGS -g -O2' >> arch-local.fcm |
---|
| 93 | echo '%DEBUG_FFLAGS -g' >> arch-local.fcm |
---|
| 94 | echo '' >> arch-local.fcm |
---|
| 95 | echo '%BASE_INC -D__NONE__' >> arch-local.fcm |
---|
| 96 | echo '%BASE_LD -lstdc++ -Wl,-rpath='${mpi_home}'/lib' >> arch-local.fcm |
---|
| 97 | echo '' >> arch-local.fcm |
---|
| 98 | echo '%CPP '${mpi_home}'/bin/mpicc -EP' >> arch-local.fcm |
---|
| 99 | echo '%FPP cpp -P' >> arch-local.fcm |
---|
| 100 | echo '%MAKE make' >> arch-local.fcm |
---|
| 101 | |
---|
| 102 | # arch-local.path |
---|
| 103 | echo 'NETCDF_INCDIR="-I${NETCDFC_INC} -I${NETCDFF_INC} -I${NETCDFCXX_INC} "' > arch-local.path |
---|
| 104 | echo 'NETCDF_LIBDIR="-L${NETCDFC_LIB} -L${NETCDFF_LIB} -L${NETCDFCXX_LIB} "' >> arch-local.path |
---|
| 105 | echo 'NETCDF_LIB="-lnetcdf -lnetcdff -lnetcdf_c++4"' >> arch-local.path |
---|
| 106 | echo 'HDF5_INCDIR="-I'${hdf5_home}'/include"' >> arch-local.path |
---|
| 107 | echo 'HDF5_LIBDIR="-L'${hdf5_home}'/lib"' >> arch-local.path |
---|
| 108 | echo 'HDF5_LIB="-lhdf5_hl -lhdf5 -lhdf5 -lz -lcurl"' >> arch-local.path |
---|
| 109 | fi |
---|
| 110 | |
---|
| 111 | # make XIOS |
---|
| 112 | cd $install_dir/XIOS |
---|
| 113 | ./make_xios --arch $arch --job 8 2>&1 | tee make_xios.out |
---|
| 114 | |
---|