2002-06-30 08:11:42 +08:00
|
|
|
|
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
2007-02-07 22:56:24 +08:00
|
|
|
|
* Copyright by The HDF Group. *
|
2002-06-30 08:11:42 +08:00
|
|
|
|
* Copyright by the Board of Trustees of the University of Illinois. *
|
|
|
|
|
* All rights reserved. *
|
|
|
|
|
* *
|
|
|
|
|
* This file is part of HDF5. The full HDF5 copyright notice, including *
|
|
|
|
|
* terms governing use, modification, and redistribution, is contained in *
|
|
|
|
|
* the files COPYING and Copyright.html. COPYING can be found at the root *
|
|
|
|
|
* of the source code distribution tree; Copyright.html can be found at the *
|
|
|
|
|
* root level of an installed copy of the electronic HDF5 document set and *
|
|
|
|
|
* is linked from the top-level documents page. It can also be found at *
|
2007-02-07 22:56:24 +08:00
|
|
|
|
* http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have *
|
|
|
|
|
* access to either file, you may request a copy from help@hdfgroup.org. *
|
2002-06-30 08:11:42 +08:00
|
|
|
|
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
|
|
|
|
|
2001-08-15 02:46:27 +08:00
|
|
|
|
/*
|
|
|
|
|
* Programmer: Robb Matzke <matzke@llnl.gov>
|
|
|
|
|
* Thursday, March 12, 1998
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
/* See H5private.h for how to include headers */
|
|
|
|
|
#include "hdf5.h"
|
|
|
|
|
|
2001-11-04 06:27:54 +08:00
|
|
|
|
#include "H5private.h"
|
2001-08-15 02:46:27 +08:00
|
|
|
|
|
2005-08-14 04:53:35 +08:00
|
|
|
|
#ifdef H5_HAVE_SYS_TIMEB
|
2001-08-15 02:46:27 +08:00
|
|
|
|
#include <sys/timeb.h>
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#define RAW_FILE_NAME "iopipe.raw"
|
|
|
|
|
#define HDF5_FILE_NAME "iopipe.h5"
|
|
|
|
|
#define HEADING "%-16s"
|
|
|
|
|
#define PROGRESS '='
|
|
|
|
|
|
|
|
|
|
#if 0
|
|
|
|
|
/* Normal testing */
|
|
|
|
|
#define REQUEST_SIZE_X 4579
|
|
|
|
|
#define REQUEST_SIZE_Y 4579
|
|
|
|
|
#define NREAD_REQUESTS 45
|
|
|
|
|
#define NWRITE_REQUESTS 45
|
|
|
|
|
#else
|
|
|
|
|
/* Speedy testing */
|
|
|
|
|
#define REQUEST_SIZE_X 1000
|
|
|
|
|
#define REQUEST_SIZE_Y 1000
|
|
|
|
|
#define NREAD_REQUESTS 45
|
|
|
|
|
#define NWRITE_REQUESTS 45
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*-------------------------------------------------------------------------
|
|
|
|
|
* Function: print_stats
|
|
|
|
|
*
|
|
|
|
|
* Purpose: Prints statistics
|
|
|
|
|
*
|
|
|
|
|
* Return: void
|
|
|
|
|
*
|
|
|
|
|
* Programmer: Robb Matzke
|
|
|
|
|
* Thursday, March 12, 1998
|
|
|
|
|
*
|
|
|
|
|
* Modifications:
|
|
|
|
|
*
|
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
|
*/
|
|
|
|
|
#ifdef H5_HAVE_GETRUSAGE
|
|
|
|
|
static void
|
|
|
|
|
print_stats (const char *prefix,
|
|
|
|
|
struct rusage *r_start, struct rusage *r_stop,
|
|
|
|
|
struct timeval *t_start, struct timeval *t_stop,
|
|
|
|
|
size_t nbytes)
|
|
|
|
|
#else /* H5_HAVE_GETRUSAGE */
|
|
|
|
|
static void
|
|
|
|
|
print_stats (const char *prefix,
|
|
|
|
|
struct timeval *r_start, struct timeval *r_stop,
|
|
|
|
|
struct timeval *t_start, struct timeval *t_stop,
|
|
|
|
|
size_t nbytes)
|
|
|
|
|
#endif /* H5_HAVE_GETRUSAGE */
|
|
|
|
|
{
|
|
|
|
|
double e_time, bw;
|
|
|
|
|
#ifdef H5_HAVE_GETRUSAGE
|
|
|
|
|
double u_time, s_time;
|
|
|
|
|
|
|
|
|
|
u_time = ((double)(r_stop->ru_utime.tv_sec)+
|
|
|
|
|
(double)(r_stop->ru_utime.tv_usec)/1000000.0) -
|
|
|
|
|
((double)(r_start->ru_utime.tv_sec)+
|
|
|
|
|
(double)(r_start->ru_utime.tv_usec)/1000000.0);
|
|
|
|
|
|
|
|
|
|
s_time = ((double)(r_stop->ru_stime.tv_sec)+
|
|
|
|
|
(double)(r_stop->ru_stime.tv_usec)/1000000.0) -
|
|
|
|
|
((double)(r_start->ru_stime.tv_sec)+
|
|
|
|
|
(double)(r_start->ru_stime.tv_usec)/1000000.0);
|
|
|
|
|
#endif
|
|
|
|
|
#ifndef H5_HAVE_SYS_TIMEB
|
|
|
|
|
e_time = ((double)(t_stop->tv_sec)+
|
|
|
|
|
(double)(t_stop->tv_usec)/1000000.0) -
|
|
|
|
|
((double)(t_start->tv_sec)+
|
|
|
|
|
(double)(t_start->tv_usec)/1000000.0);
|
|
|
|
|
#else
|
|
|
|
|
e_time = ((double)(t_stop->tv_sec)+
|
|
|
|
|
(double)(t_stop->tv_usec)/1000.0) -
|
|
|
|
|
((double)(t_start->tv_sec)+
|
|
|
|
|
(double)(t_start->tv_usec)/1000.0);
|
|
|
|
|
#endif
|
|
|
|
|
bw = (double)nbytes / e_time;
|
2005-08-14 04:53:35 +08:00
|
|
|
|
|
2001-08-15 02:46:27 +08:00
|
|
|
|
#ifdef H5_HAVE_GETRUSAGE
|
2005-08-14 04:53:35 +08:00
|
|
|
|
printf (HEADING "%1.2fuser %1.2fsystem %1.2felapsed %1.2fMB/s\n",
|
2001-08-15 02:46:27 +08:00
|
|
|
|
prefix, u_time, s_time, e_time, bw/(1024*1024));
|
|
|
|
|
#else
|
2005-08-14 04:53:35 +08:00
|
|
|
|
printf (HEADING "%1.2felapsed %1.2fMB/s\n",
|
2001-08-15 02:46:27 +08:00
|
|
|
|
prefix, e_time, bw/(1024*1024));
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*-------------------------------------------------------------------------
|
|
|
|
|
* Function: synchronize
|
|
|
|
|
*
|
2005-08-14 04:53:35 +08:00
|
|
|
|
* Purpose:
|
2001-08-15 02:46:27 +08:00
|
|
|
|
*
|
|
|
|
|
* Return: void
|
|
|
|
|
*
|
|
|
|
|
* Programmer: Robb Matzke
|
|
|
|
|
* Thursday, March 12, 1998
|
|
|
|
|
*
|
|
|
|
|
* Modifications:
|
|
|
|
|
*
|
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
|
*/
|
|
|
|
|
static void
|
|
|
|
|
synchronize (void)
|
|
|
|
|
{
|
|
|
|
|
#ifdef H5_HAVE_SYSTEM
|
2007-05-18 23:14:43 +08:00
|
|
|
|
#if defined(_WIN32) && ! defined(__CYGWIN__)
|
2011-02-05 10:41:22 +08:00
|
|
|
|
_flushall();
|
2001-08-15 02:46:27 +08:00
|
|
|
|
#else
|
2011-02-05 10:41:22 +08:00
|
|
|
|
HDsystem("sync");
|
|
|
|
|
HDsystem("df >/dev/null");
|
2001-08-15 02:46:27 +08:00
|
|
|
|
#endif
|
|
|
|
|
#endif
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*-------------------------------------------------------------------------
|
|
|
|
|
* Function: main
|
|
|
|
|
*
|
2005-08-14 04:53:35 +08:00
|
|
|
|
* Purpose:
|
2001-08-15 02:46:27 +08:00
|
|
|
|
*
|
2005-08-14 04:53:35 +08:00
|
|
|
|
* Return: Success:
|
2001-08-15 02:46:27 +08:00
|
|
|
|
*
|
2005-08-14 04:53:35 +08:00
|
|
|
|
* Failure:
|
2001-08-15 02:46:27 +08:00
|
|
|
|
*
|
|
|
|
|
* Programmer: Robb Matzke
|
|
|
|
|
* Thursday, March 12, 1998
|
|
|
|
|
*
|
|
|
|
|
* Modifications:
|
|
|
|
|
*
|
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
|
*/
|
|
|
|
|
int
|
|
|
|
|
main (void)
|
|
|
|
|
{
|
|
|
|
|
static hsize_t size[2] = {REQUEST_SIZE_X, REQUEST_SIZE_Y};
|
2011-02-05 10:41:22 +08:00
|
|
|
|
static unsigned nread = NREAD_REQUESTS, nwrite = NWRITE_REQUESTS;
|
2001-08-15 02:46:27 +08:00
|
|
|
|
|
|
|
|
|
unsigned char *the_data = NULL;
|
2011-02-05 10:41:22 +08:00
|
|
|
|
hid_t file, dset, file_space = -1;
|
2001-08-15 02:46:27 +08:00
|
|
|
|
herr_t status;
|
|
|
|
|
#ifdef H5_HAVE_GETRUSAGE
|
|
|
|
|
struct rusage r_start, r_stop;
|
2005-08-14 04:53:35 +08:00
|
|
|
|
#else
|
2001-08-15 02:46:27 +08:00
|
|
|
|
struct timeval r_start, r_stop;
|
2005-08-14 04:53:35 +08:00
|
|
|
|
#endif
|
2001-08-15 02:46:27 +08:00
|
|
|
|
struct timeval t_start, t_stop;
|
2011-02-05 10:41:22 +08:00
|
|
|
|
int fd;
|
|
|
|
|
unsigned u;
|
2001-08-15 02:46:27 +08:00
|
|
|
|
hssize_t n;
|
|
|
|
|
off_t offset;
|
2004-12-29 22:26:20 +08:00
|
|
|
|
hsize_t start[2];
|
2001-08-15 02:46:27 +08:00
|
|
|
|
hsize_t count[2];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef H5_HAVE_SYS_TIMEB
|
|
|
|
|
struct _timeb *tbstart = malloc(sizeof(struct _timeb));
|
|
|
|
|
struct _timeb *tbstop = malloc(sizeof(struct _timeb));
|
|
|
|
|
#endif
|
|
|
|
|
/*
|
|
|
|
|
* The extra cast in the following statement is a bug workaround for the
|
|
|
|
|
* Win32 version 5.0 compiler.
|
|
|
|
|
* 1998-11-06 ptl
|
|
|
|
|
*/
|
|
|
|
|
printf ("I/O request size is %1.1fMB\n",
|
|
|
|
|
(double)(hssize_t)(size[0]*size[1])/1024.0*1024);
|
2005-08-14 04:53:35 +08:00
|
|
|
|
|
2001-08-15 02:46:27 +08:00
|
|
|
|
/* Open the files */
|
|
|
|
|
file = H5Fcreate (HDF5_FILE_NAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
|
|
|
|
|
assert (file>=0);
|
|
|
|
|
fd = HDopen (RAW_FILE_NAME, O_RDWR|O_CREAT|O_TRUNC, 0666);
|
|
|
|
|
assert (fd>=0);
|
2005-08-14 04:53:35 +08:00
|
|
|
|
|
2001-08-15 02:46:27 +08:00
|
|
|
|
/* Create the dataset */
|
|
|
|
|
file_space = H5Screate_simple (2, size, size);
|
[svn-r14199] Description:
Add H5Dcreate to API versioned routines, replacing internal usage with
H5Dcreate2
Fix thread-safe error stack initialization for API versioned error
stack printing routines.
Tested on:
FreeBSD/32 6.2 (duty) in debug mode
FreeBSD/64 6.2 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (kagiso) w/PGI compilers, w/C++ & FORTRAN, w/threadsafe,
in debug mode
Linux/64-amd64 2.6 (smirom) w/default API=1.6.x, w/C++ & FORTRAN,
in production mode
Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN,
in production mode
Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN,
w/szip filter, in production mode
Mac OS X/32 10.4.10 (amazon) in debug mode
2007-10-12 00:24:11 +08:00
|
|
|
|
assert(file_space >= 0);
|
|
|
|
|
dset = H5Dcreate2(file, "dset", H5T_NATIVE_UCHAR, file_space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
|
|
|
|
|
assert(dset >= 0);
|
2011-02-05 10:41:22 +08:00
|
|
|
|
the_data = (unsigned char *)malloc((size_t)(size[0] * size[1]));
|
[svn-r14199] Description:
Add H5Dcreate to API versioned routines, replacing internal usage with
H5Dcreate2
Fix thread-safe error stack initialization for API versioned error
stack printing routines.
Tested on:
FreeBSD/32 6.2 (duty) in debug mode
FreeBSD/64 6.2 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (kagiso) w/PGI compilers, w/C++ & FORTRAN, w/threadsafe,
in debug mode
Linux/64-amd64 2.6 (smirom) w/default API=1.6.x, w/C++ & FORTRAN,
in production mode
Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN,
in production mode
Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN,
w/szip filter, in production mode
Mac OS X/32 10.4.10 (amazon) in debug mode
2007-10-12 00:24:11 +08:00
|
|
|
|
|
|
|
|
|
/* initial fill for lazy malloc */
|
2011-02-05 10:41:22 +08:00
|
|
|
|
HDmemset(the_data, 0xAA, (size_t)(size[0] * size[1]));
|
2001-08-15 02:46:27 +08:00
|
|
|
|
|
|
|
|
|
/* Fill raw */
|
|
|
|
|
synchronize ();
|
|
|
|
|
#ifdef H5_HAVE_GETRUSAGE
|
2011-02-05 10:41:22 +08:00
|
|
|
|
HDgetrusage(RUSAGE_SELF, &r_start);
|
2001-08-15 02:46:27 +08:00
|
|
|
|
#endif
|
|
|
|
|
#ifdef H5_HAVE_GETTIMEOFDAY
|
2011-02-05 10:41:22 +08:00
|
|
|
|
HDgettimeofday(&t_start, NULL);
|
2005-08-14 04:53:35 +08:00
|
|
|
|
#else
|
2001-08-15 02:46:27 +08:00
|
|
|
|
#ifdef H5_HAVE_SYS_TIMEB
|
|
|
|
|
_ftime(tbstart);
|
|
|
|
|
#endif
|
2005-08-14 04:53:35 +08:00
|
|
|
|
#endif
|
2001-08-15 02:46:27 +08:00
|
|
|
|
fprintf (stderr, HEADING, "fill raw");
|
2011-02-05 10:41:22 +08:00
|
|
|
|
for(u = 0; u < nwrite; u++) {
|
2001-08-15 02:46:27 +08:00
|
|
|
|
putc (PROGRESS, stderr);
|
2011-02-05 10:41:22 +08:00
|
|
|
|
HDfflush(stderr);
|
|
|
|
|
HDmemset(the_data, 0xAA, (size_t)(size[0]*size[1]));
|
2001-08-15 02:46:27 +08:00
|
|
|
|
}
|
|
|
|
|
#ifdef H5_HAVE_GETRUSAGE
|
2011-02-05 10:41:22 +08:00
|
|
|
|
HDgetrusage(RUSAGE_SELF, &r_stop);
|
2001-08-15 02:46:27 +08:00
|
|
|
|
#endif
|
|
|
|
|
#ifdef H5_HAVE_GETTIMEOFDAY
|
2011-02-05 10:41:22 +08:00
|
|
|
|
HDgettimeofday(&t_stop, NULL);
|
2001-08-15 02:46:27 +08:00
|
|
|
|
#else
|
|
|
|
|
#ifdef H5_HAVE_SYS_TIMEB
|
|
|
|
|
_ftime(tbstop);
|
|
|
|
|
t_start.tv_sec = tbstart->time;
|
|
|
|
|
t_start.tv_usec = tbstart->millitm;
|
|
|
|
|
t_stop.tv_sec = tbstop->time;
|
|
|
|
|
t_stop.tv_usec = tbstop->millitm;
|
2005-08-14 04:53:35 +08:00
|
|
|
|
#endif
|
|
|
|
|
#endif
|
2001-08-15 02:46:27 +08:00
|
|
|
|
putc ('\n', stderr);
|
|
|
|
|
print_stats ("fill raw",
|
|
|
|
|
&r_start, &r_stop, &t_start, &t_stop,
|
|
|
|
|
(size_t)(nread*size[0]*size[1]));
|
2005-08-14 04:53:35 +08:00
|
|
|
|
|
2001-08-15 02:46:27 +08:00
|
|
|
|
|
|
|
|
|
/* Fill hdf5 */
|
|
|
|
|
synchronize ();
|
|
|
|
|
#ifdef H5_HAVE_GETRUSAGE
|
2011-02-05 10:41:22 +08:00
|
|
|
|
HDgetrusage(RUSAGE_SELF, &r_start);
|
2001-08-15 02:46:27 +08:00
|
|
|
|
#endif
|
|
|
|
|
#ifdef H5_HAVE_GETTIMEOFDAY
|
2011-02-05 10:41:22 +08:00
|
|
|
|
HDgettimeofday(&t_start, NULL);
|
2001-08-15 02:46:27 +08:00
|
|
|
|
#else
|
|
|
|
|
#ifdef H5_HAVE_SYS_TIMEB
|
|
|
|
|
_ftime(tbstart);
|
|
|
|
|
#endif
|
2005-08-14 04:53:35 +08:00
|
|
|
|
#endif
|
2001-08-15 02:46:27 +08:00
|
|
|
|
fprintf (stderr, HEADING, "fill hdf5");
|
2011-02-05 10:41:22 +08:00
|
|
|
|
for(u = 0; u < nread; u++) {
|
2001-08-15 02:46:27 +08:00
|
|
|
|
putc (PROGRESS, stderr);
|
2011-02-05 10:41:22 +08:00
|
|
|
|
HDfflush(stderr);
|
2001-08-15 02:46:27 +08:00
|
|
|
|
status = H5Dread (dset, H5T_NATIVE_UCHAR, file_space, file_space,
|
|
|
|
|
H5P_DEFAULT, the_data);
|
|
|
|
|
assert (status>=0);
|
|
|
|
|
}
|
|
|
|
|
#ifdef H5_HAVE_GETRUSAGE
|
2011-02-05 10:41:22 +08:00
|
|
|
|
HDgetrusage(RUSAGE_SELF, &r_stop);
|
2001-08-15 02:46:27 +08:00
|
|
|
|
#endif
|
|
|
|
|
#ifdef H5_HAVE_GETTIMEOFDAY
|
2011-02-05 10:41:22 +08:00
|
|
|
|
HDgettimeofday(&t_stop, NULL);
|
2001-08-15 02:46:27 +08:00
|
|
|
|
#else
|
|
|
|
|
#ifdef H5_HAVE_SYS_TIMEB
|
|
|
|
|
_ftime(tbstop);
|
|
|
|
|
t_start.tv_sec = tbstart->time;
|
|
|
|
|
t_start.tv_usec = tbstart->millitm;
|
|
|
|
|
t_stop.tv_sec = tbstop->time;
|
|
|
|
|
t_stop.tv_usec = tbstop->millitm;
|
2005-08-14 04:53:35 +08:00
|
|
|
|
#endif
|
|
|
|
|
#endif
|
2001-08-15 02:46:27 +08:00
|
|
|
|
putc ('\n', stderr);
|
|
|
|
|
print_stats ("fill hdf5",
|
|
|
|
|
&r_start, &r_stop, &t_start, &t_stop,
|
|
|
|
|
(size_t)(nread*size[0]*size[1]));
|
2005-08-14 04:53:35 +08:00
|
|
|
|
|
2001-08-15 02:46:27 +08:00
|
|
|
|
/* Write the raw dataset */
|
|
|
|
|
synchronize ();
|
|
|
|
|
#ifdef H5_HAVE_GETRUSAGE
|
2011-02-05 10:41:22 +08:00
|
|
|
|
HDgetrusage(RUSAGE_SELF, &r_start);
|
2001-08-15 02:46:27 +08:00
|
|
|
|
#endif
|
|
|
|
|
#ifdef H5_HAVE_GETTIMEOFDAY
|
2011-02-05 10:41:22 +08:00
|
|
|
|
HDgettimeofday(&t_start, NULL);
|
2001-08-15 02:46:27 +08:00
|
|
|
|
#else
|
|
|
|
|
#ifdef H5_HAVE_SYS_TIMEB
|
|
|
|
|
_ftime(tbstart);
|
|
|
|
|
#endif
|
2005-08-14 04:53:35 +08:00
|
|
|
|
#endif
|
2001-08-15 02:46:27 +08:00
|
|
|
|
fprintf (stderr, HEADING, "out raw");
|
2011-02-05 10:41:22 +08:00
|
|
|
|
for(u = 0; u < nwrite; u++) {
|
2001-08-15 02:46:27 +08:00
|
|
|
|
putc (PROGRESS, stderr);
|
2011-02-05 10:41:22 +08:00
|
|
|
|
HDfflush(stderr);
|
[svn-r15150] Purpose: Separate Windows function macro definitions to win32defs.h
Description:
In library code, we try not to use system calls directly, but instead use the HD{function} macro instead. This way, we can map special versions of the call on particular systems. Previously, it was all done in H5private.h. However, in an effort to clean up platform-specific definitions, we move all of the Windows macros into a separate file, win32defs.h. This way, we can use the non-Posix versions that Visual Studio sends warnings about.
Some macros are set specifically in the platform-specific header files. Then, any macros left unset will be set by the "default" implementation in H5private.h.
This checkin also cleans up various source files to use the HD* macros when possible.
Tested:
VS2005 on WinXP
VS.NET on WinXP
h5committest (kagiso, linew, smirom)
2008-06-06 02:52:19 +08:00
|
|
|
|
offset = HDlseek (fd, (off_t)0, SEEK_SET);
|
2001-08-15 02:46:27 +08:00
|
|
|
|
assert (0==offset);
|
[svn-r15150] Purpose: Separate Windows function macro definitions to win32defs.h
Description:
In library code, we try not to use system calls directly, but instead use the HD{function} macro instead. This way, we can map special versions of the call on particular systems. Previously, it was all done in H5private.h. However, in an effort to clean up platform-specific definitions, we move all of the Windows macros into a separate file, win32defs.h. This way, we can use the non-Posix versions that Visual Studio sends warnings about.
Some macros are set specifically in the platform-specific header files. Then, any macros left unset will be set by the "default" implementation in H5private.h.
This checkin also cleans up various source files to use the HD* macros when possible.
Tested:
VS2005 on WinXP
VS.NET on WinXP
h5committest (kagiso, linew, smirom)
2008-06-06 02:52:19 +08:00
|
|
|
|
n = HDwrite (fd, the_data, (size_t)(size[0]*size[1]));
|
2001-08-15 02:46:27 +08:00
|
|
|
|
assert (n>=0 && (size_t)n==size[0]*size[1]);
|
|
|
|
|
}
|
|
|
|
|
#ifdef H5_HAVE_GETRUSAGE
|
2011-02-05 10:41:22 +08:00
|
|
|
|
HDgetrusage(RUSAGE_SELF, &r_stop);
|
2001-08-15 02:46:27 +08:00
|
|
|
|
#endif
|
|
|
|
|
#ifdef H5_HAVE_GETTIMEOFDAY
|
2011-02-05 10:41:22 +08:00
|
|
|
|
HDgettimeofday(&t_stop, NULL);
|
2001-08-15 02:46:27 +08:00
|
|
|
|
#else
|
|
|
|
|
#ifdef H5_HAVE_SYS_TIMEB
|
|
|
|
|
_ftime(tbstop);
|
|
|
|
|
t_start.tv_sec = tbstart->time;
|
|
|
|
|
t_start.tv_usec = tbstart->millitm;
|
|
|
|
|
t_stop.tv_sec = tbstop->time;
|
|
|
|
|
t_stop.tv_usec = tbstop->millitm;
|
2005-08-14 04:53:35 +08:00
|
|
|
|
#endif
|
|
|
|
|
#endif
|
2001-08-15 02:46:27 +08:00
|
|
|
|
putc ('\n', stderr);
|
|
|
|
|
print_stats ("out raw",
|
|
|
|
|
&r_start, &r_stop, &t_start, &t_stop,
|
|
|
|
|
(size_t)(nread*size[0]*size[1]));
|
|
|
|
|
|
|
|
|
|
/* Write the hdf5 dataset */
|
|
|
|
|
synchronize ();
|
|
|
|
|
#ifdef H5_HAVE_GETRUSAGE
|
2011-02-05 10:41:22 +08:00
|
|
|
|
HDgetrusage(RUSAGE_SELF, &r_start);
|
2001-08-15 02:46:27 +08:00
|
|
|
|
#endif
|
|
|
|
|
#ifdef H5_HAVE_GETTIMEOFDAY
|
2011-02-05 10:41:22 +08:00
|
|
|
|
HDgettimeofday(&t_start, NULL);
|
2001-08-15 02:46:27 +08:00
|
|
|
|
#else
|
|
|
|
|
#ifdef H5_HAVE_SYS_TIMEB
|
|
|
|
|
_ftime(tbstart);
|
|
|
|
|
#endif
|
2005-08-14 04:53:35 +08:00
|
|
|
|
#endif
|
2001-08-15 02:46:27 +08:00
|
|
|
|
fprintf (stderr, HEADING, "out hdf5");
|
2011-02-05 10:41:22 +08:00
|
|
|
|
for(u = 0; u < nwrite; u++) {
|
2001-08-15 02:46:27 +08:00
|
|
|
|
putc (PROGRESS, stderr);
|
2011-02-05 10:41:22 +08:00
|
|
|
|
HDfflush(stderr);
|
2001-08-15 02:46:27 +08:00
|
|
|
|
status = H5Dwrite (dset, H5T_NATIVE_UCHAR, H5S_ALL, H5S_ALL,
|
|
|
|
|
H5P_DEFAULT, the_data);
|
|
|
|
|
assert (status>=0);
|
|
|
|
|
}
|
|
|
|
|
#ifdef H5_HAVE_GETRUSAGE
|
2011-02-05 10:41:22 +08:00
|
|
|
|
HDgetrusage(RUSAGE_SELF, &r_stop);
|
2001-08-15 02:46:27 +08:00
|
|
|
|
#endif
|
|
|
|
|
#ifdef H5_HAVE_GETTIMEOFDAY
|
2011-02-05 10:41:22 +08:00
|
|
|
|
HDgettimeofday(&t_stop, NULL);
|
2001-08-15 02:46:27 +08:00
|
|
|
|
#else
|
|
|
|
|
#ifdef H5_HAVE_SYS_TIMEB
|
|
|
|
|
_ftime(tbstop);
|
|
|
|
|
t_start.tv_sec = tbstart->time;
|
|
|
|
|
t_start.tv_usec = tbstart->millitm;
|
|
|
|
|
t_stop.tv_sec = tbstop->time;
|
|
|
|
|
t_stop.tv_usec = tbstop->millitm;
|
2005-08-14 04:53:35 +08:00
|
|
|
|
#endif
|
|
|
|
|
#endif
|
2001-08-15 02:46:27 +08:00
|
|
|
|
putc ('\n', stderr);
|
|
|
|
|
print_stats ("out hdf5",
|
|
|
|
|
&r_start, &r_stop, &t_start, &t_stop,
|
|
|
|
|
(size_t)(nread*size[0]*size[1]));
|
|
|
|
|
|
|
|
|
|
/* Read the raw dataset */
|
|
|
|
|
synchronize ();
|
|
|
|
|
#ifdef H5_HAVE_GETRUSAGE
|
2011-02-05 10:41:22 +08:00
|
|
|
|
HDgetrusage(RUSAGE_SELF, &r_start);
|
2001-08-15 02:46:27 +08:00
|
|
|
|
#endif
|
|
|
|
|
#ifdef H5_HAVE_GETTIMEOFDAY
|
2011-02-05 10:41:22 +08:00
|
|
|
|
HDgettimeofday(&t_start, NULL);
|
2001-08-15 02:46:27 +08:00
|
|
|
|
#else
|
|
|
|
|
#ifdef H5_HAVE_SYS_TIMEB
|
|
|
|
|
_ftime(tbstart);
|
|
|
|
|
#endif
|
2005-08-14 04:53:35 +08:00
|
|
|
|
#endif
|
2001-08-15 02:46:27 +08:00
|
|
|
|
fprintf (stderr, HEADING, "in raw");
|
2011-02-05 10:41:22 +08:00
|
|
|
|
for(u = 0; u < nread; u++) {
|
2001-08-15 02:46:27 +08:00
|
|
|
|
putc (PROGRESS, stderr);
|
2011-02-05 10:41:22 +08:00
|
|
|
|
HDfflush(stderr);
|
[svn-r15150] Purpose: Separate Windows function macro definitions to win32defs.h
Description:
In library code, we try not to use system calls directly, but instead use the HD{function} macro instead. This way, we can map special versions of the call on particular systems. Previously, it was all done in H5private.h. However, in an effort to clean up platform-specific definitions, we move all of the Windows macros into a separate file, win32defs.h. This way, we can use the non-Posix versions that Visual Studio sends warnings about.
Some macros are set specifically in the platform-specific header files. Then, any macros left unset will be set by the "default" implementation in H5private.h.
This checkin also cleans up various source files to use the HD* macros when possible.
Tested:
VS2005 on WinXP
VS.NET on WinXP
h5committest (kagiso, linew, smirom)
2008-06-06 02:52:19 +08:00
|
|
|
|
offset = HDlseek (fd, (off_t)0, SEEK_SET);
|
2001-08-15 02:46:27 +08:00
|
|
|
|
assert (0==offset);
|
[svn-r15150] Purpose: Separate Windows function macro definitions to win32defs.h
Description:
In library code, we try not to use system calls directly, but instead use the HD{function} macro instead. This way, we can map special versions of the call on particular systems. Previously, it was all done in H5private.h. However, in an effort to clean up platform-specific definitions, we move all of the Windows macros into a separate file, win32defs.h. This way, we can use the non-Posix versions that Visual Studio sends warnings about.
Some macros are set specifically in the platform-specific header files. Then, any macros left unset will be set by the "default" implementation in H5private.h.
This checkin also cleans up various source files to use the HD* macros when possible.
Tested:
VS2005 on WinXP
VS.NET on WinXP
h5committest (kagiso, linew, smirom)
2008-06-06 02:52:19 +08:00
|
|
|
|
n = HDread (fd, the_data, (size_t)(size[0]*size[1]));
|
2001-08-15 02:46:27 +08:00
|
|
|
|
assert (n>=0 && (size_t)n==size[0]*size[1]);
|
|
|
|
|
}
|
|
|
|
|
#ifdef H5_HAVE_GETRUSAGE
|
2011-02-05 10:41:22 +08:00
|
|
|
|
HDgetrusage(RUSAGE_SELF, &r_stop);
|
2001-08-15 02:46:27 +08:00
|
|
|
|
#endif
|
|
|
|
|
#ifdef H5_HAVE_GETTIMEOFDAY
|
2011-02-05 10:41:22 +08:00
|
|
|
|
HDgettimeofday(&t_stop, NULL);
|
2001-08-15 02:46:27 +08:00
|
|
|
|
#else
|
|
|
|
|
#ifdef H5_HAVE_SYS_TIMEB
|
|
|
|
|
_ftime(tbstop);
|
|
|
|
|
t_start.tv_sec = tbstart->time;
|
|
|
|
|
t_start.tv_usec = tbstart->millitm;
|
|
|
|
|
t_stop.tv_sec = tbstop->time;
|
|
|
|
|
t_stop.tv_usec = tbstop->millitm;
|
2005-08-14 04:53:35 +08:00
|
|
|
|
#endif
|
|
|
|
|
#endif
|
2001-08-15 02:46:27 +08:00
|
|
|
|
putc ('\n', stderr);
|
|
|
|
|
print_stats ("in raw",
|
|
|
|
|
&r_start, &r_stop, &t_start, &t_stop,
|
|
|
|
|
(size_t)(nread*size[0]*size[1]));
|
2005-08-14 04:53:35 +08:00
|
|
|
|
|
2001-08-15 02:46:27 +08:00
|
|
|
|
|
|
|
|
|
/* Read the hdf5 dataset */
|
|
|
|
|
synchronize ();
|
|
|
|
|
#ifdef H5_HAVE_GETRUSAGE
|
2011-02-05 10:41:22 +08:00
|
|
|
|
HDgetrusage(RUSAGE_SELF, &r_start);
|
2001-08-15 02:46:27 +08:00
|
|
|
|
#endif
|
|
|
|
|
#ifdef H5_HAVE_GETTIMEOFDAY
|
2011-02-05 10:41:22 +08:00
|
|
|
|
HDgettimeofday(&t_start, NULL);
|
2001-08-15 02:46:27 +08:00
|
|
|
|
#else
|
|
|
|
|
#ifdef H5_HAVE_SYS_TIMEB
|
|
|
|
|
_ftime(tbstart);
|
2005-08-14 04:53:35 +08:00
|
|
|
|
#endif
|
|
|
|
|
#endif
|
2001-08-15 02:46:27 +08:00
|
|
|
|
fprintf (stderr, HEADING, "in hdf5");
|
2011-02-05 10:41:22 +08:00
|
|
|
|
for(u = 0; u < nread; u++) {
|
2001-08-15 02:46:27 +08:00
|
|
|
|
putc (PROGRESS, stderr);
|
2011-02-05 10:41:22 +08:00
|
|
|
|
HDfflush(stderr);
|
2001-08-15 02:46:27 +08:00
|
|
|
|
status = H5Dread (dset, H5T_NATIVE_UCHAR, file_space, file_space,
|
|
|
|
|
H5P_DEFAULT, the_data);
|
|
|
|
|
assert (status>=0);
|
|
|
|
|
}
|
|
|
|
|
#ifdef H5_HAVE_GETRUSAGE
|
2011-02-05 10:41:22 +08:00
|
|
|
|
HDgetrusage(RUSAGE_SELF, &r_stop);
|
2001-08-15 02:46:27 +08:00
|
|
|
|
#endif
|
|
|
|
|
#ifdef H5_HAVE_GETTIMEOFDAY
|
2011-02-05 10:41:22 +08:00
|
|
|
|
HDgettimeofday(&t_stop, NULL);
|
2001-08-15 02:46:27 +08:00
|
|
|
|
#else
|
|
|
|
|
#ifdef H5_HAVE_SYS_TIMEB
|
|
|
|
|
_ftime(tbstop);
|
|
|
|
|
t_start.tv_sec = tbstart->time;
|
|
|
|
|
t_start.tv_usec = tbstart->millitm;
|
|
|
|
|
t_stop.tv_sec = tbstop->time;
|
|
|
|
|
t_stop.tv_usec = tbstop->millitm;
|
|
|
|
|
#endif
|
2005-08-14 04:53:35 +08:00
|
|
|
|
#endif
|
2001-08-15 02:46:27 +08:00
|
|
|
|
putc ('\n', stderr);
|
|
|
|
|
print_stats ("in hdf5",
|
|
|
|
|
&r_start, &r_stop, &t_start, &t_stop,
|
|
|
|
|
(size_t)(nread*size[0]*size[1]));
|
|
|
|
|
|
|
|
|
|
/* Read hyperslab */
|
|
|
|
|
assert (size[0]>20 && size[1]>20);
|
|
|
|
|
start[0] = start[1] = 10;
|
|
|
|
|
count[0] = count[1] = size[0]-20;
|
|
|
|
|
status = H5Sselect_hyperslab (file_space, H5S_SELECT_SET, start, NULL, count, NULL);
|
|
|
|
|
assert (status>=0);
|
|
|
|
|
synchronize ();
|
|
|
|
|
#ifdef H5_HAVE_GETRUSAGE
|
2011-02-05 10:41:22 +08:00
|
|
|
|
HDgetrusage(RUSAGE_SELF, &r_start);
|
2001-08-15 02:46:27 +08:00
|
|
|
|
#endif
|
|
|
|
|
#ifdef H5_HAVE_GETTIMEOFDAY
|
2011-02-05 10:41:22 +08:00
|
|
|
|
HDgettimeofday(&t_start, NULL);
|
2001-08-15 02:46:27 +08:00
|
|
|
|
#else
|
|
|
|
|
#ifdef H5_HAVE_SYS_TIMEB
|
|
|
|
|
_ftime(tbstart);
|
2005-08-14 04:53:35 +08:00
|
|
|
|
#endif
|
|
|
|
|
#endif
|
2001-08-15 02:46:27 +08:00
|
|
|
|
fprintf (stderr, HEADING, "in hdf5 partial");
|
2011-02-05 10:41:22 +08:00
|
|
|
|
for(u = 0; u < nread; u++) {
|
2001-08-15 02:46:27 +08:00
|
|
|
|
putc (PROGRESS, stderr);
|
2011-02-05 10:41:22 +08:00
|
|
|
|
HDfflush(stderr);
|
2001-08-15 02:46:27 +08:00
|
|
|
|
status = H5Dread (dset, H5T_NATIVE_UCHAR, file_space, file_space,
|
|
|
|
|
H5P_DEFAULT, the_data);
|
|
|
|
|
assert (status>=0);
|
|
|
|
|
}
|
|
|
|
|
#ifdef H5_HAVE_GETRUSAGE
|
2011-02-05 10:41:22 +08:00
|
|
|
|
HDgetrusage(RUSAGE_SELF, &r_stop);
|
2001-08-15 02:46:27 +08:00
|
|
|
|
#endif
|
|
|
|
|
#ifdef H5_HAVE_GETTIMEOFDAY
|
2011-02-05 10:41:22 +08:00
|
|
|
|
HDgettimeofday(&t_stop, NULL);
|
2001-08-15 02:46:27 +08:00
|
|
|
|
#else
|
|
|
|
|
#ifdef H5_HAVE_SYS_TIMEB
|
|
|
|
|
_ftime(tbstop);
|
|
|
|
|
t_start.tv_sec = tbstart->time;
|
|
|
|
|
t_start.tv_usec = tbstart->millitm;
|
|
|
|
|
t_stop.tv_sec = tbstop->time;
|
|
|
|
|
t_stop.tv_usec = tbstop->millitm;
|
2005-08-14 04:53:35 +08:00
|
|
|
|
#endif
|
|
|
|
|
#endif
|
2011-02-05 10:41:22 +08:00
|
|
|
|
putc('\n', stderr);
|
|
|
|
|
print_stats("in hdf5 partial",
|
2001-08-15 02:46:27 +08:00
|
|
|
|
&r_start, &r_stop, &t_start, &t_stop,
|
|
|
|
|
(size_t)(nread*count[0]*count[1]));
|
|
|
|
|
|
2005-08-14 04:53:35 +08:00
|
|
|
|
|
|
|
|
|
|
2001-08-15 02:46:27 +08:00
|
|
|
|
/* Close everything */
|
2011-02-05 10:41:22 +08:00
|
|
|
|
HDclose(fd);
|
|
|
|
|
H5Dclose(dset);
|
|
|
|
|
H5Sclose(file_space);
|
|
|
|
|
H5Fclose(file);
|
|
|
|
|
free(the_data);
|
2005-08-14 04:53:35 +08:00
|
|
|
|
|
2001-08-15 02:46:27 +08:00
|
|
|
|
return 0;
|
|
|
|
|
}
|
2011-02-05 10:41:22 +08:00
|
|
|
|
|