[Swift-commit] r3693 - trunk/tests/mpi
noreply at svn.ci.uchicago.edu
noreply at svn.ci.uchicago.edu
Tue Oct 26 14:47:15 CDT 2010
Author: wozniak
Date: 2010-10-26 14:47:15 -0500 (Tue, 26 Oct 2010)
New Revision: 3693
Added:
trunk/tests/mpi/100-input.txt
trunk/tests/mpi/100-mci.check.sh
trunk/tests/mpi/100-mci.clean.sh
trunk/tests/mpi/100-mci.setup.sh
trunk/tests/mpi/100-mci.swift
trunk/tests/mpi/100-mpi-cp.c
trunk/tests/mpi/sites.template.xml
trunk/tests/mpi/tc.template.data
Log:
Import first MPI test (sketch)
Added: trunk/tests/mpi/100-input.txt
===================================================================
--- trunk/tests/mpi/100-input.txt (rev 0)
+++ trunk/tests/mpi/100-input.txt 2010-10-26 19:47:15 UTC (rev 3693)
@@ -0,0 +1 @@
+hello
Added: trunk/tests/mpi/100-mci.check.sh
===================================================================
--- trunk/tests/mpi/100-mci.check.sh (rev 0)
+++ trunk/tests/mpi/100-mci.check.sh 2010-10-26 19:47:15 UTC (rev 3693)
@@ -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
Property changes on: trunk/tests/mpi/100-mci.check.sh
___________________________________________________________________
Name: svn:executable
+ *
Added: trunk/tests/mpi/100-mci.clean.sh
===================================================================
--- trunk/tests/mpi/100-mci.clean.sh (rev 0)
+++ trunk/tests/mpi/100-mci.clean.sh 2010-10-26 19:47:15 UTC (rev 3693)
@@ -0,0 +1,8 @@
+#!/bin/bash
+
+set -x
+
+rm -v 100-input.txt || exit 1
+rm -v 100-output.txt || exit 1
+
+exit 0
Property changes on: trunk/tests/mpi/100-mci.clean.sh
___________________________________________________________________
Name: svn:executable
+ *
Added: trunk/tests/mpi/100-mci.setup.sh
===================================================================
--- trunk/tests/mpi/100-mci.setup.sh (rev 0)
+++ trunk/tests/mpi/100-mci.setup.sh 2010-10-26 19:47:15 UTC (rev 3693)
@@ -0,0 +1,11 @@
+#!/bin/bash
+
+set -x
+
+which mpicc || exit 1
+
+mpicc -std=gnu99 $GROUP/100-mpi-cp.c -o mpi-cp || exit 1
+
+cp -v $GROUP/100-input.txt . || exit 1
+
+exit 0
Property changes on: trunk/tests/mpi/100-mci.setup.sh
___________________________________________________________________
Name: svn:executable
+ *
Added: trunk/tests/mpi/100-mci.swift
===================================================================
--- trunk/tests/mpi/100-mci.swift (rev 0)
+++ trunk/tests/mpi/100-mci.swift 2010-10-26 19:47:15 UTC (rev 3693)
@@ -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);
Added: trunk/tests/mpi/100-mpi-cp.c
===================================================================
--- trunk/tests/mpi/100-mpi-cp.c (rev 0)
+++ trunk/tests/mpi/100-mpi-cp.c 2010-10-26 19:47:15 UTC (rev 3693)
@@ -0,0 +1,135 @@
+/*
+ * Simple Hydra test
+ */
+
+#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 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;
+
+ assert(argc == 3);
+
+ 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);
+ }
+
+ 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);
+}
+
+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);
+}
Added: trunk/tests/mpi/sites.template.xml
===================================================================
--- trunk/tests/mpi/sites.template.xml (rev 0)
+++ trunk/tests/mpi/sites.template.xml 2010-10-26 19:47:15 UTC (rev 3693)
@@ -0,0 +1,24 @@
+<config>
+
+ <pool handle="localhost" sysinfo="INTEL32::LINUX">
+ <gridftp url="local://localhost" />
+ <execution provider="local" url="none" />
+ <workdirectory>_WORK_</workdirectory>
+ <profile namespace="swift" key="stagingMethod">file</profile>
+ </pool>
+
+ <pool handle="coasterslocal">
+ <filesystem provider="local" />
+ <execution provider="coaster" jobmanager="local:local"/>
+ <profile namespace="globus" key="internalHostname">_HOST_</profile>
+ <profile namespace="karajan" key="jobthrottle">2.55</profile>
+ <profile namespace="karajan" key="initialScore">10000</profile>
+ <profile namespace="globus" key="workersPerNode">4</profile>
+ <profile namespace="globus" key="slots">8</profile>
+ <profile namespace="globus" key="maxTime">1000</profile>
+ <profile namespace="globus" key="nodeGranularity">1</profile>
+ <profile namespace="globus" key="maxNodes">4</profile>
+ <workdirectory>_WORK_</workdirectory>
+ </pool>
+
+</config>
Added: trunk/tests/mpi/tc.template.data
===================================================================
--- trunk/tests/mpi/tc.template.data (rev 0)
+++ trunk/tests/mpi/tc.template.data 2010-10-26 19:47:15 UTC (rev 3693)
@@ -0,0 +1,24 @@
+#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
+
+coasterslocal mpi_cp _PWD_/mpi-cp INSTALLED INTEL32::LINUX globus::hostCount=2
+
+# coasterslocal mpi_cp /bin/false INSTALLED INTEL32::LINUX globus::hostCount=2
More information about the Swift-commit
mailing list