diff options
author | Albert Cheng <acheng@hdfgroup.org> | 1998-02-14 06:22:11 (GMT) |
---|---|---|
committer | Albert Cheng <acheng@hdfgroup.org> | 1998-02-14 06:22:11 (GMT) |
commit | ffdd694b4f4d27eba61c5069c174dc42ce16e4c0 (patch) | |
tree | a1a8915e1bf97c8ef20318baecb7de6a7cb263f0 /testpar/phdf5sup.c | |
parent | 88e3f96bd8cc8d2c83f76b1f6c81e84befd0e90f (diff) | |
download | hdf5-ffdd694b4f4d27eba61c5069c174dc42ce16e4c0.zip hdf5-ffdd694b4f4d27eba61c5069c174dc42ce16e4c0.tar.gz hdf5-ffdd694b4f4d27eba61c5069c174dc42ce16e4c0.tar.bz2 |
[svn-r275] Initial version of test files for the parallel library.
Diffstat (limited to 'testpar/phdf5sup.c')
-rw-r--r-- | testpar/phdf5sup.c | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/testpar/phdf5sup.c b/testpar/phdf5sup.c new file mode 100644 index 0000000..e09c403 --- /dev/null +++ b/testpar/phdf5sup.c @@ -0,0 +1,54 @@ +/* debugging tools */ +#define MESG(x)\ + printf("%s\n", x);\ + +#ifdef HAVE_PARALLEL +#define MPI_BANNER(mesg)\ + {printf("================================\n");\ + printf("Proc %d: ", myid); \ + printf("*** %s\n", mesg);\ + printf("================================\n");} +#else +#define MPI_BANNER(mesg)\ + {printf("================================\n");\ + printf("*** %s\n", mesg);\ + printf("================================\n");} +#endif + +#ifdef HAVE_PARALLEL +#define SYNC(comm)\ + {MPI_BANNER("doing a SYNC"); MPI_Barrier(comm); MPI_BANNER("SYNC DONE");} + +/* pause the process for a moment to allow debugger to attach if desired. */ +/* Will pause more if greenlight file is not persent but will eventually */ +/* continue. */ +#include <sys/types.h> +#include <sys/stat.h> +void pause_proc(MPI_Comm comm, int myid, char* processor_name, int namelen, + int argc, char **argv) +{ + + int pid; + struct stat statbuf; + char greenlight[] = "go"; + int maxloop = 10; + int time_int = 10; + + /* check if an pause interval option is given */ + if (--argc > 0 && isdigit(*++argv)) + time_int = atoi(*argv); + pid = getpid(); + printf("Proc %d (%*s): pid = %d\n", + myid, namelen, processor_name, pid); + + if (myid == 0) + while ((stat(greenlight, &statbuf) == -1) && maxloop-- > 0){ + printf("waiting(%ds) for file %s ...", time_int, greenlight); + fflush(stdout); + sleep(time_int); + } + MPI_Barrier(comm); +} +#endif /*HAVE_PARALLEL*/ + + |