[Swift-commit] r5011 - trunk/tests/mpi/crow/long

wozniak at ci.uchicago.edu wozniak at ci.uchicago.edu
Thu Aug 25 15:37:05 CDT 2011


Author: wozniak
Date: 2011-08-25 15:37:05 -0500 (Thu, 25 Aug 2011)
New Revision: 5011

Modified:
   trunk/tests/mpi/crow/long/100-mci.setup.sh
   trunk/tests/mpi/crow/long/mpi-sleep.c
Log:
Modify and use mpi-sleep


Modified: trunk/tests/mpi/crow/long/100-mci.setup.sh
===================================================================
--- trunk/tests/mpi/crow/long/100-mci.setup.sh	2011-08-25 19:52:00 UTC (rev 5010)
+++ trunk/tests/mpi/crow/long/100-mci.setup.sh	2011-08-25 20:37:05 UTC (rev 5011)
@@ -4,7 +4,8 @@
 
 which mpicc || exit 1
 
-mpicc -std=gnu99 $GROUP/100-mpi-cp.c -o $GROUP/mpi-cp || exit 1
+# mpicc -std=gnu99 $GROUP/100-mpi-cp.c -o $GROUP/mpi-cp || exit 1
+mpicc -std=gnu99 $GROUP/mpi-sleep.c -o $GROUP/mpi-sleep || exit 1
 
 cp -v $GROUP/100-input.txt . || exit 1
 

Modified: trunk/tests/mpi/crow/long/mpi-sleep.c
===================================================================
--- trunk/tests/mpi/crow/long/mpi-sleep.c	2011-08-25 19:52:00 UTC (rev 5010)
+++ trunk/tests/mpi/crow/long/mpi-sleep.c	2011-08-25 20:37:05 UTC (rev 5011)
@@ -4,6 +4,10 @@
  * No I/O
  *
  * usage: mpi-sleep <duration>
+ *
+ * The copy of this program in the JETS repository has profiling
+ * information that was removed here.
+ *
  * */
 
 #include <assert.h>
@@ -16,7 +20,7 @@
 
 #include <mpi.h>
 
-#include "./profile.h"
+// #include "./profile.h"
 
 // There is a Makefile option to turn on debugging
 #ifdef ENABLE_DEBUG
@@ -41,18 +45,14 @@
 const int INPUT_MAX = 10;
 int input_count = 0;
 
-const int OUTPUT_MAX = 10;
-int output_count = 0;
+char output[1024];
 
 bool write_header = false;
 
 int main(int argc, char* argv[])
 {
-  profile_init(100);
-
   int duration = -1;
   char* inputs[INPUT_MAX];
-  char* outputs[OUTPUT_MAX];
 
   int opt = -1;
   while ((opt = getopt(argc, argv, "i:o:v")) != -1)
@@ -65,11 +65,7 @@
         inputs[input_count++] = strdup(optarg);
         break;
       case 'o':
-        if (output_count >= OUTPUT_MAX)
-          crash("too many outputs!");
-        outputs[output_count++] = optarg;
-        debug("output: %s\n", optarg);
-        break;
+        strcpy(output, optarg);
       case 'v':
         write_header = true;
         break;
@@ -78,69 +74,55 @@
 
   MPI_Init(&argc, &argv);
 
-  profile_entry(MPI_Wtime(), strdup("job start"));
-
   debug("mpi-sleep\n");
 
   MPI_Comm_size(MPI_COMM_WORLD, &mpi_size);
   MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank);
 
-  profile_entry(MPI_Wtime(), strdup("rank"));
-
   startup();
 
   if (optind >= argc)
   {
     if (mpi_rank == 0)
       print_help();
-    return EXIT_FAILURE;
+    MPI_Abort(MPI_COMM_WORLD, 1);
+    return 1;
   }
 
   int count = sscanf(argv[optind], "%d", &duration);
   if (count != 1)
   {
     printf("Did not receive integer duration argument!\n");
-    return EXIT_FAILURE;
+    fflush(stdout);
+    MPI_Abort(MPI_COMM_WORLD, 1);;
   }
 
   // INTRO BARRIER
   debug("barrier1\n");
-  profile_entry(MPI_Wtime(), strdup("barrier1 start"));
   MPI_Barrier(MPI_COMM_WORLD);
-  profile_entry(MPI_Wtime(), strdup("barrier1 done"));
   debug("sleep %i\n", duration);
 
   // SLEEP
   sleep(duration);
 
-  // WRITE OUTPUTS
-  if (output_count > 0)
-    profile_entry(MPI_Wtime(), strdup("write start"));
-  for (int i = 0; i < output_count; i++)
+  // WRITE OUTPUT
+  if (mpi_rank == 0)
   {
-    char tmp[128];
-    sprintf(tmp, "%s-%i", outputs[i], mpi_rank);
-    debug("write to: %s\n", tmp);
-    FILE* file = fopen(tmp, "w");
+    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);
   }
-  if (output_count > 0)
-    profile_entry(MPI_Wtime(), strdup("write done"));
 
   // FINAL BARRIER
   debug("barrier2\n");
-  profile_entry(MPI_Wtime(), strdup("barrier2 start"));
-
   MPI_Barrier(MPI_COMM_WORLD);
-  profile_entry(MPI_Wtime(), strdup("barrier2 done"));
 
   debug("job done\n");
   MPI_Finalize();
-  profile_write(mpi_rank, stdout);
-  profile_finalize();
   return EXIT_SUCCESS;
 }
 
@@ -163,7 +145,8 @@
 
 void print_help()
 {
-  printf("usage: <duration>\n");
+  printf("usage: <options> <duration>\n");
+  fflush(stdout);
 }
 
 void crash(char* msg)




More information about the Swift-commit mailing list