[Swift-commit] r5005 - trunk/tests/mpi/crow

wozniak at ci.uchicago.edu wozniak at ci.uchicago.edu
Thu Aug 25 11:30:09 CDT 2011


Author: wozniak
Date: 2011-08-25 11:30:08 -0500 (Thu, 25 Aug 2011)
New Revision: 5005

Added:
   trunk/tests/mpi/crow/100-input.txt
   trunk/tests/mpi/crow/100-mci.check.sh
   trunk/tests/mpi/crow/100-mci.clean.sh
   trunk/tests/mpi/crow/100-mci.setup.sh
   trunk/tests/mpi/crow/100-mci.swift
   trunk/tests/mpi/crow/100-mpi-cp.c
   trunk/tests/mpi/crow/sites.template.xml
   trunk/tests/mpi/crow/tc.template.data
Log:
Initial MPI test for crow


Copied: trunk/tests/mpi/crow/100-input.txt (from rev 4993, trunk/tests/mpi/local/100-input.txt)
===================================================================
--- trunk/tests/mpi/crow/100-input.txt	                        (rev 0)
+++ trunk/tests/mpi/crow/100-input.txt	2011-08-25 16:30:08 UTC (rev 5005)
@@ -0,0 +1 @@
+hello

Copied: trunk/tests/mpi/crow/100-mci.check.sh (from rev 4993, trunk/tests/mpi/local/100-mci.check.sh)
===================================================================
--- trunk/tests/mpi/crow/100-mci.check.sh	                        (rev 0)
+++ trunk/tests/mpi/crow/100-mci.check.sh	2011-08-25 16:30:08 UTC (rev 5005)
@@ -0,0 +1,12 @@
+#!/bin/bash
+
+set -x
+
+[ -f 100-output.txt ] || exit 1
+
+CONTENTS1=$( cat 100-input.txt )
+CONTENTS2=$( cat 100-output.txt )
+
+[[ $CONTENTS1 == $CONTENTS2 ]] || exit 1
+
+exit 0

Copied: trunk/tests/mpi/crow/100-mci.clean.sh (from rev 4993, trunk/tests/mpi/local/100-mci.clean.sh)
===================================================================
--- trunk/tests/mpi/crow/100-mci.clean.sh	                        (rev 0)
+++ trunk/tests/mpi/crow/100-mci.clean.sh	2011-08-25 16:30:08 UTC (rev 5005)
@@ -0,0 +1,8 @@
+#!/bin/bash
+
+set -x
+
+rm -v 100-input.txt  || exit 1
+rm -v 100-output.txt || exit 1
+
+exit 0

Copied: trunk/tests/mpi/crow/100-mci.setup.sh (from rev 4993, trunk/tests/mpi/local/100-mci.setup.sh)
===================================================================
--- trunk/tests/mpi/crow/100-mci.setup.sh	                        (rev 0)
+++ trunk/tests/mpi/crow/100-mci.setup.sh	2011-08-25 16:30:08 UTC (rev 5005)
@@ -0,0 +1,11 @@
+#!/bin/bash
+
+set -x
+
+which mpicc || exit 1
+
+mpicc -std=gnu99 $GROUP/100-mpi-cp.c -o $GROUP/mpi-cp || exit 1
+
+cp -v $GROUP/100-input.txt . || exit 1
+
+exit 0

Copied: trunk/tests/mpi/crow/100-mci.swift (from rev 4993, trunk/tests/mpi/local/100-mci.swift)
===================================================================
--- trunk/tests/mpi/crow/100-mci.swift	                        (rev 0)
+++ trunk/tests/mpi/crow/100-mci.swift	2011-08-25 16:30:08 UTC (rev 5005)
@@ -0,0 +1,12 @@
+
+type file;
+
+app (file o) copy(file i)
+{
+  mpi_cp @i @o;
+}
+
+file input<"100-input.txt">;
+file output<"100-output.txt">;
+
+output = copy(input);

Copied: trunk/tests/mpi/crow/100-mpi-cp.c (from rev 4993, trunk/tests/mpi/local/100-mpi-cp.c)
===================================================================
--- trunk/tests/mpi/crow/100-mpi-cp.c	                        (rev 0)
+++ trunk/tests/mpi/crow/100-mpi-cp.c	2011-08-25 16:30:08 UTC (rev 5005)
@@ -0,0 +1,155 @@
+
+/**
+ * Simple Hydra test
+ *
+ * usage: mpi-cp <input> <output>
+ *
+ * Rank 0 reads the input file and sends it to rank 1.
+ * Rank 1 recvs the data and writes the output.
+ */
+
+#include <assert.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/stat.h>
+
+#include <mpi.h>
+
+#define max(a, b) (((a) > (b)) ? (a) : (b))
+#define min(a, b) (((a) < (b)) ? (a) : (b))
+
+void print_help(void);
+void read_input(const char *restrict filename, char** data, int* size);
+void write_output(const char *restrict filename, char* data, int size);
+void startup(void);
+
+const int chunk = 64*1024;
+
+int main(int argc, char* argv[])
+{
+  int mpi_size, mpi_rank;
+
+  MPI_Init(&argc, &argv);
+
+  MPI_Comm_size(MPI_COMM_WORLD, &mpi_size);
+  MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank);
+
+  startup();
+
+  // system("/bin/hostname");
+  // printf("size: %i\n", mpi_size);
+  // printf("rank: %i\n", mpi_rank);
+
+  char* data;
+  int size;
+
+  if (argc != 3)
+  {
+    print_help();
+    return 1;
+  }
+
+  if (mpi_rank == 0)
+  {
+    read_input(argv[1], &data, &size);
+    printf("size: %i\n", size);
+    MPI_Send(&size, 1, MPI_INT,
+             1, 1, MPI_COMM_WORLD);
+    MPI_Send(data, size, MPI_CHAR,
+             1, 1, MPI_COMM_WORLD);
+  }
+  else
+  {
+    MPI_Status status;
+
+    MPI_Recv(&size, 1, MPI_INT,
+             0, 1, MPI_COMM_WORLD, &status);
+    printf("size: %i\n", size);
+
+    data = malloc(size);
+    assert(data);
+    MPI_Recv(data, size, MPI_CHAR,
+             0, 1, MPI_COMM_WORLD, &status);
+
+    write_output(argv[2], data, size);
+  }
+  free(data);
+
+  MPI_Finalize();
+  return EXIT_SUCCESS;
+}
+
+void startup()
+{
+  // system("/bin/hostname");
+  // printf("size: %i\n", mpi_size);
+  // printf("rank: %i\n", mpi_rank);
+  char* pwd = getenv("PWD");
+  printf("PWD: %s\n", pwd);
+  fflush(NULL);
+}
+
+/**
+   Allocates memory for *data
+*/
+void read_input(const char* restrict filename, char** data, int* size)
+{
+  char* result;
+  FILE *file;
+
+  printf("read: %s\n", filename);
+
+  struct stat filestat;
+
+  int error = stat(filename, &filestat);
+  assert(error == 0);
+  int s = filestat.st_size;
+  int actual, c;
+
+  result = malloc(s);
+
+  file = fopen(filename, "r");
+  assert(file);
+
+  int count = 0;
+  while (count < s)
+  {
+    c = min(chunk, s-count);
+    actual = fread(result+count, 1, c, file);
+    count += actual;
+  }
+
+  fclose(file);
+
+  *size = s;
+  *data = result;
+}
+
+void write_output(const char* restrict filename,
+                   char* data, int size)
+{
+  FILE *file;
+
+  int actual, c;
+
+  printf("write: %s\n", filename);
+
+  file = fopen(filename, "w");
+  assert(file);
+
+  int count = 0;
+  while (count < size)
+  {
+    c = min(chunk, size-count);
+    actual = fwrite(data+count, 1, c, file);
+    count += actual;
+  }
+
+  fclose(file);
+}
+
+void print_help()
+{
+  printf("usage: <input> <output>\n");
+}

Copied: trunk/tests/mpi/crow/sites.template.xml (from rev 4991, trunk/tests/providers/local-pbs-coasters/crow/sites.template.xml)
===================================================================
--- trunk/tests/mpi/crow/sites.template.xml	                        (rev 0)
+++ trunk/tests/mpi/crow/sites.template.xml	2011-08-25 16:30:08 UTC (rev 5005)
@@ -0,0 +1,31 @@
+<config>
+
+<import file="sys.xml"/>
+<set name="pwd"><sys:getenv name="PWD"/></set>
+<set name="wdir" value="{pwd}/work"/>
+<echo message="setting workDirectory to: {wdir}"/>
+
+<pool handle="crow">
+  <execution jobmanager="local:pbs" provider="coaster" url="none"/>
+  <filesystem provider="local" url="none" />
+  <profile namespace="globus" key="maxWallTime">1</profile>
+  <profile namespace="globus" key="maxTime">7200</profile>
+
+  <profile namespace="globus" key="providerAttributes">
+    pbs.aprun;pbs.mpp;depth=6
+  </profile>
+  <profile key="jobsPerNode" namespace="globus">1</profile>
+  <profile key="slots" namespace="globus">1</profile>
+  <profile key="nodeGranularity" namespace="globus">2</profile>
+  <profile key="maxNodes" namespace="globus">4</profile>
+  <profile key="workerLoggingLevel" namespace="globus">DEBUG</profile>
+  <profile key="workerLoggingDirectory" namespace="globus">{wdir}</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 -->

Copied: trunk/tests/mpi/crow/tc.template.data (from rev 4993, trunk/tests/mpi/local/tc.template.data)
===================================================================
--- trunk/tests/mpi/crow/tc.template.data	                        (rev 0)
+++ trunk/tests/mpi/crow/tc.template.data	2011-08-25 16:30:08 UTC (rev 5005)
@@ -0,0 +1,22 @@
+#This is the transformation catalog.
+#
+#It comes pre-configured with a number of simple transformations with
+#paths that are likely to work on a linux box. However, on some systems,
+#the paths to these executables will be different (for example, sometimes
+#some of these programs are found in /usr/bin rather than in /bin)
+#
+#NOTE WELL: fields in this file must be separated by tabs, not spaces; and
+#there must be no trailing whitespace at the end of each line.
+#
+# sitename  transformation  path   INSTALLED  platform  profiles
+localhost 	echo 		/bin/echo	INSTALLED	INTEL32::LINUX	null
+localhost 	cat 		/bin/cat	INSTALLED	INTEL32::LINUX	null
+localhost 	ls 		/bin/ls		INSTALLED	INTEL32::LINUX	null
+localhost 	grep 		/bin/grep	INSTALLED	INTEL32::LINUX	null
+localhost 	sort 		/bin/sort	INSTALLED	INTEL32::LINUX	null
+localhost 	paste 		/bin/paste	INSTALLED	INTEL32::LINUX	null
+localhost 	cp 		/bin/cp	        INSTALLED	INTEL32::LINUX	null
+
+# hydra-tests-2
+
+crow 	mpi_cp 		_DIR_/mpi-cp    INSTALLED	INTEL32::LINUX	globus::hostCount=2




More information about the Swift-commit mailing list