[Pvfs2-cvs] commit by sson in pvfs2/test/active-storage: Makefile
simple.c
CVS commit program
cvs at parl.clemson.edu
Thu Feb 11 11:47:50 EST 2010
Update of /projects/cvsroot/pvfs2/test/active-storage
In directory parlweb1:/tmp/cvs-serv19236/test/active-storage
Modified Files:
Tag: as-branch
Makefile simple.c
Log Message:
minor changes in test programs.
Index: Makefile
===================================================================
RCS file: /projects/cvsroot/pvfs2/test/active-storage/Attic/Makefile,v
diff -p -u -r1.1.2.9 -r1.1.2.10
--- Makefile 25 Oct 2009 05:54:04 -0000 1.1.2.9
+++ Makefile 11 Feb 2010 16:47:50 -0000 1.1.2.10
@@ -1,10 +1,7 @@
all: simple1_unaligned test_kmeans
-#MPICC=/home/sson/as-branch/mpich2-1.1/bin/mpicc
-#MPICC=/home/sson/test/mpich2/bin/mpicc
MPICC=mpicc
CFLAGS=-Wall -O2
-#CFLAGS=-Wall -O2
simple.o: simple.c
$(MPICC) -c -O2 simple.c
Index: simple.c
===================================================================
RCS file: /projects/cvsroot/pvfs2/test/active-storage/Attic/simple.c,v
diff -p -u -r1.1.2.5 -r1.1.2.6
--- simple.c 3 Feb 2010 16:59:50 -0000 1.1.2.5
+++ simple.c 11 Feb 2010 16:47:50 -0000 1.1.2.6
@@ -32,6 +32,7 @@ int main( int argc, char *argv[] )
extern int optind;
int is_output_timing=0, is_print_usage = 0;
int _debug=0, use_gen_file = 0, use_actsto = 0, use_normalsto=0;
+ char *token;
MPI_Offset disp, offset, file_size;
MPI_Datatype etype, ftype, buftype;
@@ -69,17 +70,42 @@ int main( int argc, char *argv[] )
break;
case 'h': is_print_usage = 1;
break;
- case 's': fsize = atoi(optarg);
- if (rank ==0) printf("fsize = %d (MB)\n", fsize);
+ case 's':
+ token = strtok(optarg, ":");
+ //if (rank == 0) printf("token=%s\n", token);
+ if(token == NULL) {
+ if (rank == 0) printf("1: Wrong file size format!\n");
+ MPI_Finalize();
+ exit(1);
+ }
+
+ fsize = atoi(token);
+ token = strtok(NULL, ":");
+ //if (rank == 0) printf("token=%s\n", token);
+ if(token == NULL) {
+ if (rank == 0) printf("2: Wrong file size format!\n");
+ MPI_Finalize();
+ exit(1);
+ }
+ if(*token != 'm' && *token != 'g') {
+ if (rank == 0) printf("3: Wrong file size format!\n");
+ MPI_Finalize();
+ exit(1);
+ }
+ if (rank ==0) printf("fsize = %d (%s)\n", fsize, (*token=='m'?"MB":"GB"));
if (fsize == 0)
nitem = 0;
else {
MPI_Type_size(MPI_DOUBLE, &type_size);
- nitem = fsize*1024;
- nitem = nitem*1024;
+ nitem = fsize*1024; /* KB */
+ nitem = nitem*1024; /* MB */
+ if(*token == 'g') {
+ //if(rank == 0) printf("data in GB\n");
+ nitem = nitem*1024; /* GB */
+ }
nitem = nitem/type_size;
//printf("nitem=%lld\n", nitem);
- nitem = nitem/size;
+ nitem = nitem/size; /* size means comm size */
}
if (rank == 0) printf("nitem = %d\n", nitem);
break;
@@ -97,6 +123,11 @@ int main( int argc, char *argv[] )
MPI_Finalize();
exit(1);
}
+
+ int sizeof_mpi_offset;
+ sizeof_mpi_offset = (int)(sizeof(MPI_Offset)); // 8
+ //if (rank == 0) printf ("size_of_mpi_offset=%d\n", sizeof_mpi_offset);
+
if(use_normalsto == 1 && use_actsto == 1) {
if(rank == 0)
printf("Can't test both: either normalsto or actsto\n");
@@ -113,9 +144,11 @@ int main( int argc, char *argv[] )
MPI_File_open( comm, fname, MPI_MODE_RDWR | MPI_MODE_CREATE, MPI_INFO_NULL, &fh );
/* Set the file view */
- disp = rank * nitem * type_size;;
+ disp = rank * nitem * type_size;
+ printf("%d: disp = %lld\n", rank, disp);
etype = MPI_DOUBLE;
ftype = MPI_DOUBLE;
+
result = MPI_File_set_view(fh, disp, etype, ftype, "native", MPI_INFO_NULL);
if(result != MPI_SUCCESS)
@@ -123,6 +156,12 @@ int main( int argc, char *argv[] )
buf = (double *)malloc( nitem * sizeof(double) );
+ if (buf == NULL) {
+ if(rank == 0) printf("malloc() failed\n");
+ MPI_Finalize();
+ exit(1);
+ }
+
buf[0] = rand()%4096;
if(rank==0) printf("%lf\n", buf[0]);
max = min = sum = buf[0];
@@ -150,9 +189,10 @@ int main( int argc, char *argv[] )
printf("%d: iotime (write) = %10.4f\n", rank, iotime);
MPI_Get_count( &status, MPI_DOUBLE, &count );
- //printf("count=%d\n", count);
+ //printf("count = %lld\n", count);
+
if (count != nitem) {
- fprintf( stderr, "%d: Wrong count (%d) on write\n", rank, count );
+ fprintf( stderr, "%d: Wrong count (%lld) on write\n", rank, count );
fflush(stderr);
/* exit */
MPI_Finalize();
@@ -160,6 +200,7 @@ int main( int argc, char *argv[] )
}
if(rank == 0) printf("File is written\n\n");
+
MPI_File_close(&fh);
}
More information about the Pvfs2-cvs
mailing list