https://gitorious.org/ocamlp3l/ocamlp3l_cvs.git
Revision 2db189928c94d62a3b4757b3eec68f0a4d4113f0 authored by dicosmo on 23 June 1998, 11:28:44 UTC, committed by dicosmo on 23 June 1998, 11:28:44 UTC
1 parent 8d2207a
Tip revision: 2db189928c94d62a3b4757b3eec68f0a4d4113f0 authored by dicosmo on 23 June 1998, 11:28:44 UTC
*** empty log message ***
*** empty log message ***
Tip revision: 2db1899
ocamlp3lrun
#!###PERL###
$argc = @ARGV;
if($argc == 0) {
print "Usage is\:\n";
print "ocamlp3lrun [<program>] [-m<machine-file>] [-video] [-nocopy] [machine-list]\n";
exit;
}
$copia = 1;
$video = ":0.0";
@machines = ();
foreach $argu (@ARGV) {
$_=$argu;
if(-x "$argu.par") {
$program = "$argu.par";
next;
}
if(-x "$argu.seq") {
$program = "$argu.seq";
next;
}
if(-x "$argu.gra") {
$program = "$argu.gra";
next;
}
if(-x $argu) {
$program = $argu;
next;
}
if(/-m(.*)/) {
@machines = `cat $1`;
next;
}
if(/-video/) {
$video = `hostname`.":0.0";
$video =~ s/\n//g;
next;
}
if(/-nocopy/) {
$copia = 0;
next;
}
# default it is a machine name
@machines = (@machines,$argu);
}
$host = `hostname`;
chop $host;
if($program =~ /\.seq/) {
print "Running $program (sequential semantics) onto localhost $host\n";
`$program`;
exit;
}
if($program =~ /\.gra/) {
print "Running $program (graphic semantics) onto localhost $host\n";
`$program`;
exit;
}
print "Running $program with video output on $video (copy = $copia)\n";
print "on machines: ";
foreach (@machines) {
print "$_ ";
}
print "\n";
if($#machines == 0) {
$startnode = $machines[0];
$stopnode = $machines[0];
print "Executing on a single machine \($stopnode\)\n";
} else {
$startnode = $machines[0];
$stopnode = $machines[1];
print "Executing start on $startnode, stop on $stopnode\n";
}
#default output from stopnode
$out = `xhost $stopnode`;
print "XHOST\: $out\n";
foreach $m (@machines) {
if($copia) {
# do not copy on the current machine
if($m =~ /$host/) {
print "Skipping copy of $program to $m\n";
} else {
$out = `rcp $program $m\:$program`;
print "RCP\: $out\n";
if($out =~ /Permission denied/) {
print "rcp $program $m FAILED\n";
exit
}
}
}
}
$out = `sleep 3`;
foreach $m (@machines) {
# remote execution of the program
if($m =~ /$host/) {
print "Executing ./$program on localhost $m\n";
$out = `./$program > $m.log & `;
} else {
print "Executing $program on host $m\n";
if($copia) {
# just executes the program in the root directory
$out = `rsh $m "setenv DISPLAY $video; $program < /dev/null" > $m.log &`;
} else {
# execute the program in the right (possibly nested) directory
$out = `rsh $m "setenv DISPLAY $video; $ENV{PWD}/$program < /dev/null" > $m.log &`;
}
print "RSH\: $out\n";
}
}
#print "Sleeping 5 now ...\n";
$out = `sleep 5`;
#print "Done\n";
# executing the root program here
$out = `$program p3lroot $startnode $stopnode @machines[2..$#machines]`;
print "EXEC\: $out\n";
# registering current network configuration in the .ocamlp3l file
open STATUS, ">.ocamlp3l" or die "Cannot open .ocamlp3l file";
print STATUS "machines @machines\n";
print STATUS "start $startnode\n";
print STATUS "stop $stopnode\n";
print STATUS "program $program\n";
close STATUS;
print "Done\nbye ...\n";
Computing file changes ...