Commit f246595d authored by Leigh Stoller's avatar Leigh Stoller

Lets checkpoint. About 2/3 of the way there.

parent 802a9a56
This diff is collapsed.
...@@ -49,9 +49,10 @@ sub usage () ...@@ -49,9 +49,10 @@ sub usage ()
} }
my $optlist = "vunfp"; my $optlist = "vunfp";
my $verbose = 0; my $verbose = 0;
my $debug = 1;
my $fixmode = 0; my $fixmode = 0;
my $updating = 0; my $updating = 0;
my $impotent = 0; my $impotent = 1;
my $precheck = 0; my $precheck = 0;
my $quiet = 0; my $quiet = 0;
my $warnings = 0; my $warnings = 0;
...@@ -134,6 +135,8 @@ $vtopflags |= $libvtop::VTOP_FLAGS_UPDATE ...@@ -134,6 +135,8 @@ $vtopflags |= $libvtop::VTOP_FLAGS_UPDATE
if ($updating); if ($updating);
$vtopflags |= $libvtop::VTOP_FLAGS_FIXNODES $vtopflags |= $libvtop::VTOP_FLAGS_FIXNODES
if ($fixmode); if ($fixmode);
$vtopflags |= $libvtop::VTOP_FLAGS_IMPOTENT
if ($impotent);
chat("Starting the new and improved mapper wrapper.\n"); chat("Starting the new and improved mapper wrapper.\n");
...@@ -141,6 +144,10 @@ my $vtop = libvtop->Create($experiment, $vtopflags); ...@@ -141,6 +144,10 @@ my $vtop = libvtop->Create($experiment, $vtopflags);
if (!defined($vtop)) { if (!defined($vtop)) {
fatal("Could not create vtop structure for $experiment"); fatal("Could not create vtop structure for $experiment");
} }
TBDebugTimeStamp("vtopgen started");
$vtop->CreateVtop() == 0
or fatal("Could not create vtop for $experiment");
TBDebugTimeStamp("vtopgen finished");
# #
# The assign loop. # The assign loop.
...@@ -162,7 +169,7 @@ TBDebugTimeStamp("mapper loop started"); ...@@ -162,7 +169,7 @@ TBDebugTimeStamp("mapper loop started");
while (1) { while (1) {
chat("Assign run $currentrun\n"); chat("Assign run $currentrun\n");
my $prefix = "$pid-$eid-$$"; my $prefix = ($debug ? "$pid-$eid" : "$pid-$eid-$$");
# #
# When precheck is on, we only do one run in impotent mode and exit. # When precheck is on, we only do one run in impotent mode and exit.
...@@ -301,14 +308,10 @@ sub RunAssign($$) ...@@ -301,14 +308,10 @@ sub RunAssign($$)
# #
# Now generate a vtop file and dump it to a file. # Now generate a vtop file and dump it to a file.
# #
TBDebugTimeStamp("vtopgen started");
$vtop->CreateVtop() == 0
or fatal("Could not create vtop for $experiment");
open(VTOPFILE, "> $vtopfile") or open(VTOPFILE, "> $vtopfile") or
fatal("Could not open $vtopfile: $!"); fatal("Could not open $vtopfile: $!");
$vtop->PrintTop(*VTOPFILE) == 0 or $vtop->PrintTop(*VTOPFILE) == 0 or
fatal("Could not print vtop file for $experiment"); fatal("Could not print vtop file for $experiment");
TBDebugTimeStamp("ptopgen finished");
close(VTOPFILE); close(VTOPFILE);
if ($impotent) { if ($impotent) {
...@@ -318,7 +321,7 @@ sub RunAssign($$) ...@@ -318,7 +321,7 @@ sub RunAssign($$)
} }
# Run assign # Run assign
my $cmd = "$ASSIGN"; my $cmd = "assign";
my $args = "-P $ptopfile $vtopfile"; my $args = "-P $ptopfile $vtopfile";
$args = "-uod -c .75 $args" $args = "-uod -c .75 $args"
if ($vtop->virtnodecount() || $vtop->simnodecount()); if ($vtop->virtnodecount() || $vtop->simnodecount());
...@@ -330,6 +333,7 @@ sub RunAssign($$) ...@@ -330,6 +333,7 @@ sub RunAssign($$)
# Fork a child to run assign. Parent spins watching the cancel flag # Fork a child to run assign. Parent spins watching the cancel flag
# and waiting for assign to finish. # and waiting for assign to finish.
# #
TBDebugTimeStamp("assign started");
if (my $childpid = fork()) { if (my $childpid = fork()) {
while (1) { while (1) {
sleep(2); sleep(2);
...@@ -363,6 +367,7 @@ sub RunAssign($$) ...@@ -363,6 +367,7 @@ sub RunAssign($$)
exec("nice $WRAPPER2 $cmd $args > assign.log"); exec("nice $WRAPPER2 $cmd $args > assign.log");
die("Could not start assign!\n"); die("Could not start assign!\n");
} }
TBDebugTimeStamp("assign finished");
# Check cancel flag before continuing. # Check cancel flag before continuing.
if ($experiment->canceled()) { if ($experiment->canceled()) {
...@@ -408,8 +413,27 @@ sub RunAssign($$) ...@@ -408,8 +413,27 @@ sub RunAssign($$)
print("Could not open assign logfile! $!\n"); print("Could not open assign logfile! $!\n");
return -1; return -1;
} }
if ($vtop->ReadSolution(*ASSIGNFP) != 0) {
print("Could not parse assign logfile! $!\n");
return -1;
}
close(ASSIGNFP);
if ($vtop->InterpNodes() != 0) {
print("Could not interpret nodes.\n");
return -1;
}
# Check cancel flag before continuing.
if ($experiment->canceled()) {
fatal({cause => 'canceled', severity => SEV_IMMEDIATE,
error => ['cancel_flag']},
"Cancel flag set; aborting assign run!");
return -1;
}
if ($vtop->AllocNodes() != 0) {
print("Could not allocate nodes.\n");
return -1;
}
exit(0); exit(0);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment