#!/bin/sh 
#!perl
eval 'exec perl -x -S -w $0 "$@";'
    if 0;


%dir_val = (
  'Linux' => {
    'alpha' => "/ufs/gm/ruth/mpich_alpha/mpich/examples/perftest",
    'i386'  => "/ufs/gm/ruth/mpich/examples/perftest",
    'i486'  => "/ufs/gm/ruth/mpich/examples/perftest",
    'i586'  => "/ufs/gm/ruth/mpich/examples/perftest",
    'i686'  => "/ufs/gm/ruth/mpich/examples/perftest",
    'i786'  => "/ufs/gm/ruth/mpich/examples/perftest",
  },
  'other' => {
    'alpha' => "/ufs/gm/ruth/mpich_alpha/mpich/examples/perftest",
    'i386'  => "/ufs/gm/ruth/mpich/examples/perftest",
    'i486'  => "/ufs/gm/ruth/mpich/examples/perftest",
    'i586'  => "/ufs/gm/ruth/mpich/examples/perftest",
    'i686'  => "/ufs/gm/ruth/mpich/examples/perftest",
    'i786'  => "/ufs/gm/ruth/mpich/examples/perftest",
  },
);


$mach_type = `uname -m`;
chomp $mach_type;

$op_type = `uname -s`;
chomp $op_type;

$mget= '';
$mrel = '';

$cmd = "./stress";

$verbose = 1;

$the_args = '';
if (@ARGV > 0) {
    @the_args = (@ARGV[0..$#ARGV]);
}
$the_args = [@the_args];
$cmd_arg = "@{$the_args}";

$display=$ENV{'DISPLAY'};
print "DISPLAY = $display\n" if $verbose;
$gmpi_conf=$ENV{'GMPI_CONF'};
print "GMPI_CONF = $gmpi_conf\n" if $verbose;
$gmpi_opts=$ENV{'GMPI_OPTS'};
print "GMPI_OPTS = $gmpi_opts\n" if $verbose;

$varenv .= " DISPLAY=$display" if $display;
$varenv .= " GMPI_CONF=$gmpi_conf";
$varenv .= " GMPI_OPTS=$gmpi_opts";

$dir = $dir_val{$op_type}{$mach_type};

$cmdline = "cd $dir;$mget env $varenv $cmd $cmd_arg $mrel";    

print "starting $cmdline\n";

system($cmdline);




