[Pvfs2-cvs] commit by aching in pvfs2-1/test/client/mpi-io:
mpi-unbalanced-test.c module.mk.in mpi-md-test.c
CVS commit program
cvs at parl.clemson.edu
Mon Jul 21 14:22:28 EDT 2008
Update of /projects/cvsroot/pvfs2-1/test/client/mpi-io
In directory parlweb1:/tmp/cvs-serv20547/test/client/mpi-io
Modified Files:
Tag: locking-branch
module.mk.in mpi-md-test.c
Added Files:
Tag: locking-branch
mpi-unbalanced-test.c
Log Message:
Reverse merged and ported to HEAD.
--- /dev/null 2004-06-24 14:04:38.000000000 -0400
+++ mpi-unbalanced-test.c 2008-07-21 14:22:29.000000000 -0400
@@ -0,0 +1,103 @@
+/*
+ * (C) 1995-2001 Clemson University and Argonne National Laboratory.
+ *
+ * See COPYING in top-level directory.
+ */
+
+/* This is a test from Julian Kunkel that places an unbalanced distributed
+ * on the servers.
+ * With two servers, the datatype used for the view will place
+ * 64KByte on one server and 128KByte on another. This should probably
+ * be generalized for a better test of this type of workload.
+ */
+#include <mpi.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <getopt.h>
+#include <assert.h>
+
+int main (int argc, char** argv)
+{
+ int iter;
+ int ret;
+ MPI_File fh;
+ MPI_Init(&argc, &argv);
+
+ MPI_Aint indices[4];
+ MPI_Datatype old_types[4];
+ int blocklens[4];
+ char fname[255];
+
+ MPI_Datatype dt;
+
+ int total_bytes = 100*1024*1024;
+
+ char * f_buff = malloc( total_bytes );
+
+ if(argc < 2)
+ {
+ fprintf(stderr, "usage: %s <pvfs test dir>\n", argv[0]);
+ exit(1);
+ }
+
+ /* creation of datatype */
+ blocklens[0] = 1;
+ blocklens[1] = 128*1024;
+ blocklens[2] = 64*1024;
+ blocklens[3] = 1;
+ indices[0] = 0;
+ indices[1] = 0;
+ indices[2] = (128+64)*1024;
+ indices[3] = (128+128)*1024;
+ old_types[0] = MPI_LB;
+ old_types[1] = MPI_BYTE;
+ old_types[2] = MPI_BYTE;
+ old_types[3] = MPI_UB;
+
+ ret = MPI_Type_struct( 4, blocklens, indices, old_types, & dt );
+ assert(ret == 0);
+
+ ret = MPI_Type_commit(& dt);
+ assert(ret == 0);
+
+ sprintf(fname, "%s/test.%d", argv[1], rand());
+ ret = MPI_File_open( MPI_COMM_WORLD,
+ fname, MPI_MODE_RDWR | MPI_MODE_CREATE,
+ MPI_INFO_NULL, & fh );
+ assert(ret == 0);
+
+ ret = MPI_File_set_view(fh, 0,
+ MPI_BYTE, /* etype */
+ dt, /* file type */
+ "native", MPI_INFO_NULL);
+
+ assert(ret == 0);
+ memset(f_buff, 17, total_bytes );
+ for(iter = 0 ; iter < 50; iter ++){
+ printf("%d writing %fKByte \n", iter, total_bytes/1024.0f);
+ ret = MPI_File_write(
+ fh,
+ f_buff,
+ total_bytes,
+ MPI_BYTE,
+ MPI_STATUS_IGNORE );
+ assert(ret == 0);
+ }
+
+ MPI_File_close(& fh);
+
+ MPI_Finalize();
+
+ return 0;
+}
+
+/*
+ * Local variables:
+ * c-indent-level: 4
+ * c-basic-offset: 4
+ * End:
+ *
+ * vim: ts=8 sts=4 sw=4 expandtab
+ */
Index: module.mk.in
===================================================================
RCS file: /projects/cvsroot/pvfs2-1/test/client/mpi-io/module.mk.in,v
diff -p -u -r1.7 -r1.7.38.1
--- module.mk.in 26 Jan 2006 19:19:35 -0000 1.7
+++ module.mk.in 21 Jul 2008 18:22:28 -0000 1.7.38.1
@@ -2,4 +2,5 @@ DIR := client/mpi-io
MPIIOTESTSRC += \
$(DIR)/mpi-io-test.c \
- $(DIR)/mpi-md-test.c
+ $(DIR)/mpi-md-test.c \
+ $(DIR)/mpi-unbalanced-test.c
Index: mpi-md-test.c
===================================================================
RCS file: /projects/cvsroot/pvfs2-1/test/client/mpi-io/mpi-md-test.c,v
diff -p -u -r1.1 -r1.1.50.1
--- mpi-md-test.c 29 Aug 2005 16:19:05 -0000 1.1
+++ mpi-md-test.c 21 Jul 2008 18:22:28 -0000 1.1.50.1
@@ -8,7 +8,11 @@
* The timing and command-line parsing were so useful that this was further
* extended to test resize operations
*
- * usage: -d /path/to/directory -n number_of_files [-O] [-R]
+ * And while the default (and most useful) mode is to compare collective
+ * open/create/resize, it is sometimes instructive to compare with independent
+ * access
+ *
+ * usage: -d /path/to/directory -n number_of_files [-O] [-R] [-i]
*/
#include <string.h>
@@ -138,6 +142,7 @@ int opt_nfiles;
char opt_basedir[PATH_MAX];
int opt_do_open=0;
int opt_do_resize=0;
+int opt_do_indep=0;
void usage(char *name);
int parse_args(int argc, char **argv);
@@ -147,17 +152,20 @@ int test_resize(int rank, int iterations
void usage(char *name)
{
- fprintf(stderr, "usage: %s -d /path/to/directory -n #_of_files [TEST}\n", name);
+ fprintf(stderr, "usage: %s -d /path/to/directory -n #_of_files [TEST] [MODE]\n", name);
fprintf(stderr, " where TEST is one of:\n"
" -O test file open times\n"
- " -R test file resize times\n");
+ " -R test file resize times\n"
+ " and MODE is one of:\n"
+ " -i independent operations\n"
+ " -c collective operations (default)\n");
exit(-1);
}
int parse_args(int argc, char **argv)
{
int c;
- while ( (c = getopt(argc, argv, "d:n:OR")) != -1 ) {
+ while ( (c = getopt(argc, argv, "d:n:ORic")) != -1 ) {
switch (c) {
case 'd':
strncpy(opt_basedir, optarg, PATH_MAX);
@@ -171,6 +179,9 @@ int parse_args(int argc, char **argv)
case 'R':
opt_do_resize = 1;
break;
+ case 'i':
+ opt_do_indep = 1;
+ break;
case '?':
case ':':
default:
@@ -224,13 +235,15 @@ int main(int argc, char **argv)
if (rank == 0) {
printf("%d procs ", nprocs);
if (opt_do_open) {
- printf("%f seconds to open %d files: %f secs/open\n",
- total_time, opt_nfiles,
- (total_time)/opt_nfiles);
+ printf("%f seconds to open %d files: %f secs/open: %s\n",
+ total_time, opt_nfiles,
+ (total_time)/opt_nfiles,
+ (opt_do_indep? "independent" : "collective"));
} else if (opt_do_resize) {
- printf("%f seconds to perform %d resize ops: %f secs/opeeration\n",
- total_time, opt_nfiles,
- (total_time)/opt_nfiles);
+ printf("%f seconds to perform %d resize ops: %f secs/operation: %s\n",
+ total_time, opt_nfiles,
+ (total_time)/opt_nfiles,
+ (opt_do_indep? "independent" : "collective"));
}
}
@@ -245,11 +258,15 @@ int test_opens(int nfiles, char * test_d
int i;
char test_file[PATH_MAX];
MPI_File fh;
+ MPI_Comm comm = MPI_COMM_WORLD;
int errcode;
+ if (opt_do_indep)
+ comm = MPI_COMM_SELF;
+
for (i=0; i<nfiles; i++) {
snprintf(test_file, PATH_MAX, "%s/testfile.%d", test_dir, i);
- errcode = MPI_File_open(MPI_COMM_WORLD, test_file,
+ errcode = MPI_File_open(comm, test_file,
MPI_MODE_CREATE|MPI_MODE_RDWR, info, &fh);
if (errcode != MPI_SUCCESS) {
handle_error(errcode, "MPI_File_open");
@@ -277,9 +294,13 @@ int test_resize(int rank, int iterations
MPI_File fh;
int errcode;
MPI_Offset size;
+ MPI_Comm comm = MPI_COMM_WORLD;
+
+ if (opt_do_indep)
+ comm = MPI_COMM_SELF;
snprintf(test_file, PATH_MAX, "%s/testfile", test_dir);
- errcode = MPI_File_open(MPI_COMM_WORLD, test_file,
+ errcode = MPI_File_open(comm, test_file,
MPI_MODE_CREATE|MPI_MODE_RDWR, info, &fh);
if (errcode != MPI_SUCCESS) {
handle_error(errcode, "MPI_File_open");
More information about the Pvfs2-cvs
mailing list