source: palm/trunk/LIB/rrtmg/install_rrtmg @ 3943

Last change on this file since 3943 was 3943, checked in by maronga, 5 years ago

bugfixes in urban surface model; output of greenz roof transpiration added/corrected; minor formatting improvements

  • Property svn:executable set to *
  • Property svn:keywords set to Id
File size: 7.9 KB
Line 
1#!/bin/ksh
2
3# install_rrtmg - install script for creating a RRTMG library
4
5#--------------------------------------------------------------------------------#
6# This file is part of the PALM model system.
7#
8# PALM is free software: you can redistribute it and/or modify it under the terms
9# of the GNU General Public License as published by the Free Software Foundation,
10# either version 3 of the License, or (at your option) any later version.
11#
12# PALM is distributed in the hope that it will be useful, but WITHOUT ANY
13# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
14# A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
15#
16# You should have received a copy of the GNU General Public License along with
17# PALM. If not, see <http://www.gnu.org/licenses/>.
18#
19# Copyright 1997-2018  Leibniz Universitaet Hannover
20#--------------------------------------------------------------------------------#
21#
22# Current revisions:
23# ------------------
24#
25#
26# Former revisions:
27# -----------------
28# $Id: install_rrtmg 3943 2019-05-02 09:50:41Z maronga $
29#
30# 1613 2015-07-08 14:53:29Z maronga
31# Bugfix: compilation of shared library fails due to misplaced rm command
32#
33# 1585 2015-04-30 07:05:52Z maronga
34# Initial revision
35#
36#--------------------------------------------------------------------------------#
37# install_rrtmg - install script for creating a RRTMG library
38#--------------------------------------------------------------------------------#
39
40# the following variables must be modified for the local system according to
41# .mrun.config
42#
43# Example 1 (lcmuk):
44# compiler_name="mpif90"
45# fopts="-fltconsistency -O3 -cpp -r8 -nbs -convert little_endian -I /muksoft/packages/netcdf/4_intel/include"
46# fopts_trace="-fpe0 -C -check nooutput_conversion -debug -traceback -g -w -xT -O0 -ftz -fno-alias -no-prec-div -no-prec-sqrt -ip -nbs -convert little_endian -diag-disable 8290,8291 -I /muksoft/packages/netcdf/4_intel/include"
47#
48# Example 2 (lccrayh):
49# compiler_name="ftn"
50# fopts="-em -s real64 -O3 -hnoomp -hfp3 -hdynamic"
51# fopts_trace="-eD -em -g -R b -K trap=fp -O0 -hnoomp"
52#
53#
54
55
56%cpp_options         -cpp -D__parallel -DMPI_REAL=MPI_DOUBLE_PRECISION -DMPI_2REAL=MPI_2DOUBLE_PRECISION -D__fftw -D__netcdf -D__netcdf4 -D__netcdf4_parallel
57%make_options        -j 4
58%compiler_options    -fpe0 -O3 -xHost -fp-model source -ftz -fno-alias -no-prec-div -no-prec-sqrt -ip -I /muksoft/packages/fftw/3.3.7/mvapich2-2.3rc1/gnu/include/ -I /muksoft/packages/netcdf4_hdf5parallel/4411c_443f/hdf5-1.10.0-patch1/mvapich2-2.3rc1/intel/2018.1.163/include/
59%linker_options      -parallel -fpe0 -O3 -xHost -fp-model source -ftz -fno-alias -no-prec-div -no-prec-sqrt -ip -L/muksoft/packages/fftw/3.3.7/mvapich2-2.3rc1/gnu/lib64/ -lfftw3 -L/muksoft/packages/netcdf4_hdf5parallel/4411c_443f/hdf5-1.10.0-patch1/mvapich2-2.3rc1/intel/2018.1.163/lib64/ -lnetcdf -lnetcdff
60
61
62 compiler_name="mpif90"
63 fopts="-cpp -DMPI_REAL=MPI_DOUBLE_PRECISION -DMPI_2REAL=MPI_2DOUBLE_PRECISION -fpe0 -O3 -xHost -fp-model source -ftz -fno-alias -no-prec-div -no-prec-sqrt -ip -I /muksoft/packages/fftw/3.3.7/mvapich2-2.3rc1/gnu/include/ -I /muksoft/packages/netcdf4_hdf5parallel/4411c_443f/hdf5-1.10.0-patch1/mvapich2-2.3rc1/intel/2018.1.163/include/"
64 fopts_trace="-fpe0 -C -check nooutput_conversion -debug -traceback -g -w -xT -O0 -ftz -fno-alias -no-prec-div -no-prec-sqrt -ip -nbs -convert little_endian -diag-disable 8290,8291 -I /muksoft/packages/netcdf/4_intel/include"
65 install_path="$HOME/palm/rrtmg"
66 compile_static=false
67 compile_shared=true
68 compile_static_debug=false
69 compile_shared_debug=false
70
71 while  getopts  p: option
72 do
73   case  $option  in
74       (p)   install_path=$OPTARG;;
75 
76       (\?)  printf "\n  +++ unknown option $OPTARG \n"
77             printf "\n  --> type \"$0 ?\" for available options \n"
78             locat=parameter;exit;;
79   esac
80 done
81
82 (( to_shift = $OPTIND - 1 ))
83 shift $to_shift
84
85    # PRINT SHORT DESCRIPTION OF OPTIONS
86 if [[ "$1" = "?" ]]
87 then
88   (printf "\n  *** rrtmg_install can be called as follows:\n"
89    printf "\n      rrtmg_install -p.\n"
90    printf "\n      Description of available options:\n"
91    printf "\n      Option  Description                              Default-Value"
92    printf "\n        -p    installation path                                   ./"
93
94    printf "\n "
95    printf "\n      Possible values of positional parameter <modus>:"
96    printf "\n        \"?\"       -  this outline \n\n") | more
97    exit
98 elif [[ "$1" != "" ]]
99 then
100    printf "\n  +++ positional parameter $1 unknown \n"
101    locat=parameter; exit
102 fi
103
104 prog="librrtmg"
105 version="1.0"
106
107
108# 1 static
109
110 if [[ $compile_static = true ]]
111 then
112    printf "\n      Start compiling static library $prog... (make)\n\n"
113    mkdir -p static/lib
114    mkdir -p static/include
115    make -f Makefile_static F90=$compiler_name  PROG=$prog F90FLAGS="$fopts"
116    cp $prog.a  static/lib
117    cp *.mod    static/include
118    make -f Makefile_static clean
119    mkdir -p $install_path/static/lib
120    mkdir -p $install_path/static/include
121    cp static/lib/$prog.a $install_path/static/lib
122    cp static/include/*.mod $install_path/static/include/
123    rm -rf static
124    printf "\n      finished.\n"
125 fi
126
127# 2 static debug
128 if [[ $compile_static_debug = true ]]
129 then
130    printf "\n      Start compiling static debug library $prog... (make)\n\n"
131    mkdir -p static_trace/lib
132    mkdir -p static_trace/include
133    make -f Makefile_static F90=$compiler_name  PROG=$prog F90FLAGS="$fopts_trace"
134    cp $prog.a  static_trace/lib
135    cp *.mod    static_trace/include
136    make -f Makefile_static clean
137    mkdir -p $install_path/static_trace/lib
138    mkdir -p $install_path/static_trace/include
139    cp static_trace/lib/$prog.a $install_path/static_trace/lib
140    cp static_trace/include/*.mod $install_path/static_trace/include/
141    rm -rf static_trace
142    printf "\n      finished.\n"
143 fi
144
145# 3 shared
146 if [[ $compile_shared = true ]]
147 then
148    printf "\n      Start compiling shared (dynamic) library $prog... (make)\n\n"
149    mkdir -p shared/lib
150    mkdir -p shared/include
151    make -f Makefile F90=$compiler_name  PROG=$prog F90FLAGS="$fopts"
152    cp $prog.so shared/lib/$prog.so.$version
153    cp *.mod    shared/include/
154    make -f Makefile clean
155    mkdir -p $install_path/shared/lib
156    mkdir -p $install_path/shared/include
157    cp shared/lib/$prog.so.$version $install_path/shared/lib/
158    cp shared/include/*.mod $install_path/shared/include/
159    if [ -f $install_path/shared/lib/$prog.so.1 ]
160    then
161       rm $install_path/shared/lib/$prog.so.1
162    fi
163    ln -s $install_path/shared/lib/$prog.so.$version $install_path/shared/lib/$prog.so.1
164    if [ -f $install_path/shared/lib/$prog.so ]
165    then
166       rm $install_path/shared/lib/$prog.so
167    fi
168    ln -s $install_path/shared/lib/$prog.so.1 $install_path/shared/lib/$prog.so
169    rm -rf shared
170    printf "\n      finished.\n"
171 fi
172
173# 4 shared debug
174 if [[ $compile_static_debug = true ]]
175 then
176    printf "\n      Start compiling shared debug library $prog... (make)\n\n"
177    mkdir -p shared_trace/lib
178    mkdir -p shared_trace/include
179    make -f Makefile F90=$compiler_name  PROG=$prog F90FLAGS="$fopts_trace"
180    cp $prog.so shared_trace/lib/$prog.so.$version
181    cp *.mod    shared_trace/include/
182    make -f Makefile clean
183    mkdir -p $install_path/shared_trace/lib
184    mkdir -p $install_path/shared_trace/include
185    cp shared_trace/lib/$prog.so.$version $install_path/shared_trace/lib
186    cp shared_trace/include/*.mod $install_path/shared_trace/include/
187    if [ -f $install_path/shared_trace/lib/$prog.so.1 ]
188    then
189       rm $install_path/shared_trace/lib/$prog.so.1
190    fi
191    ln -s $install_path/shared_trace/lib/$prog.so.$version $install_path/shared_trace/lib/$prog.so.1
192    if [ -f $install_path/shared_trace/lib/$prog.so ]
193    then
194       rm $install_path/shared_trace/lib/$prog.so
195    fi
196    ln -s $install_path/shared_trace/lib/$prog.so.1 $install_path/shared_trace/lib/$prog.so
197    rm -rf shared_trace
198    printf "\n      finished.\n"
199 fi
200
201 printf "\n      Libraries $prog are installed in \"$install_path\".\n\n" 
202 printf "\n\n  *** all actions complete."
203 
Note: See TracBrowser for help on using the repository browser.