summaryrefslogtreecommitdiffstats
path: root/perform
diff options
context:
space:
mode:
authorAllen Byrne <byrn@hdfgroup.org>2011-08-15 14:06:53 (GMT)
committerAllen Byrne <byrn@hdfgroup.org>2011-08-15 14:06:53 (GMT)
commit8d80bf4a93a2de494e710eb9719483178ad215e8 (patch)
tree733fc801d4b04608cd57bc5003a52513c193dc4d /perform
parent03a4dd9fc38eba695cb9c169d6879280fc665f3f (diff)
downloadhdf5-8d80bf4a93a2de494e710eb9719483178ad215e8.zip
hdf5-8d80bf4a93a2de494e710eb9719483178ad215e8.tar.gz
hdf5-8d80bf4a93a2de494e710eb9719483178ad215e8.tar.bz2
[svn-r21228] Added #ifdefs around #include unistd.h and created windows getlogin() function for building HDF5 parallel on windows.
Reviewed and tested locally and tested by user.
Diffstat (limited to 'perform')
-rw-r--r--perform/benchpar.c13
-rw-r--r--perform/mpi-perf.c13
-rw-r--r--perform/perf.c113
-rw-r--r--perform/pio_engine.c2
-rw-r--r--perform/sio_standalone.h48
5 files changed, 110 insertions, 79 deletions
diff --git a/perform/benchpar.c b/perform/benchpar.c
index 035e9d6..ea1195b 100644
--- a/perform/benchpar.c
+++ b/perform/benchpar.c
@@ -13,7 +13,9 @@
* access to either file, you may request a copy from help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+#ifdef H5_HAVE_UNISTD_H
#include <unistd.h>
+#endif
#include <stdlib.h>
#include <assert.h>
#include <math.h>
@@ -23,6 +25,11 @@
#include "hdf5.h"
/* Local macros */
+#ifdef _MSC_VER /* H5_HAVE_VISUAL_STUDIO */
+#define HDgetlogin() Wgetlogin()
+#else /* H5_HAVE_VISUAL_STUDIO */
+#define HDgetlogin() getlogin()
+#endif /* H5_HAVE_VISUAL_STUDIO */
/*
* HDF Boolean type.
@@ -115,13 +122,13 @@ static hid_t create_fapl(MPI_Comm comm, MPI_Info info, int acc_type )
/* set parallel access with communicator, using MPI-I/O driver */
if (acc_type == FACC_MPIO) {
- ret = H5Pset_fapl_mpio(fapl, comm, info);
+ ret = H5Pset_fapl_mpio(fapl, comm, info);
assert(ret>=0);
} /* end if */
/* set parallel access with communicator, using MPI-posix driver */
if (acc_type == FACC_MPIPOSIX) {
- ret = H5Pset_fapl_mpiposix(fapl, comm, use_gpfs);
+ ret = H5Pset_fapl_mpiposix(fapl, comm, use_gpfs);
assert(ret>=0);
} /* end if */
@@ -312,7 +319,7 @@ int main(int argc, char *argv[])
char *login; /* Pointer to login name */
/* Get the login name for this user */
- login=getlogin();
+ login=HDgetlogin();
if(login==NULL)
login=DEFAULT_USERNAME;
diff --git a/perform/mpi-perf.c b/perform/mpi-perf.c
index c0fe794..a09d672 100644
--- a/perform/mpi-perf.c
+++ b/perform/mpi-perf.c
@@ -55,10 +55,19 @@
#include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>
+#ifdef H5_HAVE_UNISTD_H
#include <unistd.h>
+#endif
#include <errno.h>
#include <string.h>
-#include <sys/time.h>
+#if defined(H5_TIME_WITH_SYS_TIME)
+# include <sys/time.h>
+# include <time.h>
+#elif defined(H5_HAVE_SYS_TIME_H)
+# include <sys/time.h>
+#else
+# include <time.h>
+#endif
#include <mpi.h>
#ifndef MPI_FILE_NULL /*MPIO may be defined in mpi.h already */
# include <mpio.h>
@@ -299,7 +308,7 @@ die_jar_jar_die:
#if H5_HAVE_SETENV
/* no setenv or unsetenv */
/* clear the environment variable if it was set earlier */
- if (opt_pvfstab_set){
+ if (opt_pvfstab_set){
unsetenv("PVFSTAB_FILE");
}
#endif
diff --git a/perform/perf.c b/perform/perf.c
index 92b85bc..f006afb 100644
--- a/perform/perf.c
+++ b/perform/perf.c
@@ -28,10 +28,19 @@
#include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>
+#ifdef H5_HAVE_UNISTD_H
#include <unistd.h>
+#endif
#include <errno.h>
#include <string.h>
-#include <sys/time.h>
+#if defined(H5_TIME_WITH_SYS_TIME)
+# include <sys/time.h>
+# include <time.h>
+#elif defined(H5_HAVE_SYS_TIME_H)
+# include <sys/time.h>
+#else
+# include <time.h>
+#endif
#include <mpi.h>
#ifndef MPI_FILE_NULL /*MPIO may be defined in mpi.h already */
# include <mpio.h>
@@ -45,30 +54,30 @@
#define H5FATAL 1
#define VRFY(val, mesg, fatal) do { \
if (!val) { \
- printf("Proc %d: ", mynod); \
+ printf("Proc %d: ", mynod); \
printf("*** Assertion failed (%s) at line %4d in %s\n", \
- mesg, (int)__LINE__, __FILE__); \
- if (fatal){ \
- fflush(stdout); \
- goto die_jar_jar_die; \
- } \
+ mesg, (int)__LINE__, __FILE__); \
+ if (fatal){ \
+ fflush(stdout); \
+ goto die_jar_jar_die; \
+ } \
} \
} while(0)
#define RANK 1
-hsize_t dims[RANK]; /* dataset dim sizes */
+hsize_t dims[RANK]; /* dataset dim sizes */
hsize_t block[RANK], stride[RANK], count[RANK];
hssize_t start[RANK];
hid_t fid; /* HDF5 file ID */
-hid_t acc_tpl; /* File access templates */
-hid_t sid; /* Dataspace ID */
-hid_t file_dataspace; /* File dataspace ID */
-hid_t mem_dataspace; /* memory dataspace ID */
-hid_t dataset; /* Dataset ID */
-hsize_t opt_alignment = 1;
-hsize_t opt_threshold = 1;
-int opt_split_vfd = 0;
-char *meta_ext, *raw_ext; /* holds the meta and raw file extension if */
- /* opt_split_vfd is set */
+hid_t acc_tpl; /* File access templates */
+hid_t sid; /* Dataspace ID */
+hid_t file_dataspace; /* File dataspace ID */
+hid_t mem_dataspace; /* memory dataspace ID */
+hid_t dataset; /* Dataset ID */
+hsize_t opt_alignment = 1;
+hsize_t opt_threshold = 1;
+int opt_split_vfd = 0;
+char *meta_ext, *raw_ext; /* holds the meta and raw file extension if */
+ /* opt_split_vfd is set */
/* DEFAULT VALUES FOR OPTIONS */
@@ -105,7 +114,7 @@ int main(int argc, char **argv)
MPI_File fh;
MPI_Status status;
int nchars;
- herr_t ret; /* Generic return value */
+ herr_t ret; /* Generic return value */
/* startup MPI and determine the rank of this process */
MPI_Init(&argc,&argv);
@@ -155,38 +164,38 @@ int main(int argc, char **argv)
/* setup file access template with parallel IO access. */
if (opt_split_vfd){
- hid_t mpio_pl;
-
- mpio_pl = H5Pcreate (H5P_FILE_ACCESS);
- VRFY((acc_tpl >= 0), "", H5FATAL);
- ret = H5Pset_fapl_mpio(mpio_pl, MPI_COMM_WORLD, MPI_INFO_NULL);
- VRFY((ret >= 0), "", H5FATAL);
-
- /* set optional allocation alignment */
- if (opt_alignment*opt_threshold != 1){
- ret = H5Pset_alignment(acc_tpl, opt_threshold, opt_alignment );
- VRFY((ret >= 0), "H5Pset_alignment succeeded", !H5FATAL);
- }
-
- /* setup file access template */
- acc_tpl = H5Pcreate (H5P_FILE_ACCESS);
- VRFY((acc_tpl >= 0), "", H5FATAL);
- ret = H5Pset_fapl_split(acc_tpl, meta_ext, mpio_pl, raw_ext, mpio_pl);
- VRFY((ret >= 0), "H5Pset_fapl_split succeeded", H5FATAL);
- ret = H5Pclose(mpio_pl);
- VRFY((ret >= 0), "H5Pclose mpio_pl succeeded", H5FATAL);
+ hid_t mpio_pl;
+
+ mpio_pl = H5Pcreate (H5P_FILE_ACCESS);
+ VRFY((acc_tpl >= 0), "", H5FATAL);
+ ret = H5Pset_fapl_mpio(mpio_pl, MPI_COMM_WORLD, MPI_INFO_NULL);
+ VRFY((ret >= 0), "", H5FATAL);
+
+ /* set optional allocation alignment */
+ if (opt_alignment*opt_threshold != 1){
+ ret = H5Pset_alignment(acc_tpl, opt_threshold, opt_alignment );
+ VRFY((ret >= 0), "H5Pset_alignment succeeded", !H5FATAL);
+ }
+
+ /* setup file access template */
+ acc_tpl = H5Pcreate (H5P_FILE_ACCESS);
+ VRFY((acc_tpl >= 0), "", H5FATAL);
+ ret = H5Pset_fapl_split(acc_tpl, meta_ext, mpio_pl, raw_ext, mpio_pl);
+ VRFY((ret >= 0), "H5Pset_fapl_split succeeded", H5FATAL);
+ ret = H5Pclose(mpio_pl);
+ VRFY((ret >= 0), "H5Pclose mpio_pl succeeded", H5FATAL);
}else{
- /* setup file access template */
- acc_tpl = H5Pcreate (H5P_FILE_ACCESS);
- VRFY((acc_tpl >= 0), "", H5FATAL);
- ret = H5Pset_fapl_mpio(acc_tpl, MPI_COMM_WORLD, MPI_INFO_NULL);
- VRFY((ret >= 0), "", H5FATAL);
-
- /* set optional allocation alignment */
- if (opt_alignment*opt_threshold != 1){
- ret = H5Pset_alignment(acc_tpl, opt_threshold, opt_alignment );
- VRFY((ret >= 0), "H5Pset_alignment succeeded", !H5FATAL);
- }
+ /* setup file access template */
+ acc_tpl = H5Pcreate (H5P_FILE_ACCESS);
+ VRFY((acc_tpl >= 0), "", H5FATAL);
+ ret = H5Pset_fapl_mpio(acc_tpl, MPI_COMM_WORLD, MPI_INFO_NULL);
+ VRFY((ret >= 0), "", H5FATAL);
+
+ /* set optional allocation alignment */
+ if (opt_alignment*opt_threshold != 1){
+ ret = H5Pset_alignment(acc_tpl, opt_threshold, opt_alignment );
+ VRFY((ret >= 0), "H5Pset_alignment succeeded", !H5FATAL);
+ }
}
/* create the parallel file */
@@ -198,7 +207,7 @@ int main(int argc, char **argv)
sid = H5Screate_simple(RANK, dims, NULL);
VRFY((sid >= 0), "H5Screate_simple succeeded", H5FATAL);
dataset = H5Dcreate2(fid, "Dataset1", H5T_NATIVE_CHAR, sid,
- H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
VRFY((dataset >= 0), "H5Dcreate2 succeeded", H5FATAL);
/* create the memory dataspace and the file dataspace */
@@ -366,7 +375,7 @@ die_jar_jar_die:
#if H5_HAVE_SETENV
/* no setenv or unsetenv */
/* clear the environment variable if it was set earlier */
- if (opt_pvfstab_set){
+ if (opt_pvfstab_set){
unsetenv("PVFSTAB_FILE");
}
#endif
diff --git a/perform/pio_engine.c b/perform/pio_engine.c
index 27606d0..129addf 100644
--- a/perform/pio_engine.c
+++ b/perform/pio_engine.c
@@ -22,7 +22,9 @@
#include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>
+#ifdef H5_HAVE_UNISTD_H
#include <unistd.h>
+#endif
#include <errno.h>
#include "hdf5.h"
diff --git a/perform/sio_standalone.h b/perform/sio_standalone.h
index 77bb7f8..42f534f 100644
--- a/perform/sio_standalone.h
+++ b/perform/sio_standalone.h
@@ -21,7 +21,7 @@
/** From H5private.h **/
-#include "H5public.h" /* Include Public Definitions */
+#include "H5public.h" /* Include Public Definitions */
/*
@@ -129,11 +129,11 @@
#define HDfgetc(F) fgetc(F)
#define HDfgetpos(F,P) fgetpos(F,P)
#define HDfgets(S,N,F) fgets(S,N,F)
-#ifdef _WIN32
+#ifdef _WIN32 /* H5_HAVE_VISUAL_STUDIO */
#define HDfileno(F) _fileno(F)
-#else /* _WIN32 */
+#else /* H5_HAVE_VISUAL_STUDIO */
#define HDfileno(F) fileno(F)
-#endif /* _WIN32 */
+#endif /* H5_HAVE_VISUAL_STUDIO */
#define HDfloor(X) floor(X)
#define HDfmod(X,Y) fmod(X,Y)
#define HDfopen(S,M) fopen(S,M)
@@ -169,7 +169,7 @@ H5_DLL int HDfprintf (FILE *stream, const char *fmt, ...);
* For Unix, if off_t is not 64bit big, try use the pseudo-standard
* xxx64 versions if available.
*/
-#ifdef _WIN32
+#ifdef _WIN32 /* H5_HAVE_VISUAL_STUDIO */
#define HDfstat(F,B) _fstati64(F,B)
#define HDlstat(S,B) _lstati64(S,B)
#define HDstat(S,B) _stati64(S,B)
@@ -202,7 +202,11 @@ H5_DLL int HDfprintf (FILE *stream, const char *fmt, ...);
#define HDgetgrgid(G) getgrgid(G)
#define HDgetgrnam(S) getgrnam(S)
#define HDgetgroups(Z,G) getgroups(Z,G)
+#ifdef _MSC_VER /* H5_HAVE_VISUAL_STUDIO */
+#define HDgetlogin() Wgetlogin()
+#else /* H5_HAVE_VISUAL_STUDIO */
#define HDgetlogin() getlogin()
+#endif /* H5_HAVE_VISUAL_STUDIO */
#define HDgetpgrp() getpgrp()
#define HDgetpid() getpid()
#define HDgetppid() getppid()
@@ -235,7 +239,7 @@ H5_DLL int HDfprintf (FILE *stream, const char *fmt, ...);
#define HDlog(X) log(X)
#define HDlog10(X) log10(X)
#define HDlongjmp(J,N) longjmp(J,N)
-#ifdef _WIN32
+#ifdef _WIN32 /* H5_HAVE_VISUAL_STUDIO */
#define HDlseek(F,O,W) _lseeki64(F,O,W)
#else
#ifdef H5_HAVE_LSEEK64
@@ -258,18 +262,18 @@ H5_DLL int HDfprintf (FILE *stream, const char *fmt, ...);
#define HDmemcpy(X,Y,Z) memcpy((char*)(X),(const char*)(Y),Z)
#define HDmemmove(X,Y,Z) memmove((char*)(X),(const char*)(Y),Z)
/*
- * The (void*) cast just avoids a compiler warning in _WIN32
+ * The (void*) cast just avoids a compiler warning in H5_HAVE_VISUAL_STUDIO
*/
-#ifdef _WIN32
+#ifdef _WIN32 /* H5_HAVE_VISUAL_STUDIO */
#define HDmemset(X,C,Z) memset((void*)(X),C,Z)
-#else /* _WIN32 */
+#else /* H5_HAVE_VISUAL_STUDIO */
#define HDmemset(X,C,Z) memset(X,C,Z)
-#endif /* _WIN32 */
-#ifdef _WIN32
+#endif /* H5_HAVE_VISUAL_STUDIO */
+#ifdef _WIN32 /* H5_HAVE_VISUAL_STUDIO */
#define HDmkdir(S,M) _mkdir(S)
-#else /* _WIN32 */
+#else /* H5_HAVE_VISUAL_STUDIO */
#define HDmkdir(S,M) mkdir(S,M)
-#endif /* _WIN32 */
+#endif /* H5_HAVE_VISUAL_STUDIO */
#define HDmkfifo(S,M) mkfifo(S,M)
#define HDmktime(T) mktime(T)
#define HDmodf(X,Y) modf(X,Y)
@@ -331,7 +335,7 @@ int HDremove_all(const char * fname);
#define HDsetuid(U) setuid(U)
/* Windows does not permit setting the buffer size to values
less than 2. */
-#ifndef _WIN32
+#ifndef H5_HAVE_WIN32_API
#define HDsetvbuf(F,S,M,Z) setvbuf(F,S,M,Z)
#else
#define HDsetvbuf(F,S,M,Z) setvbuf(F,S,M,(Z>1?Z:2))
@@ -350,7 +354,7 @@ int HDremove_all(const char * fname);
#define HDsin(X) sin(X)
#define HDsinh(X) sinh(X)
#define HDsleep(N) sleep(N)
-#ifdef _WIN32
+#ifdef _WIN32 /* H5_HAVE_VISUAL_STUDIO */
#define HDsnprintf _snprintf /*varargs*/
#else
#define HDsnprintf snprintf /*varargs*/
@@ -369,7 +373,7 @@ H5_DLL void HDsrand(unsigned int seed);
#endif
/* sscanf() variable arguments */
-#define HDstrcasecmp(X,Y) strcasecmp(X,Y)
+#define HDstrcasecmp(X,Y) strcasecmp(X,Y)
#define HDstrcat(X,Y) strcat(X,Y)
#define HDstrchr(S,C) strchr(S,C)
#define HDstrcmp(X,Y) strcmp(X,Y)
@@ -415,7 +419,7 @@ H5_DLL int64_t HDstrtoll (const char *s, const char **rest, int base);
#define HDumask(N) umask(N)
#define HDuname(S) uname(S)
#define HDungetc(C,F) ungetc(C,F)
-#ifdef _WIN32
+#ifdef _WIN32 /* H5_HAVE_VISUAL_STUDIO */
#define HDunlink(S) _unlink(S)
#else
#define HDunlink(S) unlink(S)
@@ -428,7 +432,7 @@ H5_DLL int64_t HDstrtoll (const char *s, const char **rest, int base);
#define HDvfprintf(F,FMT,A) vfprintf(F,FMT,A)
#define HDvprintf(FMT,A) vprintf(FMT,A)
#define HDvsprintf(S,FMT,A) vsprintf(S,FMT,A)
-#ifdef _WIN32
+#ifdef _WIN32 /* H5_HAVE_VISUAL_STUDIO */
# define HDvsnprintf(S,N,FMT,A) _vsnprintf(S,N,FMT,A)
#else
# define HDvsnprintf(S,N,FMT,A) vsnprintf(S,N,FMT,A)
@@ -443,9 +447,9 @@ H5_DLL int64_t HDstrtoll (const char *s, const char **rest, int base);
* And now for a couple non-Posix functions... Watch out for systems that
* define these in terms of macros.
*/
-#ifdef _WIN32
+#ifdef _WIN32 /* H5_HAVE_VISUAL_STUDIO */
#define HDstrdup(S) _strdup(S)
-#else /* _WIN32 */
+#else /* H5_HAVE_VISUAL_STUDIO */
#if !defined strdup && !defined H5_HAVE_STRDUP
extern char *strdup(const char *s);
@@ -453,7 +457,7 @@ extern char *strdup(const char *s);
#define HDstrdup(S) strdup(S)
-#endif /* _WIN32 */
+#endif /* H5_HAVE_VISUAL_STUDIO */
/*
* HDF Boolean type.
@@ -487,7 +491,7 @@ extern const char *opt_arg; /* flag argument (or value) */
enum {
no_arg = 0, /* doesn't take an argument */
- require_arg, /* requires an argument */
+ require_arg, /* requires an argument */
optional_arg /* argument is optional */
};