#! /bin/sh # # $Id$ # # Copyright 1989-2016 MINES ParisTech # # This file is part of PIPS. # # PIPS is free software: you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # any later version. # # PIPS is distributed in the hope that it will be useful, but WITHOUT ANY # WARRANTY; without even the implied warranty of MERCHANTABILITY or # FITNESS FOR A PARTICULAR PURPOSE. # # See the GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with PIPS. If not, see . # # generate the initialization file script=`basename $0` unset NAME usage() { echo "Usage: $script [ -n name ] dirname" 1>&2 exit 1 } while getopts n: OPT do case $OPT in n) NAME=$OPTARG ;; *) usage ;; esac done shift `expr $OPTIND - 1` [ "$#" -eq 1 ] || usage dirname=$1 filename=hpfc_initialize_runtime.m4 init=$dirname/$filename NAME="${NAME:-`basename $dirname .database`}" NAME=`echo $NAME | tr '[A-Z]' '[a-z]'` # the key is used to check that the nodes and host do match... key="${NAME}.`hostname`.`whoami`.`date +"%H.%M.%S.%j.%y"`" { echo "!" echo "! File $filename" echo "! This file has been automatically generated by the hpf compiler" echo "!" echo " subroutine HPFC INIT COMMON PARAM" echo " implicit none" echo " include \"hpfc_commons.h\"" # # must avoid the hpfc_ version. # pips generates uppercase file names... # for file in $dirname/[A-Z]*_parameters.h do echo " include \"`basename $file`\"" done for file in $dirname/*_init.h do echo " include \"`basename $file`\"" done echo "! other initializations" echo " MAIN PROGRAM NAME=\"${NAME}_mainpvm\"" echo " NODE PROGRAM NAME=\"${NAME}_node\"" echo " NODE ARCHITECTURE=\"PVM_ARCH\"" echo " HPFC GROUP NAME=\"${NAME}_group\"" echo " HPFC KEY=\"$key\"" echo " end" echo "!" echo "! end of file $filename" echo "!" } > $init