mirror of
https://github.com/HDFGroup/hdf5.git
synced 2024-11-21 01:04:10 +08:00
Reorg tools perform to provide h5perf for installation (#884)
* Changes from PR#3 * HDFFV-11213 added option to control gcc10 warnings diagnostics * HDFFV-11212 Use the new references correctly in JNI utility and tests * format source * Fix typo * Add new test file * HDFFV-11212 - update test and remove unused arg * Minor non-space formatting changes * Use H5I_INVALID_ID instead of "-1" * source formatting * add missing testfile, update jni function * Undo commit of debug code * remove mislocated file * Fix h5repack test for handling of fapls and id close * Update h5diff test files usage text * HDFFV-11212 add new ref tests for JNI export dataset * src format update * Remove blank line typo * src format typo * long double requires %Lg * Another long double foramt specifer S.B. %Lg * issue with t128bit test * Windows issue with h5dump and type. * Fix review issues * refactor function nesting and fix error checks * format fixes * Remove untested functions and javadoc quiet comments * Restore TRY block. * Change string append errors to memory exception * revert to H5_JNI_FATAL_ERROR - support functions need work * Add assertion error for h5util functions * remove duplicate function * format fix * Revert HD function error handling * Update copyright comments * GH #386 java folder copyright corrections * Whitespace * GH #359 implement and fix tools 1.6 API usage * remove excessive comments * Flip inits to correct ifdef section * rework ifdef to be simpler * format issue * Reformat ifdef inits * remove static attribute * format compliance * Update names * Revert because logic relies on float not being int * Changes noticed from creating merge of #412 * Double underscore change * Correct compiler version variable used * Remove header guard underscores * Whitespace cleanup * Split format source and commit changes on repo push * remove pre-split setting * Change windows TS to use older VS. * correct window os name * HDFFV-11212 JNI export util and Javadoc * Suggested review changes * Another change found * Committing clang-format changes * HDFFV-11113 long double in tools * HDFFV-11113 add note * Disable long double tests for now * HDFFV-11228 remove arbitrary CMake warning groups. * Make each flag a string * Some Javadoc warning fixes * Updated javadoc fixes * # WARNING: head commit changed in the meantime HDFFV-11229 Fix long double usage in tools and java Changed h5dump and h5ls to just print 128-bit for long double type. Added test and file for dataset and attributes with all three float types. * Committing clang-format changes * HDFFV-11229 Add release note * HDFFV-11229 windows testfile needed * fix typo * Remove non supported message text * HDFFV-11229 - change ldouble test to check both native and general * HDFFV-11229 add second file compare * HDFFV-11229 fix reference file * HDFFV-11229 autotools check two refs * HDFFV-11229 revert back to removal of NATIVE_LDOUBLE in tools output * Committing clang-format changes * Update release note * Update attribute type of ref file * Change source of ninja for macs * try port instead of brew * Recommended is to use brew. * Undo non long double changes * remove unneeded file * Fix perl and doxygen CMake code * Add "option" command for clang options * Rework CMake add_custom to use the BYPRODUCTS argument * Add stamp files to BYPRODUCTS * Only one copy of file exists * Fix custom cmmand depends targets * Fix fortran custom command DEPENDS * Add LD_LIBRARY_PATH to tests * Add custom target for DEPENDS * Add h5detect conditionaly to generated target DEPENDS * Correct DEPENDS targets * Parallel builds need the mpi compiler for pkgconfig scripts. * install only if MPI build * Fortran target depends * Remove incorrect source attribute * doxygen adjustments * doxygen build updates * Correct version * Correct function version - function has been merged to 1.12 * Correct version string for map functions * Cleanup warnings for tools debug builds * TRILAB-227 - fix indexing for h5diff selections * Correct location of pos to index function call * TRILAB-227 Enable test * Quote subset args * Use MATCHES because of AppleClang * if blocks needed for build modes * Update list of DT platforms * VS2019 correctly displays float values * revert VS2019 change * Issue #669 remove version from pkgcfg filename * remove version from h5cc script * Java reference functions updated enabled fortran in cmake gcc action yaml file java reference test changed to correctly test refs jni reference functions that create ids changed to use jni id logging * Correct BYPRODUCTS argument * Correct more genereated files BYPRODUCTS * BYPRODUCTS must have unique locations * Fix typo * Fix fortran configure checks * Rework H5_PAC_C_MAX_REAL_PRECISION setting logic * Add note about fortran configure change * Adds a quick for for some egregious chunk_info badness (#722) * Fixes issue with ccmake that prevents building Fortran (#723) ccmake runs iteratively, and the check_fortran_source_runs macros were clobbering a single output file that did not get updated on further configure iterations * Fix conflicts with merge * Move MAX_PRECISION back to HDF5UseFortran.cmake * Use STREQUAL to test macro argument * Move C language test to ConfigureChecks from HDF5UseFortran * MAX_PRECISION defines must be defined * Organize flags and align autotools and cmake * Fix comment in no-error-general warnings files. * Flag cleanup and fix typos * Add comment * Correct VAR used to find configure time file * Set the path correctly * Update missing release note info. * Update code owners * Correct JIRA note * add known problem. * Use only core library for testing dynamic plugins. * Reorg tools perform to provide h5perf for installation * Correct file paths * Correct path * Add new src folder to makefile list * Remove bin_PROGRAMS from TEST_PROG * Default h5perf executables to static build * Remove test lib dependency from h5perf * format adjustments * Remove test lib from autotools makefile * Add note * h5perf needs the math library Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Dana Robinson <43805+derobins@users.noreply.github.com>
This commit is contained in:
parent
acb186f6e5
commit
06a09a962a
17
MANIFEST
17
MANIFEST
@ -2947,6 +2947,15 @@
|
||||
./tools/testfiles/h5mkgrp_single_p.ls
|
||||
./tools/testfiles/h5mkgrp_single_l.ls
|
||||
|
||||
./tools/src/h5perf/Makefile.am
|
||||
./tools/src/h5perf/perf.c
|
||||
./tools/src/h5perf/pio_engine.c
|
||||
./tools/src/h5perf/pio_perf.c
|
||||
./tools/src/h5perf/pio_perf.h
|
||||
./tools/src/h5perf/sio_engine.c
|
||||
./tools/src/h5perf/sio_perf.c
|
||||
./tools/src/h5perf/sio_perf.h
|
||||
|
||||
./tools/test/perform/Makefile.am
|
||||
./tools/test/perform/build_h5perf_alone.sh
|
||||
./tools/test/perform/build_h5perf_serial_alone.sh
|
||||
@ -2956,16 +2965,9 @@
|
||||
./tools/test/perform/gen_report.pl
|
||||
./tools/test/perform/iopipe.c
|
||||
./tools/test/perform/overhead.c
|
||||
./tools/test/perform/perf.c
|
||||
./tools/test/perform/perf_meta.c
|
||||
./tools/test/perform/pio_engine.c
|
||||
./tools/test/perform/pio_perf.c
|
||||
./tools/test/perform/pio_perf.h
|
||||
./tools/test/perform/pio_standalone.c
|
||||
./tools/test/perform/pio_standalone.h
|
||||
./tools/test/perform/sio_engine.c
|
||||
./tools/test/perform/sio_perf.c
|
||||
./tools/test/perform/sio_perf.h
|
||||
./tools/test/perform/sio_standalone.c
|
||||
./tools/test/perform/sio_standalone.h
|
||||
./tools/test/perform/zip_perf.c
|
||||
@ -3708,6 +3710,7 @@
|
||||
./tools/test/h5stat/CMakeLists.txt
|
||||
./tools/test/h5stat/CMakeTests.cmake
|
||||
./tools/src/misc/CMakeLists.txt
|
||||
./tools/src/h5perf/CMakeLists.txt
|
||||
./tools/test/misc/CMakeLists.txt
|
||||
./tools/test/misc/CMakeTestsClear.cmake
|
||||
./tools/test/misc/CMakeTestsMkgrp.cmake
|
||||
|
@ -4019,6 +4019,7 @@ AC_CONFIG_FILES([src/libhdf5.settings
|
||||
tools/test/misc/vds/Makefile
|
||||
tools/test/h5stat/Makefile
|
||||
tools/test/h5stat/testh5stat.sh
|
||||
tools/src/h5perf/Makefile
|
||||
tools/test/perform/Makefile
|
||||
examples/Makefile
|
||||
examples/run-c-ex.sh
|
||||
|
@ -820,6 +820,17 @@ New Features
|
||||
|
||||
Tools:
|
||||
------
|
||||
- Refactored the perform tools and removed depends on test library.
|
||||
|
||||
Moved the perf and h5perf tools from tools/test/perform to
|
||||
tools/src/h5perf so that they can be installed. This required
|
||||
that the test library dependency be removed by copying the
|
||||
needed functions from h5test.c.
|
||||
The standalone scripts and other perform tools remain in the
|
||||
tools/test/perform folder.
|
||||
|
||||
(ADB - 2021/08/10)
|
||||
|
||||
- Removed partial long exceptions
|
||||
|
||||
Some of the tools accepted shortened versions of the long options
|
||||
@ -1089,10 +1100,10 @@ Bug Fixes since HDF5-1.12.0 release
|
||||
Configuration
|
||||
-------------
|
||||
- Better support for libaec (open-source Szip library) in CMake
|
||||
|
||||
Implemented better support for libaec 1.0.5 (or later) library. This version
|
||||
|
||||
Implemented better support for libaec 1.0.5 (or later) library. This version
|
||||
of libaec contains improvements for better integration with HDF5. Furthermore,
|
||||
the variable USE_LIBAEC_STATIC has been introduced to allow to make use of
|
||||
the variable USE_LIBAEC_STATIC has been introduced to allow to make use of
|
||||
static version of libaec library. Use libaec_DIR or libaec_ROOT to set
|
||||
the location in which libaec can be found.
|
||||
|
||||
|
@ -13,7 +13,7 @@ add_subdirectory (misc)
|
||||
#-- Add the h5import and test executables
|
||||
add_subdirectory (h5import)
|
||||
|
||||
#-- h5Repack executables
|
||||
#-- h5repack executables
|
||||
add_subdirectory (h5repack)
|
||||
|
||||
#-- Add the h5dump and test executables
|
||||
@ -30,3 +30,6 @@ add_subdirectory (h5dump)
|
||||
|
||||
#-- Add the h5format_convert and test executables
|
||||
add_subdirectory (h5format_convert)
|
||||
|
||||
#-- h5perf executables
|
||||
add_subdirectory (h5perf)
|
||||
|
@ -23,6 +23,6 @@ CONFIG=ordered
|
||||
|
||||
# All subdirectories
|
||||
SUBDIRS=h5diff h5ls h5dump misc h5import h5repack h5jam h5copy \
|
||||
h5format_convert h5stat
|
||||
h5format_convert h5stat h5perf
|
||||
|
||||
include $(top_srcdir)/config/conclude.am
|
||||
|
103
tools/src/h5perf/CMakeLists.txt
Normal file
103
tools/src/h5perf/CMakeLists.txt
Normal file
@ -0,0 +1,103 @@
|
||||
cmake_minimum_required (VERSION 3.12)
|
||||
project (HDF5_TOOLS_SRC_H5PERF C)
|
||||
|
||||
# --------------------------------------------------------------------
|
||||
# Add the executables
|
||||
# --------------------------------------------------------------------
|
||||
#-- Adding test for h5perf_serial
|
||||
set (h5perf_serial_SOURCES
|
||||
${HDF5_TOOLS_SRC_H5PERF_SOURCE_DIR}/sio_perf.c
|
||||
${HDF5_TOOLS_SRC_H5PERF_SOURCE_DIR}/sio_engine.c
|
||||
)
|
||||
add_executable (h5perf_serial ${h5perf_serial_SOURCES})
|
||||
target_include_directories (h5perf_serial PRIVATE "${HDF5_TEST_SRC_DIR};${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
|
||||
if (NOT ONLY_SHARED_LIBS)
|
||||
TARGET_C_PROPERTIES (h5perf_serial STATIC)
|
||||
target_link_libraries (h5perf_serial PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET})
|
||||
else ()
|
||||
TARGET_C_PROPERTIES (h5perf_serial SHARED)
|
||||
target_link_libraries (h5perf_serial PRIVATE ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_LIBSH_TARGET})
|
||||
endif ()
|
||||
set_target_properties (h5perf_serial PROPERTIES FOLDER perform)
|
||||
set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};h5perf_serial")
|
||||
|
||||
set (H5_DEP_EXECUTABLES h5perf_serial)
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# Add Target to clang-format
|
||||
#-----------------------------------------------------------------------------
|
||||
if (HDF5_ENABLE_FORMATTERS)
|
||||
clang_format (HDF5_TOOLS_SRC_H5PERF_h5perf_serial_FORMAT h5perf_serial)
|
||||
endif ()
|
||||
|
||||
if (H5_HAVE_PARALLEL)
|
||||
if (UNIX)
|
||||
#-- Adding test for perf - only on unix systems
|
||||
set (perf_SOURCES
|
||||
${HDF5_TOOLS_SRC_H5PERF_SOURCE_DIR}/perf.c
|
||||
)
|
||||
add_executable (perf ${perf_SOURCES})
|
||||
target_include_directories (perf PRIVATE "${HDF5_TEST_SRC_DIR};${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
|
||||
if (NOT ONLY_SHARED_LIBS)
|
||||
TARGET_C_PROPERTIES (perf STATIC)
|
||||
target_link_libraries (perf PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET})
|
||||
else ()
|
||||
TARGET_C_PROPERTIES (perf SHARED)
|
||||
target_link_libraries (perf PRIVATE ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_LIBSH_TARGET})
|
||||
endif ()
|
||||
set_target_properties (perf PROPERTIES FOLDER perform)
|
||||
set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};perf")
|
||||
|
||||
set (H5_DEP_EXECUTABLES perf)
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# Add Target to clang-format
|
||||
#-----------------------------------------------------------------------------
|
||||
if (HDF5_ENABLE_FORMATTERS)
|
||||
clang_format (HDF5_TOOLS_SRC_H5PERF_perf_FORMAT perf)
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
#-- Adding test for h5perf
|
||||
set (h5perf_SOURCES
|
||||
${HDF5_TOOLS_SRC_H5PERF_SOURCE_DIR}/pio_perf.c
|
||||
${HDF5_TOOLS_SRC_H5PERF_SOURCE_DIR}/pio_engine.c
|
||||
)
|
||||
add_executable (h5perf ${h5perf_SOURCES})
|
||||
target_include_directories (h5perf PRIVATE "${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
|
||||
if (NOT ONLY_SHARED_LIBS)
|
||||
TARGET_C_PROPERTIES (h5perf STATIC)
|
||||
target_link_libraries (h5perf PRIVATE ${LINK_LIBS} ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET})
|
||||
else ()
|
||||
TARGET_C_PROPERTIES (h5perf SHARED)
|
||||
target_link_libraries (h5perf PRIVATE ${LINK_LIBS} ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_LIBSH_TARGET})
|
||||
endif ()
|
||||
set_target_properties (h5perf PROPERTIES FOLDER perform)
|
||||
set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};h5perf")
|
||||
|
||||
set (H5_DEP_EXECUTABLES h5perf)
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# Add Target to clang-format
|
||||
#-----------------------------------------------------------------------------
|
||||
if (HDF5_ENABLE_FORMATTERS)
|
||||
clang_format (HDF5_TOOLS_SRC_H5PERF_h5perf_FORMAT h5perf)
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# Rules for Installation of tools using make Install target
|
||||
#-----------------------------------------------------------------------------
|
||||
if (HDF5_EXPORTED_TARGETS)
|
||||
foreach (exec ${H5_DEP_EXECUTABLES})
|
||||
INSTALL_PROGRAM_PDB (${exec} ${HDF5_INSTALL_BIN_DIR} toolsapplications)
|
||||
endforeach ()
|
||||
|
||||
install (
|
||||
TARGETS
|
||||
${H5_DEP_EXECUTABLES}
|
||||
EXPORT
|
||||
${HDF5_EXPORTED_TARGETS}
|
||||
RUNTIME DESTINATION ${HDF5_INSTALL_BIN_DIR} COMPONENT toolsapplications
|
||||
)
|
||||
endif ()
|
63
tools/src/h5perf/Makefile.am
Normal file
63
tools/src/h5perf/Makefile.am
Normal file
@ -0,0 +1,63 @@
|
||||
#
|
||||
# Copyright by The HDF Group.
|
||||
# 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 COPYING file, which can be found at the root of the source code
|
||||
# distribution tree, or in https://www.hdfgroup.org/licenses.
|
||||
# If you do not have access to either file, you may request a copy from
|
||||
# help@hdfgroup.org.
|
||||
##
|
||||
## Makefile.am
|
||||
## Run automake to generate a Makefile.in from this file.
|
||||
##
|
||||
#
|
||||
# HDF5 Library Performance Makefile(.in)
|
||||
#
|
||||
|
||||
include $(top_srcdir)/config/commence.am
|
||||
|
||||
AM_CPPFLAGS+=-I$(top_srcdir)/src -I$(top_srcdir)/test -I$(top_srcdir)/tools/lib
|
||||
|
||||
# bin_PROGRAMS will be installed.
|
||||
if BUILD_PARALLEL_CONDITIONAL
|
||||
bin_PROGRAMS=h5perf_serial perf h5perf
|
||||
else
|
||||
bin_PROGRAMS=h5perf_serial
|
||||
endif
|
||||
|
||||
# Add h5perf and h5perf_serial specific linker flags here
|
||||
h5perf_LDFLAGS = $(LT_STATIC_EXEC) $(AM_LDFLAGS)
|
||||
h5perf_serial_LDFLAGS = $(LT_STATIC_EXEC) $(AM_LDFLAGS)
|
||||
|
||||
# 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.
|
||||
# Currently there is no such program.
|
||||
if BUILD_PARALLEL_CONDITIONAL
|
||||
PARA_BUILD_ALL=
|
||||
endif
|
||||
if BUILD_ALL_CONDITIONAL
|
||||
BUILD_ALL_PROGS=$(PARA_BUILD_ALL)
|
||||
endif
|
||||
|
||||
# Define programs that will be run in 'make check'
|
||||
# List them in the order they should be run.
|
||||
# Parallel test programs.
|
||||
if BUILD_PARALLEL_CONDITIONAL
|
||||
TEST_PROG_PARA=h5perf perf
|
||||
endif
|
||||
|
||||
h5perf_SOURCES=pio_perf.c pio_engine.c
|
||||
h5perf_serial_SOURCES=sio_perf.c sio_engine.c
|
||||
|
||||
# All of the programs depend on the main hdf5 library, and some of them
|
||||
# depend on test or tools library.
|
||||
LDADD=$(LIBHDF5)
|
||||
h5perf_LDADD=$(LIBH5TOOLS) $(LIBHDF5)
|
||||
h5perf_serial_LDADD=$(LIBH5TOOLS) $(LIBHDF5)
|
||||
perf_LDADD=$(LIBHDF5)
|
||||
|
||||
include $(top_srcdir)/config/conclude.am
|
@ -22,7 +22,6 @@
|
||||
|
||||
#include "hdf5.h"
|
||||
#include "H5private.h"
|
||||
#include "h5test.h"
|
||||
|
||||
#ifdef H5_HAVE_PARALLEL
|
||||
|
||||
@ -108,6 +107,15 @@ static int parse_args(int argc, char **argv);
|
||||
extern char *optarg;
|
||||
#endif
|
||||
|
||||
#ifndef HDF5_PARAPREFIX
|
||||
#define HDF5_PARAPREFIX ""
|
||||
#endif
|
||||
char * paraprefix = NULL; /* for command line option para-prefix */
|
||||
MPI_Info h5_io_info_g = MPI_INFO_NULL; /* MPI INFO object for IO */
|
||||
|
||||
static char *h5_fixname_real(const char *base_name, hid_t fapl, const char *_suffix, char *fullname,
|
||||
size_t size, hbool_t nest_printf, hbool_t subst_for_superblock);
|
||||
|
||||
int
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
@ -206,7 +214,7 @@ main(int argc, char **argv)
|
||||
}
|
||||
}
|
||||
|
||||
h5_fixname_no_suffix(FILENAME[0], acc_tpl, filename, sizeof filename);
|
||||
h5_fixname_real(FILENAME[0], acc_tpl, NULL, filename, sizeof filename, FALSE, FALSE);
|
||||
|
||||
/* create the parallel file */
|
||||
fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, acc_tpl);
|
||||
@ -451,6 +459,323 @@ parse_args(int argc, char **argv)
|
||||
|
||||
return (0);
|
||||
}
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: getenv_all
|
||||
*
|
||||
* Purpose: Used to get the environment that the root MPI task has.
|
||||
* name specifies which environment variable to look for
|
||||
* val is the string to which the value of that environment
|
||||
* variable will be copied.
|
||||
*
|
||||
* NOTE: The pointer returned by this function is only
|
||||
* valid until the next call to getenv_all and the data
|
||||
* stored there must be copied somewhere else before any
|
||||
* further calls to getenv_all take place.
|
||||
*
|
||||
* Return: pointer to a string containing the value of the environment variable
|
||||
* NULL if the varialbe doesn't exist in task 'root's environment.
|
||||
*
|
||||
* Programmer: Leon Arber
|
||||
* 4/4/05
|
||||
*
|
||||
* Modifications:
|
||||
* Use original getenv if MPI is not initialized. This happens
|
||||
* one uses the PHDF5 library to build a serial nature code.
|
||||
* Albert 2006/04/07
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
char *
|
||||
getenv_all(MPI_Comm comm, int root, const char *name)
|
||||
{
|
||||
int mpi_size, mpi_rank, mpi_initialized, mpi_finalized;
|
||||
int len;
|
||||
static char *env = NULL;
|
||||
|
||||
HDassert(name);
|
||||
|
||||
MPI_Initialized(&mpi_initialized);
|
||||
MPI_Finalized(&mpi_finalized);
|
||||
|
||||
if (mpi_initialized && !mpi_finalized) {
|
||||
MPI_Comm_rank(comm, &mpi_rank);
|
||||
MPI_Comm_size(comm, &mpi_size);
|
||||
HDassert(root < mpi_size);
|
||||
|
||||
/* The root task does the getenv call
|
||||
* and sends the result to the other tasks */
|
||||
if (mpi_rank == root) {
|
||||
env = HDgetenv(name);
|
||||
if (env) {
|
||||
len = (int)HDstrlen(env);
|
||||
MPI_Bcast(&len, 1, MPI_INT, root, comm);
|
||||
MPI_Bcast(env, len, MPI_CHAR, root, comm);
|
||||
}
|
||||
else {
|
||||
/* len -1 indicates that the variable was not in the environment */
|
||||
len = -1;
|
||||
MPI_Bcast(&len, 1, MPI_INT, root, comm);
|
||||
}
|
||||
}
|
||||
else {
|
||||
MPI_Bcast(&len, 1, MPI_INT, root, comm);
|
||||
if (len >= 0) {
|
||||
if (env == NULL)
|
||||
env = (char *)HDmalloc((size_t)len + 1);
|
||||
else if (HDstrlen(env) < (size_t)len)
|
||||
env = (char *)HDrealloc(env, (size_t)len + 1);
|
||||
|
||||
MPI_Bcast(env, len, MPI_CHAR, root, comm);
|
||||
env[len] = '\0';
|
||||
}
|
||||
else {
|
||||
if (env)
|
||||
HDfree(env);
|
||||
env = NULL;
|
||||
}
|
||||
}
|
||||
#ifndef NDEBUG
|
||||
MPI_Barrier(comm);
|
||||
#endif
|
||||
}
|
||||
else {
|
||||
/* use original getenv */
|
||||
if (env)
|
||||
HDfree(env);
|
||||
env = HDgetenv(name);
|
||||
} /* end if */
|
||||
|
||||
return env;
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: h5_fixname_real
|
||||
*
|
||||
* Purpose: Create a file name from a file base name like `test' and
|
||||
* return it through the FULLNAME (at most SIZE characters
|
||||
* counting the null terminator). The full name is created by
|
||||
* prepending the contents of HDF5_PREFIX (separated from the
|
||||
* base name by a slash) and appending a file extension based on
|
||||
* the driver supplied, resulting in something like
|
||||
* `ufs:/u/matzke/test.h5'.
|
||||
*
|
||||
* Return: Success: The FULLNAME pointer.
|
||||
*
|
||||
* Failure: NULL if BASENAME or FULLNAME is the null
|
||||
* pointer or if FULLNAME isn't large enough for
|
||||
* the result.
|
||||
*
|
||||
* Programmer: Robb Matzke
|
||||
* Thursday, November 19, 1998
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
static char *
|
||||
h5_fixname_real(const char *base_name, hid_t fapl, const char *_suffix, char *fullname, size_t size,
|
||||
hbool_t nest_printf, hbool_t subst_for_superblock)
|
||||
{
|
||||
const char *prefix = NULL;
|
||||
const char *env = NULL; /* HDF5_DRIVER environment variable */
|
||||
char * ptr, last = '\0';
|
||||
const char *suffix = _suffix;
|
||||
size_t i, j;
|
||||
hid_t driver = -1;
|
||||
int isppdriver = 0; /* if the driver is MPI parallel */
|
||||
|
||||
if (!base_name || !fullname || size < 1)
|
||||
return NULL;
|
||||
|
||||
HDmemset(fullname, 0, size);
|
||||
|
||||
/* figure out the suffix */
|
||||
if (H5P_DEFAULT != fapl) {
|
||||
if ((driver = H5Pget_driver(fapl)) < 0)
|
||||
return NULL;
|
||||
|
||||
if (suffix) {
|
||||
if (H5FD_FAMILY == driver) {
|
||||
if (subst_for_superblock)
|
||||
suffix = "00000.h5";
|
||||
else
|
||||
suffix = nest_printf ? "%%05d.h5" : "%05d.h5";
|
||||
}
|
||||
else if (H5FD_MULTI == driver) {
|
||||
|
||||
/* Get the environment variable, if it exists, in case
|
||||
* we are using the split driver since both of those
|
||||
* use the multi VFD under the hood.
|
||||
*/
|
||||
env = HDgetenv("HDF5_DRIVER");
|
||||
#ifdef HDF5_DRIVER
|
||||
/* Use the environment variable, then the compile-time constant */
|
||||
if (!env)
|
||||
env = HDF5_DRIVER;
|
||||
#endif
|
||||
if (env && !HDstrcmp(env, "split")) {
|
||||
/* split VFD */
|
||||
if (subst_for_superblock)
|
||||
suffix = "-m.h5";
|
||||
else
|
||||
suffix = NULL;
|
||||
}
|
||||
else {
|
||||
/* multi VFD */
|
||||
if (subst_for_superblock)
|
||||
suffix = "-s.h5";
|
||||
else
|
||||
suffix = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Must first check fapl is not H5P_DEFAULT (-1) because H5FD_XXX
|
||||
* could be of value -1 if it is not defined.
|
||||
*/
|
||||
isppdriver = H5P_DEFAULT != fapl && (H5FD_MPIO == driver);
|
||||
|
||||
/* Check what prefix to use for test files. Process HDF5_PARAPREFIX and
|
||||
* HDF5_PREFIX.
|
||||
* Use different ones depending on parallel or serial driver used.
|
||||
* (The #ifdef is needed to prevent compile failure in case MPI is not
|
||||
* configured.)
|
||||
*/
|
||||
if (isppdriver) {
|
||||
/*
|
||||
* For parallel:
|
||||
* First use command line option, then the environment
|
||||
* variable, then try the constant
|
||||
*/
|
||||
static int explained = 0;
|
||||
|
||||
prefix = (paraprefix ? paraprefix : getenv_all(MPI_COMM_WORLD, 0, "HDF5_PARAPREFIX"));
|
||||
|
||||
if (!prefix && !explained) {
|
||||
/* print hint by process 0 once. */
|
||||
int mpi_rank;
|
||||
|
||||
MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank);
|
||||
|
||||
if (mpi_rank == 0)
|
||||
HDprintf("*** Hint ***\n"
|
||||
"You can use environment variable HDF5_PARAPREFIX to "
|
||||
"run parallel test files in a\n"
|
||||
"different directory or to add file type prefix. e.g.,\n"
|
||||
" HDF5_PARAPREFIX=pfs:/PFS/user/me\n"
|
||||
" export HDF5_PARAPREFIX\n"
|
||||
"*** End of Hint ***\n");
|
||||
|
||||
explained = TRUE;
|
||||
#ifdef HDF5_PARAPREFIX
|
||||
prefix = HDF5_PARAPREFIX;
|
||||
#endif /* HDF5_PARAPREFIX */
|
||||
}
|
||||
}
|
||||
else {
|
||||
/*
|
||||
* For serial:
|
||||
* First use the environment variable, then try the constant
|
||||
*/
|
||||
prefix = HDgetenv("HDF5_PREFIX");
|
||||
|
||||
#ifdef HDF5_PREFIX
|
||||
if (!prefix)
|
||||
prefix = HDF5_PREFIX;
|
||||
#endif /* HDF5_PREFIX */
|
||||
}
|
||||
|
||||
/* Prepend the prefix value to the base name */
|
||||
if (prefix && *prefix) {
|
||||
if (isppdriver) {
|
||||
/* This is a parallel system */
|
||||
char *subdir;
|
||||
|
||||
if (!HDstrcmp(prefix, HDF5_PARAPREFIX)) {
|
||||
/*
|
||||
* If the prefix specifies the HDF5_PARAPREFIX directory, then
|
||||
* default to using the "/tmp/$USER" or "/tmp/$LOGIN"
|
||||
* directory instead.
|
||||
*/
|
||||
char *user, *login;
|
||||
|
||||
user = HDgetenv("USER");
|
||||
login = HDgetenv("LOGIN");
|
||||
subdir = (user ? user : login);
|
||||
|
||||
if (subdir) {
|
||||
for (i = 0; i < size && prefix[i]; i++)
|
||||
fullname[i] = prefix[i];
|
||||
|
||||
fullname[i++] = '/';
|
||||
|
||||
for (j = 0; i < size && subdir[j]; ++i, ++j)
|
||||
fullname[i] = subdir[j];
|
||||
}
|
||||
}
|
||||
|
||||
if (!fullname[0]) {
|
||||
/* We didn't append the prefix yet */
|
||||
HDstrncpy(fullname, prefix, size);
|
||||
fullname[size - 1] = '\0';
|
||||
}
|
||||
|
||||
if (HDstrlen(fullname) + HDstrlen(base_name) + 1 < size) {
|
||||
/*
|
||||
* Append the base_name with a slash first. Multiple
|
||||
* slashes are handled below.
|
||||
*/
|
||||
h5_stat_t buf;
|
||||
|
||||
if (HDstat(fullname, &buf) < 0)
|
||||
/* The directory doesn't exist just yet */
|
||||
if (HDmkdir(fullname, (mode_t)0755) < 0 && errno != EEXIST)
|
||||
/*
|
||||
* We couldn't make the "/tmp/${USER,LOGIN}"
|
||||
* subdirectory. Default to PREFIX's original
|
||||
* prefix value.
|
||||
*/
|
||||
HDstrcpy(fullname, prefix);
|
||||
|
||||
HDstrcat(fullname, "/");
|
||||
HDstrcat(fullname, base_name);
|
||||
}
|
||||
else {
|
||||
/* Buffer is too small */
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (HDsnprintf(fullname, size, "%s/%s", prefix, base_name) == (int)size)
|
||||
/* Buffer is too small */
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
else if (HDstrlen(base_name) >= size) {
|
||||
/* Buffer is too small */
|
||||
return NULL;
|
||||
}
|
||||
else {
|
||||
HDstrcpy(fullname, base_name);
|
||||
}
|
||||
|
||||
/* Append a suffix */
|
||||
if (suffix) {
|
||||
if (HDstrlen(fullname) + HDstrlen(suffix) >= size)
|
||||
return NULL;
|
||||
|
||||
HDstrcat(fullname, suffix);
|
||||
}
|
||||
|
||||
/* Remove any double slashes in the filename */
|
||||
for (ptr = fullname, i = j = 0; ptr && i < size; i++, ptr++) {
|
||||
if (*ptr != '/' || last != '/')
|
||||
fullname[j++] = *ptr;
|
||||
|
||||
last = *ptr;
|
||||
}
|
||||
|
||||
return fullname;
|
||||
}
|
||||
|
||||
/*
|
||||
* Local variables:
|
@ -113,6 +113,12 @@ int pio_debug_level = 0; /* The debug level:
|
||||
/* local variables */
|
||||
static const char *progname = "h5perf";
|
||||
|
||||
#ifndef HDF5_PARAPREFIX
|
||||
#define HDF5_PARAPREFIX ""
|
||||
#endif
|
||||
char * paraprefix = NULL; /* for command line option para-prefix */
|
||||
MPI_Info h5_io_info_g = MPI_INFO_NULL; /* MPI INFO object for IO */
|
||||
|
||||
/*
|
||||
* Command-line options: The user can specify short or long-named
|
||||
* parameters. The long-named ones can be partially spelled. When
|
||||
@ -849,6 +855,135 @@ output_all_info(minmax *mm, int count, int indent_level)
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Function: h5_set_info_object
|
||||
* Purpose: Process environment variables setting to set up MPI Info
|
||||
* object.
|
||||
* Return: 0 if all is fine; otherwise non-zero.
|
||||
* Programmer: Albert Cheng, 2002/05/21.
|
||||
* Modifications:
|
||||
* Bill Wendling, 2002/05/31
|
||||
* Modified so that the HDF5_MPI_INFO environment variable can
|
||||
* be a semicolon separated list of "key=value" pairings. Most
|
||||
* of the code is to remove any whitespaces which might be
|
||||
* surrounding the "key=value" pairs.
|
||||
*/
|
||||
int
|
||||
h5_set_info_object(void)
|
||||
{
|
||||
char *envp; /* environment pointer */
|
||||
int ret_value = 0;
|
||||
|
||||
/* handle any MPI INFO hints via $HDF5_MPI_INFO */
|
||||
if ((envp = HDgetenv("HDF5_MPI_INFO")) != NULL) {
|
||||
char *next, *valp;
|
||||
|
||||
valp = envp = next = HDstrdup(envp);
|
||||
|
||||
if (!valp)
|
||||
return 0;
|
||||
|
||||
/* create an INFO object if not created yet */
|
||||
if (h5_io_info_g == MPI_INFO_NULL)
|
||||
MPI_Info_create(&h5_io_info_g);
|
||||
|
||||
do {
|
||||
size_t len;
|
||||
char * key_val, *endp, *namep;
|
||||
|
||||
if (*valp == ';')
|
||||
valp++;
|
||||
|
||||
/* copy key/value pair into temporary buffer */
|
||||
len = strcspn(valp, ";");
|
||||
next = &valp[len];
|
||||
key_val = (char *)HDcalloc(1, len + 1);
|
||||
|
||||
/* increment the next pointer past the terminating semicolon */
|
||||
if (*next == ';')
|
||||
++next;
|
||||
|
||||
namep = HDstrncpy(key_val, valp, len);
|
||||
|
||||
/* pass up any beginning whitespaces */
|
||||
while (*namep && (*namep == ' ' || *namep == '\t'))
|
||||
namep++;
|
||||
|
||||
if (!*namep)
|
||||
continue; /* was all white space, so move to next k/v pair */
|
||||
|
||||
/* eat up any ending white spaces */
|
||||
endp = &namep[HDstrlen(namep) - 1];
|
||||
|
||||
while (endp && (*endp == ' ' || *endp == '\t'))
|
||||
*endp-- = '\0';
|
||||
|
||||
/* find the '=' */
|
||||
valp = HDstrchr(namep, '=');
|
||||
|
||||
if (valp != NULL) { /* it's a valid key/value pairing */
|
||||
char *tmp_val = valp + 1;
|
||||
|
||||
/* change '=' to \0, move valp down one */
|
||||
*valp-- = '\0';
|
||||
|
||||
/* eat up ending whitespace on the "key" part */
|
||||
while (*valp == ' ' || *valp == '\t')
|
||||
*valp-- = '\0';
|
||||
|
||||
valp = tmp_val;
|
||||
|
||||
/* eat up beginning whitespace on the "value" part */
|
||||
while (*valp == ' ' || *valp == '\t')
|
||||
*valp++ = '\0';
|
||||
|
||||
/* actually set the darned thing */
|
||||
if (MPI_SUCCESS != MPI_Info_set(h5_io_info_g, namep, valp)) {
|
||||
HDprintf("MPI_Info_set failed\n");
|
||||
ret_value = -1;
|
||||
}
|
||||
}
|
||||
|
||||
valp = next;
|
||||
HDfree(key_val);
|
||||
} while (next && *next);
|
||||
|
||||
HDfree(envp);
|
||||
}
|
||||
|
||||
return ret_value;
|
||||
}
|
||||
|
||||
/*
|
||||
* Function: h5_dump_info_object
|
||||
* Purpose: Display content of an MPI Info object
|
||||
* Return: void
|
||||
* Programmer: Albert Cheng 2002/05/21
|
||||
* Modifications:
|
||||
*/
|
||||
void
|
||||
h5_dump_info_object(MPI_Info info)
|
||||
{
|
||||
char key[MPI_MAX_INFO_KEY + 1];
|
||||
char value[MPI_MAX_INFO_VAL + 1];
|
||||
int flag;
|
||||
int i, nkeys;
|
||||
|
||||
HDprintf("Dumping MPI Info Object (up to %d bytes per item):\n", MPI_MAX_INFO_VAL);
|
||||
if (info == MPI_INFO_NULL) {
|
||||
HDprintf("object is MPI_INFO_NULL\n");
|
||||
}
|
||||
else {
|
||||
MPI_Info_get_nkeys(info, &nkeys);
|
||||
HDprintf("object has %d items\n", nkeys);
|
||||
for (i = 0; i < nkeys; i++) {
|
||||
MPI_Info_get_nthkey(info, i, key);
|
||||
MPI_Info_get(info, key, MPI_MAX_INFO_VAL, value, &flag);
|
||||
HDprintf("%s=%s\n", key, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Function: get_minmax
|
||||
* Purpose: Gather all the min, max and total of val.
|
@ -15,7 +15,7 @@
|
||||
|
||||
#ifndef STANDALONE
|
||||
#include "io_timer.h"
|
||||
#include "h5test.h"
|
||||
#include "H5private.h"
|
||||
#include "h5tools.h"
|
||||
#include "h5tools_utils.h"
|
||||
#else
|
||||
@ -23,6 +23,15 @@
|
||||
#include "pio_standalone.h"
|
||||
#endif
|
||||
|
||||
#ifdef H5_HAVE_PARALLEL
|
||||
extern MPI_Info h5_io_info_g; /* MPI INFO object for IO */
|
||||
#endif
|
||||
|
||||
#ifdef H5_HAVE_PARALLEL
|
||||
int h5_set_info_object(void);
|
||||
void h5_dump_info_object(MPI_Info info);
|
||||
#endif
|
||||
|
||||
/* setup the dataset no fill option if this is v1.5 or more */
|
||||
#if H5_VERS_MAJOR > 1 || H5_VERS_MINOR > 4
|
||||
#define H5_HAVE_NOFILL 1
|
@ -15,7 +15,7 @@
|
||||
|
||||
#ifndef STANDALONE
|
||||
#include "io_timer.h"
|
||||
#include "h5test.h"
|
||||
#include "H5private.h"
|
||||
#include "h5tools.h"
|
||||
#include "h5tools_utils.h"
|
||||
#else
|
@ -4,39 +4,17 @@ project (HDF5_TOOLS_TEST_PERFORM C)
|
||||
# --------------------------------------------------------------------
|
||||
# Add the executables
|
||||
# --------------------------------------------------------------------
|
||||
#-- Adding test for h5perf_serial
|
||||
set (h5perf_serial_SOURCES
|
||||
${HDF5_TOOLS_TEST_PERFORM_SOURCE_DIR}/sio_perf.c
|
||||
${HDF5_TOOLS_TEST_PERFORM_SOURCE_DIR}/sio_engine.c
|
||||
)
|
||||
add_executable (h5perf_serial ${h5perf_serial_SOURCES})
|
||||
target_include_directories (h5perf_serial PRIVATE "${HDF5_TEST_SRC_DIR};${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
|
||||
if (NOT BUILD_SHARED_LIBS)
|
||||
TARGET_C_PROPERTIES (h5perf_serial STATIC)
|
||||
target_link_libraries (h5perf_serial PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET})
|
||||
else ()
|
||||
TARGET_C_PROPERTIES (h5perf_serial SHARED)
|
||||
target_link_libraries (h5perf_serial PRIVATE ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_LIBSH_TARGET})
|
||||
endif ()
|
||||
set_target_properties (h5perf_serial PROPERTIES FOLDER perform)
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# Add Target to clang-format
|
||||
#-----------------------------------------------------------------------------
|
||||
if (HDF5_ENABLE_FORMATTERS)
|
||||
clang_format (HDF5_TOOLS_TEST_PERFORM_h5perf_serial_FORMAT h5perf_serial)
|
||||
endif ()
|
||||
|
||||
if (HDF5_BUILD_PERFORM_STANDALONE)
|
||||
#-- Adding test for h5perf_serial_alone - io_timer.c includes
|
||||
set (h5perf_serial_alone_SOURCES
|
||||
${HDF5_TOOLS_DIR}/lib/io_timer.c
|
||||
${HDF5_TOOLS_TEST_PERFORM_SOURCE_DIR}/sio_perf.c
|
||||
${HDF5_TOOLS_TEST_PERFORM_SOURCE_DIR}/sio_engine.c
|
||||
${HDF5_TOOLS_SRC_H5PERF_SOURCE_DIR}/sio_perf.c
|
||||
${HDF5_TOOLS_SRC_H5PERF_SOURCE_DIR}/sio_engine.c
|
||||
${HDF5_TOOLS_TEST_PERFORM_SOURCE_DIR}/sio_standalone.c
|
||||
)
|
||||
add_executable (h5perf_serial_alone ${h5perf_serial_alone_SOURCES})
|
||||
target_include_directories (h5perf_serial_alone PRIVATE "${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR};${HDF5_TOOLS_DIR}/lib;$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
|
||||
target_include_directories (h5perf_serial_alone PRIVATE "${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR};${HDF5_TOOLS_DIR}/lib;${HDF5_TOOLS_SRC_H5PERF_SOURCE_DIR};${HDF5_TOOLS_TEST_PERFORM_SOURCE_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
|
||||
if (NOT BUILD_SHARED_LIBS)
|
||||
TARGET_C_PROPERTIES (h5perf_serial_alone STATIC)
|
||||
target_link_libraries (h5perf_serial_alone PRIVATE ${HDF5_LIB_TARGET} "$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_LIBRARIES}>")
|
||||
@ -188,63 +166,16 @@ if (HDF5_ENABLE_FORMATTERS)
|
||||
endif ()
|
||||
|
||||
if (H5_HAVE_PARALLEL AND HDF5_TEST_PARALLEL)
|
||||
if (UNIX)
|
||||
#-- Adding test for perf - only on unix systems
|
||||
set (perf_SOURCES
|
||||
${HDF5_TOOLS_TEST_PERFORM_SOURCE_DIR}/perf.c
|
||||
)
|
||||
add_executable (perf ${perf_SOURCES})
|
||||
target_include_directories (perf PRIVATE "${HDF5_TEST_SRC_DIR};${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
|
||||
if (NOT BUILD_SHARED_LIBS)
|
||||
TARGET_C_PROPERTIES (perf STATIC)
|
||||
target_link_libraries (perf PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_TEST_LIB_TARGET} ${HDF5_LIB_TARGET})
|
||||
else ()
|
||||
TARGET_C_PROPERTIES (perf SHARED)
|
||||
target_link_libraries (perf PRIVATE ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_TEST_LIBSH_TARGET} ${HDF5_LIBSH_TARGET})
|
||||
endif ()
|
||||
set_target_properties (perf PROPERTIES FOLDER perform)
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# Add Target to clang-format
|
||||
#-----------------------------------------------------------------------------
|
||||
if (HDF5_ENABLE_FORMATTERS)
|
||||
clang_format (HDF5_TOOLS_TEST_PERFORM_perf_FORMAT perf)
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
#-- Adding test for h5perf
|
||||
set (h5perf_SOURCES
|
||||
${HDF5_TOOLS_TEST_PERFORM_SOURCE_DIR}/pio_perf.c
|
||||
${HDF5_TOOLS_TEST_PERFORM_SOURCE_DIR}/pio_engine.c
|
||||
)
|
||||
add_executable (h5perf ${h5perf_SOURCES})
|
||||
target_include_directories (h5perf PRIVATE "${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
|
||||
if (NOT BUILD_SHARED_LIBS)
|
||||
TARGET_C_PROPERTIES (h5perf STATIC)
|
||||
target_link_libraries (h5perf PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_TEST_LIB_TARGET} ${HDF5_LIB_TARGET})
|
||||
else ()
|
||||
TARGET_C_PROPERTIES (h5perf SHARED)
|
||||
target_link_libraries (h5perf PRIVATE ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_TEST_LIBSH_TARGET} ${HDF5_LIBSH_TARGET})
|
||||
endif ()
|
||||
set_target_properties (h5perf PROPERTIES FOLDER perform)
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# Add Target to clang-format
|
||||
#-----------------------------------------------------------------------------
|
||||
if (HDF5_ENABLE_FORMATTERS)
|
||||
clang_format (HDF5_TOOLS_TEST_PERFORM_h5perf_FORMAT h5perf)
|
||||
endif ()
|
||||
|
||||
if (HDF5_BUILD_PERFORM_STANDALONE)
|
||||
#-- Adding test for h5perf
|
||||
set (h5perf_alone_SOURCES
|
||||
${HDF5_TOOLS_DIR}/lib/io_timer.c
|
||||
${HDF5_TOOLS_TEST_PERFORM_SOURCE_DIR}/pio_perf.c
|
||||
${HDF5_TOOLS_TEST_PERFORM_SOURCE_DIR}/pio_engine.c
|
||||
${HDF5_TOOLS_SRC_H5PERF_SOURCE_DIR}/pio_perf.c
|
||||
${HDF5_TOOLS_SRC_H5PERF_SOURCE_DIR}/pio_engine.c
|
||||
${HDF5_TOOLS_TEST_PERFORM_SOURCE_DIR}/pio_standalone.c
|
||||
)
|
||||
add_executable (h5perf_alone ${h5perf_alone_SOURCES})
|
||||
target_include_directories (h5perf_alone PRIVATE "${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR};${HDF5_TOOLS_DIR}/lib;$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
|
||||
target_include_directories (h5perf_alone PRIVATE "${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR};${HDF5_TOOLS_DIR}/lib;${HDF5_TOOLS_SRC_H5PERF_SOURCE_DIR};${HDF5_TOOLS_TEST_PERFORM_SOURCE_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
|
||||
if (NOT BUILD_SHARED_LIBS)
|
||||
TARGET_C_PROPERTIES (h5perf_alone STATIC)
|
||||
target_link_libraries (h5perf_alone PRIVATE ${HDF5_LIB_TARGET} ${LINK_LIBS} "$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_LIBRARIES}>")
|
||||
|
@ -21,17 +21,6 @@ include $(top_srcdir)/config/commence.am
|
||||
|
||||
AM_CPPFLAGS+=-I$(top_srcdir)/src -I$(top_srcdir)/test -I$(top_srcdir)/tools/lib
|
||||
|
||||
# bin_PROGRAMS will be installed.
|
||||
if BUILD_PARALLEL_CONDITIONAL
|
||||
bin_PROGRAMS=h5perf_serial h5perf
|
||||
else
|
||||
bin_PROGRAMS=h5perf_serial
|
||||
endif
|
||||
|
||||
# Add h5perf and h5perf_serial specific linker flags here
|
||||
h5perf_LDFLAGS = $(LT_STATIC_EXEC) $(AM_LDFLAGS)
|
||||
h5perf_serial_LDFLAGS = $(LT_STATIC_EXEC) $(AM_LDFLAGS)
|
||||
|
||||
# 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.
|
||||
@ -47,18 +36,15 @@ endif
|
||||
# List them in the order they should be run.
|
||||
# Parallel test programs.
|
||||
if BUILD_PARALLEL_CONDITIONAL
|
||||
TEST_PROG_PARA=h5perf perf
|
||||
TEST_PROG_PARA=
|
||||
endif
|
||||
# Serial test programs.
|
||||
TEST_PROG = iopipe chunk chunk_cache overhead zip_perf perf_meta h5perf_serial $(BUILD_ALL_PROGS)
|
||||
TEST_PROG = iopipe chunk chunk_cache overhead zip_perf perf_meta $(BUILD_ALL_PROGS)
|
||||
|
||||
# check_PROGRAMS will be built but not installed. Do not any executable
|
||||
# that is in bin_PROGRAMS already. Otherwise, it will be removed twice in
|
||||
# "make clean" and some systems, e.g., AIX, do not like it.
|
||||
check_PROGRAMS= iopipe chunk chunk_cache overhead zip_perf perf_meta $(BUILD_ALL_PROGS) perf
|
||||
|
||||
h5perf_SOURCES=pio_perf.c pio_engine.c
|
||||
h5perf_serial_SOURCES=sio_perf.c sio_engine.c
|
||||
check_PROGRAMS= $(TEST_PROG) $(BUILD_ALL_PROGS)
|
||||
|
||||
# These are the files that `make clean' (and derivatives) will remove from
|
||||
# this directory.
|
||||
@ -67,9 +53,6 @@ CLEANFILES=*.h5 *.raw *.dat x-gnuplot perftest.out
|
||||
# All of the programs depend on the main hdf5 library, and some of them
|
||||
# depend on test or tools library.
|
||||
LDADD=$(LIBHDF5)
|
||||
h5perf_LDADD=$(LIBH5TOOLS) $(LIBH5TEST) $(LIBHDF5)
|
||||
h5perf_serial_LDADD=$(LIBH5TOOLS) $(LIBH5TEST) $(LIBHDF5)
|
||||
perf_LDADD=$(LIBH5TEST) $(LIBHDF5)
|
||||
iopipe_LDADD=$(LIBH5TEST) $(LIBHDF5)
|
||||
zip_perf_LDADD=$(LIBH5TOOLS) $(LIBH5TEST) $(LIBHDF5)
|
||||
perf_meta_LDADD=$(LIBH5TEST) $(LIBHDF5)
|
||||
|
@ -17,10 +17,6 @@
|
||||
|
||||
#include "pio_perf.h"
|
||||
|
||||
#ifdef STANDALONE
|
||||
MPI_Info h5_io_info_g = MPI_INFO_NULL; /* MPI INFO object for IO */
|
||||
#endif
|
||||
|
||||
/** From h5tools_utils.c **/
|
||||
|
||||
/* global variables */
|
||||
@ -156,134 +152,3 @@ print_version(const char *progname)
|
||||
printf("%s: Version %u.%u.%u%s%s\n", progname, H5_VERS_MAJOR, H5_VERS_MINOR, H5_VERS_RELEASE,
|
||||
H5_VERS_SUBRELEASE[0] ? "-" : "", H5_VERS_SUBRELEASE);
|
||||
}
|
||||
|
||||
#ifdef STANDALONE
|
||||
/*
|
||||
* Function: h5_set_info_object
|
||||
* Purpose: Process environment variables setting to set up MPI Info
|
||||
* object.
|
||||
* Return: 0 if all is fine; otherwise non-zero.
|
||||
* Programmer: Albert Cheng, 2002/05/21.
|
||||
* Modifications:
|
||||
* Bill Wendling, 2002/05/31
|
||||
* Modified so that the HDF5_MPI_INFO environment variable can
|
||||
* be a semicolon separated list of "key=value" pairings. Most
|
||||
* of the code is to remove any whitespaces which might be
|
||||
* surrounding the "key=value" pairs.
|
||||
*/
|
||||
int
|
||||
h5_set_info_object(void)
|
||||
{
|
||||
char *envp; /* environment pointer */
|
||||
int ret_value = 0;
|
||||
|
||||
/* handle any MPI INFO hints via $HDF5_MPI_INFO */
|
||||
if ((envp = HDgetenv("HDF5_MPI_INFO")) != NULL) {
|
||||
char *next, *valp;
|
||||
|
||||
valp = envp = next = HDstrdup(envp);
|
||||
|
||||
if (!valp)
|
||||
return 0;
|
||||
|
||||
/* create an INFO object if not created yet */
|
||||
if (h5_io_info_g == MPI_INFO_NULL)
|
||||
MPI_Info_create(&h5_io_info_g);
|
||||
|
||||
do {
|
||||
size_t len;
|
||||
char * key_val, *endp, *namep;
|
||||
|
||||
if (*valp == ';')
|
||||
valp++;
|
||||
|
||||
/* copy key/value pair into temporary buffer */
|
||||
len = strcspn(valp, ";");
|
||||
next = &valp[len];
|
||||
key_val = (char *)HDcalloc(1, len + 1);
|
||||
|
||||
/* increment the next pointer past the terminating semicolon */
|
||||
if (*next == ';')
|
||||
++next;
|
||||
|
||||
namep = HDstrncpy(key_val, valp, len);
|
||||
|
||||
/* pass up any beginning whitespaces */
|
||||
while (*namep && (*namep == ' ' || *namep == '\t'))
|
||||
namep++;
|
||||
|
||||
if (!*namep)
|
||||
continue; /* was all white space, so move to next k/v pair */
|
||||
|
||||
/* eat up any ending white spaces */
|
||||
endp = &namep[HDstrlen(namep) - 1];
|
||||
|
||||
while (endp && (*endp == ' ' || *endp == '\t'))
|
||||
*endp-- = '\0';
|
||||
|
||||
/* find the '=' */
|
||||
valp = HDstrchr(namep, '=');
|
||||
|
||||
if (valp != NULL) { /* it's a valid key/value pairing */
|
||||
char *tmp_val = valp + 1;
|
||||
|
||||
/* change '=' to \0, move valp down one */
|
||||
*valp-- = '\0';
|
||||
|
||||
/* eat up ending whitespace on the "key" part */
|
||||
while (*valp == ' ' || *valp == '\t')
|
||||
*valp-- = '\0';
|
||||
|
||||
valp = tmp_val;
|
||||
|
||||
/* eat up beginning whitespace on the "value" part */
|
||||
while (*valp == ' ' || *valp == '\t')
|
||||
*valp++ = '\0';
|
||||
|
||||
/* actually set the darned thing */
|
||||
if (MPI_SUCCESS != MPI_Info_set(h5_io_info_g, namep, valp)) {
|
||||
HDprintf("MPI_Info_set failed\n");
|
||||
ret_value = -1;
|
||||
}
|
||||
}
|
||||
|
||||
valp = next;
|
||||
HDfree(key_val);
|
||||
} while (next && *next);
|
||||
|
||||
HDfree(envp);
|
||||
}
|
||||
|
||||
return ret_value;
|
||||
}
|
||||
|
||||
/*
|
||||
* Function: h5_dump_info_object
|
||||
* Purpose: Display content of an MPI Info object
|
||||
* Return: void
|
||||
* Programmer: Albert Cheng 2002/05/21
|
||||
* Modifications:
|
||||
*/
|
||||
void
|
||||
h5_dump_info_object(MPI_Info info)
|
||||
{
|
||||
char key[MPI_MAX_INFO_KEY + 1];
|
||||
char value[MPI_MAX_INFO_VAL + 1];
|
||||
int flag;
|
||||
int i, nkeys;
|
||||
|
||||
HDprintf("Dumping MPI Info Object (up to %d bytes per item):\n", MPI_MAX_INFO_VAL);
|
||||
if (info == MPI_INFO_NULL) {
|
||||
HDprintf("object is MPI_INFO_NULL\n");
|
||||
}
|
||||
else {
|
||||
MPI_Info_get_nkeys(info, &nkeys);
|
||||
HDprintf("object has %d items\n", nkeys);
|
||||
for (i = 0; i < nkeys; i++) {
|
||||
MPI_Info_get_nthkey(info, i, key);
|
||||
MPI_Info_get(info, key, MPI_MAX_INFO_VAL, value, &flag);
|
||||
HDprintf("%s=%s\n", key, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif /* STANDALONE */
|
||||
|
@ -441,17 +441,6 @@ extern char * strdup(const char *s);
|
||||
#define TRUE true
|
||||
#endif
|
||||
|
||||
/** From h5test.h **/
|
||||
|
||||
#ifdef H5_HAVE_PARALLEL
|
||||
extern MPI_Info h5_io_info_g; /* MPI INFO object for IO */
|
||||
#endif
|
||||
|
||||
#ifdef H5_HAVE_PARALLEL
|
||||
int h5_set_info_object(void);
|
||||
void h5_dump_info_object(MPI_Info info);
|
||||
#endif
|
||||
|
||||
/** From h5tools_utils.h **/
|
||||
|
||||
H5_DLLVAR int H5_opterr; /* getoption prints errors if this is on */
|
||||
|
@ -456,17 +456,6 @@ extern char * strdup(const char *s);
|
||||
#define TRUE true
|
||||
#endif
|
||||
|
||||
/** From h5test.h **/
|
||||
|
||||
#ifdef H5_HAVE_PARALLEL
|
||||
extern MPI_Info h5_io_info_g; /* MPI INFO object for IO */
|
||||
#endif
|
||||
|
||||
#ifdef H5_HAVE_PARALLEL
|
||||
int h5_set_info_object(void);
|
||||
void h5_dump_info_object(MPI_Info info);
|
||||
#endif
|
||||
|
||||
/** From h5tools_utils.h **/
|
||||
|
||||
H5_DLLVAR int H5_opterr; /* getoption prints errors if this is on */
|
||||
|
Loading…
Reference in New Issue
Block a user