[Swift-commit] r6094 - in branches/release-0.94: bin libexec

davidk at ci.uchicago.edu davidk at ci.uchicago.edu
Wed Nov 28 13:12:32 CST 2012


Author: davidk
Date: 2012-11-28 13:12:31 -0600 (Wed, 28 Nov 2012)
New Revision: 6094

Modified:
   branches/release-0.94/bin/slurm-qsub
   branches/release-0.94/bin/slurm-qsub-emulator
   branches/release-0.94/libexec/_swiftwrap
Log:
Fixes to slurm scripts and extra debug info in _swiftwrap


Modified: branches/release-0.94/bin/slurm-qsub
===================================================================
--- branches/release-0.94/bin/slurm-qsub	2012-11-27 18:46:27 UTC (rev 6093)
+++ branches/release-0.94/bin/slurm-qsub	2012-11-28 19:12:31 UTC (rev 6094)
@@ -7,7 +7,7 @@
 script=$1.slurm
 echo '#! /bin/sh' >$script
 # echo 'export PBS_NODELIST=SLURM_NODELIST'' >>$script  # FIXME: convert SLURM_NODELIST to PBS_NODEFILE here...
-cat $1 >>$script
+cat $1 | grep -v '^#PBS' >>$script
 chmod +x $script
 
 srunargs=$(awk <$1 '
@@ -18,6 +18,8 @@
                   sub(/nodes=/,"",nodes); sub(/:.*/,"",nodes);
                   sub(/^.*ppn=/,"",ppn);  }
 /#PBS -l walltime/ { walltime = $3; sub(/walltime=/,"",walltime);}
+#/#PBS -l advres/ { advres = "," $3; sub(/advres=/,"",advres); advres="," advres }
+/#PBS -l advres/ { advres = "," $3; }
 /#PBS -q/ { queue = $3 }
 /#PBS -o/ { sofile = $3 }
 /#PBS -e/ { sefile = $3 }
@@ -29,8 +31,8 @@
 
 #   printf("-S %s -N %s -m %s -l nodes=%s:ppn=%s -l walltime=%s -q %s -o %s -e %s",
 #            shell, jobname, m, nodes, ppn, walltime, queue, sofile, sefile);
-   printf("-N %s -m %s -l nodes=%s:ppn=%s -l walltime=%s -q %s -o %s -e %s",
-             jobname, m, nodes, ppn, walltime, queue, sofile, sefile);
+   printf("-N %s -m %s -l nodes=%s:ppn=%s,walltime=%s%s -q %s -o %s -e %s",
+             jobname, m, nodes, ppn, walltime, advres, queue, sofile, sefile);
 
 }')
 

Modified: branches/release-0.94/bin/slurm-qsub-emulator
===================================================================
--- branches/release-0.94/bin/slurm-qsub-emulator	2012-11-27 18:46:27 UTC (rev 6093)
+++ branches/release-0.94/bin/slurm-qsub-emulator	2012-11-28 19:12:31 UTC (rev 6094)
@@ -81,7 +81,6 @@
 
 my $sbatch = "sbatch";
 my $salloc = "salloc";
-my $srun = "$srun";
 
 GetOptions('a=s'      => \$start_time,
 	   'A=s'      => \$account,
@@ -190,6 +189,7 @@
 $command .= " --tmp=$res_opts{file}" if $res_opts{file};
 $command .= " --mem=$res_opts{mem}" if $res_opts{mem};
 $command .= " --nice=$res_opts{nice}" if $res_opts{nice};
+$command .= " --reservation=$res_opts{advres}" if $res_opts{advres};
 # Cray-specific options
 $command .= " -n$res_opts{mppwidth}"		    if $res_opts{mppwidth};
 $command .= " -w$res_opts{mppnodes}"		    if $res_opts{mppnodes};
@@ -215,7 +215,7 @@
 
 $command .= " $script";
 
-system("(echo; echo $command; echo) >> $HOME/pbslog");
+system("(echo; echo $command; echo) >> \$HOME/pbslog");
 
 system($command);
 
@@ -236,6 +236,7 @@
 		   'pvmem' => "",
 		   'software' => "",
 		   'vmem' => "",
+		   'advres' => "",
 		   # Cray-specific resources
 		   'mppwidth' => "",
 		   'mppdepth' => "",
@@ -247,9 +248,9 @@
 	my @keys = keys(%opt);
 
 	foreach my $key (@keys) {
-		#print "$rl\n";
-		($opt{$key}) = $rl =~ m/$key=([\w:\+=+]+)/;
-
+		# print "key=$key rl=$rl\n";
+		($opt{$key}) = $rl =~ m/$key=([-\w:\+=+]+)/;
+                # print " set to $opt{$key}\n";
 	}
 	if($opt{cput}) {
 		$opt{cput} = get_minutes($opt{cput});

Modified: branches/release-0.94/libexec/_swiftwrap
===================================================================
--- branches/release-0.94/libexec/_swiftwrap	2012-11-27 18:46:27 UTC (rev 6093)
+++ branches/release-0.94/libexec/_swiftwrap	2012-11-28 19:12:31 UTC (rev 6094)
@@ -1,3 +1,4 @@
+
 #!/bin/bash
 # this script must be invoked inside of bash, not plain sh
 # note that this script modifies $IFS
@@ -475,17 +476,31 @@
 	fail 254 "The executable $EXEC does not have the executable bit set"
 fi
 if [ "$KICKSTART" == "" ]; then
+
+    TIMEARGS="-o swiftapp.resources -f APP_RESOURCES=real_time:%E,real_secs:%e,kernel_secs:%S,user_secs:%U,percent_cpu:%P,max_rss:%M,avg_rss:%t,avg_tot_vm:%K,avg_priv_data:%D,avg_priv_stack:%p,avg_shared_text:%X,page_size:%Z,major_pgfaults:%F,minor_pgfaults:%R,swaps:%W,invol_context_switches:%c,vol_waits%w,fs_reads:%I,fs_writes:%O,sock_recv:%r,sock_send:%s,signals:%k,exit_status:%x,command:%C"
+
+    if [ -x /usr/bin/time ]; then
+        TIMECMD="/usr/bin/time"
+    elif [ -x $HOME/swift.time ]; then
+        TIMECMD="$HOME/swift.time"
+    else
+        TIMECMD=""
+		TIMEARGS=""
+    fi
 	if [ "$STDIN" == "" ]; then
 		if [ "$SWIFT_GEN_SCRIPTS" != "" ]; then
 			genScripts
 		fi
-		"$EXEC" "${CMDARGS[@]}" 1>>"$STDOUT" 2>>"$STDERR"
+		eval $TIMECMD $TIMEARGS "$EXEC" "${CMDARGS[@]}" 1>>"$STDOUT" 2>>"$STDERR"
 	else
 		if [ "$SWIFT_GEN_SCRIPTS" != "" ]; then
 			genScripts
 		fi
-		"$EXEC" "${CMDARGS[@]}" 1>>"$STDOUT" 2>>"$STDERR" <"$STDIN"
+		eval $TIMECMD $TIMEARGS "$EXEC" "${CMDARGS[@]}" 1>>"$STDOUT" 2>>"$STDERR" <"$STDIN"
 	fi
+    if [ "_$TIMECMD" != _ ]; then
+		log "$(cat swiftapp.resources)"
+    fi
 	checkError $? "Application $EXEC failed with an exit code of $?"
 else
 	if [ ! -f "$KICKSTART" ]; then




More information about the Swift-commit mailing list