From 8619af74a4bc5013d6c9896f1c696f91e7bda050 Mon Sep 17 00:00:00 2001 From: James Laird Date: Mon, 24 Oct 2005 13:58:15 -0500 Subject: [svn-r11601] Purpose: Added additional targets to build-all Description: Surveyed files to find out which ones are not built. Added test/space_overflow and perform/benchpar to programs built with --enable-build-all. Discovered that tools/misc/pdb2hdf5 and tools/misc/h5import were obsolete and deleted them. Platforms tested: mir, modi4, sol Misc. update: Update of release file and removal of --enable-pdb2hdf5 to follow. --- perform/Makefile.am | 12 +- perform/Makefile.in | 37 ++-- perform/benchpar.c | 12 ++ test/Makefile.am | 3 +- test/Makefile.in | 26 ++- tools/misc/h5import.c | 152 --------------- tools/misc/pdb2hdf.c | 527 -------------------------------------------------- 7 files changed, 64 insertions(+), 705 deletions(-) delete mode 100644 tools/misc/h5import.c delete mode 100644 tools/misc/pdb2hdf.c diff --git a/perform/Makefile.am b/perform/Makefile.am index c10a80e..a43e925 100644 --- a/perform/Makefile.am +++ b/perform/Makefile.am @@ -30,17 +30,19 @@ endif # always installed with the tools during make install. bin_PROGRAMS=h5perf -# mpi-perf is not built or run by default, but can be built by hand or by +# Some programs are not built or run by default, but can be built by hand or by # specifying --enable-build-all at configure time. +# Also, some of these programs should only be built in parallel. +if BUILD_PARALLEL_CONDITIONAL + PARA_BUILD_ALL=benchpar mpi-perf +endif if BUILD_ALL_CONDITIONAL - MPI_PERF=mpi-perf -else - MPI_PERF= + BUILD_ALL_PROGS=$(PARA_BUILD_ALL) endif # These are the programs that `make all' or `make tests' will build and which # `make check' will run. List them in the order they should be run. -TEST_PROG = iopipe chunk overhead zip_perf perf_meta $(MPI_PERF) +TEST_PROG = iopipe chunk overhead zip_perf perf_meta $(BUILD_ALL_PROGS) check_PROGRAMS=$(TEST_PROG_PARA) $(TEST_PROG) perf h5perf_SOURCES=pio_perf.c pio_engine.c pio_timer.c diff --git a/perform/Makefile.in b/perform/Makefile.in index caff887..70e53b5 100644 --- a/perform/Makefile.in +++ b/perform/Makefile.in @@ -30,7 +30,7 @@ # HDF5 Library Performance Makefile(.in) # -SOURCES = chunk.c $(h5perf_SOURCES) iopipe.c mpi-perf.c overhead.c perf.c perf_meta.c zip_perf.c +SOURCES = benchpar.c chunk.c $(h5perf_SOURCES) iopipe.c mpi-perf.c overhead.c perf.c perf_meta.c zip_perf.c srcdir = @srcdir@ top_srcdir = @top_srcdir@ @@ -58,7 +58,7 @@ DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ $(top_srcdir)/config/commence.am \ $(top_srcdir)/config/conclude.am bin_PROGRAMS = h5perf$(EXEEXT) -check_PROGRAMS = $(am__EXEEXT_1) $(am__EXEEXT_3) perf$(EXEEXT) +check_PROGRAMS = $(am__EXEEXT_1) $(am__EXEEXT_4) perf$(EXEEXT) subdir = perform ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.in @@ -70,14 +70,20 @@ CONFIG_CLEAN_FILES = am__installdirs = "$(DESTDIR)$(bindir)" binPROGRAMS_INSTALL = $(INSTALL_PROGRAM) @BUILD_PARALLEL_CONDITIONAL_TRUE@am__EXEEXT_1 = h5perf$(EXEEXT) -@BUILD_ALL_CONDITIONAL_TRUE@am__EXEEXT_2 = mpi-perf$(EXEEXT) -am__EXEEXT_3 = iopipe$(EXEEXT) chunk$(EXEEXT) overhead$(EXEEXT) \ - zip_perf$(EXEEXT) perf_meta$(EXEEXT) $(am__EXEEXT_2) +@BUILD_PARALLEL_CONDITIONAL_TRUE@am__EXEEXT_2 = benchpar$(EXEEXT) \ +@BUILD_PARALLEL_CONDITIONAL_TRUE@ mpi-perf$(EXEEXT) +@BUILD_ALL_CONDITIONAL_TRUE@am__EXEEXT_3 = $(am__EXEEXT_2) +am__EXEEXT_4 = iopipe$(EXEEXT) chunk$(EXEEXT) overhead$(EXEEXT) \ + zip_perf$(EXEEXT) perf_meta$(EXEEXT) $(am__EXEEXT_3) PROGRAMS = $(bin_PROGRAMS) +benchpar_SOURCES = benchpar.c +benchpar_OBJECTS = benchpar.$(OBJEXT) +benchpar_LDADD = $(LDADD) +am__DEPENDENCIES_1 = $(top_builddir)/src/libhdf5.la +benchpar_DEPENDENCIES = $(am__DEPENDENCIES_1) chunk_SOURCES = chunk.c chunk_OBJECTS = chunk.$(OBJEXT) chunk_LDADD = $(LDADD) -am__DEPENDENCIES_1 = $(top_builddir)/src/libhdf5.la chunk_DEPENDENCIES = $(am__DEPENDENCIES_1) am_h5perf_OBJECTS = pio_perf.$(OBJEXT) pio_engine.$(OBJEXT) \ pio_timer.$(OBJEXT) @@ -118,10 +124,10 @@ LTCOMPILE = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) \ CCLD = $(CC) LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ -SOURCES = chunk.c $(h5perf_SOURCES) iopipe.c mpi-perf.c overhead.c \ - perf.c perf_meta.c zip_perf.c -DIST_SOURCES = chunk.c $(h5perf_SOURCES) iopipe.c mpi-perf.c \ +SOURCES = benchpar.c chunk.c $(h5perf_SOURCES) iopipe.c mpi-perf.c \ overhead.c perf.c perf_meta.c zip_perf.c +DIST_SOURCES = benchpar.c chunk.c $(h5perf_SOURCES) iopipe.c \ + mpi-perf.c overhead.c perf.c perf_meta.c zip_perf.c ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) @@ -353,15 +359,16 @@ H5FC_PP = $(bindir)/h5pfc CHECK_CLEANFILES = *.chkexe *.chklog *.clog INCLUDES = -I$(top_srcdir)/src -I$(top_srcdir)/test -I$(top_srcdir)/tools/lib @BUILD_PARALLEL_CONDITIONAL_TRUE@TEST_PROG_PARA = h5perf -@BUILD_ALL_CONDITIONAL_FALSE@MPI_PERF = -# mpi-perf is not built or run by default, but can be built by hand or by +# Some programs are not built or run by default, but can be built by hand or by # specifying --enable-build-all at configure time. -@BUILD_ALL_CONDITIONAL_TRUE@MPI_PERF = mpi-perf +# Also, some of these programs should only be built in parallel. +@BUILD_PARALLEL_CONDITIONAL_TRUE@PARA_BUILD_ALL = benchpar mpi-perf +@BUILD_ALL_CONDITIONAL_TRUE@BUILD_ALL_PROGS = $(PARA_BUILD_ALL) # These are the programs that `make all' or `make tests' will build and which # `make check' will run. List them in the order they should be run. -TEST_PROG = iopipe chunk overhead zip_perf perf_meta $(MPI_PERF) +TEST_PROG = iopipe chunk overhead zip_perf perf_meta $(BUILD_ALL_PROGS) h5perf_SOURCES = pio_perf.c pio_engine.c pio_timer.c # These are the files that `make clean' (and derivatives) will remove from @@ -461,6 +468,9 @@ clean-checkPROGRAMS: echo " rm -f $$p $$f"; \ rm -f $$p $$f ; \ done +benchpar$(EXEEXT): $(benchpar_OBJECTS) $(benchpar_DEPENDENCIES) + @rm -f benchpar$(EXEEXT) + $(LINK) $(benchpar_LDFLAGS) $(benchpar_OBJECTS) $(benchpar_LDADD) $(LIBS) chunk$(EXEEXT): $(chunk_OBJECTS) $(chunk_DEPENDENCIES) @rm -f chunk$(EXEEXT) $(LINK) $(chunk_LDFLAGS) $(chunk_OBJECTS) $(chunk_LDADD) $(LIBS) @@ -492,6 +502,7 @@ mostlyclean-compile: distclean-compile: -rm -f *.tab.c +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/benchpar.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/chunk.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/iopipe.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mpi-perf.Po@am__quote@ diff --git a/perform/benchpar.c b/perform/benchpar.c index e5b6690..947a20c 100644 --- a/perform/benchpar.c +++ b/perform/benchpar.c @@ -16,11 +16,23 @@ #include #include #include +#include +#include #include "hdf5.h" /* Local macros */ +/* + * HDF Boolean type. + */ +#ifndef FALSE +# define FALSE 0 +#endif +#ifndef TRUE +# define TRUE 1 +#endif + /* defines for type of VFL driver to use */ #define FACC_DEFAULT 0 #define FACC_MPIO 1 diff --git a/test/Makefile.am b/test/Makefile.am index f4e986d..89ce616 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -56,7 +56,8 @@ check_PROGRAMS=$(TEST_PROG) error_test err_compat testmeta # so do not appear in this list. if BUILD_ALL_CONDITIONAL BUILD_ALL_PROGS=gen_deflate gen_filters gen_new_array gen_new_fill \ - gen_new_mtime gen_new_super gen_noencoder gen_nullspace + gen_new_mtime gen_new_super gen_noencoder gen_nullspace \ + space_overflow else BUILD_ALL_PROGS= endif diff --git a/test/Makefile.in b/test/Makefile.in index 3c8588d..32af5f6 100644 --- a/test/Makefile.in +++ b/test/Makefile.in @@ -31,7 +31,7 @@ # -SOURCES = $(libh5test_la_SOURCES) b+tree.c big.c bittests.c blocktrack.c btree2.c cache.c cmpd_dset.c dangle.c dsets.c dt_arith.c dtransform.c dtypes.c enum.c err_compat.c error_test.c extend.c external.c fillval.c flush1.c flush2.c gen_deflate.c gen_filters.c gen_new_array.c gen_new_fill.c gen_new_mtime.c gen_new_super.c gen_noencoder.c gen_nullspace.c getname.c gheap.c hyperslab.c istore.c lheap.c links.c mount.c mtime.c ntypes.c ohdr.c pool.c reserved.c set_extent.c sheap.c stab.c stream_test.c $(testhdf5_SOURCES) testmeta.c $(ttsafe_SOURCES) unlink.c vfd.c +SOURCES = $(libh5test_la_SOURCES) b+tree.c big.c bittests.c blocktrack.c btree2.c cache.c cmpd_dset.c dangle.c dsets.c dt_arith.c dtransform.c dtypes.c enum.c err_compat.c error_test.c extend.c external.c fillval.c flush1.c flush2.c gen_deflate.c gen_filters.c gen_new_array.c gen_new_fill.c gen_new_mtime.c gen_new_super.c gen_noencoder.c gen_nullspace.c getname.c gheap.c hyperslab.c istore.c lheap.c links.c mount.c mtime.c ntypes.c ohdr.c pool.c reserved.c set_extent.c sheap.c space_overflow.c stab.c stream_test.c $(testhdf5_SOURCES) testmeta.c $(ttsafe_SOURCES) unlink.c vfd.c srcdir = @srcdir@ top_srcdir = @top_srcdir@ @@ -92,7 +92,8 @@ am__EXEEXT_1 = testhdf5$(EXEEXT) lheap$(EXEEXT) ohdr$(EXEEXT) \ @BUILD_ALL_CONDITIONAL_TRUE@ gen_new_mtime$(EXEEXT) \ @BUILD_ALL_CONDITIONAL_TRUE@ gen_new_super$(EXEEXT) \ @BUILD_ALL_CONDITIONAL_TRUE@ gen_noencoder$(EXEEXT) \ -@BUILD_ALL_CONDITIONAL_TRUE@ gen_nullspace$(EXEEXT) +@BUILD_ALL_CONDITIONAL_TRUE@ gen_nullspace$(EXEEXT) \ +@BUILD_ALL_CONDITIONAL_TRUE@ space_overflow$(EXEEXT) PROGRAMS = $(noinst_PROGRAMS) b_tree_SOURCES = b+tree.c b_tree_OBJECTS = b+tree.$(OBJEXT) @@ -263,6 +264,10 @@ sheap_SOURCES = sheap.c sheap_OBJECTS = sheap.$(OBJEXT) sheap_LDADD = $(LDADD) sheap_DEPENDENCIES = libh5test.la $(am__DEPENDENCIES_1) +space_overflow_SOURCES = space_overflow.c +space_overflow_OBJECTS = space_overflow.$(OBJEXT) +space_overflow_LDADD = $(LDADD) +space_overflow_DEPENDENCIES = libh5test.la $(am__DEPENDENCIES_1) stab_SOURCES = stab.c stab_OBJECTS = stab.$(OBJEXT) stab_LDADD = $(LDADD) @@ -319,8 +324,9 @@ SOURCES = $(libh5test_la_SOURCES) b+tree.c big.c bittests.c \ gen_new_mtime.c gen_new_super.c gen_noencoder.c \ gen_nullspace.c getname.c gheap.c hyperslab.c istore.c lheap.c \ links.c mount.c mtime.c ntypes.c ohdr.c pool.c reserved.c \ - set_extent.c sheap.c stab.c stream_test.c $(testhdf5_SOURCES) \ - testmeta.c $(ttsafe_SOURCES) unlink.c vfd.c + set_extent.c sheap.c space_overflow.c stab.c stream_test.c \ + $(testhdf5_SOURCES) testmeta.c $(ttsafe_SOURCES) unlink.c \ + vfd.c DIST_SOURCES = $(libh5test_la_SOURCES) b+tree.c big.c bittests.c \ blocktrack.c btree2.c cache.c cmpd_dset.c dangle.c dsets.c \ dt_arith.c dtransform.c dtypes.c enum.c err_compat.c \ @@ -329,8 +335,9 @@ DIST_SOURCES = $(libh5test_la_SOURCES) b+tree.c big.c bittests.c \ gen_new_mtime.c gen_new_super.c gen_noencoder.c \ gen_nullspace.c getname.c gheap.c hyperslab.c istore.c lheap.c \ links.c mount.c mtime.c ntypes.c ohdr.c pool.c reserved.c \ - set_extent.c sheap.c stab.c stream_test.c $(testhdf5_SOURCES) \ - testmeta.c $(ttsafe_SOURCES) unlink.c vfd.c + set_extent.c sheap.c space_overflow.c stab.c stream_test.c \ + $(testhdf5_SOURCES) testmeta.c $(ttsafe_SOURCES) unlink.c \ + vfd.c ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) @@ -610,7 +617,8 @@ TEST_PROG = testhdf5 lheap ohdr stab gheap btree2 cache b+tree blocktrack sheap # The gen_old_* files can only be compiled with older versions of the library # so do not appear in this list. @BUILD_ALL_CONDITIONAL_TRUE@BUILD_ALL_PROGS = gen_deflate gen_filters gen_new_array gen_new_fill \ -@BUILD_ALL_CONDITIONAL_TRUE@ gen_new_mtime gen_new_super gen_noencoder gen_nullspace +@BUILD_ALL_CONDITIONAL_TRUE@ gen_new_mtime gen_new_super gen_noencoder gen_nullspace \ +@BUILD_ALL_CONDITIONAL_TRUE@ space_overflow # The libh5test library provides common support code for the tests. @@ -831,6 +839,9 @@ set_extent$(EXEEXT): $(set_extent_OBJECTS) $(set_extent_DEPENDENCIES) sheap$(EXEEXT): $(sheap_OBJECTS) $(sheap_DEPENDENCIES) @rm -f sheap$(EXEEXT) $(LINK) $(sheap_LDFLAGS) $(sheap_OBJECTS) $(sheap_LDADD) $(LIBS) +space_overflow$(EXEEXT): $(space_overflow_OBJECTS) $(space_overflow_DEPENDENCIES) + @rm -f space_overflow$(EXEEXT) + $(LINK) $(space_overflow_LDFLAGS) $(space_overflow_OBJECTS) $(space_overflow_LDADD) $(LIBS) stab$(EXEEXT): $(stab_OBJECTS) $(stab_DEPENDENCIES) @rm -f stab$(EXEEXT) $(LINK) $(stab_LDFLAGS) $(stab_OBJECTS) $(stab_LDADD) $(LIBS) @@ -902,6 +913,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/reserved.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/set_extent.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sheap.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/space_overflow.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stab.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stream_test.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tarray.Po@am__quote@ diff --git a/tools/misc/h5import.c b/tools/misc/h5import.c deleted file mode 100644 index 4192821..0000000 --- a/tools/misc/h5import.c +++ /dev/null @@ -1,152 +0,0 @@ -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * 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 * - * http://hdf.ncsa.uiuc.edu/HDF5/doc/Copyright.html. If you do not have * - * access to either file, you may request a copy from hdfhelp@ncsa.uiuc.edu. * - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -/* - * Programmer: Robb Matzke - * Thursday, June 11, 1998 - * - * Purpose: Create an hdf5 file with a 1d dataset of uint8. - */ - -/* See H5private.h for how to include system headers */ -#include -#ifdef H5_STDC_HEADERS -# include -# include -# include -# include -#endif - -#ifdef H5_HAVE_UNISTD_H -# include -# include -#endif - -#ifdef H5_HAVE_SYS_STAT_H -# include -#endif - -#ifdef WIN32 -# include -#endif - - -/*------------------------------------------------------------------------- - * Function: usage - * - * Purpose: Print a usage message and exit with non-zero status - * - * Return: never returns - * - * Programmer: Robb Matzke - * Thursday, June 11, 1998 - * - * Modifications: - * - *------------------------------------------------------------------------- - */ -static void -usage (const char *argv0) -{ - fprintf (stderr, "Usage: %s -f HDF5-FILE FILES...\n", argv0); - exit (1); -} - - -/*------------------------------------------------------------------------- - * Function: main - * - * Purpose: - * - * Return: Success: 0 - * - * Failure: 1 - * - * Programmer: Robb Matzke - * Thursday, June 11, 1998 - * - * Modifications: - * - *------------------------------------------------------------------------- - */ -int -main (int argc, char *argv[]) -{ - hid_t file, space=-1, dset=-1; - const char *output_name, *dset_name; - int argno, fd=-1; - hsize_t size[1]; - struct stat sb; - - /* Parse arguments */ - if (argc<4) usage (argv[0]); - if (strcmp (argv[1], "-f")) usage (argv[0]); - output_name = argv[2]; - - /* create the file */ - H5E_BEGIN_TRY { - if ((file = H5Fcreate (output_name, H5F_ACC_EXCL, - H5P_DEFAULT, H5P_DEFAULT))<0 && - (file = H5Fopen (output_name, H5F_ACC_RDWR, H5P_DEFAULT)<0)) { - fprintf (stderr, "%s: unable to create or open hdf5 file\n", - output_name); - exit (1); - } - } H5E_END_TRY; - - /* process files from command-line */ - for (argno=3; argno=0) close (fd); - fd = -1; - H5E_BEGIN_TRY { - if (space>=0) { - H5Sclose (space); - space = -1; - } - if (dset>=0) { - H5Dclose (dset); - dset = -1; - } - } H5E_END_TRY; - } - - /* Close the file */ - H5Fclose (file); - return 0; -} diff --git a/tools/misc/pdb2hdf.c b/tools/misc/pdb2hdf.c deleted file mode 100644 index c3e93aa..0000000 --- a/tools/misc/pdb2hdf.c +++ /dev/null @@ -1,527 +0,0 @@ -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * 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 * - * http://hdf.ncsa.uiuc.edu/HDF5/doc/Copyright.html. If you do not have * - * access to either file, you may request a copy from hdfhelp@ncsa.uiuc.edu. * - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -/* - * Programmer: Robb Matzke - * Tuesday, October 12, 1999 - * - * Purpose: Creates an HDF5 file from a PDB file. The raw data can be - * left in the PDB file, creating an HDF5 file that contains - * meta data that points into the PDB file. - */ -#include -#include -#include - -#include "hdf5.h" - -/* Strictly speaking, the "ifdef H5_HAVE_PDB_H" is unnecessary, since this - * file won't be compiled unless PDB is available (see the Makefile.in for - * this directory, as well as the PDB detection in the main configure.in). - * However, the Intel C compiler, v7.1, seems to have problems generating - * correct dependencies with the -MG flag when include files are not found - * and having this ifdef here removes the PDB headers from its consideration. - * QAK - 2004/02/07 - */ -#ifdef H5_HAVE_PDB_H - -#include "pdb.h" -#include "score.h" - -/* - * libsilo renames all the PDB functions. However, this source files uses - * their documented names, so we have #define's to translate them to Silo - * terminology. - */ -#ifdef H5_HAVE_LIBSILO -# define PD_open lite_PD_open -# define PD_close lite_PD_close -# define PD_ls lite_PD_ls -# define PD_cd lite_PD_cd -# define PD_inquire_entry lite_PD_inquire_entry -# define PD_read lite_PD_read -# define _PD_fixname _lite_PD_fixname -# define _PD_rl_defstr _lite_PD_rl_defstr -# define SC_free lite_SC_free -#endif - -static int verbose_g = 0; /*verbose output? */ -static int cached_g = 0; /*use core file driver? */ - - -/*------------------------------------------------------------------------- - * Function: usage - * - * Purpose: Print a usage message. - * - * Return: void - * - * Programmer: Robb Matzke - * Tuesday, October 12, 1999 - * - * Modifications: - * - *------------------------------------------------------------------------- - */ -static void -usage(const char *arg0) -{ - char *progname; - - if ((progname=strrchr(arg0, '/')) && progname[1]) progname++; - else progname = arg0; - - fprintf(stderr, "\ -usage: %s [OPTIONS] [PDBFILE ...]\n\ - OPTIONS\n\ - -h, -?, --help Print a usage message and exit\n\ - -c, --cached Cache all data in memory before writing the output\n\ - -v, --verbose Print the name of each object processed\n\ - -V, --version Show the version number of this program\n\ -\n\ - The options and PDB file names may be interspersed and are processed from\n\ - left to right.\n\ -\n\ - The name of the HDF5 file is generated by taking the basename of the PDB\n\ - file and replacing the last extension (or appending if no extension) with\n\ - the characters \".h5\". For example, \"/tmp/test/eos.data\" would result\n\ - in an HDF5 file called \"eos.h5\" in the current directory.\n", - progname); - -} - - -/*------------------------------------------------------------------------- - * Function: version - * - * Purpose: Print the version number. - * - * Return: void - * - * Programmer: Robb Matzke - * Friday, October 15, 1999 - * - * Modifications: - * - *------------------------------------------------------------------------- - */ -static void -version(const char *arg0) -{ - const char *progname; - - if ((progname=strrchr(arg0, '/')) && progname[1]) progname++; - else progname = arg0; - print_version(progname); -} - - -/*------------------------------------------------------------------------- - * Function: fix_name - * - * Purpose: Given a PDB file name create the corresponding HDF5 file - * name. This is done by taking the base name of the PDB file - * and replacing (or appending) the last extension with ".h5". - * - * Return: Success: HDF_NAME - * - * Failure: NULL - * - * Programmer: Robb Matzke - * Tuesday, October 12, 1999 - * - * Modifications: - * - *------------------------------------------------------------------------- - */ -static char * -fix_name(const char *pdb_name, char *hdf_name, size_t size) -{ - char *s; - const char *ext; - - if (!pdb_name || !hdf_name) return NULL; - if ((s=strrchr(pdb_name, '/'))) pdb_name = s; - if (NULL==(ext=strrchr(pdb_name, '.'))) ext = pdb_name + strlen(pdb_name); - if ((size_t)((ext-pdb_name)+4) > size) return NULL; /*overflow*/ - memcpy(hdf_name, pdb_name, ext-pdb_name); - strcpy(hdf_name+(ext-pdb_name), ".h5"); - return hdf_name; -} - - -/*------------------------------------------------------------------------- - * Function: fix_type - * - * Purpose: Given a PDB datatype return a corresponding hdf5 datatype. - * The hdf5 datatype should be closed when the caller is - * finished using it. - * - * Return: Success: HDF5 datatype - * - * Failure: negative - * - * Programmer: Robb Matzke - * Tuesday, October 12, 1999 - * - * Modifications: - * - *------------------------------------------------------------------------- - */ -static hid_t -fix_type(PDBfile *pdb, const char *s) -{ - hid_t type = -1; - defstr *d = _lite_PD_lookup_type((char*)s, pdb->chart); - - /* PDB checking */ - assert(d); - assert(d->size>0); - if (d->onescmp) return -1; - - - if (!strcmp(s, "char")) { - /* - * Character datatypes. Use whatever sign the native system uses by - * default. - */ - type = H5Tcopy(H5T_NATIVE_CHAR); - - } else if (!strcmp(s, "integer")) { - /* - * Integer datatypes. PDB supports various sizes of signed or - * unsigned integers. - */ - type = H5Tcopy(d->unsgned?H5T_NATIVE_UINT:H5T_NATIVE_INT); - H5Tset_size(type, d->size); - H5Tset_precision(type, 8*d->size); - assert(NORMAL_ORDER==d->order_flag || REVERSE_ORDER==d->order_flag); - H5Tset_order(type, - NORMAL_ORDER==d->order_flag?H5T_ORDER_BE:H5T_ORDER_LE); - - } else if (!strcmp(s, "float") || !strcmp(s, "double")) { - /* - * Floating-point datatypes - */ - size_t nbits, spos, epos, esize, mpos, msize; - - type = H5Tcopy(H5T_NATIVE_FLOAT); - H5Tset_size(type, d->size); - H5Tset_precision(type, 8*d->size); - assert(d->order); - H5Tset_order(type, 1==d->order[0]?H5T_ORDER_BE:H5T_ORDER_LE); - - /* - * format[0] = # of bits per number - * format[1] = # of bits in exponent - * format[2] = # of bits in mantissa - * format[3] = start bit of sign - * format[4] = start bit of exponent - * format[5] = start bit of mantissa - * format[6] = high order mantissa bit (CRAY needs this) - * format[7] = bias of exponent - */ - assert(d->format && d->format[0] == 8*d->size); - nbits = d->format[0]; - spos = nbits - (d->format[3]+1); - esize = d->format[1]; - epos = nbits - (d->format[4]+esize); - msize = d->format[2]; - mpos = nbits - (d->format[5]+msize); - H5Tset_fields(type, spos, epos, esize, mpos, msize); - H5Tset_ebias(type, d->format[7]); - } - return type; -} - - -/*------------------------------------------------------------------------- - * Function: fix_space - * - * Purpose: Convert a PDB dimension list into an HDF5 data space. - * - * Return: Success: HDF5 data space - * - * Failure: negative - * - * Programmer: Robb Matzke - * Tuesday, October 12, 1999 - * - * Modifications: - * - *------------------------------------------------------------------------- - */ -static hid_t -fix_space(const dimdes *dim) -{ - hsize_t size[H5S_MAX_RANK]; - int rank; - - for (rank=0; ranknext) { - size[rank] = dim->number; - } - if (rank>=H5S_MAX_RANK) return -1; - return H5Screate_simple(rank, size, NULL); -} - - -/*------------------------------------------------------------------------- - * Function: fix_external - * - * Purpose: Sets the external file information for a dataset creation - * property list based on information from PDB. - * - * Return: Success: non-negative - * - * Failure: negative - * - * Programmer: Robb Matzke - * Tuesday, October 12, 1999 - * - * Modifications: - * - *------------------------------------------------------------------------- - */ -static int -fix_external(hid_t dcpl, const char *pdb_file_name, long nelmts, - hsize_t elmt_size, symblock *block) -{ - int i; - - for (i=0; nelmts>0; i++) { - hsize_t nbytes = block[i].number * elmt_size; - H5Pset_external(dcpl, pdb_file_name, block[i].diskaddr, nbytes); - nelmts -= block[i].number; - } - return 0; -} - - -/*------------------------------------------------------------------------- - * Function: traverse - * - * Purpose: Traverse the current working directory of the PDB file. - * - * Return: Success: 0 - * - * Failure: -1 - * - * Programmer: Robb Matzke - * Tuesday, October 12, 1999 - * - * Modifications: - * - *------------------------------------------------------------------------- - */ -static int -traverse(PDBfile *pdb, const char *pdb_file_name, hid_t hdf) -{ - int nitems, i, in_subdir=FALSE; - char **list=NULL; - hid_t group=-1, h_type=-1, h_space=-1, dset=-1, dcpl=-1; - hsize_t elmt_size; - const syment *ep=NULL; - - if (NULL==(list=PD_ls(pdb, ".", NULL, &nitems))) { - fprintf(stderr, "cannot obtain PDB directory contents\n"); - goto error; - } - - for (i=0; itype); - fflush(stdout); - } - - - if ('/'==list[i][strlen(list[i])-1]) { - /* - * This is a PDB directory. Make a corresponding HDF5 group and - * traverse into that PDB directory and HDF5 group - */ - if ((group=H5Gcreate(hdf, list[i], 0))<0) { - fprintf(stderr, "cannot create HDF group %s\n", list[i]); - goto error; - } - if (!PD_cd(pdb, list[i])) { - fprintf(stderr, "cannot cd into PDB directory %s\n", list[i]); - goto error; - } else { - in_subdir = TRUE; - } - - traverse(pdb, pdb_file_name, group); - if (!PD_cd(pdb, "..")) { - fprintf(stderr, "cannot traverse out of PDB %s\n", list[i]); - goto error; - } - H5Gclose(group); - - } else { - /* This is some non-directory PDB object */ - - /* Create an HDF5 datatype from the PDB type */ - if ((h_type=fix_type(pdb, ep->type))<0) { - fprintf(stderr, "cannot create datatype for %s (%s)\n", - list[i], ep->type); - continue; - } - elmt_size = H5Tget_size(h_type); - - /* Create an HDF5 dataspace from the PDB dimensions */ - if ((h_space=fix_space(ep->dimensions))<0) { - fprintf(stderr, "cannot create datatype for %s\n", list[i]); - continue; - } - - /* Create pointers to the external PDB data */ - dcpl = H5Pcreate(H5P_DATASET_CREATE); - fix_external(dcpl, pdb_file_name, ep->number, elmt_size, - ep->blocks); - - /* Create the dataset */ - if ((dset=H5Dcreate(hdf, list[i], h_type, h_space, dcpl))<0) { - fprintf(stderr, "cannot create dataset for %s\n", list[i]); - } - - H5Pclose(dcpl); - H5Dclose(dset); - H5Sclose(h_space); - H5Tclose(h_type); - } - - } - - for (i=0; i=0) H5Gclose(group); - if (in_subdir) PD_cd(pdb, ".."); - if (list) { - for (i=0; i