[Swift-commit] r5121 - in trunk/tests/mpi/fusion: long short

wozniak at ci.uchicago.edu wozniak at ci.uchicago.edu
Thu Sep 15 14:36:27 CDT 2011


Author: wozniak
Date: 2011-09-15 14:36:27 -0500 (Thu, 15 Sep 2011)
New Revision: 5121

Modified:
   trunk/tests/mpi/fusion/long/100-mci.clean.sh
   trunk/tests/mpi/fusion/long/100-mci.swift
   trunk/tests/mpi/fusion/long/mpi-sleep.c
   trunk/tests/mpi/fusion/long/sites.template.xml
   trunk/tests/mpi/fusion/long/tc.template.data
   trunk/tests/mpi/fusion/short/tc.template.data
Log:
Improve test for MPI on Fusion


Modified: trunk/tests/mpi/fusion/long/100-mci.clean.sh
===================================================================
--- trunk/tests/mpi/fusion/long/100-mci.clean.sh	2011-09-15 14:43:40 UTC (rev 5120)
+++ trunk/tests/mpi/fusion/long/100-mci.clean.sh	2011-09-15 19:36:27 UTC (rev 5121)
@@ -2,6 +2,6 @@
 
 set -x
 
-rm -v transform-*.txt || exit 1
+# rm -v transform-*.txt || exit 1
 
 exit 0

Modified: trunk/tests/mpi/fusion/long/100-mci.swift
===================================================================
--- trunk/tests/mpi/fusion/long/100-mci.swift	2011-09-15 14:43:40 UTC (rev 5120)
+++ trunk/tests/mpi/fusion/long/100-mci.swift	2011-09-15 19:36:27 UTC (rev 5121)
@@ -8,9 +8,9 @@
 
 file input<"100-input.txt">;
 
-int total = 10;
+int total = 1;
 
-foreach i in [0:total] {
+foreach i in [0:total-1] {
   file output<single_file_mapper;file=@strcat("transform-",i,".txt")>;
   output = transform(input);
 }

Modified: trunk/tests/mpi/fusion/long/mpi-sleep.c
===================================================================
--- trunk/tests/mpi/fusion/long/mpi-sleep.c	2011-09-15 14:43:40 UTC (rev 5120)
+++ trunk/tests/mpi/fusion/long/mpi-sleep.c	2011-09-15 19:36:27 UTC (rev 5121)
@@ -1,7 +1,6 @@
 
 /**
  * Simple Hydra test
- * No I/O
  *
  * usage: mpi-sleep <duration>
  *
@@ -11,11 +10,12 @@
  * */
 
 #include <assert.h>
+#include <errno.h>
 #include <stdbool.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#include <sys/stat.h>
+#include <sys/utsname.h>
 #include <unistd.h>
 
 #include <mpi.h>
@@ -26,7 +26,9 @@
 #ifdef ENABLE_DEBUG
 #define DEBUG(...) __VA_ARGS__
 #define debug(...)                              \
-  { printf("%i: ", mpi_rank); printf(__VA_ARGS__); }
+  { printf("%i: ", mpi_rank);                   \
+    printf(__VA_ARGS__);                        \
+    fflush(stdout); }
 #else
 #define DEBUG(...)
 #define debug(...)
@@ -37,6 +39,8 @@
 
 void print_help(void);
 void startup(void);
+void write_header(void);
+void write_data(void);
 void crash(char* msg);
 void check(void* value, char* msg);
 
@@ -45,14 +49,16 @@
 const int INPUT_MAX = 10;
 int input_count = 0;
 
+char hostname[1024];
 char output[1024];
 
-bool write_header = false;
+bool enable_write_header = false;
 
 int main(int argc, char* argv[])
 {
   int duration = -1;
   char* inputs[INPUT_MAX];
+  output[0] = '\0';
 
   int opt = -1;
   while ((opt = getopt(argc, argv, "i:o:v")) != -1)
@@ -67,7 +73,7 @@
       case 'o':
         strcpy(output, optarg);
       case 'v':
-        write_header = true;
+        enable_write_header = true;
         break;
     }
   }
@@ -100,22 +106,17 @@
   // INTRO BARRIER
   debug("barrier1\n");
   MPI_Barrier(MPI_COMM_WORLD);
-  debug("sleep %i\n", duration);
 
+  // WRITE HEADER
+  if (enable_write_header)
+    write_header();
+
   // SLEEP
+  debug("sleep %i\n", duration);
   sleep(duration);
 
   // WRITE OUTPUT
-  if (mpi_rank == 0)
-  {
-    debug("write to: %s\n", output);
-    FILE* file = fopen(output, "w");
-    check(file, "could not write to file!");
-    if (write_header)
-      fprintf(file, "rank: %i/%i\n", mpi_rank, mpi_size);
-    fprintf(file, "howdy\n");
-    fclose(file);
-  }
+  write_data();
 
   // FINAL BARRIER
   debug("barrier2\n");
@@ -132,6 +133,14 @@
   FILE* file;
   char filename[1024];
   // DEBUG(system("/bin/hostname"));
+
+  if (mpi_rank == 0)
+    if (strlen(output) == 0)
+    {
+      printf("No output file!\n");
+      exit(1);
+    }
+
   debug("size: %i\n", mpi_size);
   debug("rank: %i\n", mpi_rank);
   DEBUG(pwd = getenv("PWD"));
@@ -143,6 +152,56 @@
   // DEBUG(fclose(file));
 }
 
+/**
+   An output header written only by rank 0
+*/
+void write_header()
+{
+  if (mpi_rank == 0)
+  {
+    debug("write_header(): %s\n", output);
+    FILE* file = fopen(output, "w");
+    check(file, "could not write to file!");
+    fprintf(file, "rank 0: header\n");
+    fclose(file);
+  }
+}
+
+void read_hostname()
+{
+  struct utsname name;
+  if (uname (&name) == -1)
+  {
+    printf("Could not call uname()!\n");
+    MPI_Abort(MPI_COMM_WORLD, 1);
+  }
+
+  strcpy(hostname, name.nodename);
+
+  /*
+  char* filename = "/etc/HOSTNAME";
+  FILE* file = fopen(filename, "r");
+  if (!file)
+  {
+    printf("Could not open: %s\n", filename);
+    MPI_Abort(MPI_COMM_WORLD, 1);
+  }
+  fscanf(file, "%s", hostname);
+  fclose(file);
+  */
+}
+
+void write_data()
+{
+  debug("write_data(): %s\n", output);
+  read_hostname();
+  FILE* file = fopen(output, "a");
+  check(file, "could not write to file!");
+  fprintf(file, "rank: %i/%i %s\n",
+          mpi_rank, mpi_size, hostname);
+  fclose(file);
+}
+
 void print_help()
 {
   printf("usage: <options> <duration>\n");

Modified: trunk/tests/mpi/fusion/long/sites.template.xml
===================================================================
--- trunk/tests/mpi/fusion/long/sites.template.xml	2011-09-15 14:43:40 UTC (rev 5120)
+++ trunk/tests/mpi/fusion/long/sites.template.xml	2011-09-15 19:36:27 UTC (rev 5121)
@@ -8,21 +8,19 @@
 <pool handle="fusion">
   <execution jobmanager="local:pbs" provider="coaster" url="none"/>
   <filesystem provider="local" url="none" />
-  <profile namespace="globus" key="maxWallTime">100</profile>
-  <profile namespace="globus" key="maxTime">7200</profile>
+  <profile namespace="globus" key="maxWallTime">1</profile> <!-- minutes -->
+  <!-- <profile namespace="globus" key="maxTime">500</profile> -->
 
   <profile key="jobsPerNode" namespace="globus">1</profile>
   <profile key="slots" namespace="globus">1</profile>
-  <profile key="nodeGranularity" namespace="globus">6</profile>
-  <profile key="maxNodes" namespace="globus">6</profile>
+  <profile key="nodeGranularity" namespace="globus">2</profile>
+  <profile key="maxNodes" namespace="globus">2</profile>
   <profile key="workerLoggingLevel" namespace="globus">DEBUG</profile>
   <profile key="workerLoggingDirectory" namespace="globus">{wdir}</profile>
+  <profile key="queue" namespace="globus">shared</profile>
   <profile key="jobThrottle" namespace="karajan">5.99</profile>
   <profile key="initialScore" namespace="karajan">10000</profile>
+
   <workdirectory>{wdir}</workdirectory>
 </pool>
 </config>
-
-<!-- RESERVATIONS:
-Add something like this to your providerAttributes:
-pbs.resources=advres=modFTDock.47 -->

Modified: trunk/tests/mpi/fusion/long/tc.template.data
===================================================================
--- trunk/tests/mpi/fusion/long/tc.template.data	2011-09-15 14:43:40 UTC (rev 5120)
+++ trunk/tests/mpi/fusion/long/tc.template.data	2011-09-15 19:36:27 UTC (rev 5121)
@@ -17,7 +17,4 @@
 localhost 	paste 		/bin/paste	INSTALLED	INTEL32::LINUX	null
 localhost 	cp 		/bin/cp	        INSTALLED	INTEL32::LINUX	null
 
-# hydra-tests-2
-
-fusion 	mpi_cp 		_DIR_/mpi-cp       INSTALLED	INTEL32::LINUX	globus::hostCount=2
-fusion 	mpi_sleep 	_DIR_/mpi-sleep    INSTALLED	INTEL32::LINUX	globus::hostCount=2
+fusion 	mpi_sleep _DIR_/mpi-sleep    INSTALLED	INTEL32::LINUX	globus::mpi.processes=4;globus::mpi.ppn=2

Modified: trunk/tests/mpi/fusion/short/tc.template.data
===================================================================
--- trunk/tests/mpi/fusion/short/tc.template.data	2011-09-15 14:43:40 UTC (rev 5120)
+++ trunk/tests/mpi/fusion/short/tc.template.data	2011-09-15 19:36:27 UTC (rev 5121)
@@ -19,4 +19,4 @@
 
 # hydra-tests-2
 
-fusion 	mpi_cp 		_DIR_/mpi-cp    INSTALLED	INTEL32::LINUX	globus::hostCount=2
+fusion 	mpi_cp 		_DIR_/mpi-cp    INSTALLED	INTEL32::LINUX	globus::mpi.processes=2




More information about the Swift-commit mailing list