| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105 | #!/bin/bash# StarPU --- Runtime system for heterogeneous multicore architectures.# # Copyright (C) 2014-2016  Université Bordeaux# # StarPU is free software; you can redistribute it and/or modify# it under the terms of the GNU Lesser General Public License as published by# the Free Software Foundation; either version 2.1 of the License, or (at# your option) any later version.# # StarPU 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 Lesser General Public License in COPYING.LGPL for more details.# Script for running starpu-mpi application in simgrid modeprefix=@prefix@SMPIRUN=@smpirun_path@STARPU_DATADIR=@datarootdir@STARPU_XSLTDIR=$STARPU_DATADIR/starpuSOURCE_DATADIR=@abs_srcdir@BUILDDIR=@abs_builddir@# When executed from source, take xslt from source[ "$0" -ef $BUILDDIR/starpu_smpirun ] && STARPU_XSLTDIR=$SOURCE_DATADIRMPI_PLATFORM=""MPI_HOSTFILE=""NP=""while true; do	case "$1" in		"-platform")			MPI_PLATFORM=$2			if [ ! -r "$MPI_PLATFORM" ]; then				echo "$MPI_PLATFORM can't be read"				exit 1			fi			shift 2			;;		"-hostfile")			MPI_HOSTFILE=$2			if [ ! -r "$MPI_HOSTFILE" ]; then				echo "$MPI_HOSTFILE can't be read"				exit 1			fi			shift 2			;;		"-np")			NP=$2			shift 2			;;		*)			break			;;	esacdoneif [ -z "$MPI_PLATFORM" ] || [ -z "$MPI_HOSTFILE" ]; then	echo "$0 -platform PLATFORM -hostfile HOSTFILE [ -np N ] [ ... ] program [ args ]"	exit 2fiPLATFORM=$(mktemp /tmp/StarPU-MPI-platform-XXXXXXXX.xml)[ -n "$STARPU_HOME" ] || STARPU_HOME=$HOME[ -n "$STARPU_PERF_MODEL_DIR" ] || STARPU_PERF_MODEL_DIR=$STARPU_HOME/.starpu/sampling[ -n "$STARPU_HOSTNAME" ] || STARPU_HOSTNAME=$(hostname)NODE_PLATFORM=$STARPU_PERF_MODEL_DIR/bus/${STARPU_HOSTNAME}.platform.xml[ -n "$NP" ] || NP=$(grep -v "^$" $MPI_HOSTFILE | wc -l)if ! type xsltproc > /dev/null 2> /dev/nullthen	echo xsltproc is needed for starpu simgrid mpi.	exit 1fi(	cat << \EOF<?xml version='1.0'?><!DOCTYPE platform SYSTEM "http://simgrid.gforge.inria.fr/simgrid.dtd"><platform version="3"><AS id="ASroot" routing="None">EOF	tail -n +3 $MPI_PLATFORM | grep -v '<platform' | grep -v '</platform'	for i in $(seq 0 $((NP - 1))) ; do		xsltproc --novalid --stringparam ASname StarPU-MPI$i $STARPU_XSLTDIR/starpu_smpi.xslt $NODE_PLATFORM | grep -v network/ | tail -n +4 | head -n -1	done	cat << \EOF</AS></platform>EOF) > $PLATFORMSTACKSIZE=$(ulimit -s)[ "$STACKSIZE" != unlimited ] || STACKSIZE=8192$SMPIRUN -platform $PLATFORM -hostfile $MPI_HOSTFILE "$@" --cfg=smpi/privatize_global_variables:yes --cfg=smpi/simulate_computation:no --cfg=contexts/stack_size:$STACKSIZERET=$?rm -f $PLATFORMexit $RET
 |