mirror of
https://github.com/HDFGroup/hdf5.git
synced 2025-02-17 16:10:24 +08:00
[svn-r900] Changes since 19981106
---------------------- ./tools/h5ls.c The chunk dimensions and total size is printed for chunked datasets. ./examples/h5_attribute.c ./examples/h5_select.c ./test/chunk.c ./test/iopipe.c ./test/ragged.c ./src/H5.c ./src/H5private.h ./src/H5public.h Removed extra carriage-return characters inserted by a broken OS :-) Reformatted strange-looking comments. Removed C++ comments. Wrapped long lines. ./examples/h5_attribute.c ./examples/h5_select.c Removed inclusion of private headers. Changed `uint32' (originally `uint') to `unsigned' because `int32' is not exported as part of the API. ./src/H5Fmpio.h Removed includes for <sys/types.h> and <sys/stat.h> since they're already included by H5private.h. All system include files should be included in H5private.h so we can wrap them with appropriate feature macros. ./tools/h5import.c ./tools/h5repart.c Included header files like all other programs in that directory. ./tools/h5tools.c Better type checking for `hsize_t' and `hssize_t'.
This commit is contained in:
parent
c82e6a4122
commit
bb36032d5a
@ -12,7 +12,6 @@
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <hdf5.h>
|
||||
#include <H5private.h>
|
||||
|
||||
#define FILE "Attributes.h5"
|
||||
|
||||
@ -46,7 +45,7 @@ main (void)
|
||||
float matrix[ADIM1][ADIM2]; /* Attribute data */
|
||||
|
||||
herr_t ret; /* Return value */
|
||||
uint32 i,j; /* Counters */
|
||||
unsigned i,j; /* Counters */
|
||||
int idx; /* Attribute index */
|
||||
char string_out[80]; /* Buffer to read string attribute back */
|
||||
int point_out; /* Buffer to read scalar attribute back */
|
||||
|
@ -10,7 +10,6 @@
|
||||
*/
|
||||
|
||||
#include <hdf5.h>
|
||||
#include <H5private.h>
|
||||
|
||||
#define FILE "Select.h5"
|
||||
|
||||
@ -58,7 +57,7 @@ int main (void)
|
||||
hssize_t coord[NPOINTS][FSPACE_RANK]; /* Array to store selected points
|
||||
from the file dataspace */
|
||||
herr_t ret;
|
||||
uint32 i,j;
|
||||
unsigned i,j;
|
||||
int matrix[FSPACE_DIM1][FSPACE_DIM2]; /* Buffer to write to the dataset */
|
||||
int matrix_out[MSPACE_DIM1][MSPACE_DIM2]; /* Buffer to read from the
|
||||
dataset */
|
||||
|
@ -47,9 +47,6 @@
|
||||
#include <H5Dprivate.h>
|
||||
#include <H5MMprivate.h>
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
#ifndef HAVE_PARALLEL
|
||||
/*
|
||||
* The H5F_mpio_xxxx functions are for parallel I/O only and are
|
||||
|
@ -94,7 +94,6 @@
|
||||
# include <io.h>
|
||||
#endif
|
||||
#ifdef HAVE_WINSOCK_H
|
||||
//# include <winsock.h>
|
||||
# include <winsock2.h>
|
||||
#endif
|
||||
#ifndef F_OK
|
||||
|
10
test/chunk.c
10
test/chunk.c
@ -285,11 +285,11 @@ test_diag (int op, hsize_t cache_size, hsize_t io_size, hsize_t offset)
|
||||
H5Dclose (dset);
|
||||
H5Fclose (file);
|
||||
|
||||
/*
|
||||
* The extra cast in the following statement is a bug
|
||||
* workaround for the Win32 version 0.0 compiler.
|
||||
* 1998-11-06 ptl
|
||||
*/
|
||||
/*
|
||||
* The extra cast in the following statement is a bug workaround for the
|
||||
* Win32 version 0.0 compiler.
|
||||
* 1998-11-06 ptl
|
||||
*/
|
||||
return (double)((hssize_t)(nio/nio_g));
|
||||
}
|
||||
|
||||
|
@ -183,17 +183,14 @@ main (void)
|
||||
off_t offset;
|
||||
hssize_t start[2];
|
||||
hsize_t count[2];
|
||||
|
||||
|
||||
/*
|
||||
* The extra cast in the following statement is a bug
|
||||
* workaround for the Win32 version 0.0 compiler.
|
||||
* 1998-11-06 ptl
|
||||
*/
|
||||
/*
|
||||
* The extra cast in the following statement is a bug workaround for the
|
||||
* Win32 version 0.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));
|
||||
// ((double)(size[0])*(double)(size[1]))/(1024.0*1024));
|
||||
|
||||
((double)((hssize_t)(size[0]*size[1])))/(1024.0*1024));
|
||||
|
||||
/* Open the files */
|
||||
file = H5Fcreate (HDF5_FILE_NAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
|
||||
|
@ -247,12 +247,13 @@ ragged_write_all(hid_t ra, hsize_t rows_at_once)
|
||||
if (0==row || alarm_g || 0==timeout_g) {
|
||||
alarm_g = 0;
|
||||
H5_timer_end(&timer_total, &timer);
|
||||
/*
|
||||
* The extra cast in the following statement is a bug
|
||||
* workaround for the Win32 version 0.0 compiler.
|
||||
* 1998-11-06 ptl
|
||||
*/
|
||||
H5_bandwidth(s, (double)((hssize_t)interval_nelmts)*sizeof(C_MTYPE),
|
||||
/*
|
||||
* The extra cast in the following statement is a bug workaround
|
||||
* for the Win32 version 0.0 compiler.
|
||||
* 1998-11-06 ptl
|
||||
*/
|
||||
H5_bandwidth(s,
|
||||
(double)((hssize_t)interval_nelmts)*sizeof(C_MTYPE),
|
||||
timer.etime);
|
||||
printf(" %8lu %8lu %7.3f%% %10s%s\n",
|
||||
(unsigned long)(row+i), (unsigned long)total_nelmts,
|
||||
@ -266,13 +267,13 @@ ragged_write_all(hid_t ra, hsize_t rows_at_once)
|
||||
/* Conclusions */
|
||||
if (timeout_g) { /*a minor race condition, but who really cares?*/
|
||||
H5_timer_end(&timer_total, &timer);
|
||||
|
||||
/*
|
||||
* The extra cast in the following statement is a bug
|
||||
* workaround for the Win32 version 0.0 compiler.
|
||||
* 1998-11-06 ptl
|
||||
*/
|
||||
H5_bandwidth(s, (double)((hssize_t)interval_nelmts)*sizeof(C_MTYPE), timer.etime);
|
||||
/*
|
||||
* The extra cast in the following statement is a bug workaround for
|
||||
* the Win32 version 0.0 compiler.
|
||||
* 1998-11-06 ptl
|
||||
*/
|
||||
H5_bandwidth(s, (double)((hssize_t)interval_nelmts)*sizeof(C_MTYPE),
|
||||
timer.etime);
|
||||
printf(" %8lu %8lu %7.3f%% %10s\n",
|
||||
(unsigned long)row, (unsigned long)total_nelmts,
|
||||
100.0*total_nelmts/MAX_NELMTS, s);
|
||||
@ -380,12 +381,13 @@ ragged_read_all(hid_t ra, hsize_t rows_at_once)
|
||||
if (0==row || alarm_g || 0==timeout_g) {
|
||||
alarm_g = 0;
|
||||
H5_timer_end(&timer_total, &timer);
|
||||
/*
|
||||
* The extra cast in the following statement is a bug
|
||||
* workaround for the Win32 version 0.0 compiler.
|
||||
* 1998-11-06 ptl
|
||||
*/
|
||||
H5_bandwidth(s, (double)((hssize_t)interval_nelmts)*sizeof(C_MTYPE),
|
||||
/*
|
||||
* The extra cast in the following statement is a bug workaround
|
||||
* for the Win32 version 0.0 compiler.
|
||||
* 1998-11-06 ptl
|
||||
*/
|
||||
H5_bandwidth(s,
|
||||
(double)((hssize_t)interval_nelmts)*sizeof(C_MTYPE),
|
||||
timer.etime);
|
||||
printf(" %8lu %8lu %7.3f%% %10s%s\n",
|
||||
(unsigned long)(row+i), (unsigned long)total_nelmts,
|
||||
@ -407,12 +409,13 @@ ragged_read_all(hid_t ra, hsize_t rows_at_once)
|
||||
/* Conclusions */
|
||||
if (timeout_g) { /*a minor race condition, but who really cares?*/
|
||||
H5_timer_end(&timer_total, &timer);
|
||||
/*
|
||||
* The extra cast in the following statement is a bug
|
||||
* workaround for the Win32 version 0.0 compiler.
|
||||
* 1998-11-06 ptl
|
||||
*/
|
||||
H5_bandwidth(s, (double)((hssize_t)interval_nelmts)*sizeof(C_MTYPE), timer.etime);
|
||||
/*
|
||||
* The extra cast in the following statement is a bug workaround for
|
||||
* the Win32 version 0.0 compiler.
|
||||
* 1998-11-06 ptl
|
||||
*/
|
||||
H5_bandwidth(s, (double)((hssize_t)interval_nelmts)*sizeof(C_MTYPE),
|
||||
timer.etime);
|
||||
printf(" %8lu %8lu %7.3f%% %10s\n",
|
||||
(unsigned long)row, (unsigned long)total_nelmts,
|
||||
100.0*total_nelmts/MAX_NELMTS, s);
|
||||
@ -542,12 +545,13 @@ ragged_read_short(hid_t ra, hsize_t rows_at_once, hsize_t width)
|
||||
if (0==row || alarm_g || 0==timeout_g) {
|
||||
alarm_g = 0;
|
||||
H5_timer_end(&timer_total, &timer);
|
||||
/*
|
||||
* The extra cast in the following statement is a bug
|
||||
* workaround for the Win32 version 0.0 compiler.
|
||||
* 1998-11-06 ptl
|
||||
*/
|
||||
H5_bandwidth(s, (double)((hssize_t)interval_nelmts)*sizeof(C_MTYPE),
|
||||
/*
|
||||
* The extra cast in the following statement is a bug workaround
|
||||
* for the Win32 version 0.0 compiler.
|
||||
* 1998-11-06 ptl
|
||||
*/
|
||||
H5_bandwidth(s,
|
||||
(double)((hssize_t)interval_nelmts)*sizeof(C_MTYPE),
|
||||
timer.etime);
|
||||
printf(" %8lu %8lu %7.3f%% %10s%s\n",
|
||||
(unsigned long)(row+i), (unsigned long)read_nelmts,
|
||||
@ -569,23 +573,25 @@ ragged_read_short(hid_t ra, hsize_t rows_at_once, hsize_t width)
|
||||
/* Conclusions */
|
||||
if (timeout_g) { /*a minor race condition, but who really cares?*/
|
||||
H5_timer_end(&timer_total, &timer);
|
||||
/*
|
||||
* The extra cast in the following statement is a bug
|
||||
* workaround for the Win32 version 0.0 compiler.
|
||||
* 1998-11-06 ptl
|
||||
*/
|
||||
H5_bandwidth(s, (double)((hssize_t)interval_nelmts)*sizeof(C_MTYPE), timer.etime);
|
||||
/*
|
||||
* The extra cast in the following statement is a bug workaround for
|
||||
* the Win32 version 0.0 compiler.
|
||||
* 1998-11-06 ptl
|
||||
*/
|
||||
H5_bandwidth(s, (double)((hssize_t)interval_nelmts)*sizeof(C_MTYPE),
|
||||
timer.etime);
|
||||
printf(" %8lu %8lu %7.3f%% %10s\n",
|
||||
(unsigned long)row, (unsigned long)read_nelmts,
|
||||
100.0*total_nelmts/MAX_NELMTS, s);
|
||||
}
|
||||
printf(" -------- -------- -------- ----------\n");
|
||||
/*
|
||||
* The extra cast in the following statement is a bug
|
||||
* workaround for the Win32 version 0.0 compiler.
|
||||
* 1998-11-06 ptl
|
||||
*/
|
||||
H5_bandwidth(s, (double)((hssize_t)read_nelmts)*sizeof(C_MTYPE), timer_total.etime);
|
||||
/*
|
||||
* The extra cast in the following statement is a bug workaround for the
|
||||
* Win32 version 0.0 compiler.
|
||||
* 1998-11-06 ptl
|
||||
*/
|
||||
H5_bandwidth(s, (double)((hssize_t)read_nelmts)*sizeof(C_MTYPE),
|
||||
timer_total.etime);
|
||||
printf(" %27s%10s\n", "", s);
|
||||
|
||||
/* Cleanup */
|
||||
|
@ -7,15 +7,27 @@
|
||||
*
|
||||
* Purpose: Create an hdf5 file with a 1d dataset of uint8.
|
||||
*/
|
||||
#include <fcntl.h>
|
||||
#include <hdf5.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <sys/stat.h>
|
||||
#ifdef HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
|
||||
/* See H5private.h for how to include system headers */
|
||||
#include <H5config.h>
|
||||
#ifdef STDC_HEADERS
|
||||
# include <fcntl.h>
|
||||
# include <string.h>
|
||||
# include <stdlib.h>
|
||||
# include <stdio.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_UNISTD_H
|
||||
# include <sys/types.h>
|
||||
# include <unistd.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_SYS_STAT_H
|
||||
# include <sys/stat.h>
|
||||
#endif
|
||||
|
||||
#include <hdf5.h>
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: usage
|
||||
|
44
tools/h5ls.c
44
tools/h5ls.c
@ -919,6 +919,7 @@ dataset_list2(hid_t dset)
|
||||
{
|
||||
hid_t dcpl; /*dataset creation property list*/
|
||||
hid_t type; /*data type of dataset */
|
||||
hid_t space; /*data space of dataset */
|
||||
int nf; /*number of filters */
|
||||
unsigned filt_flags; /*filter flags */
|
||||
H5Z_filter_t filt_id; /*filter identification number */
|
||||
@ -929,42 +930,50 @@ dataset_list2(hid_t dset)
|
||||
char s[64]; /*temporary string buffer */
|
||||
off_t f_offset; /*offset in external file */
|
||||
hsize_t f_size; /*bytes used in external file */
|
||||
hsize_t total_offset; /*total dataset offset */
|
||||
hsize_t total; /*total size or offset */
|
||||
hsize_t chsize[64]; /*chunk size in elements */
|
||||
int ndims; /*dimensionality */
|
||||
int i;
|
||||
|
||||
|
||||
if (verbose_g>0) {
|
||||
dcpl = H5Dget_create_plist(dset);
|
||||
|
||||
/* Print data type */
|
||||
printf(" %-10s ", "Type:");
|
||||
space = H5Dget_space(dset);
|
||||
type = H5Dget_type(dset);
|
||||
display_type(type, 15);
|
||||
H5Tclose(type);
|
||||
printf("\n");
|
||||
|
||||
/* Print information about chunked storage */
|
||||
if (H5D_CHUNKED==H5Pget_layout(dcpl)) {
|
||||
ndims = H5Pget_chunk(dcpl, NELMTS(chsize), chsize/*out*/);
|
||||
printf(" %-10s {", "Chunks:");
|
||||
total = H5Tget_size(type);
|
||||
for (i=0; i<ndims; i++) {
|
||||
printf("%s%lu", i?", ":"", (unsigned long)(chsize[i]));
|
||||
total *= chsize[i];
|
||||
}
|
||||
printf("} %lu bytes\n", (unsigned long)total);
|
||||
}
|
||||
|
||||
/* Print information about external strorage */
|
||||
if ((nf = H5Pget_external_count(dcpl))>0) {
|
||||
printf(" %-10s %d external file%s (num/addr/offset/length)\n",
|
||||
"Extern:", nf, 1==nf?"":"s");
|
||||
for (i=0, total_offset=0; i<nf; i++) {
|
||||
for (i=0, total=0; i<nf; i++) {
|
||||
if (H5Pget_external(dcpl, i, sizeof(f_name), f_name, &f_offset,
|
||||
&f_size)<0) {
|
||||
HDfprintf(stdout,
|
||||
" #%03d %10Hu %10s %10s ***ERROR*** %s\n",
|
||||
i, total_offset, "", "",
|
||||
i, total, "", "",
|
||||
i+1<nf?"Following addresses are incorrect":"");
|
||||
} else if (H5S_UNLIMITED==f_size) {
|
||||
HDfprintf(stdout, " #%03d %10Hu %10Hu %10s \"",
|
||||
i, total_offset, (hsize_t)f_offset, "INF");
|
||||
i, total, (hsize_t)f_offset, "INF");
|
||||
display_string(f_name);
|
||||
} else {
|
||||
HDfprintf(stdout, " #%03d %10Hu %10Hu %10Hu \"",
|
||||
i, total_offset, (hsize_t)f_offset, f_size);
|
||||
i, total, (hsize_t)f_offset, f_size);
|
||||
display_string(f_name);
|
||||
}
|
||||
printf("\"\n");
|
||||
total_offset += f_size;
|
||||
total += f_size;
|
||||
}
|
||||
}
|
||||
|
||||
@ -986,6 +995,15 @@ dataset_list2(hid_t dset)
|
||||
printf("}\n");
|
||||
}
|
||||
}
|
||||
|
||||
/* Print data type */
|
||||
printf(" %-10s ", "Type:");
|
||||
display_type(type, 15);
|
||||
printf("\n");
|
||||
|
||||
/* Close stuff */
|
||||
H5Tclose(type);
|
||||
H5Sclose(space);
|
||||
H5Pclose(dcpl);
|
||||
}
|
||||
|
||||
|
@ -11,17 +11,28 @@
|
||||
* changing the size of the family members. It can also be used
|
||||
* to copy a single file to a single file with holes.
|
||||
*/
|
||||
#include <ctype.h>
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <hdf5.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <sys/stat.h>
|
||||
#ifdef HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
|
||||
/* See H5private.h for how to include system headers */
|
||||
#include <H5config.h>
|
||||
#ifdef STDC_HEADERS
|
||||
# include <ctype.h>
|
||||
# include <errno.h>
|
||||
# include <fcntl.h>
|
||||
# include <stdio.h>
|
||||
# include <stdlib.h>
|
||||
# include <string.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_UNISTD_H
|
||||
# include <sys/types.h>
|
||||
# include <unistd.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_SYS_STAT_H
|
||||
# include <sys/stat.h>
|
||||
#endif
|
||||
|
||||
#include <hdf5.h>
|
||||
#define FALSE 0
|
||||
#define TRUE 1
|
||||
#define NAMELEN 4096
|
||||
|
@ -29,8 +29,6 @@
|
||||
#endif
|
||||
|
||||
#define OPT(X,S) ((X)?(X):(S))
|
||||
#define MIN(X,Y) ((X)<(Y)?(X):(Y))
|
||||
#define NELMTS(X) (sizeof(X)/sizeof(*X))
|
||||
#define ALIGN(A,Z) ((((A)+(Z)-1)/(Z))*(Z))
|
||||
|
||||
|
||||
@ -250,7 +248,9 @@ h5dump_sprint(char *s/*out*/, const h5dump_t *info, hid_t type, void *vp)
|
||||
sprintf(temp, "%lu", *((unsigned long*)vp));
|
||||
|
||||
} else if (H5Tequal(type, H5T_NATIVE_HSSIZE)) {
|
||||
if (sizeof(hssize_t)==sizeof(long)) {
|
||||
if (sizeof(hssize_t)==sizeof(int)) {
|
||||
sprintf(temp, "%d", *((int*)vp));
|
||||
} else if (sizeof(hssize_t)==sizeof(long)) {
|
||||
sprintf(temp, "%ld", *((long*)vp));
|
||||
} else {
|
||||
char fmt[8];
|
||||
@ -261,7 +261,9 @@ h5dump_sprint(char *s/*out*/, const h5dump_t *info, hid_t type, void *vp)
|
||||
}
|
||||
|
||||
} else if (H5Tequal(type, H5T_NATIVE_HSIZE)) {
|
||||
if (sizeof(hsize_t)==sizeof(long)) {
|
||||
if (sizeof(hsize_t)==sizeof(int)) {
|
||||
sprintf(temp, "%u", *((unsigned*)vp));
|
||||
} else if (sizeof(hsize_t)==sizeof(long)) {
|
||||
sprintf(temp, "%lu", *((unsigned long*)vp));
|
||||
} else {
|
||||
char fmt[8];
|
||||
|
Loading…
Reference in New Issue
Block a user