1998-03-14 01:50:38 +08:00
|
|
|
|
/*
|
|
|
|
|
* Copyright (C) 1998 NCSA
|
|
|
|
|
* All rights reserved.
|
|
|
|
|
*
|
|
|
|
|
* Programmer: Robb Matzke <matzke@llnl.gov>
|
|
|
|
|
* Thursday, March 12, 1998
|
|
|
|
|
*/
|
1998-11-03 01:58:28 +08:00
|
|
|
|
|
|
|
|
|
/* See H5private.h for how to include headers */
|
1998-03-14 01:50:38 +08:00
|
|
|
|
#undef NDEBUG
|
1998-11-20 02:52:56 +08:00
|
|
|
|
#include <hdf5.h>
|
1998-10-24 02:16:48 +08:00
|
|
|
|
|
1998-11-03 01:58:28 +08:00
|
|
|
|
#ifdef STDC_HEADERS
|
|
|
|
|
# include <assert.h>
|
|
|
|
|
# include <fcntl.h>
|
|
|
|
|
# include <stdio.h>
|
|
|
|
|
# include <string.h>
|
|
|
|
|
# include <stdlib.h>
|
|
|
|
|
#endif
|
1998-10-24 02:16:48 +08:00
|
|
|
|
|
1998-11-03 01:58:28 +08:00
|
|
|
|
#ifdef HAVE_UNISTD_H
|
|
|
|
|
# include <sys/types.h>
|
|
|
|
|
# include <unistd.h>
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#if defined(TIME_WITH_SYS_TIME)
|
|
|
|
|
# include <sys/time.h>
|
|
|
|
|
# include <time.h>
|
|
|
|
|
#elif defined(HAVE_SYS_TIME_H)
|
|
|
|
|
# include <sys/time.h>
|
1998-10-24 02:16:48 +08:00
|
|
|
|
#else
|
1998-11-03 01:58:28 +08:00
|
|
|
|
# include <time.h>
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#ifdef HAVE_SYS_RESOURCE_H
|
|
|
|
|
# include <sys/resource.h>
|
1998-10-24 02:16:48 +08:00
|
|
|
|
#endif
|
1998-03-14 01:50:38 +08:00
|
|
|
|
|
1998-11-03 01:58:28 +08:00
|
|
|
|
#ifdef HAVE_WINSOCK_H
|
|
|
|
|
#include <Winsock.h>
|
|
|
|
|
#endif
|
|
|
|
|
|
1998-03-14 01:50:38 +08:00
|
|
|
|
#define RAW_FILE_NAME "iopipe.raw"
|
|
|
|
|
#define HDF5_FILE_NAME "iopipe.h5"
|
1998-03-17 09:29:54 +08:00
|
|
|
|
#define HEADING "%-16s"
|
|
|
|
|
#define PROGRESS '='
|
|
|
|
|
|
1998-08-14 04:17:47 +08:00
|
|
|
|
#if 0
|
1998-03-17 09:29:54 +08:00
|
|
|
|
/* Normal testing */
|
1998-03-14 01:50:38 +08:00
|
|
|
|
#define REQUEST_SIZE_X 4579
|
|
|
|
|
#define REQUEST_SIZE_Y 4579
|
|
|
|
|
#define NREAD_REQUESTS 45
|
|
|
|
|
#define NWRITE_REQUESTS 45
|
1998-03-17 09:29:54 +08:00
|
|
|
|
#else
|
|
|
|
|
/* Speedy testing */
|
|
|
|
|
#define REQUEST_SIZE_X 1000
|
|
|
|
|
#define REQUEST_SIZE_Y 1000
|
|
|
|
|
#define NREAD_REQUESTS 45
|
|
|
|
|
#define NWRITE_REQUESTS 45
|
|
|
|
|
#endif
|
1998-03-14 01:50:38 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*-------------------------------------------------------------------------
|
|
|
|
|
* Function: print_stats
|
|
|
|
|
*
|
|
|
|
|
* Purpose: Prints statistics
|
|
|
|
|
*
|
|
|
|
|
* Return: void
|
|
|
|
|
*
|
|
|
|
|
* Programmer: Robb Matzke
|
|
|
|
|
* Thursday, March 12, 1998
|
|
|
|
|
*
|
|
|
|
|
* Modifications:
|
|
|
|
|
*
|
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
|
*/
|
|
|
|
|
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)
|
|
|
|
|
{
|
1998-04-29 23:57:59 +08:00
|
|
|
|
double e_time, bw;
|
|
|
|
|
#ifdef HAVE_GETRUSAGE
|
|
|
|
|
double u_time, s_time;
|
1998-03-14 01:50:38 +08:00
|
|
|
|
|
1998-03-31 03:24:08 +08:00
|
|
|
|
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);
|
1998-03-14 01:50:38 +08:00
|
|
|
|
|
1998-03-31 03:24:08 +08:00
|
|
|
|
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);
|
1998-04-29 23:57:59 +08:00
|
|
|
|
#endif
|
1998-03-14 01:50:38 +08:00
|
|
|
|
|
1998-03-31 03:24:08 +08:00
|
|
|
|
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);
|
1998-03-14 01:50:38 +08:00
|
|
|
|
|
1998-03-31 03:24:08 +08:00
|
|
|
|
bw = (double)nbytes / e_time;
|
1998-03-14 01:50:38 +08:00
|
|
|
|
|
1998-04-29 23:57:59 +08:00
|
|
|
|
#ifdef HAVE_GETRUSAGE
|
1998-03-14 01:50:38 +08:00
|
|
|
|
printf (HEADING "%1.2fuser %1.2fsystem %1.2felapsed %1.2fMB/s\n",
|
|
|
|
|
prefix, u_time, s_time, e_time, bw/(1024*1024));
|
1998-04-29 23:57:59 +08:00
|
|
|
|
#else
|
|
|
|
|
printf (HEADING "%1.2felapsed %1.2fMB/s\n",
|
|
|
|
|
prefix, e_time, bw/(1024*1024));
|
|
|
|
|
#endif
|
1998-03-14 01:50:38 +08:00
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*-------------------------------------------------------------------------
|
|
|
|
|
* Function: synchronize
|
|
|
|
|
*
|
|
|
|
|
* Purpose:
|
|
|
|
|
*
|
|
|
|
|
* Return: void
|
|
|
|
|
*
|
|
|
|
|
* Programmer: Robb Matzke
|
|
|
|
|
* Thursday, March 12, 1998
|
|
|
|
|
*
|
|
|
|
|
* Modifications:
|
|
|
|
|
*
|
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
|
*/
|
|
|
|
|
static void
|
|
|
|
|
synchronize (void)
|
|
|
|
|
{
|
1998-03-17 09:29:54 +08:00
|
|
|
|
#ifdef HAVE_SYSTEM
|
1998-03-14 01:50:38 +08:00
|
|
|
|
system ("sync");
|
|
|
|
|
system ("df >/dev/null");
|
|
|
|
|
#if 0
|
1998-03-17 09:29:54 +08:00
|
|
|
|
/*
|
|
|
|
|
* This works well on Linux to get rid of all cached disk buffers. The
|
|
|
|
|
* number should be approximately the amount of RAM in MB. Do not
|
|
|
|
|
* include swap space in that amount or the command will fail.
|
|
|
|
|
*/
|
|
|
|
|
system ("/sbin/swapout 128");
|
|
|
|
|
#endif
|
1998-03-14 01:50:38 +08:00
|
|
|
|
#endif
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*-------------------------------------------------------------------------
|
|
|
|
|
* Function: main
|
|
|
|
|
*
|
|
|
|
|
* Purpose:
|
|
|
|
|
*
|
|
|
|
|
* Return: Success:
|
|
|
|
|
*
|
|
|
|
|
* Failure:
|
|
|
|
|
*
|
|
|
|
|
* Programmer: Robb Matzke
|
|
|
|
|
* Thursday, March 12, 1998
|
|
|
|
|
*
|
|
|
|
|
* Modifications:
|
|
|
|
|
*
|
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
|
*/
|
|
|
|
|
int
|
|
|
|
|
main (void)
|
|
|
|
|
{
|
1998-04-09 05:43:02 +08:00
|
|
|
|
static hsize_t size[2] = {REQUEST_SIZE_X, REQUEST_SIZE_Y};
|
1998-03-14 01:50:38 +08:00
|
|
|
|
static int nread=NREAD_REQUESTS, nwrite=NWRITE_REQUESTS;
|
|
|
|
|
|
|
|
|
|
unsigned char *the_data = NULL;
|
|
|
|
|
hid_t file, dset, file_space=-1;
|
|
|
|
|
herr_t status;
|
1998-11-03 01:58:28 +08:00
|
|
|
|
#ifdef HAVE_GETRUSAGE
|
1998-03-14 01:50:38 +08:00
|
|
|
|
struct rusage r_start, r_stop;
|
1998-10-24 02:16:48 +08:00
|
|
|
|
#else
|
1998-11-03 01:58:28 +08:00
|
|
|
|
struct timeval r_start, r_stop;
|
1998-10-24 02:16:48 +08:00
|
|
|
|
#endif
|
1998-03-14 01:50:38 +08:00
|
|
|
|
struct timeval t_start, t_stop;
|
|
|
|
|
int i, fd;
|
1998-04-09 05:43:02 +08:00
|
|
|
|
hssize_t n;
|
1998-03-14 01:50:38 +08:00
|
|
|
|
off_t offset;
|
1998-04-09 05:43:02 +08:00
|
|
|
|
hssize_t start[2];
|
|
|
|
|
hsize_t count[2];
|
1998-11-11 02:15:37 +08:00
|
|
|
|
|
1998-11-12 00:33:33 +08:00
|
|
|
|
/*
|
|
|
|
|
* The extra cast in the following statement is a bug workaround for the
|
1998-11-18 02:19:51 +08:00
|
|
|
|
* Win32 version 5.0 compiler.
|
1998-11-12 00:33:33 +08:00
|
|
|
|
* 1998-11-06 ptl
|
|
|
|
|
*/
|
1998-03-31 03:24:08 +08:00
|
|
|
|
printf ("I/O request size is %1.1fMB\n",
|
1998-11-21 11:36:51 +08:00
|
|
|
|
(double)(hssize_t)(size[0]*size[1])/1024.0*1024);
|
1998-03-14 01:50:38 +08:00
|
|
|
|
|
|
|
|
|
/* Open the files */
|
|
|
|
|
file = H5Fcreate (HDF5_FILE_NAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
|
|
|
|
|
assert (file>=0);
|
|
|
|
|
fd = open (RAW_FILE_NAME, O_RDWR|O_CREAT|O_TRUNC, 0666);
|
|
|
|
|
assert (fd>=0);
|
|
|
|
|
|
|
|
|
|
/* Create the dataset */
|
|
|
|
|
file_space = H5Screate_simple (2, size, size);
|
|
|
|
|
assert (file_space>=0);
|
|
|
|
|
dset = H5Dcreate (file, "dset", H5T_NATIVE_UCHAR, file_space, H5P_DEFAULT);
|
|
|
|
|
assert (dset>=0);
|
1998-04-09 05:43:02 +08:00
|
|
|
|
the_data = malloc ((size_t)(size[0]*size[1]));
|
|
|
|
|
/*initial fill for lazy malloc*/
|
|
|
|
|
memset (the_data, 0xAA, (size_t)(size[0]*size[1]));
|
1998-03-14 01:50:38 +08:00
|
|
|
|
|
|
|
|
|
/* Fill raw */
|
|
|
|
|
synchronize ();
|
1998-04-29 23:57:59 +08:00
|
|
|
|
#ifdef HAVE_GETRUSAGE
|
1998-03-14 01:50:38 +08:00
|
|
|
|
getrusage (RUSAGE_SELF, &r_start);
|
1998-04-29 23:57:59 +08:00
|
|
|
|
#endif
|
1998-11-03 01:58:28 +08:00
|
|
|
|
#ifdef HAVE_GETTIMEOFDAY
|
1998-03-14 01:50:38 +08:00
|
|
|
|
gettimeofday (&t_start, NULL);
|
1998-10-24 02:16:48 +08:00
|
|
|
|
#endif
|
1998-03-14 01:50:38 +08:00
|
|
|
|
fprintf (stderr, HEADING, "fill raw");
|
|
|
|
|
for (i=0; i<nwrite; i++) {
|
|
|
|
|
putc (PROGRESS, stderr);
|
|
|
|
|
fflush (stderr);
|
1998-04-09 05:43:02 +08:00
|
|
|
|
memset (the_data, 0xAA, (size_t)(size[0]*size[1]));
|
1998-03-14 01:50:38 +08:00
|
|
|
|
}
|
1998-04-29 23:57:59 +08:00
|
|
|
|
#ifdef HAVE_GETRUSAGE
|
1998-03-14 01:50:38 +08:00
|
|
|
|
getrusage (RUSAGE_SELF, &r_stop);
|
1998-04-29 23:57:59 +08:00
|
|
|
|
#endif
|
1998-11-03 01:58:28 +08:00
|
|
|
|
#ifdef HAVE_GETTIMEOFDAY
|
1998-03-14 01:50:38 +08:00
|
|
|
|
gettimeofday (&t_stop, NULL);
|
1998-10-24 02:16:48 +08:00
|
|
|
|
#endif
|
1998-03-14 01:50:38 +08:00
|
|
|
|
putc ('\n', stderr);
|
|
|
|
|
print_stats ("fill raw",
|
|
|
|
|
&r_start, &r_stop, &t_start, &t_stop,
|
1998-04-09 05:43:02 +08:00
|
|
|
|
(size_t)(nread*size[0]*size[1]));
|
1998-03-14 01:50:38 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Fill hdf5 */
|
|
|
|
|
synchronize ();
|
1998-04-29 23:57:59 +08:00
|
|
|
|
#ifdef HAVE_GETRUSAGE
|
1998-03-14 01:50:38 +08:00
|
|
|
|
getrusage (RUSAGE_SELF, &r_start);
|
1998-04-29 23:57:59 +08:00
|
|
|
|
#endif
|
1998-11-03 01:58:28 +08:00
|
|
|
|
#ifdef HAVE_GETTIMEOFDAY
|
1998-03-14 01:50:38 +08:00
|
|
|
|
gettimeofday (&t_start, NULL);
|
1998-10-24 02:16:48 +08:00
|
|
|
|
#endif
|
1998-03-14 01:50:38 +08:00
|
|
|
|
fprintf (stderr, HEADING, "fill hdf5");
|
|
|
|
|
for (i=0; i<nread; i++) {
|
|
|
|
|
putc (PROGRESS, stderr);
|
|
|
|
|
fflush (stderr);
|
|
|
|
|
status = H5Dread (dset, H5T_NATIVE_UCHAR, file_space, file_space,
|
|
|
|
|
H5P_DEFAULT, the_data);
|
|
|
|
|
assert (status>=0);
|
|
|
|
|
}
|
1998-04-29 23:57:59 +08:00
|
|
|
|
#ifdef HAVE_GETRUSAGE
|
1998-03-14 01:50:38 +08:00
|
|
|
|
getrusage (RUSAGE_SELF, &r_stop);
|
1998-04-29 23:57:59 +08:00
|
|
|
|
#endif
|
1998-11-03 01:58:28 +08:00
|
|
|
|
#ifdef HAVE_GETTIMEOFDAY
|
1998-03-14 01:50:38 +08:00
|
|
|
|
gettimeofday (&t_stop, NULL);
|
1998-10-24 02:16:48 +08:00
|
|
|
|
#endif
|
1998-03-14 01:50:38 +08:00
|
|
|
|
putc ('\n', stderr);
|
|
|
|
|
print_stats ("fill hdf5",
|
|
|
|
|
&r_start, &r_stop, &t_start, &t_stop,
|
1998-04-09 05:43:02 +08:00
|
|
|
|
(size_t)(nread*size[0]*size[1]));
|
1998-03-14 01:50:38 +08:00
|
|
|
|
|
|
|
|
|
/* Write the raw dataset */
|
|
|
|
|
synchronize ();
|
1998-04-29 23:57:59 +08:00
|
|
|
|
#ifdef HAVE_GETRUSAGE
|
1998-03-14 01:50:38 +08:00
|
|
|
|
getrusage (RUSAGE_SELF, &r_start);
|
1998-04-29 23:57:59 +08:00
|
|
|
|
#endif
|
1998-11-03 01:58:28 +08:00
|
|
|
|
#ifdef HAVE_GETTIMEOFDAY
|
1998-03-14 01:50:38 +08:00
|
|
|
|
gettimeofday (&t_start, NULL);
|
1998-10-24 02:16:48 +08:00
|
|
|
|
#endif
|
1998-03-14 01:50:38 +08:00
|
|
|
|
fprintf (stderr, HEADING, "out raw");
|
|
|
|
|
for (i=0; i<nwrite; i++) {
|
|
|
|
|
putc (PROGRESS, stderr);
|
|
|
|
|
fflush (stderr);
|
|
|
|
|
offset = lseek (fd, 0, SEEK_SET);
|
|
|
|
|
assert (0==offset);
|
1998-04-09 05:43:02 +08:00
|
|
|
|
n = write (fd, the_data, (size_t)(size[0]*size[1]));
|
1998-04-07 23:34:16 +08:00
|
|
|
|
assert (n>=0 && (size_t)n==size[0]*size[1]);
|
1998-03-14 01:50:38 +08:00
|
|
|
|
}
|
1998-04-29 23:57:59 +08:00
|
|
|
|
#ifdef HAVE_GETRUSAGE
|
1998-03-14 01:50:38 +08:00
|
|
|
|
getrusage (RUSAGE_SELF, &r_stop);
|
1998-04-29 23:57:59 +08:00
|
|
|
|
#endif
|
1998-11-03 01:58:28 +08:00
|
|
|
|
#ifdef HAVE_GETTIMEOFDAY
|
1998-03-14 01:50:38 +08:00
|
|
|
|
gettimeofday (&t_stop, NULL);
|
1998-10-24 02:16:48 +08:00
|
|
|
|
#endif
|
1998-03-14 01:50:38 +08:00
|
|
|
|
putc ('\n', stderr);
|
|
|
|
|
print_stats ("out raw",
|
|
|
|
|
&r_start, &r_stop, &t_start, &t_stop,
|
1998-04-09 05:43:02 +08:00
|
|
|
|
(size_t)(nread*size[0]*size[1]));
|
1998-03-14 01:50:38 +08:00
|
|
|
|
|
|
|
|
|
/* Write the hdf5 dataset */
|
|
|
|
|
synchronize ();
|
1998-04-29 23:57:59 +08:00
|
|
|
|
#ifdef HAVE_GETRUSAGE
|
1998-03-14 01:50:38 +08:00
|
|
|
|
getrusage (RUSAGE_SELF, &r_start);
|
1998-04-29 23:57:59 +08:00
|
|
|
|
#endif
|
1998-11-03 01:58:28 +08:00
|
|
|
|
#ifdef HAVE_GETTIMEOFDAY
|
1998-03-14 01:50:38 +08:00
|
|
|
|
gettimeofday (&t_start, NULL);
|
1998-10-24 02:16:48 +08:00
|
|
|
|
#endif
|
1998-03-14 01:50:38 +08:00
|
|
|
|
fprintf (stderr, HEADING, "out hdf5");
|
|
|
|
|
for (i=0; i<nwrite; i++) {
|
|
|
|
|
putc (PROGRESS, stderr);
|
|
|
|
|
fflush (stderr);
|
|
|
|
|
status = H5Dwrite (dset, H5T_NATIVE_UCHAR, H5S_ALL, H5S_ALL,
|
|
|
|
|
H5P_DEFAULT, the_data);
|
|
|
|
|
assert (status>=0);
|
|
|
|
|
}
|
1998-04-29 23:57:59 +08:00
|
|
|
|
#ifdef HAVE_GETRUSAGE
|
1998-03-14 01:50:38 +08:00
|
|
|
|
getrusage (RUSAGE_SELF, &r_stop);
|
1998-04-29 23:57:59 +08:00
|
|
|
|
#endif
|
1998-11-03 01:58:28 +08:00
|
|
|
|
#ifdef HAVE_GETTIMEOFDAY
|
1998-03-14 01:50:38 +08:00
|
|
|
|
gettimeofday (&t_stop, NULL);
|
1998-10-24 02:16:48 +08:00
|
|
|
|
#endif
|
1998-03-14 01:50:38 +08:00
|
|
|
|
putc ('\n', stderr);
|
|
|
|
|
print_stats ("out hdf5",
|
|
|
|
|
&r_start, &r_stop, &t_start, &t_stop,
|
1998-04-09 05:43:02 +08:00
|
|
|
|
(size_t)(nread*size[0]*size[1]));
|
1998-03-14 01:50:38 +08:00
|
|
|
|
|
|
|
|
|
/* Read the raw dataset */
|
|
|
|
|
synchronize ();
|
1998-04-29 23:57:59 +08:00
|
|
|
|
#ifdef HAVE_GETRUSAGE
|
1998-03-14 01:50:38 +08:00
|
|
|
|
getrusage (RUSAGE_SELF, &r_start);
|
1998-04-29 23:57:59 +08:00
|
|
|
|
#endif
|
1998-11-03 01:58:28 +08:00
|
|
|
|
#ifdef HAVE_GETTIMEOFDAY
|
1998-03-14 01:50:38 +08:00
|
|
|
|
gettimeofday (&t_start, NULL);
|
1998-10-24 02:16:48 +08:00
|
|
|
|
#endif
|
1998-03-14 01:50:38 +08:00
|
|
|
|
fprintf (stderr, HEADING, "in raw");
|
|
|
|
|
for (i=0; i<nread; i++) {
|
|
|
|
|
putc (PROGRESS, stderr);
|
|
|
|
|
fflush (stderr);
|
|
|
|
|
offset = lseek (fd, 0, SEEK_SET);
|
|
|
|
|
assert (0==offset);
|
1998-04-09 05:43:02 +08:00
|
|
|
|
n = read (fd, the_data, (size_t)(size[0]*size[1]));
|
1998-04-07 23:34:16 +08:00
|
|
|
|
assert (n>=0 && (size_t)n==size[0]*size[1]);
|
1998-03-14 01:50:38 +08:00
|
|
|
|
}
|
1998-04-29 23:57:59 +08:00
|
|
|
|
#ifdef HAVE_GETRUSAGE
|
1998-03-14 01:50:38 +08:00
|
|
|
|
getrusage (RUSAGE_SELF, &r_stop);
|
1998-04-29 23:57:59 +08:00
|
|
|
|
#endif
|
1998-11-03 01:58:28 +08:00
|
|
|
|
#ifdef HAVE_GETTIMEOFDAY
|
1998-03-14 01:50:38 +08:00
|
|
|
|
gettimeofday (&t_stop, NULL);
|
1998-10-24 02:16:48 +08:00
|
|
|
|
#endif
|
1998-03-14 01:50:38 +08:00
|
|
|
|
putc ('\n', stderr);
|
|
|
|
|
print_stats ("in raw",
|
|
|
|
|
&r_start, &r_stop, &t_start, &t_stop,
|
1998-04-09 05:43:02 +08:00
|
|
|
|
(size_t)(nread*size[0]*size[1]));
|
1998-03-14 01:50:38 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Read the hdf5 dataset */
|
|
|
|
|
synchronize ();
|
1998-04-29 23:57:59 +08:00
|
|
|
|
#ifdef HAVE_GETRUSAGE
|
1998-03-14 01:50:38 +08:00
|
|
|
|
getrusage (RUSAGE_SELF, &r_start);
|
1998-04-29 23:57:59 +08:00
|
|
|
|
#endif
|
1998-11-03 01:58:28 +08:00
|
|
|
|
#ifdef HAVE_GETTIMEOFDAY
|
1998-03-14 01:50:38 +08:00
|
|
|
|
gettimeofday (&t_start, NULL);
|
1998-10-24 02:16:48 +08:00
|
|
|
|
#endif
|
1998-03-14 01:50:38 +08:00
|
|
|
|
fprintf (stderr, HEADING, "in hdf5");
|
|
|
|
|
for (i=0; i<nread; i++) {
|
|
|
|
|
putc (PROGRESS, stderr);
|
|
|
|
|
fflush (stderr);
|
|
|
|
|
status = H5Dread (dset, H5T_NATIVE_UCHAR, file_space, file_space,
|
|
|
|
|
H5P_DEFAULT, the_data);
|
|
|
|
|
assert (status>=0);
|
|
|
|
|
}
|
1998-04-29 23:57:59 +08:00
|
|
|
|
#ifdef HAVE_GETRUSAGE
|
1998-03-14 01:50:38 +08:00
|
|
|
|
getrusage (RUSAGE_SELF, &r_stop);
|
1998-04-29 23:57:59 +08:00
|
|
|
|
#endif
|
1998-11-03 01:58:28 +08:00
|
|
|
|
#ifdef HAVE_GETTIMEOFDAY
|
1998-03-14 01:50:38 +08:00
|
|
|
|
gettimeofday (&t_stop, NULL);
|
1998-10-24 02:16:48 +08:00
|
|
|
|
#endif
|
1998-03-14 01:50:38 +08:00
|
|
|
|
putc ('\n', stderr);
|
|
|
|
|
print_stats ("in hdf5",
|
|
|
|
|
&r_start, &r_stop, &t_start, &t_stop,
|
1998-04-09 05:43:02 +08:00
|
|
|
|
(size_t)(nread*size[0]*size[1]));
|
1998-03-14 01:50:38 +08:00
|
|
|
|
|
|
|
|
|
/* Read hyperslab */
|
|
|
|
|
assert (size[0]>20 && size[1]>20);
|
|
|
|
|
start[0] = start[1] = 10;
|
|
|
|
|
count[0] = count[1] = size[0]-20;
|
1998-07-07 05:01:59 +08:00
|
|
|
|
status = H5Sselect_hyperslab (file_space, H5S_SELECT_SET, start, NULL, count, NULL);
|
1998-03-14 01:50:38 +08:00
|
|
|
|
assert (status>=0);
|
|
|
|
|
synchronize ();
|
1998-04-29 23:57:59 +08:00
|
|
|
|
#ifdef HAVE_GETRUSAGE
|
1998-03-14 01:50:38 +08:00
|
|
|
|
getrusage (RUSAGE_SELF, &r_start);
|
1998-04-29 23:57:59 +08:00
|
|
|
|
#endif
|
1998-11-03 01:58:28 +08:00
|
|
|
|
#ifdef HAVE_GETTIMEOFDAY
|
1998-03-14 01:50:38 +08:00
|
|
|
|
gettimeofday (&t_start, NULL);
|
1998-10-24 02:16:48 +08:00
|
|
|
|
#endif
|
1998-03-14 01:50:38 +08:00
|
|
|
|
fprintf (stderr, HEADING, "in hdf5 partial");
|
|
|
|
|
for (i=0; i<nread; i++) {
|
|
|
|
|
putc (PROGRESS, stderr);
|
|
|
|
|
fflush (stderr);
|
|
|
|
|
status = H5Dread (dset, H5T_NATIVE_UCHAR, file_space, file_space,
|
|
|
|
|
H5P_DEFAULT, the_data);
|
|
|
|
|
assert (status>=0);
|
|
|
|
|
}
|
1998-04-29 23:57:59 +08:00
|
|
|
|
#ifdef HAVE_GETRUSAGE
|
1998-03-14 01:50:38 +08:00
|
|
|
|
getrusage (RUSAGE_SELF, &r_stop);
|
1998-04-29 23:57:59 +08:00
|
|
|
|
#endif
|
1998-11-03 01:58:28 +08:00
|
|
|
|
#ifdef HAVE_GETTIMEOFDAY
|
1998-03-14 01:50:38 +08:00
|
|
|
|
gettimeofday (&t_stop, NULL);
|
1998-10-24 02:16:48 +08:00
|
|
|
|
#endif
|
1998-03-14 01:50:38 +08:00
|
|
|
|
putc ('\n', stderr);
|
|
|
|
|
print_stats ("in hdf5 partial",
|
|
|
|
|
&r_start, &r_stop, &t_start, &t_stop,
|
1998-04-09 05:43:02 +08:00
|
|
|
|
(size_t)(nread*count[0]*count[1]));
|
1998-03-14 01:50:38 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Close everything */
|
|
|
|
|
close (fd);
|
|
|
|
|
H5Dclose (dset);
|
|
|
|
|
H5Sclose (file_space);
|
|
|
|
|
H5Fclose (file);
|
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
}
|