diff options
author | Albert Cheng <acheng@hdfgroup.org> | 2003-01-03 19:37:48 (GMT) |
---|---|---|
committer | Albert Cheng <acheng@hdfgroup.org> | 2003-01-03 19:37:48 (GMT) |
commit | bd54330abfb17cd4f8ebc45203581ccc1eddf5a9 (patch) | |
tree | 557fd8ddca9ef407f2259dc55975c2788091bb05 | |
parent | 8bd4ac2b3883db921a20de53130e274d7c456fd5 (diff) | |
download | hdf5-bd54330abfb17cd4f8ebc45203581ccc1eddf5a9.zip hdf5-bd54330abfb17cd4f8ebc45203581ccc1eddf5a9.tar.gz hdf5-bd54330abfb17cd4f8ebc45203581ccc1eddf5a9.tar.bz2 |
[svn-r6232] Purpose:
new feature
Description:
Added MPICH/MPE instrumentation support.
All source code are bracketed by the macro H5_HAVE_MPE.
Use "--enable-mpe" to configure it in.
Currently only worked in Eirene because the MPE library is
not installed in all machines yet.
The added file, H5MPprivate.h, holds HDF5/MPE related defintions.
Platforms tested:
Tested h5committest {arabica (fortran), eirene (fortran, C++)
modi4 (parallel, fortran)}? Yep.
Other platforms/configurations tested?
--enable-mpe feature tested in Eirene.
-rw-r--r-- | src/H5.c | 40 | ||||
-rw-r--r-- | src/H5Eprivate.h | 1 | ||||
-rw-r--r-- | src/H5MPprivate.h | 402 | ||||
-rw-r--r-- | src/H5config.h.in | 3 | ||||
-rw-r--r-- | src/H5private.h | 26 |
5 files changed, 467 insertions, 5 deletions
@@ -45,6 +45,10 @@ H5_api_t H5_g; hbool_t H5_libinit_g = FALSE; /* Library hasn't been initialized */ #endif +#ifdef H5_HAVE_MPE +hbool_t H5_MPEinit_g = FALSE; /* MPE Library hasn't been initialized */ +#endif + char H5_lib_vers_info_g[] = H5_VERS_INFO; hbool_t dont_atexit_g = FALSE; H5_debug_t H5_debug_g; /*debugging info */ @@ -74,7 +78,6 @@ H5_init_library(void) herr_t ret_value=SUCCEED; FUNC_ENTER_NOAPI(H5_init_library, FAIL); - /* * Make sure the package information is updated. */ @@ -98,6 +101,24 @@ H5_init_library(void) H5_debug_g.pkg[H5_PKG_V].name = "v"; H5_debug_g.pkg[H5_PKG_Z].name = "z"; +#ifdef H5_HAVE_MPE + /* Initialize MPE instrumentation library. May need to move this + * up earlier if any of the above initialization involves using + * the instrumentation code. + */ + if (!H5_MPEinit_g) + { + int mpe_code; + int mpi_initialized; + MPI_Initialized(&mpi_initialized); + if (mpi_initialized){ + mpe_code = MPE_Init_log(); + assert(mpe_code >=0); + H5_MPEinit_g = TRUE; + } + } +#endif + /* * Install atexit() library cleanup routine unless the H5dont_atexit() * has been called. Once we add something to the atexit() list it stays @@ -208,6 +229,23 @@ H5_term_library(void) fprintf(stderr, " %s...\n", loop); } } + +#ifdef H5_HAVE_MPE + /* Close MPE instrumentation library. May need to move this + * down if any of the below code involves using the instrumentation code. + */ + if (H5_MPEinit_g) + { + int mpe_code; + int mpi_initialized; + MPI_Initialized(&mpi_initialized); + if (mpi_initialized){ + mpe_code = MPE_Finish_log("cpilog"); + assert(mpe_code >=0); + } + H5_MPEinit_g = FALSE; /* turn it off no matter what */ + } +#endif /* Mark library as closed */ H5_INIT_GLOBAL = FALSE; diff --git a/src/H5Eprivate.h b/src/H5Eprivate.h index 75360f3..52566e4 100644 --- a/src/H5Eprivate.h +++ b/src/H5Eprivate.h @@ -74,6 +74,7 @@ * the return value. */ #define HRETURN(ret_val) { \ + FINISH_MPE_LOG; \ PABLO_TRACE_OFF (PABLO_MASK, pablo_func_id); \ H5TRACE_RETURN(ret_val); \ H5_API_UNLOCK \ diff --git a/src/H5MPprivate.h b/src/H5MPprivate.h new file mode 100644 index 0000000..78d2c81 --- /dev/null +++ b/src/H5MPprivate.h @@ -0,0 +1,402 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * 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. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* + * Header file for private definitions of the MPE instrumentation. + */ +#ifndef _H5MPprivate_H +#define _H5MPprivate_H + +#ifdef H5_HAVE_MPE +/*------------------------------------------------------------------------ + * Purpose: Begin to collect MPE log information for a function. It should + * be ahead of the actual function's process. + * + * Programmer: Long Wang + * + *------------------------------------------------------------------------ + */ +#include "mpe.h" +/* + * #define eventa(func_name) h5_mpe_ ## func_name ## _a + * #define eventb(func_name) h5_mpe_ ## func_name ## _b + * #define eventc(func_name) h5_mpe_ ## func_name ## _counter + */ +#define eventa(func_name) h5_mpe_eventa +#define eventb(func_name) h5_mpe_eventb +#define eventc(func_name) h5_mpe_counter +#define COLOR(func_name) color_ ## func_name +#define MPE_LOG_VARS(func_name) \ + static int eventa(func_name) = -1; \ + static int eventb(func_name) = -1; \ + static int eventc(func_name) = 0; \ + int * p_eventb = &eventb(func_name); \ + char* p_end_funcname = #func_name; \ + char* p_event_start = "start" #func_name; \ + int * p_eventc = & eventc(func_name); +/* the following is for the elimination of "unused variable" warning */ +#define MPE_LOG_VARS_USE(func_name) \ + eventa(func_name) = eventa(func_name); \ + eventb(func_name) = eventb(func_name); \ + eventc(func_name) = eventc(func_name); \ + p_eventc = p_eventc; \ + p_event_start = p_event_start; + +#define BEGIN_MPE_LOG(func_name) \ + if (H5_MPEinit_g){ \ + if (H5_MPEinit_g && eventa(func_name) == -1 && eventb(func_name) == -1) { \ + char* p_color = COLOR(func_name); \ + eventa(func_name)=MPE_Log_get_event_number(); \ + eventb(func_name)=MPE_Log_get_event_number(); \ + MPE_Describe_state(eventa(func_name), eventb(func_name), p_end_funcname,p_color); \ + } \ + MPE_Log_event(eventa(func_name), 0, p_event_start); \ + } + + +/*------------------------------------------------------------------------ + * Purpose: Finish the collection of MPE log information for a function. + * It should be after the actual function's process. + * + * Programmer: Long Wang + */ +#define FINISH_MPE_LOG \ + if (H5_IS_API(FUNC) && H5_MPEinit_g) { \ + MPE_Log_event(*p_eventb, 0, p_end_funcname); \ +/* eventc(func_name)++ */ \ + } + + + +/* color for each public HDF5 API function */ +#define color_H5_init_library "red" + +#define color_H5open "red" +#define color_H5close "red" +#define color_H5dont_atexit "red" +#define color_H5garbage_collect "red" +#define color_H5set_free_list_limits "red" +#define color_H5get_libversion "red" +#define color_H5check_version "red" + +#define color_H5Dcreate "red" +#define color_H5Dopen "red" +#define color_H5Dclose "red" +#define color_H5Dget_space "red" +#define color_H5Dget_space_status "red" +#define color_H5Dget_type "red" +#define color_H5Dget_create_plist "red" +#define color_H5Dget_storage_size "red" +#define color_H5Dread "red" +#define color_H5Dwrite "red" +#define color_H5Dextend "red" +#define color_H5Diterate "red" +#define color_H5Dvlen_reclaim "red" +#define color_H5Dvlen_get_buf_size "red" +#define color_H5Dfill "red" +#define color_H5Ddebug "red" +#define color_H5Dset_extent "red" +#define color_H5Dget_offset "red" + +#define color_H5Eset_auto "red" +#define color_H5Eget_auto "red" +#define color_H5Eclear "red" +#define color_H5Eprint "red" +#define color_H5Ewalk "red" +#define color_H5Eget_major "red" +#define color_H5Eget_minor "red" +#define color_H5Epush "red" + +#define color_H5Fis_hdf5 "red" +#define color_H5Fcreate "red" +#define color_H5Fopen "red" +#define color_H5Freopen "red" +#define color_H5Fflush "red" +#define color_H5Fclose "red" +#define color_H5Fget_create_plist "red" +#define color_H5Fget_access_plist "red" +#define color_H5Fget_obj_count "red" +#define color_H5Fget_vfd_handle "red" +#define color_H5Fget_obj_ids "red" +#define color_H5Fmount "red" +#define color_H5Funmount "red" + +#define color_H5Gcreate "red" +#define color_H5Gopen "red" +#define color_H5Gclose "red" +#define color_H5Giterate "red" +#define color_H5Gmove2 "red" +#define color_H5Glink2 "red" +#define color_H5Gunlink "red" +#define color_H5Gget_objinfo "red" +#define color_H5Gget_linkval "red" +#define color_H5Gset_comment "red" +#define color_H5Gget_comment "red" +#define color_H5Gget_num_objs "red" +#define color_H5Gget_objname_by_idx "red" +#define color_H5Gget_objtype_by_idx "red" + +#define color_H5Iget_type "red" +#define color_H5Iget_name "red" + +#define color_H5Rdereference "red" +#define color_H5Rcreate "red" +#define color_H5Rget_region "red" +#define color_H5Rget_object_type "red" +#define color_H5Rget_obj_type "red" + +#define color_H5Topen "red" +#define color_H5Tcreate "red" +#define color_H5Tcopy "red" +#define color_H5Tclose "red" +#define color_H5Tequal "red" +#define color_H5Tlock "red" +#define color_H5Tcommit "red" +#define color_H5Tcommitted "red" +#define color_H5Tinsert "red" +#define color_H5Tpack "red" +#define color_H5Tenum_create "red" +#define color_H5Tenum_insert "red" +#define color_H5Tenum_nameof "red" +#define color_H5Tenum_valueof "red" +#define color_H5Tvlen_create "red" +#define color_H5Tarray_create "red" +#define color_H5Tis_variable_str "red" +#define color_H5Tget_array_dims "red" +#define color_H5Tget_array_ndims "red" +#define color_H5Tset_tag "red" +#define color_H5Tget_tag "red" +#define color_H5Tget_super "red" +#define color_H5Tget_class "red" +#define color_H5Tdetect_class "red" +#define color_H5Tget_size "red" +#define color_H5Tget_order "red" +#define color_H5Tget_precision "red" +#define color_H5Tget_offset "red" +#define color_H5Tget_pad "red" +#define color_H5Tget_sign "red" +#define color_H5Tget_fields "red" +#define color_H5Tget_ebias "red" +#define color_H5Tget_norm "red" +#define color_H5Tget_inpad "red" +#define color_H5Tget_strpad "red" +#define color_H5Tget_nmembers "red" +#define color_H5Tget_num_members "red" +#define color_H5Tget_member_name "red" +#define color_H5Tget_member_index "red" +#define color_H5Tget_member_offset "red" +#define color_H5Tget_member_class "red" +#define color_H5Tget_member_value "red" +#define color_H5Tget_member_type "red" +#define color_H5Tget_cset "red" +#define color_H5Tset_size "red" +#define color_H5Tset_order "red" +#define color_H5Tset_precision "red" +#define color_H5Tset_offset "red" +#define color_H5Tset_pad "red" +#define color_H5Tset_sign "red" +#define color_H5Tset_fields "red" +#define color_H5Tset_ebias "red" +#define color_H5Tset_norm "red" +#define color_H5Tset_inpad "red" +#define color_H5Tset_cset "red" +#define color_H5Tset_strpad "red" +#define color_H5Tregister "red" +#define color_H5Tunregister "red" +#define color_H5Tfind "red" +#define color_H5Tconvert "red" +#define color_H5Tget_overflow "red" +#define color_H5Tset_overflow "red" +#define color_H5Tget_native_type "red" + +#define color_H5Acreate "red" +#define color_H5Aopen_name "red" +#define color_H5Aopen_idx "red" +#define color_H5Awrite "red" +#define color_H5Aread "red" +#define color_H5Aclose "red" +#define color_H5Aget_space "red" +#define color_H5Aget_type "red" +#define color_H5Aget_name "red" +#define color_H5Aget_num_attrs "red" +#define color_H5Aget_storage_size "red" +#define color_H5Aiterate "red" +#define color_H5Adelete "red" +#define color_H5Arename "red" + +#define color_H5FDregister "red" +#define color_H5FDunregister "red" +#define color_H5FDopen "red" +#define color_H5FDclose "red" +#define color_H5FDcmp "red" +#define color_H5FDquery "red" +#define color_H5FDalloc "red" +#define color_H5FDfree "red" +#define color_H5FDrealloc "red" +#define color_H5FDget_eoa "red" +#define color_H5FDset_eoa "red" +#define color_H5FDget_eof "red" +#define color_H5FDget_vdf_handle "red" +#define color_H5FDread "red" +#define color_H5FDwrite "red" +#define color_H5FDflush "red" +#define color_H5FDget_vfd_handle "red" +#define color_H5Pset_fapl_core "red" +#define color_H5Pget_fapl_core "red" +#define color_H5Pset_fapl_family "red" +#define color_H5Pget_fapl_family "red" +#define color_H5Pset_fapl_log "red" +#define color_H5Pget_fapl_log "red" +#define color_H5Pset_fapl_mpio "red" +#define color_H5Pget_fapl_mpio "red" +#define color_H5Pset_dxpl_mpio "red" +#define color_H5Pget_dxpl_mpio "red" +#define color_H5Pset_fapl_mpiposix "red" +#define color_H5Pget_fapl_mpiposix "red" +#define color_H5Pset_fapl_sec2 "red" +#define color_H5Pget_fapl_sec2 "red" +#define color_H5Pget_filter "red" +#define color_H5Pset_btree_ratios "red" +#define color_H5Pget_btree_ratios "red" +#define color_H5Pset_shuffle "red" + +#define color_H5Pcreate_class "red" +#define color_H5Pget_class_name "red" +#define color_H5Pcreate "red" +#define color_H5Pregister "red" +#define color_H5Pinsert "red" +#define color_H5Pset "red" +#define color_H5Pexist "red" +#define color_H5Pget_size "red" +#define color_H5Pget_nprops "red" +#define color_H5Pget_class "red" +#define color_H5Pget_class_parent "red" +#define color_H5Pget "red" +#define color_H5Pequal "red" +#define color_H5Pisa_class "red" +#define color_H5Piterate "red" +#define color_H5Pcopy_prop "red" +#define color_H5Premove "red" +#define color_H5Punregister "red" +#define color_H5Pclose_class "red" +#define color_H5Pclose "red" +#define color_H5Pcopy "red" +#define color_H5Pget_version "red" +#define color_H5Pset_userblock "red" +#define color_H5Pget_userblock "red" +#define color_H5Pset_alignment "red" +#define color_H5Pget_alignment "red" +#define color_H5Pset_sizes "red" +#define color_H5Pget_sizes "red" +#define color_H5Pset_sym_k "red" +#define color_H5Pget_sym_k "red" +#define color_H5Pset_istore_k "red" +#define color_H5Pget_istore_k "red" +#define color_H5Pset_layout "red" +#define color_H5Pget_layout "red" +#define color_H5Pset_chunk "red" +#define color_H5Pget_chunk "red" +#define color_H5Pset_external "red" +#define color_H5Pget_external_count "red" +#define color_H5Pget_external "red" +#define color_H5Pset_driver "red" +#define color_H5Pget_driver "red" +#define color_H5Pget_driver_info "red" +#define color_H5Pset_family_offset "red" +#define color_H5Pget_family_offset "red" +#define color_H5Pset_multi_type "red" +#define color_H5Pget_multi_type "red" +#define color_H5Pset_buffer "red" +#define color_H5Pget_buffer "red" +#define color_H5Pset_preserve "red" +#define color_H5Pget_preserve "red" +#define color_H5Pset_filter "red" +#define color_H5Pget_nfilters "red" +#define color_H5Pget_fileter "red" +#define color_H5Pset_deflate "red" +#define color_H5Pset_cache "red" +#define color_H5Pget_cache "red" +#define color_H5Pset_hyper_cache "red" +#define color_H5Pget_hyper_cache "red" +#define color_H5Pset_htree_ratios "red" +#define color_H5Pget_htree_ratios "red" +#define color_H5Pset_fill_value "red" +#define color_H5Pget_fill_value "red" +#define color_H5Pfill_value_defined "red" +#define color_H5Pset_alloc_time "red" +#define color_H5Pget_alloc_time "red" +#define color_H5Pset_fill_time "red" +#define color_H5Pget_fill_time "red" +#define color_H5Pset_gc_references "red" +#define color_H5Pget_gc_references "red" +#define color_H5Pset_fclose_degree "red" +#define color_H5Pget_fclose_degree "red" +#define color_H5Pset_vlen_mem_manager "red" +#define color_H5Pget_vlen_mem_manager "red" +#define color_H5Pset_meta_block_size "red" +#define color_H5Pget_meta_block_size "red" +#define color_H5Pset_sieve_buf_size "red" +#define color_H5Pget_sieve_buf_size "red" +#define color_H5Pset_hyper_vector_size "red" +#define color_H5Pget_hyper_vector_size "red" +#define color_H5Pset_small_data_block_size "red" +#define color_H5Pget_small_data_block_size "red" + +#define color_H5Screate "red" +#define color_H5Screate_simple "red" +#define color_H5Sset_extent_simple "red" +#define color_H5Scopy "red" +#define color_H5Sclose "red" +#define color_H5Sget_simple_extent_npoints "red" +#define color_H5Sget_simple_extent_ndims "red" +#define color_H5Sget_simple_extent_dims "red" +#define color_H5Sis_simple "red" +#define color_H5Sset_space "red" +#define color_H5Sget_select_npoints "red" +#define color_H5Sselect_hyperslab "red" +#define color_H5Scombine_hyperslab "red" +#define color_H5Sselect_select "red" +#define color_H5Scombine_select "red" +#define color_H5Sselect_elements "red" +#define color_H5Sget_simple_extent_type "red" +#define color_H5Sset_extent_none "red" +#define color_H5Sextent_copy "red" +#define color_H5Sselect_all "red" +#define color_H5Sselect_none "red" +#define color_H5Soffset_simple "red" +#define color_H5Sselect_valid "red" +#define color_H5Sget_select_hyper_nblocks "red" +#define color_H5Sget_select_elem_npoints "red" +#define color_H5Sget_select_hyper_blocklist "red" +#define color_H5Sget_select_elem_pointlist "red" +#define color_H5Sget_select_bounds "red" +#define color_H5Sget_select_type "red" + +#define color_H5Zregister "red" +#define color_H5Zfilter_avail "red" +#define color_H5Zunregister "red" + +#else +#define eventa(func_name) /* void */ +#define eventb(func_name) /* void */ +#define eventc(func_name) /* void */ +#define MPE_LOG_VARS(func_name) /* void */ +#define MPE_LOG_VARS_USE(func_name) /* void */ +#define COLOR(func_name) /* void */ +#define BEGIN_MPE_LOG(func_name) /* void */ +#define FINISH_MPE_LOG /* void */ + +#endif + +#endif diff --git a/src/H5config.h.in b/src/H5config.h.in index daa16bf..4ae5487 100644 --- a/src/H5config.h.in +++ b/src/H5config.h.in @@ -164,6 +164,9 @@ /* Define to 1 if you have the <memory.h> header file. */ #undef HAVE_MEMORY_H +/* Define if we have MPE support */ +#undef HAVE_MPE + /* Define to 1 if you have the <netinet/tcp.h> header file. */ #undef HAVE_NETINET_TCP_H diff --git a/src/H5private.h b/src/H5private.h index e4ba48b..5fbbccd 100644 --- a/src/H5private.h +++ b/src/H5private.h @@ -156,6 +156,15 @@ #endif /* + * MPE Instrumentation support + * Do not #if the following header file because it contains + * the needed null definitions for the H5-MPE macros when MPE + * support is not configured. + * + */ +#include "H5MPprivate.h" + +/* * dmalloc (debugging malloc) support */ #ifdef H5_HAVE_DMALLOC_H @@ -1057,13 +1066,19 @@ extern H5_api_t H5_g; /* extern global variables */ extern hbool_t H5_libinit_g; /* Has the library been initialized? */ + /* Macros for accessing the global variables */ #define H5_INIT_GLOBAL H5_libinit_g #endif /* H5_HAVE_THREADSAFE */ +#ifdef H5_HAVE_MPE +extern hbool_t H5_MPEinit_g; /* Has the MPE Library been initialized? */ +#endif + #define FUNC_ENTER_COMMON(func_name,asrt) \ CONSTR (FUNC, #func_name); \ + MPE_LOG_VARS(func_name) \ PABLO_SAVE (ID_ ## func_name) \ H5TRACE_DECL; \ \ @@ -1083,8 +1098,7 @@ extern hbool_t H5_libinit_g; /* Has the library been initialized? */ /* Use this macro for all "normal" API functions */ #define FUNC_ENTER_API(func_name,err) { \ FUNC_ENTER_COMMON(func_name,H5_IS_API(FUNC)); \ - FUNC_ENTER_API_COMMON(func_name,INTERFACE_INIT,err) \ - \ + FUNC_ENTER_API_COMMON(func_name,INTERFACE_INIT,err); \ /* Clear thread error stack entering public functions */ \ H5E_clear(); \ { @@ -1095,7 +1109,7 @@ extern hbool_t H5_libinit_g; /* Has the library been initialized? */ */ #define FUNC_ENTER_API_NOCLEAR(func_name,err) { \ FUNC_ENTER_COMMON(func_name,H5_IS_API(FUNC)); \ - FUNC_ENTER_API_COMMON(func_name,INTERFACE_INIT,err) \ + FUNC_ENTER_API_COMMON(func_name,INTERFACE_INIT,err); \ { /* @@ -1105,6 +1119,7 @@ extern hbool_t H5_libinit_g; /* Has the library been initialized? */ */ #define FUNC_ENTER_API_NOINIT(func_name) { \ FUNC_ENTER_COMMON(func_name,H5_IS_API(FUNC)); \ + BEGIN_MPE_LOG(func_name); \ { /* Use this macro for all "normal" non-API functions */ @@ -1144,7 +1159,8 @@ extern hbool_t H5_libinit_g; /* Has the library been initialized? */ HGOTO_ERROR (H5E_FUNC, H5E_CANTINIT, err, \ "interface initialization failed"); \ } \ - } + } \ + BEGIN_MPE_LOG(func_name) #define FUNC_ENTER_NOAPI_INIT(func_name,interface_init_func,err) \ /* Initialize this interface or bust */ \ @@ -1174,6 +1190,7 @@ extern hbool_t H5_libinit_g; /* Has the library been initialized? */ *------------------------------------------------------------------------- */ #define FUNC_LEAVE(return_value) \ + MPE_LOG_VARS_USE(func_name); \ HRETURN(return_value) \ } /*end scope from end of FUNC_ENTER*/ \ } /*end scope from beginning of FUNC_ENTER*/ @@ -1211,4 +1228,5 @@ H5_DLL int H5T_term_interface(void); H5_DLL int H5Z_term_interface(void); + #endif |