source: codes/icosagcm/trunk/make_icosa @ 328

Last change on this file since 328 was 327, checked in by ymipsl, 9 years ago

Merge recent developments from saturn branch onto trunk.

  • lmdz generic physics interface
  • performance improvment on mix mpi/openmp
  • asynchrone and overlaping communication
  • best domain distribution between process and threads
  • ....

This version is compatible with the actual saturn version and the both branches are considered merged on dynamico component.

YM

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