source: codes/icosagcm/trunk/make_icosa @ 171

Last change on this file since 171 was 171, checked in by ymipsl, 11 years ago
  • XIOS integration -

Compiling with "-with_xios" option. Adapt path to find XIOS library (arch.path)
Retro-compatible with the old output. If xios is not present, dynamico will use the standard writefield function.
Need to have the iodef.xml configuration file in the exec directory

YM

  • Property svn:executable set to *
File size: 2.8 KB
Line 
1#!/bin/bash
2set -x
3export PATH=$PWD/tools/FCM/bin:$PATH
4
5compil_mode_defined="FALSE"
6compil_mode="prod"
7
8job=1
9full_defined="FALSE"
10with_xios_defined="FALSE"
11arch_defined="FALSE"
12parallel_defined="FALSE"
13arch=""
14parallel="none"
15CPP_KEY="CPP_NONE" 
16ICOSA_LIB=""
17
18while (($# > 0))
19  do
20  case $1 in
21      "-h") cat <<fin
22Usage :
23makegcm [options] -m arch exec
24[-h]                       : help
25[-prod / -dev / -debug]    : compilation en mode production (default) / developpement / debug .
26 -arch nom_arch            : nom de l\'architecture cible
27fin
28          exit;;
29
30      "-prod")
31          compil_mode="prod" ; shift ;;
32
33      "-dev")
34          compil_mode="dev" ; shift ;;
35
36      "-debug")
37          compil_mode="debug" ; shift ;;
38
39      "-arch")
40          arch=$2 ; arch_defined="TRUE"; shift ; shift ;;
41
42      "-parallel")
43          parallel=$2 ; parallel_defined="TRUE"; shift ; shift ;;
44
45      "-job")
46          job=$2 ; shift ; shift;;
47
48      "-full")
49          full_defined="TRUE" ; shift ;;
50
51      "-with_xios")
52          with_xios_defined="TRUE" ; shift ;;
53
54      *)
55          code="$1" ; shift ;;
56  esac
57done
58
59rm -f .void_file
60echo > .void_file
61rm -rf .void_dir
62mkdir .void_dir
63
64if [[ "$arch_defined" == "TRUE" ]]
65then
66  rm -f arch.path
67  rm -f arch.fcm
68  rm -f arch.env
69  ln -s arch/arch-${arch}.path ./arch.path
70  ln -s arch/arch-${arch}.fcm  ./arch.fcm
71  if test -f arch/arch-${arch}.env
72    then
73      ln -s arch/arch-${arch}.env arch.env
74    else
75      ln -s .void_file arch.env
76    fi
77  source arch.env
78  source arch.path
79else
80  echo "Veuillez definir une architecture cible"
81  exit 1
82fi
83
84LD_FLAGS="%BASE_LD"
85
86if [[ "$compil_mode" == "prod" ]]
87then
88  COMPIL_FFLAGS="%PROD_FFLAGS"
89elif [[ "$compil_mode" == "dev" ]]
90then
91  COMPIL_FFLAGS="%DEV_FFLAGS"
92elif [[ "$compil_mode" == "debug" ]]
93then
94  COMPIL_FFLAGS="%DEBUG_FFLAGS"
95fi
96
97if [[ "$parallel" == "mpi" ]]
98then
99  CPP_KEY="$CPP_KEY CPP_USING_MPI"
100elif [[ "$parallel" == "omp" ]]
101then
102  CPP_KEY="$CPP_KEY CPP_USING_OMP"
103  COMPIL_FFLAGS="$COMPIL_FFLAGS %OMP_FFLAGS"
104  LD_FLAGS="$LD_FLAGS %OMP_LD"
105elif [[ "$parallel" == "mpi_omp" ]]
106then
107  CPP_KEY="$CPP_KEY CPP_USING_MPI CPP_USING_OMP"
108  LD_FLAGS="$LD_FLAGS %OMP_LD"
109elif [[ "$parallel" == "none" ]]
110then
111  parallel="none"
112else
113  echo "-parallel value $parallel is invalid, only permited <none>, <mpi>, <omp> or <mpi_omp>"
114  exit 1
115fi
116
117if [[ "$with_xios_defined" == "TRUE" ]]
118then
119  CPP_KEY="$CPP_KEY CPP_USING_XIOS"
120  COMPIL_FFLAGS="$COMPIL_FFLAGS $XIOS_INCDIR"
121  ICOSA_LIB="$ICOSA_LIB $XIOS_LIBDIR $XIOS_LIB"
122fi 
123
124ICOSA_LIB="$ICOSA_LIB $NETCDF_LIBDIR $NETCDF_LIB $HDF5_LIBDIR $HDF5_LIB"
125
126rm -f config.fcm
127
128echo "%COMPIL_FFLAGS $COMPIL_FFLAGS $NETCDF_INCDIR" >> config.fcm
129echo "%LD_FLAGS $LD_FLAGS" >> config.fcm
130echo "%CPP_KEY $CPP_KEY" >> config.fcm
131echo "%LIB $ICOSA_LIB">> config.fcm
132
133if [[ "$full_defined" == "TRUE" ]]
134then
135  ./build --job $job --full
136else
137  ./build --job $job
138fi
Note: See TracBrowser for help on using the repository browser.