summaryrefslogtreecommitdiffstats
path: root/tools/perform/pio_engine.c
diff options
context:
space:
mode:
authorLarry Knox <lrknox@hdfgroup.org>2021-02-08 16:56:16 (GMT)
committerGitHub <noreply@github.com>2021-02-08 16:56:16 (GMT)
commit22c67ff6570f16050f0a5654cf1c84df917bb598 (patch)
tree38fb63aa498b250c2543fe7e22a511706de96a42 /tools/perform/pio_engine.c
parent551f15f8ae02ca9c995619b216121081eb07633e (diff)
downloadhdf5-hdf5-1_8_22.zip
hdf5-hdf5-1_8_22.tar.gz
hdf5-hdf5-1_8_22.tar.bz2
1.8/master (#317)hdf5-1_8_22
* Revert incorrect bool type * Correct grep text for filter test * Check sizeof type to use correct ref_type * h5dump reg ref chnages has no error file * Fix comment * Remove unneeded files * Verify the decoded version for "all" and "none" selection. * Remove double entry * Add missing include * Snapshot version 1.8 release 22 (snap4) Update version to 1.8-snap5 * Fixes for test failures with --disable-tests --disable-tools options. Don't test ph5diff if tests are disabled. * Correct conditions for parallel builds with and without tests. * Snapshot version 1.8 release 22 (snap5) Update version to 1.8.22-snap6 * TRILAB-192 merging warnings changes from develop * Autotools reconfigure update * Restore page ejects. * Restore page eject chars * Fix orphaned token * Update LT files * Correct extra flags and merge TRILAB-24 * Update release note for CMake warnings * H5repack bug fixes from develop * TRILAB-192 - merge changes from develop Single source, config files, for warnings for both autotools and CMake. Update CMake libraries, tools, tests to use correct flags. * Add missing m4 file * Remove 128bit config check fo 1.8 * TRILAB-192 update LTparse files * A fix in the cleaning up code for datatype when datatype initialization via H5D__init_type() fails. The code to fix the problem is the same as what is done in H5D__open_oid(). * Add missing " and update function calls incorrectly named load_gcc_arguments. Commit changes to gnu-cxxflags to remove unmatched " and to gnu-fflags to not add C warnings flags to H5_FCFLAGS. * TRILAB-192 - cleanup edits and match CMake CXX to autotools * Fix shadowed type * TRILAB-192 correct fortran commands * TRILAB-192 version of std=f2008 special check * Fix shadow variable * Add prefix_relto_examplesdir function to set relative path to h5c++. * TRILAB-192 - parser files cannot handle this warning * Parallel Fortran tests now use the MPI module instead of including mpif.h. * Don't add general warnings flags for unsupported old versions of gcc and g++ (older than gcc/g++ 4.2). Correct gnu-cxxflags to determine warnings flags to be added based on C++ compiler version instead of C compiler version. * Snapshot version 1.8 release 22 (snap6) Update version to 1.8.22-snap7 * TRILAB-244 separate CXX warnings and errors from C * Fix NoFilter build * Move ADD_H5_FLAGS macro from *CompilerFlags.cmake files to config/cmake_ext_mod/HDFMacros.cmake for common use. * Restrict errors to gcc 4.8 and above. * OESS-65 replace szip with aec szip * Correct CMake version * Correct -Werror=unused-variable * Add -Werror= flags to lists displayed in libhdf5.settings. * Fix -Werror=unused-variable * More fixes for unused variable * Resolve warning errors from -Werror= flags: -Werror=bad-function-cast -Werror=bad-function-cast -Werror=implicit-function-declaration -Werror=nested-externs * Remove verbose assignments in smoke_check 3 and 5 functions. * Update to use optimization flags, C++ error flags, and correct libhdf5.settings.in to remove unworkable changes. * Update config/gnu-cxxflags. * Add missing headers * Fix ifort warning flag. Restore AC_DEFUN([PAC_PROG_FC_DEFAULT_REALisDBLE] in m4/aclocal_fc.m4. Add --enable-symbols, --enable-profiling, and --enable-optimization options to autotools configure; all configure flags for --enable-production and --disable-production should match HDF5 1.10 and 1.12 production and debug default flags. * Add github actions file * Correct path * OESS-65 Fix packaging * Update reference name * Correct filename * disable pr action and enable fail fast * Snapshot 1.8.22-snap7 Update version to 1.8.22-snap8. * Correct mingw path * Correct mingw paths * Revise gnu-*flags and cmake/HDF*CompilerFlags.cmake files to add warning flags for GCC compilers version 4.8 and above. Removed files from gnu-warnings that only apply to versions < 4.8. Consolidated warnings from versions < 4.8 that apply to versions >= 4.8 into the 4.8 warnings files. * Update MANIFEST for removal of older warnings files. * Yanked all MPI-1 calls Added batch scripts in bin/batch. * Snapshot 1.8.22-snap8. Update version to 1.8.22-snap9. * Squashed commit of the following: commit 45b0cbc71929930a874e1c09e0770aa64d0ae697 Author: Larry Knox <lrknox@hdfgroup.org> Date: Thu Apr 23 13:14:56 2020 -0500 Add C++ warnings treated as error for autotools builds. commit 6debcddcc766601799d5bd661bd60946f951a07e Author: Larry Knox <lrknox@hdfgroup.org> Date: Fri Jun 19 16:50:03 2020 -0500 Remove tests for develop branch from testh5cc.sh.in. Add @H5_ECXXFLAGS@ to AM_CXXFLAGS. commit fed497e7f207313b2a133d3b68c942b7d7104b90 Author: Larry Knox <lrknox@hdfgroup.org> Date: Fri Jun 12 15:06:39 2020 -0500 Merge pull request #2646 in HDFFV/hdf5 from ~LRKNOX/hdf5_lrk:develop to develop * commit '998c6470d78e14228695419c3b514c35ecf3d69e': Remove unnecessary version conditions for Clang compilers. commit 92e52ce5c211bd1d3991a3b8bb67287ac7b652aa Author: Larry Knox <lrknox@hdfgroup.org> Date: Wed Jun 10 18:53:45 2020 -0500 Merge pull request #2639 in HDFFV/hdf5 from ~LRKNOX/hdf5_lrk:develop to develop * commit 'a33667faf226f5d8c9633bf537893e8fce1bf1f6': Add c++ to --enable-sanitize-checks option. commit 2e802534fb997b81fa98fdd1c7d97d4310898e0d Author: Larry Knox <lrknox@hdfgroup.org> Date: Wed Jun 10 15:18:36 2020 -0500 Merge pull request #2633 in HDFFV/hdf5 from ~LRKNOX/hdf5_lrk:develop to develop * commit '20eab963899841c9a003baebead8e3bc07d9e127': Remove duplicate entries in MANIFEST. Make changes to CMake CompilerFlags.cmake files so extra flags are loaded for non-GNU compilers. Update new clang files to not pick up clang as vendor for pgCC. Add new files to MANIFEST Temporary demotion of 2 -Werror warning flags that fail on macos 10.12 Remove Production flag unknown to Apple clang. commit 96ef60a58a23847a7da89a891f2415055ec2ab60 Author: Larry Knox <lrknox@hdfgroup.org> Date: Mon Jun 8 16:24:49 2020 -0500 Merge pull request #2631 in HDFFV/hdf5 from ~LRKNOX/hdf5_lrk:develop to develop * commit 'b942a4d8a3e27317cac50ce37ff5302d477664d8': Clean up code to get clang version in config/linux-gnulibc1 commit 8a7c687da568e8b50b38fa53da1ca63759be6ec4 Author: Larry Knox <lrknox@hdfgroup.org> Date: Mon Jun 8 11:42:37 2020 -0500 Merge pull request #2623 in HDFFV/hdf5 from ~LRKNOX/hdf5_lrk:develop to develop * commit 'c7626f79fdee4eee13925e240ef41e61f3367eab': Add flags from config/clang-warnings/*general files to H5 C and CXX flags for all versions of Clang and Clang++ compilers. Switched from cut to awk in testcheck_version.sh.in to avoid dependence on tab vs. " " in version definitions in H5public.h. Add files for adding warning flags for clang compilers in autotools configure. commit db3ef7ff3c1ed79167cecef831501411cff8291f Merge: 5a0f8d7 f9f1310 Author: Larry Knox <lrknox@hdfgroup.org> Date: Fri Jun 19 14:46:22 2020 -0500 Merge branch 'hdf5_1_12' of https://bitbucket.hdfgroup.org/scm/~lrknox/hdf5_lrk into hdf5_1_12 commit 5a0f8d7940ae57b445f545a0abd7e303ce6924ee Author: Larry Knox <lrknox@hdfgroup.org> Date: Wed Jun 10 20:15:41 2020 -0500 Merge pull request #2636 in HDFFV/hdf5 from ~LRKNOX/hdf5_lrk:HDFFV-11000-update-testh5cc.sh.in-for-version to develop * commit '5c0bd670d6e9919c463fbc05de99e2ba55b0761e': Add tests for all version to H5_NO_DEPRECATED_SYMBOLS section and to section for current version, with and without default API version flags. HDFFV-11000: update-testh5cc.sh.in to test sample versioned functions in HDF5 1.10, 1.12 and develop. * Update configure and Makefile.ins after bin/reconfigure. * Fix MANIFEST * Fix HDFFV-10591 Description: h52gif produced a segfault when a buffer overflow occurred because the data size was corrupted and became very large. This commit added a check on the data size against the buffer size to prevent the segfault. It also added error reporting to h52gif to display an error message instead of silently exiting when the failure occurred. Platforms tested: Linux/64 (jelly) * Snapshot 1.8.22-snap9. Update version to 1.8.22-snap10. * Merge pull request #2686 in HDFFV/hdf5 from ~LRKNOX/hdf5_lrk:develop to develop * commit '800f93f7c994f88dfa716746153ded4b1e690e3a': Remove path to szip header file from AM_CPPFLAGS when configure check of libsz fails. Fix for HDFFV-10830. * Regenerate configure. * Merge from 1.10-1.12-dev - LT parse needs update * Incorporate pull request #2693 from develop for the fix to HDFFV-11080: (1) Patch up the file pointer when reading attribute of variable length datatype (2) Test to verify the fix when doing multiple threads (3) Update MANIFEST (4) Add new test to Cmake * Switch bison and flex update of LT files from bin/genltanalyse to bin/genparser, and from automatically updating the LT files whenever reconfigure is run to running only on man<F12>ual command. * Update hl/sr/H5LT files. Add bin/genparser to MANIFEST; remove bin/genltanalyze. * Fix to the merge of PR #2708 for HDFFV-11080 to the 1.8 branch. Need to checkin test/Makefile.in for the new file added. * Fix HDFFV-11120 and HDFFV-11121 (CVE-2018-13870 and CVE-2018-13869) Description: When a buffer overflow occurred because a name length was corrupted and became very large, h5dump produced a segfault on one file and a memcpy parameter overlap on another file. This commit added checks that detect a read pass the end of the buffer to prevent these error conditions. Platforms tested: Linux/64 (jelly) * Fixed typo * Check for header szlib.h only when libsz passes AC_CHECK_LIB, so that H5_HAVE_SALIB_H is not defined when szip is not enabled, to prevent compile failures for incompatible szlib. * HDFFV-11127 - force RTLD_LOCAL in dlopen * spelling * Remove extra parens * Remove unnecessary assignment freom configure.ac. * Add hypen to subrelease regex * Add special case when H5_VERS_SUBRELEASE is 0 * Revert H5_VERS_SUBRELEASE check * The version string has a second use for packaging * MinGW uses "MinGW Makefiles" * Snapshot 1.8.22-snap10. Update version to 1.8.22-snap11. * Merge clang-format changes from develop * remove stray file * Source formatted * Add options to github actions. * Add back file, remove py file * HDFFV-11096 Correct h5dump usage text * Update formating * remove autogen for 1.8 branch * Fix comment whitespace * Change '==' to 'eq' in test script * Merge from develop github updates bin scripts parser updates * Snapshot 1.8.22-snap11. Update version to 1.8.22-snap12. * Merge from 1.10 Comments, whitespace Simple init and if block brackets. Minimal code changes limited to return value and spelling * Update autotools files * Update FD source * More merges from 1.10 comments and inits * Comment fixes * Fix macro argument * Remove autogen file and cache dir * Revert autotools files to previous version * Correct boolean value and missing define * URL and options corrections * revert autoconf files * Fix compile issues with vfd drivers. * Fix HDFS test * Remove extra #endif * Move init above execution * Multiple changes to bring branch up-to-date (#87) Correct TARGET variable and CMake config file location. Add option to allow filter plugins to be built inline. Update CMake tools macros. * hdf5 1 8 release text (#113) * Multiple changes to bring branch up-to-date Correct TARGET variable and CMake config file location. Add option to allow filter plugins to be built inline. Update CMake tools macros. * release text updates - mostly whitespace * Fixed HDFFV-10480 and HDFFV-11159 (#145) * Fixed HDFFV-10480 and HDFFV-11159 Description Checked against buffer size to prevent segfault, in case of data corruption. + HDFFV-11159 CVE-2018-14033 Buffer over-read in H5O_layout_decode + HDFFV-10480 CVE-2018-11206 Buffer over-read in H5O_fill_new[/old]_decode and A user's patch was applied to this previously, but it is redone for a more correct fix, that is the check now accounted for the previous advance of the buffer pointer. Platforms tested: Linux/64 (jelly) * Fixed typo * Update HDF5 1.8 copyright headers with updated copyright URL (#148) * Update URL for COPYING file in copyright headers. * Make fortran copyright headers uniformly spaced. * Update url for Copyright file in c++/src/footer.html. * OESS-98 Update plugin build option (#171) * 1.8 has extra fortran CMake option (#176) * 1.8 has extra fortran CMake option * Update license URL * OESS-98 fix tools test for plugins (#180) * Hdf5 1 8 (#169) * Fixed HDFFV-10480 and HDFFV-11159 Description Checked against buffer size to prevent segfault, in case of data corruption. + HDFFV-11159 CVE-2018-14033 Buffer over-read in H5O_layout_decode + HDFFV-10480 CVE-2018-11206 Buffer over-read in H5O_fill_new[/old]_decode and A user's patch was applied to this previously, but it is redone for a more correct fix, that is the check now accounted for the previous advance of the buffer pointer. Platforms tested: Linux/64 (jelly) * Fixed typo * Fixed HDFFV-11150 Description Replaced an HDassert with a check for null pointer in H5O_dec_rc() to catch null pointer in corrupted data situation. Reversed the fix in svn-r24463 in which a check for null pointer prior to calling H5O_dec_rc() Platforms tested: Linux/64 (jelly) * HDF5 1 8 fix fortran build on macs (#186) * Correct fortran and shared libs option * Fix for no shared fortran build * OESS-98 fix hdf5 link target (#191) * Partial changes to RELEASE.txt for release. (#185) * Partial changes to RELEASE.txt for release. * Update supported and tested platforms. * Update version to 1.8.22-12. * close #195. (#196) * Update HDF5PluginMacros.cmake * Update HDF5PluginMacros.cmake * Update directory for SZ filter in HDF5PluginMacros.cmake. Updates for release: Switch configure default to production mode. Set HDF5_GENERATE_HEADERS to OFF. * Restores maintainer mode in the autotools (#200) Maintainer mode should be enabled in development branches. Also adds helpful commenting. Add bin/switch_maint_mode Disable maintainer mode for release. Fix incomplete merge for stub functions in H5Fdhdfs.c * Update configure for Restores maintainer mode in the autotools (#200). * Update MANIFEST for switch_maint_mode script. * Restores maintainer mode in the autotools (#200) (#203) * Restores maintainer mode in the autotools (#200) Maintainer mode should be enabled in development branches. Also adds helpful commenting. Add bin/switch_maint_mode Disable maintainer mode for release. Fix incomplete merge for stub functions in H5Fdhdfs.c * Update configure for Restores maintainer mode in the autotools (#200). * Update MANIFEST for switch_maint_mode script. Co-authored-by: Dana Robinson <43805+derobins@users.noreply.github.com> * Hdf5 1 8 22 (#212) * Restores maintainer mode in the autotools (#200) Maintainer mode should be enabled in development branches. Also adds helpful commenting. Add bin/switch_maint_mode Disable maintainer mode for release. Fix incomplete merge for stub functions in H5Fdhdfs.c * Update configure for Restores maintainer mode in the autotools (#200). * Update MANIFEST for switch_maint_mode script. Co-authored-by: Dana Robinson <43805+derobins@users.noreply.github.com> * Update so numbers for 1.8.22 release. * Add so numbers changes in Makefile.ins for 1.8.22 release. * Brings ttsafe_attr_vlen.c changes from develop (#214) Fixes exposed pthread problem on Windows. * Update SO numbers for Hdf5 1 8 22 (#215) * Restores maintainer mode in the autotools (#200) Maintainer mode should be enabled in development branches. Also adds helpful commenting. Add bin/switch_maint_mode Disable maintainer mode for release. Fix incomplete merge for stub functions in H5Fdhdfs.c * Update configure for Restores maintainer mode in the autotools (#200). * Update MANIFEST for switch_maint_mode script. * Update so numbers for 1.8.22 release. * Add so numbers changes in Makefile.ins for 1.8.22 release. Co-authored-by: Dana Robinson <43805+derobins@users.noreply.github.com> * Update pkgconfig settings with version - #218 (#223) * Add notice of final HDFF5 1.8 release. Add solaris 64bit alignment issue to "Known Problems". * Update 1.8 final release notice. * Hdf5 1 8 22 (#224) * Restores maintainer mode in the autotools (#200) Maintainer mode should be enabled in development branches. Also adds helpful commenting. Add bin/switch_maint_mode Disable maintainer mode for release. Fix incomplete merge for stub functions in H5Fdhdfs.c * Update configure for Restores maintainer mode in the autotools (#200). * Update MANIFEST for switch_maint_mode script. * Update so numbers for 1.8.22 release. * Add so numbers changes in Makefile.ins for 1.8.22 release. * Update pkgconfig settings with version - #218 (#223) * Add notice of final HDFF5 1.8 release. Add solaris 64bit alignment issue to "Known Problems". * Update 1.8 final release notice. Co-authored-by: Dana Robinson <43805+derobins@users.noreply.github.com> Co-authored-by: Allen Byrne <50328838+byrnHDF@users.noreply.github.com> * Update CMake/HDF5Examples version in bin/release * Update CMake/HDF5Examples version number in bin/release (#225) * Restores maintainer mode in the autotools (#200) Maintainer mode should be enabled in development branches. Also adds helpful commenting. Add bin/switch_maint_mode Disable maintainer mode for release. Fix incomplete merge for stub functions in H5Fdhdfs.c * Update configure for Restores maintainer mode in the autotools (#200). * Update MANIFEST for switch_maint_mode script. * Update so numbers for 1.8.22 release. * Add so numbers changes in Makefile.ins for 1.8.22 release. * Update pkgconfig settings with version - #218 (#223) * Add notice of final HDFF5 1.8 release. Add solaris 64bit alignment issue to "Known Problems". * Update 1.8 final release notice. * Update CMake/HDF5Examples version in bin/release Co-authored-by: Dana Robinson <43805+derobins@users.noreply.github.com> Co-authored-by: Allen Byrne <50328838+byrnHDF@users.noreply.github.com> * Fixed typo in an error message. (#228) * Fixed typo in an error message. (#227) * Remove duplicate setting (#239) * Bring 3 small changes from Hdf5 1.8 to 1.8.22 (#241) * Restores maintainer mode in the autotools (#200) Maintainer mode should be enabled in development branches. Also adds helpful commenting. Add bin/switch_maint_mode Disable maintainer mode for release. Fix incomplete merge for stub functions in H5Fdhdfs.c * Update configure for Restores maintainer mode in the autotools (#200). * Update MANIFEST for switch_maint_mode script. * Update so numbers for 1.8.22 release. * Add so numbers changes in Makefile.ins for 1.8.22 release. * Update pkgconfig settings with version - #218 (#223) * Add notice of final HDFF5 1.8 release. Add solaris 64bit alignment issue to "Known Problems". * Update 1.8 final release notice. * Update CMake/HDF5Examples version in bin/release * Fixed typo in an error message. (#227) * Remove duplicate setting (#239) Co-authored-by: Dana Robinson <43805+derobins@users.noreply.github.com> Co-authored-by: Allen Byrne <50328838+byrnHDF@users.noreply.github.com> Co-authored-by: bmribler <39579120+bmribler@users.noreply.github.com> * Stat st blocks fix 1822 (#251) * Restores maintainer mode in the autotools (#200) Maintainer mode should be enabled in development branches. Also adds helpful commenting. Add bin/switch_maint_mode Disable maintainer mode for release. Fix incomplete merge for stub functions in H5Fdhdfs.c * Update configure for Restores maintainer mode in the autotools (#200). * Update MANIFEST for switch_maint_mode script. * Update so numbers for 1.8.22 release. * Add so numbers changes in Makefile.ins for 1.8.22 release. * Update pkgconfig settings with version - #218 (#223) * Add notice of final HDFF5 1.8 release. Add solaris 64bit alignment issue to "Known Problems". * Update 1.8 final release notice. * Update CMake/HDF5Examples version in bin/release * Fixed typo in an error message. (#227) * Remove duplicate setting (#239) * Fixes Autotools detection of the st_blocks field in stat (#246) * Fixes Autotools detection of the st_blocks field in stat The Autotools and CMake will now both correctly determine if the stat struct has the st_blocks field and set H5_HAVE_STAT_ST_BLOCKS appropriately. * Fixes a typo in configure.ac * Restore lines in RELEASE.txt. Co-authored-by: Dana Robinson <43805+derobins@users.noreply.github.com> Co-authored-by: Allen Byrne <50328838+byrnHDF@users.noreply.github.com> Co-authored-by: bmribler <39579120+bmribler@users.noreply.github.com> * Stat st blocks fix 1822 (#256) * Restores maintainer mode in the autotools (#200) Maintainer mode should be enabled in development branches. Also adds helpful commenting. Add bin/switch_maint_mode Disable maintainer mode for release. Fix incomplete merge for stub functions in H5Fdhdfs.c * Update configure for Restores maintainer mode in the autotools (#200). * Update MANIFEST for switch_maint_mode script. * Update so numbers for 1.8.22 release. * Add so numbers changes in Makefile.ins for 1.8.22 release. * Update pkgconfig settings with version - #218 (#223) * Add notice of final HDFF5 1.8 release. Add solaris 64bit alignment issue to "Known Problems". * Update 1.8 final release notice. * Update CMake/HDF5Examples version in bin/release * Fixed typo in an error message. (#227) * Remove duplicate setting (#239) * Fixes Autotools detection of the st_blocks field in stat (#246) * Fixes Autotools detection of the st_blocks field in stat The Autotools and CMake will now both correctly determine if the stat struct has the st_blocks field and set H5_HAVE_STAT_ST_BLOCKS appropriately. * Fixes a typo in configure.ac * Restore lines in RELEASE.txt. * Updated configure with reconfigure. Co-authored-by: Dana Robinson <43805+derobins@users.noreply.github.com> Co-authored-by: Allen Byrne <50328838+byrnHDF@users.noreply.github.com> Co-authored-by: bmribler <39579120+bmribler@users.noreply.github.com> * RELEASE.txt cleanup. * Hdf5 1 8 22 (#261) * Restores maintainer mode in the autotools (#200) Maintainer mode should be enabled in development branches. Also adds helpful commenting. Add bin/switch_maint_mode Disable maintainer mode for release. Fix incomplete merge for stub functions in H5Fdhdfs.c * Update configure for Restores maintainer mode in the autotools (#200). * Update MANIFEST for switch_maint_mode script. * Update so numbers for 1.8.22 release. * Add so numbers changes in Makefile.ins for 1.8.22 release. * Update pkgconfig settings with version - #218 (#223) * Add notice of final HDFF5 1.8 release. Add solaris 64bit alignment issue to "Known Problems". * Update 1.8 final release notice. * Update CMake/HDF5Examples version in bin/release * Fixed typo in an error message. (#227) * Remove duplicate setting (#239) * RELEASE.txt cleanup. Co-authored-by: Dana Robinson <43805+derobins@users.noreply.github.com> Co-authored-by: Allen Byrne <50328838+byrnHDF@users.noreply.github.com> Co-authored-by: bmribler <39579120+bmribler@users.noreply.github.com> * Add macOS Big Sur to tested machines, also missing entries for macOS 10.13 and 10.14. * )Update version. * Hdf5 1 8 22 (#266) * Restores maintainer mode in the autotools (#200) Maintainer mode should be enabled in development branches. Also adds helpful commenting. Add bin/switch_maint_mode Disable maintainer mode for release. Fix incomplete merge for stub functions in H5Fdhdfs.c * Update configure for Restores maintainer mode in the autotools (#200). * Update MANIFEST for switch_maint_mode script. * Update so numbers for 1.8.22 release. * Add so numbers changes in Makefile.ins for 1.8.22 release. * Update pkgconfig settings with version - #218 (#223) * Add notice of final HDFF5 1.8 release. Add solaris 64bit alignment issue to "Known Problems". * Update 1.8 final release notice. * Update CMake/HDF5Examples version in bin/release * Fixed typo in an error message. (#227) * Remove duplicate setting (#239) * RELEASE.txt cleanup. * Add macOS Big Sur to tested machines, also missing entries for macOS 10.13 and 10.14. * )Update version. Co-authored-by: Dana Robinson <43805+derobins@users.noreply.github.com> Co-authored-by: Allen Byrne <50328838+byrnHDF@users.noreply.github.com> Co-authored-by: bmribler <39579120+bmribler@users.noreply.github.com> * Reverts lock/unlock callback signature to 1.8.21 version (#254) * Reverts lock/unlock callback signature to 1.8.21 version This callback is unused in 1.8. The ros3 and hdfs VFDs are the only VFDs that have the lock callback implemented and that is just as no-op stubs. These stubs were removed so the callbacks are now NULL pointers, like the other VFDs in 1.8. * Trivial whitespace fix * Update version to 1.8.22-14. * Hdf5 1 8 22 - Reverts lock/unlock callback signature to 1.8.21 version (#267) * Restores maintainer mode in the autotools (#200) Maintainer mode should be enabled in development branches. Also adds helpful commenting. Add bin/switch_maint_mode Disable maintainer mode for release. Fix incomplete merge for stub functions in H5Fdhdfs.c * Update configure for Restores maintainer mode in the autotools (#200). * Update MANIFEST for switch_maint_mode script. * Update so numbers for 1.8.22 release. * Add so numbers changes in Makefile.ins for 1.8.22 release. * Update pkgconfig settings with version - #218 (#223) * Add notice of final HDFF5 1.8 release. Add solaris 64bit alignment issue to "Known Problems". * Update 1.8 final release notice. * Update CMake/HDF5Examples version in bin/release * Fixed typo in an error message. (#227) * Remove duplicate setting (#239) * RELEASE.txt cleanup. * Add macOS Big Sur to tested machines, also missing entries for macOS 10.13 and 10.14. * )Update version. * Reverts lock/unlock callback signature to 1.8.21 version (#254) * Reverts lock/unlock callback signature to 1.8.21 version This callback is unused in 1.8. The ros3 and hdfs VFDs are the only VFDs that have the lock callback implemented and that is just as no-op stubs. These stubs were removed so the callbacks are now NULL pointers, like the other VFDs in 1.8. * Trivial whitespace fix * Update version to 1.8.22-14. Co-authored-by: Dana Robinson <43805+derobins@users.noreply.github.com> Co-authored-by: Allen Byrne <50328838+byrnHDF@users.noreply.github.com> Co-authored-by: bmribler <39579120+bmribler@users.noreply.github.com> * Update version in H5public.h * Hdf5 1 8 22 (#269) * Restores maintainer mode in the autotools (#200) Maintainer mode should be enabled in development branches. Also adds helpful commenting. Add bin/switch_maint_mode Disable maintainer mode for release. Fix incomplete merge for stub functions in H5Fdhdfs.c * Update configure for Restores maintainer mode in the autotools (#200). * Update MANIFEST for switch_maint_mode script. * Update so numbers for 1.8.22 release. * Add so numbers changes in Makefile.ins for 1.8.22 release. * Update pkgconfig settings with version - #218 (#223) * Add notice of final HDFF5 1.8 release. Add solaris 64bit alignment issue to "Known Problems". * Update 1.8 final release notice. * Update CMake/HDF5Examples version in bin/release * Fixed typo in an error message. (#227) * Remove duplicate setting (#239) * RELEASE.txt cleanup. * Add macOS Big Sur to tested machines, also missing entries for macOS 10.13 and 10.14. * )Update version. * Reverts lock/unlock callback signature to 1.8.21 version (#254) * Reverts lock/unlock callback signature to 1.8.21 version This callback is unused in 1.8. The ros3 and hdfs VFDs are the only VFDs that have the lock callback implemented and that is just as no-op stubs. These stubs were removed so the callbacks are now NULL pointers, like the other VFDs in 1.8. * Trivial whitespace fix * Update version to 1.8.22-14. * Update version in H5public.h Co-authored-by: Dana Robinson <43805+derobins@users.noreply.github.com> Co-authored-by: Allen Byrne <50328838+byrnHDF@users.noreply.github.com> Co-authored-by: bmribler <39579120+bmribler@users.noreply.github.com> * Set version 1.8.22 for release. * dd RELEASE.txt entry for HDFFV-10741. * Hdf5 1 8 22 (#279) * Restores maintainer mode in the autotools (#200) Maintainer mode should be enabled in development branches. Also adds helpful commenting. Add bin/switch_maint_mode Disable maintainer mode for release. Fix incomplete merge for stub functions in H5Fdhdfs.c * Update configure for Restores maintainer mode in the autotools (#200). * Update MANIFEST for switch_maint_mode script. * Update so numbers for 1.8.22 release. * Add so numbers changes in Makefile.ins for 1.8.22 release. * Update pkgconfig settings with version - #218 (#223) * Add notice of final HDFF5 1.8 release. Add solaris 64bit alignment issue to "Known Problems". * Update 1.8 final release notice. * Update CMake/HDF5Examples version in bin/release * Fixed typo in an error message. (#227) * Remove duplicate setting (#239) * RELEASE.txt cleanup. * Add macOS Big Sur to tested machines, also missing entries for macOS 10.13 and 10.14. * )Update version. * Reverts lock/unlock callback signature to 1.8.21 version (#254) * Reverts lock/unlock callback signature to 1.8.21 version This callback is unused in 1.8. The ros3 and hdfs VFDs are the only VFDs that have the lock callback implemented and that is just as no-op stubs. These stubs were removed so the callbacks are now NULL pointers, like the other VFDs in 1.8. * Trivial whitespace fix * Update version to 1.8.22-14. * Update version in H5public.h * Set version 1.8.22 for release. * dd RELEASE.txt entry for HDFFV-10741. Co-authored-by: Dana Robinson <43805+derobins@users.noreply.github.com> Co-authored-by: Allen Byrne <50328838+byrnHDF@users.noreply.github.com> Co-authored-by: bmribler <39579120+bmribler@users.noreply.github.com> * Improve performance of multiple calls to H5Sget_select_elem_pointlist (#270) (#277) * Cache the pointer to the next point to process after the last call to H5S__get_select_elem_pointlist. This allows the normal process of iterating over the points in batches to be much more efficient, as the library does not need to traverse the entirety of the preceding points every time the funciton is re-entered. * Update RELEASE.txt for point selection iteration performance fix. * Hdf5 1 8 22 (#281) * Restores maintainer mode in the autotools (#200) Maintainer mode should be enabled in development branches. Also adds helpful commenting. Add bin/switch_maint_mode Disable maintainer mode for release. Fix incomplete merge for stub functions in H5Fdhdfs.c * Update configure for Restores maintainer mode in the autotools (#200). * Update MANIFEST for switch_maint_mode script. * Update so numbers for 1.8.22 release. * Add so numbers changes in Makefile.ins for 1.8.22 release. * Update pkgconfig settings with version - #218 (#223) * Add notice of final HDFF5 1.8 release. Add solaris 64bit alignment issue to "Known Problems". * Update 1.8 final release notice. * Update CMake/HDF5Examples version in bin/release * Fixed typo in an error message. (#227) * Remove duplicate setting (#239) * RELEASE.txt cleanup. * Add macOS Big Sur to tested machines, also missing entries for macOS 10.13 and 10.14. * )Update version. * Reverts lock/unlock callback signature to 1.8.21 version (#254) * Reverts lock/unlock callback signature to 1.8.21 version This callback is unused in 1.8. The ros3 and hdfs VFDs are the only VFDs that have the lock callback implemented and that is just as no-op stubs. These stubs were removed so the callbacks are now NULL pointers, like the other VFDs in 1.8. * Trivial whitespace fix * Update version to 1.8.22-14. * Update version in H5public.h * Set version 1.8.22 for release. * dd RELEASE.txt entry for HDFFV-10741. * Improve performance of multiple calls to H5Sget_select_elem_pointlist (#270) (#277) * Cache the pointer to the next point to process after the last call to H5S__get_select_elem_pointlist. This allows the normal process of iterating over the points in batches to be much more efficient, as the library does not need to traverse the entirety of the preceding points every time the funciton is re-entered. * Update RELEASE.txt for point selection iteration performance fix. Co-authored-by: Dana Robinson <43805+derobins@users.noreply.github.com> Co-authored-by: Allen Byrne <50328838+byrnHDF@users.noreply.github.com> Co-authored-by: bmribler <39579120+bmribler@users.noreply.github.com> Co-authored-by: Neil Fortner <nfortne2@hdfgroup.org> * Hdf5 1 8 22 (#284) * Fixed typo in an error message. * Updated for HDFFV-11150, HDFFV-10480, and HDFFV-11159 * Update "Support for New Platforms and Compilers" section in RELEASE.txt; add check_version workaround for binary compatibility to "Known Problems". * Add SUSE Linux to tested platforms. * Update numbers in config/lt_vers.am and run bin/reconfigure for so numbers. * Update version in 3 files missed by merge. Co-authored-by: Allen Byrne <byrn@hdfgroup.org> Co-authored-by: Vailin Choi <vchoi@hdfgroup.org> Co-authored-by: vchoi <vchoi@jelly.ad.hdfgroup.org> Co-authored-by: hdftest <hdftest@hdfgroup.org> Co-authored-by: Jordan Henderson <jhenderson@hdfgroup.org> Co-authored-by: Dana Robinson <derobins@hdfgroup.org> Co-authored-by: Binh-Minh Ribler <bmribler@hdfgroup.org> Co-authored-by: Allen Byrne <50328838+byrnHDF@users.noreply.github.com> Co-authored-by: bmribler <39579120+bmribler@users.noreply.github.com> Co-authored-by: H. Joe Lee <hyoklee@hdfgroup.org> Co-authored-by: Dana Robinson <43805+derobins@users.noreply.github.com> Co-authored-by: Neil Fortner <nfortne2@hdfgroup.org>
Diffstat (limited to 'tools/perform/pio_engine.c')
-rw-r--r--tools/perform/pio_engine.c3757
1 files changed, 1912 insertions, 1845 deletions
diff --git a/tools/perform/pio_engine.c b/tools/perform/pio_engine.c
index 1c0d621..65194b0 100644
--- a/tools/perform/pio_engine.c
+++ b/tools/perform/pio_engine.c
@@ -5,7 +5,7 @@
* 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://support.hdfgroup.org/ftp/HDF5/releases. *
+ * 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. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -36,67 +36,65 @@
#include <mpi.h>
-#ifndef MPI_FILE_NULL /*MPIO may be defined in mpi.h already */
-# include <mpio.h>
-#endif /* !MPI_FILE_NULL */
+#ifndef MPI_FILE_NULL /*MPIO may be defined in mpi.h already */
+#include <mpio.h>
+#endif /* !MPI_FILE_NULL */
#include "pio_perf.h"
/* Macro definitions */
#if H5_VERS_MAJOR == 1 && H5_VERS_MINOR == 6
-# define H5DCREATE(fd, name, type, space, dcpl) H5Dcreate(fd, name, type, space, dcpl)
-# define H5DOPEN(fd, name) H5Dopen(fd, name)
+#define H5DCREATE(fd, name, type, space, dcpl) H5Dcreate(fd, name, type, space, dcpl)
+#define H5DOPEN(fd, name) H5Dopen(fd, name)
#else
-# define H5DCREATE(fd, name, type, space, dcpl) H5Dcreate2(fd, name, type, space, H5P_DEFAULT, dcpl, H5P_DEFAULT)
-# define H5DOPEN(fd, name) H5Dopen2(fd, name, H5P_DEFAULT)
+#define H5DCREATE(fd, name, type, space, dcpl) \
+ H5Dcreate2(fd, name, type, space, H5P_DEFAULT, dcpl, H5P_DEFAULT)
+#define H5DOPEN(fd, name) H5Dopen2(fd, name, H5P_DEFAULT)
#endif
/* sizes of various items. these sizes won't change during program execution */
/* The following three must have the same type */
-#define ELMT_SIZE (sizeof(unsigned char)) /* we're doing bytes */
-#define ELMT_MPI_TYPE MPI_BYTE
-#define ELMT_H5_TYPE H5T_NATIVE_UCHAR
-
-#define GOTOERROR(errcode) { ret_code = errcode; goto done; }
-#define GOTODONE { goto done; }
-#define ERRMSG(mesg) { \
- fprintf(stderr, "Proc %d: ", pio_mpi_rank_g); \
- fprintf(stderr, "*** Assertion failed (%s) at line %4d in %s\n", \
- mesg, (int)__LINE__, __FILE__); \
-}
+#define ELMT_H5_TYPE H5T_NATIVE_UCHAR
-#define MSG(mesg) { \
- fprintf(stderr, "Proc %d: ", pio_mpi_rank_g); \
- fprintf(stderr, "(%s) at line %4d in %s\n", \
- mesg, (int)__LINE__, __FILE__); \
-}
+#define GOTOERROR(errcode) \
+ { \
+ ret_code = errcode; \
+ goto done; \
+ }
+#define ERRMSG(mesg) \
+ { \
+ HDfprintf(stderr, "Proc %d: ", pio_mpi_rank_g); \
+ HDfprintf(stderr, "*** Assertion failed (%s) at line %4d in %s\n", mesg, (int)__LINE__, __FILE__); \
+ }
/* verify: if val is false (0), print mesg. */
-#define VRFY(val, mesg) do { \
- if (!val) { \
- ERRMSG(mesg); \
- GOTOERROR(FAIL); \
- } \
-} while(0)
-
+#define VRFY(val, mesg) \
+ do { \
+ if (!val) { \
+ ERRMSG(mesg); \
+ GOTOERROR(FAIL); \
+ } \
+ } while (0)
/* POSIX I/O macros */
-#define POSIXCREATE(fn) HDopen(fn, O_CREAT|O_TRUNC|O_RDWR, 0600)
-#define POSIXOPEN(fn, F) HDopen(fn, F, 0600)
-#define POSIXCLOSE(F) HDclose(F)
-#define POSIXSEEK(F,L) HDlseek(F, L, SEEK_SET)
-#define POSIXWRITE(F,B,S) HDwrite(F,B,S)
-#define POSIXREAD(F,B,S) HDread(F,B,S)
-
-enum {
- PIO_CREATE = 1,
- PIO_WRITE = 2,
- PIO_READ = 4
-};
+#ifdef H5_HAVE_WIN32_API
+/* Can't link against the library, so this test will use the older, non-Unicode
+ * _open() call on Windows.
+ */
+#define HDopen(S, F, ...) _open(S, F | _O_BINARY, __VA_ARGS__)
+#endif /* H5_HAVE_WIN32_API */
+#define POSIXCREATE(fn) HDopen(fn, O_CREAT | O_TRUNC | O_RDWR, 0600)
+#define POSIXOPEN(fn, F) HDopen(fn, F, 0600)
+#define POSIXCLOSE(F) HDclose(F)
+#define POSIXSEEK(F, L) HDlseek(F, L, SEEK_SET)
+#define POSIXWRITE(F, B, S) HDwrite(F, B, S)
+#define POSIXREAD(F, B, S) HDread(F, B, S)
+
+enum { PIO_CREATE = 1, PIO_WRITE = 2, PIO_READ = 4 };
/* Global variables */
-static int clean_file_g = -1; /*whether to cleanup temporary test */
+static int clean_file_g = -1; /*whether to cleanup temporary test */
/*files. -1 is not defined; */
/*0 is no cleanup; 1 is do cleanup */
@@ -107,31 +105,30 @@ static int clean_file_g = -1; /*whether to cleanup temporary test */
* is about the best guess.
*/
#ifndef HDF5_PARAPREFIX
-# define HDF5_PARAPREFIX ""
-#endif /* !HDF5_PARAPREFIX */
+#define HDF5_PARAPREFIX ""
+#endif /* !HDF5_PARAPREFIX */
#ifndef MIN
-# define MIN(a,b) ((a) < (b) ? (a) : (b))
-#endif /* !MIN */
+#define MIN(a, b) ((a) < (b) ? (a) : (b))
+#endif /* !MIN */
/* the different types of file descriptors we can expect */
typedef union _file_descr {
- int posixfd; /* POSIX file handle*/
- MPI_File mpifd; /* MPI file */
- hid_t h5fd; /* HDF5 file */
+ int posixfd; /* POSIX file handle*/
+ MPI_File mpifd; /* MPI file */
+ hid_t h5fd; /* HDF5 file */
} file_descr;
/* local functions */
-static char *pio_create_filename(iotype iot, const char *base_name,
- char *fullname, size_t size);
-static herr_t do_write(results *res, file_descr *fd, parameters *parms,
- long ndsets, off_t nelmts, size_t buf_size, void *buffer);
-static herr_t do_read(results *res, file_descr *fd, parameters *parms,
- long ndsets, off_t nelmts, size_t buf_size, void *buffer /*out*/);
-static herr_t do_fopen(parameters *param, char *fname, file_descr *fd /*out*/,
- int flags);
+static char * pio_create_filename(iotype iot, const char *base_name, char *fullname, size_t size);
+static herr_t do_write(results *res, file_descr *fd, parameters *parms, long ndsets, off_t nelmts,
+ size_t buf_size, void *buffer);
+static herr_t do_read(results *res, file_descr *fd, parameters *parms, long ndsets, off_t nelmts,
+ size_t buf_size, void *buffer /*out*/);
+static herr_t do_fopen(parameters *param, char *fname, file_descr *fd /*out*/, int flags);
static herr_t do_fclose(iotype iot, file_descr *fd);
-static void do_cleanupfile(iotype iot, char *fname);
+static void do_cleanupfile(iotype iot, char *fname);
+static off_t sqrto(off_t);
/*
* Function: do_pio
@@ -141,32 +138,32 @@ static void do_cleanupfile(iotype iot, char *fname);
* Modifications:
* Added 2D testing (Christian Chilan, 10. August 2005)
*/
- results
+results
do_pio(parameters param)
{
/* return codes */
- herr_t ret_code = 0; /*return code */
- results res;
-
- file_descr fd;
- iotype iot;
-
- char fname[FILENAME_MAX];
- long nf;
- long ndsets;
- off_t nbytes; /*number of bytes per dataset */
- off_t snbytes; /*general dataset size */
- /*for 1D, it is the actual dataset size */
- /*for 2D, it is the size of a side of the dataset square */
- char *buffer = NULL; /*data buffer pointer */
- size_t buf_size; /*general buffer size in bytes */
- /*for 1D, it is the actual buffer size */
- /*for 2D, it is the length of the buffer rectangle */
- size_t blk_size; /*data block size in bytes */
- size_t bsize; /*actual buffer size */
+ herr_t ret_code = 0; /*return code */
+ results res;
+
+ file_descr fd;
+ iotype iot;
+
+ char fname[FILENAME_MAX];
+ long nf;
+ long ndsets;
+ off_t nbytes; /*number of bytes per dataset */
+ off_t snbytes; /*general dataset size */
+ /*for 1D, it is the actual dataset size */
+ /*for 2D, it is the size of a side of the dataset square */
+ char * buffer = NULL; /*data buffer pointer */
+ size_t buf_size; /*general buffer size in bytes */
+ /*for 1D, it is the actual buffer size */
+ /*for 2D, it is the length of the buffer rectangle */
+ size_t blk_size; /*data block size in bytes */
+ size_t bsize; /*actual buffer size */
/* HDF5 variables */
- herr_t hrc; /*HDF5 return code */
+ herr_t hrc; /*HDF5 return code */
/* Sanity check parameters */
@@ -175,7 +172,7 @@ do_pio(parameters param)
switch (iot) {
case MPIO:
- fd.mpifd = MPI_FILE_NULL;
+ fd.mpifd = MPI_FILE_NULL;
res.timers = io_time_new(MPI_CLOCK);
break;
case POSIXIO:
@@ -183,178 +180,167 @@ do_pio(parameters param)
res.timers = io_time_new(MPI_CLOCK);
break;
case PHDF5:
- fd.h5fd = -1;
+ fd.h5fd = -1;
res.timers = io_time_new(MPI_CLOCK);
break;
default:
/* unknown request */
- fprintf(stderr, "Unknown IO type request (%d)\n", iot);
+ HDfprintf(stderr, "Unknown IO type request (%d)\n", iot);
GOTOERROR(FAIL);
}
- ndsets = param.num_dsets; /* number of datasets per file */
- nbytes = param.num_bytes; /* number of bytes per dataset */
+ ndsets = param.num_dsets; /* number of datasets per file */
+ nbytes = param.num_bytes; /* number of bytes per dataset */
buf_size = param.buf_size;
blk_size = param.blk_size;
- if (!param.dim2d){
+ if (!param.dim2d) {
snbytes = nbytes; /* General dataset size */
- bsize = buf_size; /* Actual buffer size */
+ bsize = buf_size; /* Actual buffer size */
}
else {
- snbytes = (off_t)sqrt(nbytes); /* General dataset size */
- bsize = buf_size * blk_size; /* Actual buffer size */
+ snbytes = sqrto(nbytes); /* General dataset size */
+ bsize = buf_size * blk_size; /* Actual buffer size */
}
- if (param.num_files < 0 ) {
- fprintf(stderr,
- "number of files must be >= 0 (%ld)\n",
- param.num_files);
- GOTOERROR(FAIL);
+ if (param.num_files < 0) {
+ HDfprintf(stderr, "number of files must be >= 0 (%ld)\n", param.num_files);
+ GOTOERROR(FAIL);
}
- if (ndsets < 0 ) {
- fprintf(stderr,
- "number of datasets per file must be >= 0 (%ld)\n",
- ndsets);
- GOTOERROR(FAIL);
+ if (ndsets < 0) {
+ HDfprintf(stderr, "number of datasets per file must be >= 0 (%ld)\n", ndsets);
+ GOTOERROR(FAIL);
}
- if (param.num_procs <= 0 ) {
- fprintf(stderr,
- "maximum number of process to use must be > 0 (%d)\n",
- param.num_procs);
- GOTOERROR(FAIL);
+ if (param.num_procs <= 0) {
+ HDfprintf(stderr, "maximum number of process to use must be > 0 (%d)\n", param.num_procs);
+ GOTOERROR(FAIL);
}
/* Validate transfer buffer size & block size*/
- if(blk_size<=0) {
- HDfprintf(stderr,
- "Transfer block size (%zu) must be > 0\n", blk_size);
- GOTOERROR(FAIL);
- }
- if(buf_size<=0) {
- HDfprintf(stderr,
- "Transfer buffer size (%zu) must be > 0\n", buf_size);
- GOTOERROR(FAIL);
+ if (blk_size <= 0) {
+ HDfprintf(stderr, "Transfer block size (%zu) must be > 0\n", blk_size);
+ GOTOERROR(FAIL);
}
- if ((buf_size % blk_size) != 0){
- HDfprintf(stderr,
- "Transfer buffer size (%zu) must be a multiple of the "
- "interleaved I/O block size (%zu)\n",
- buf_size, blk_size);
- GOTOERROR(FAIL);
+ if (buf_size <= 0) {
+ HDfprintf(stderr, "Transfer buffer size (%zu) must be > 0\n", buf_size);
+ GOTOERROR(FAIL);
}
- if((snbytes%pio_mpi_nprocs_g)!=0) {
- HDfprintf(stderr,
- "Dataset size (%" H5_PRINTF_LL_WIDTH "d) must be a multiple of the "
- "number of processes (%d)\n",
- (long long)snbytes, pio_mpi_nprocs_g);
- GOTOERROR(FAIL);
+ if ((buf_size % blk_size) != 0) {
+ HDfprintf(stderr,
+ "Transfer buffer size (%zu) must be a multiple of the "
+ "interleaved I/O block size (%zu)\n",
+ buf_size, blk_size);
+ GOTOERROR(FAIL);
}
-
- if (!param.dim2d){
- if(((snbytes/pio_mpi_nprocs_g)%buf_size)!=0) {
+ if ((snbytes % pio_mpi_nprocs_g) != 0) {
HDfprintf(stderr,
- "Dataset size/process (%" H5_PRINTF_LL_WIDTH "d) must be a multiple of the "
- "trasfer buffer size (%zu)\n",
- (long long)(snbytes/pio_mpi_nprocs_g), buf_size);
+ "Dataset size (%" H5_PRINTF_LL_WIDTH "d) must be a multiple of the "
+ "number of processes (%d)\n",
+ (long long)snbytes, pio_mpi_nprocs_g);
GOTOERROR(FAIL);
+ }
+
+ if (!param.dim2d) {
+ if (((size_t)(snbytes / pio_mpi_nprocs_g) % buf_size) != 0) {
+ HDfprintf(stderr,
+ "Dataset size/process (%" H5_PRINTF_LL_WIDTH "d) must be a multiple of the "
+ "trasfer buffer size (%zu)\n",
+ (long long)(snbytes / pio_mpi_nprocs_g), buf_size);
+ GOTOERROR(FAIL);
}
}
else {
- if((snbytes%buf_size)!=0) {
- HDfprintf(stderr,
- "Dataset side size (%" H5_PRINTF_LL_WIDTH "d) must be a multiple of the "
- "trasfer buffer size (%zu)\n",
- (long long)snbytes, buf_size);
- GOTOERROR(FAIL);
+ if (((size_t)snbytes % buf_size) != 0) {
+ HDfprintf(stderr,
+ "Dataset side size (%" H5_PRINTF_LL_WIDTH "d) must be a multiple of the "
+ "trasfer buffer size (%zu)\n",
+ (long long)snbytes, buf_size);
+ GOTOERROR(FAIL);
}
}
/* Allocate transfer buffer */
- if ((buffer = malloc(bsize)) == NULL){
- HDfprintf(stderr, "malloc for transfer buffer size (%zu) failed\n",
- bsize);
- GOTOERROR(FAIL);
+ if ((buffer = malloc(bsize)) == NULL) {
+ HDfprintf(stderr, "malloc for transfer buffer size (%zu) failed\n", bsize);
+ GOTOERROR(FAIL);
}
if (pio_debug_level >= 4) {
- int myrank;
+ int myrank;
- MPI_Comm_rank(pio_comm_g, &myrank);
+ MPI_Comm_rank(pio_comm_g, &myrank);
- /* output all of the times for all iterations */
- if (myrank == 0)
- fprintf(output, "Timer details:\n");
+ /* output all of the times for all iterations */
+ if (myrank == 0)
+ HDfprintf(output, "Timer details:\n");
}
for (nf = 1; nf <= param.num_files; nf++) {
- /*
- * Write performance measurement
- */
- /* Open file for write */
- char base_name[256];
+ /*
+ * Write performance measurement
+ */
+ /* Open file for write */
+ char base_name[256];
- sprintf(base_name, "#pio_tmp_%lu", nf);
- pio_create_filename(iot, base_name, fname, sizeof(fname));
- if (pio_debug_level > 0)
- HDfprintf(output, "rank %d: data filename=%s\n",
- pio_mpi_rank_g, fname);
+ HDsprintf(base_name, "#pio_tmp_%lu", nf);
+ pio_create_filename(iot, base_name, fname, sizeof(fname));
+ if (pio_debug_level > 0)
+ HDfprintf(output, "rank %d: data filename=%s\n", pio_mpi_rank_g, fname);
- /* Need barrier to make sure everyone starts at the same time */
- MPI_Barrier(pio_comm_g);
+ /* Need barrier to make sure everyone starts at the same time */
+ MPI_Barrier(pio_comm_g);
- set_time(res.timers, HDF5_GROSS_WRITE_FIXED_DIMS, TSTART);
- hrc = do_fopen(&param, fname, &fd, PIO_CREATE | PIO_WRITE);
+ io_time_set(res.timers, HDF5_GROSS_WRITE_FIXED_DIMS, TSTART);
+ hrc = do_fopen(&param, fname, &fd, PIO_CREATE | PIO_WRITE);
- VRFY((hrc == SUCCESS), "do_fopen failed");
+ VRFY((hrc == SUCCESS), "do_fopen failed");
- set_time(res.timers, HDF5_FINE_WRITE_FIXED_DIMS, TSTART);
- hrc = do_write(&res, &fd, &param, ndsets, nbytes, buf_size, buffer);
- hrc == SUCCESS;
- set_time(res.timers, HDF5_FINE_WRITE_FIXED_DIMS, TSTOP);
+ io_time_set(res.timers, HDF5_FINE_WRITE_FIXED_DIMS, TSTART);
+ hrc = do_write(&res, &fd, &param, ndsets, nbytes, buf_size, buffer);
+ io_time_set(res.timers, HDF5_FINE_WRITE_FIXED_DIMS, TSTOP);
- VRFY((hrc == SUCCESS), "do_write failed");
+ VRFY((hrc == SUCCESS), "do_write failed");
- /* Close file for write */
- hrc = do_fclose(iot, &fd);
+ /* Close file for write */
+ hrc = do_fclose(iot, &fd);
- set_time(res.timers, HDF5_GROSS_WRITE_FIXED_DIMS, TSTOP);
- VRFY((hrc == SUCCESS), "do_fclose failed");
+ io_time_set(res.timers, HDF5_GROSS_WRITE_FIXED_DIMS, TSTOP);
+ VRFY((hrc == SUCCESS), "do_fclose failed");
- if (!param.h5_write_only) {
- /*
- * Read performance measurement
- */
- /* Need barrier to make sure everyone is done writing and has
- * closed the file. Also to make sure everyone starts reading
- * at the same time.
- */
- MPI_Barrier(pio_comm_g);
+ if (!param.h5_write_only) {
+ /*
+ * Read performance measurement
+ */
+ /* Need barrier to make sure everyone is done writing and has
+ * closed the file. Also to make sure everyone starts reading
+ * at the same time.
+ */
+ MPI_Barrier(pio_comm_g);
- /* Open file for read */
- set_time(res.timers, HDF5_GROSS_READ_FIXED_DIMS, TSTART);
- hrc = do_fopen(&param, fname, &fd, PIO_READ);
+ /* Open file for read */
+ io_time_set(res.timers, HDF5_GROSS_READ_FIXED_DIMS, TSTART);
+ hrc = do_fopen(&param, fname, &fd, PIO_READ);
- VRFY((hrc == SUCCESS), "do_fopen failed");
+ VRFY((hrc == SUCCESS), "do_fopen failed");
- set_time(res.timers, HDF5_FINE_READ_FIXED_DIMS, TSTART);
- hrc = do_read(&res, &fd, &param, ndsets, nbytes, buf_size, buffer);
- set_time(res.timers, HDF5_FINE_READ_FIXED_DIMS, TSTOP);
- VRFY((hrc == SUCCESS), "do_read failed");
+ io_time_set(res.timers, HDF5_FINE_READ_FIXED_DIMS, TSTART);
+ hrc = do_read(&res, &fd, &param, ndsets, nbytes, buf_size, buffer);
+ io_time_set(res.timers, HDF5_FINE_READ_FIXED_DIMS, TSTOP);
+ VRFY((hrc == SUCCESS), "do_read failed");
- /* Close file for read */
- hrc = do_fclose(iot, &fd);
+ /* Close file for read */
+ hrc = do_fclose(iot, &fd);
- set_time(res.timers, HDF5_GROSS_READ_FIXED_DIMS, TSTOP);
- VRFY((hrc == SUCCESS), "do_fclose failed");
- }
+ io_time_set(res.timers, HDF5_GROSS_READ_FIXED_DIMS, TSTOP);
+ VRFY((hrc == SUCCESS), "do_fclose failed");
+ }
- /* Need barrier to make sure everyone is done with the file */
- /* before it may be removed by do_cleanupfile */
- MPI_Barrier(pio_comm_g);
- do_cleanupfile(iot, fname);
+ /* Need barrier to make sure everyone is done with the file */
+ /* before it may be removed by do_cleanupfile */
+ MPI_Barrier(pio_comm_g);
+ do_cleanupfile(iot, fname);
}
done:
@@ -366,21 +352,23 @@ done:
switch (iot) {
case POSIXIO:
if (fd.posixfd != -1)
- hrc = do_fclose(iot, &fd);
+ hrc = do_fclose(iot, &fd);
break;
case MPIO:
if (fd.mpifd != MPI_FILE_NULL)
- hrc = do_fclose(iot, &fd);
+ hrc = do_fclose(iot, &fd);
break;
case PHDF5:
if (fd.h5fd != -1)
- hrc = do_fclose(iot, &fd);
+ hrc = do_fclose(iot, &fd);
+ break;
+ default:
break;
}
/* release generic resources */
- if(buffer)
- free(buffer);
+ if (buffer)
+ HDfree(buffer);
res.ret_code = ret_code;
return res;
}
@@ -395,12 +383,12 @@ done:
* Programmer: Bill Wendling, 21. November 2001
* Modifications:
*/
- static char *
+static char *
pio_create_filename(iotype iot, const char *base_name, char *fullname, size_t size)
{
const char *prefix, *suffix = "";
- char *ptr, last = '\0';
- size_t i, j;
+ char * ptr, last = '\0';
+ size_t i, j;
if (!base_name || !fullname || size < 1)
return NULL;
@@ -417,6 +405,8 @@ pio_create_filename(iotype iot, const char *base_name, char *fullname, size_t si
case PHDF5:
suffix = ".h5";
break;
+ default:
+ break;
}
/* First use the environment variable and then try the constant */
@@ -425,7 +415,7 @@ pio_create_filename(iotype iot, const char *base_name, char *fullname, size_t si
#ifdef HDF5_PARAPREFIX
if (!prefix)
prefix = HDF5_PARAPREFIX;
-#endif /* HDF5_PARAPREFIX */
+#endif /* HDF5_PARAPREFIX */
/* Prepend the prefix value to the base name */
if (prefix && *prefix) {
@@ -434,12 +424,12 @@ pio_create_filename(iotype iot, const char *base_name, char *fullname, size_t si
* directory instead. */
register char *user, *login, *subdir;
- user = HDgetenv("USER");
- login = HDgetenv("LOGIN");
+ user = HDgetenv("USER");
+ login = HDgetenv("LOGIN");
subdir = (user ? user : login);
if (subdir) {
- for (i = 0; i < size-1 && prefix[i]; i++)
+ for (i = 0; i < size - 1 && prefix[i]; i++)
fullname[i] = prefix[i];
fullname[i++] = '/';
@@ -460,7 +450,7 @@ pio_create_filename(iotype iot, const char *base_name, char *fullname, size_t si
if (HDstat(fullname, &buf) < 0)
/* The directory doesn't exist just yet */
- if (HDmkdir(fullname, (mode_t) 0755) < 0 && errno != EEXIST) {
+ 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);
@@ -509,62 +499,62 @@ pio_create_filename(iotype iot, const char *base_name, char *fullname, size_t si
* Modifications:
* Added 2D testing (Christian Chilan, 10. August 2005)
*/
- static herr_t
-do_write(results *res, file_descr *fd, parameters *parms, long ndsets,
- off_t nbytes, size_t buf_size, void *buffer)
+static herr_t
+do_write(results *res, file_descr *fd, parameters *parms, long ndsets, off_t nbytes, size_t buf_size,
+ void *buffer)
{
- int ret_code = SUCCESS;
- int rc; /*routine return code */
- long ndset;
- size_t blk_size; /* The block size to subdivide the xfer buffer into */
- off_t nbytes_xfer; /* Total number of bytes transferred so far */
- size_t nbytes_xfer_advance; /* Number of bytes transferred in a single I/O operation */
- size_t nbytes_toxfer; /* Number of bytes to transfer a particular time */
- char dname[64];
- off_t dset_offset=0; /*dataset offset in a file */
- off_t bytes_begin[2]; /*first elmt this process transfer */
- off_t bytes_count; /*number of elmts this process transfer */
- off_t snbytes=0; /*size of a side of the dataset square */
- unsigned char *buf_p; /* Current buffer pointer */
+ int ret_code = SUCCESS;
+ int rc; /*routine return code */
+ long ndset;
+ size_t blk_size; /* The block size to subdivide the xfer buffer into */
+ off_t nbytes_xfer; /* Total number of bytes transferred so far */
+ size_t nbytes_xfer_advance; /* Number of bytes transferred in a single I/O operation */
+ size_t nbytes_toxfer; /* Number of bytes to transfer a particular time */
+ char dname[64];
+ off_t dset_offset = 0; /*dataset offset in a file */
+ off_t bytes_begin[2]; /*first elmt this process transfer */
+ off_t bytes_count; /*number of elmts this process transfer */
+ off_t snbytes = 0; /*size of a side of the dataset square */
+ unsigned char *buf_p; /* Current buffer pointer */
/* POSIX variables */
- off_t file_offset; /* File offset of the next transfer */
- off_t file_offset_advance; /* File offset advance after each I/O operation */
- off_t posix_file_offset; /* Base file offset of the next transfer */
+ off_t file_offset; /* File offset of the next transfer */
+ off_t file_offset_advance; /* File offset advance after each I/O operation */
+ off_t posix_file_offset; /* Base file offset of the next transfer */
/* MPI variables */
- MPI_Offset mpi_file_offset; /* Base file offset of the next transfer*/
- MPI_Offset mpi_offset; /* Offset in MPI file */
- MPI_Offset mpi_offset_advance; /* Offset advance after each I/O operation */
- MPI_Datatype mpi_file_type; /* MPI derived type for 1D file */
- MPI_Datatype mpi_blk_type; /* MPI derived type for 1D buffer */
- MPI_Datatype mpi_cont_type; /* MPI derived type for 2D contiguous file */
- MPI_Datatype mpi_partial_buffer_cont; /* MPI derived type for partial 2D contiguous buffer */
- MPI_Datatype mpi_inter_type; /* MPI derived type for 2D interleaved file */
- MPI_Datatype mpi_partial_buffer_inter; /* MPI derived type for partial 2D interleaved buffer */
- MPI_Datatype mpi_full_buffer; /* MPI derived type for 2D full buffer */
- MPI_Datatype mpi_full_chunk; /* MPI derived type for 2D full chunk */
- MPI_Datatype mpi_chunk_inter_type; /* MPI derived type for 2D chunk interleaved file */
- MPI_Datatype mpi_collective_type; /* Generic MPI derived type for 2D collective access */
- MPI_Status mpi_status;
- int mrc; /* MPI return code */
+ MPI_Offset mpi_file_offset; /* Base file offset of the next transfer*/
+ MPI_Offset mpi_offset; /* Offset in MPI file */
+ MPI_Offset mpi_offset_advance; /* Offset advance after each I/O operation */
+ MPI_Datatype mpi_file_type; /* MPI derived type for 1D file */
+ MPI_Datatype mpi_blk_type; /* MPI derived type for 1D buffer */
+ MPI_Datatype mpi_cont_type; /* MPI derived type for 2D contiguous file */
+ MPI_Datatype mpi_partial_buffer_cont; /* MPI derived type for partial 2D contiguous buffer */
+ MPI_Datatype mpi_inter_type; /* MPI derived type for 2D interleaved file */
+ MPI_Datatype mpi_partial_buffer_inter; /* MPI derived type for partial 2D interleaved buffer */
+ MPI_Datatype mpi_full_buffer; /* MPI derived type for 2D full buffer */
+ MPI_Datatype mpi_full_chunk; /* MPI derived type for 2D full chunk */
+ MPI_Datatype mpi_chunk_inter_type; /* MPI derived type for 2D chunk interleaved file */
+ MPI_Datatype mpi_collective_type; /* Generic MPI derived type for 2D collective access */
+ MPI_Status mpi_status;
+ int mrc; /* MPI return code */
/* HDF5 variables */
- herr_t hrc; /*HDF5 return code */
- hsize_t h5dims[2]; /*dataset dim sizes */
- hid_t h5dset_space_id = -1; /*dataset space ID */
- hid_t h5mem_space_id = -1; /*memory dataspace ID */
- hid_t h5ds_id = -1; /*dataset handle */
- hsize_t h5block[2]; /*dataspace selection */
- hsize_t h5stride[2];
- hsize_t h5count[2];
- hsize_t h5start[2];
- hssize_t h5offset[2]; /* Selection offset within dataspace */
- hid_t h5dcpl = -1; /* Dataset creation property list */
- hid_t h5dxpl = -1; /* Dataset transfer property list */
+ herr_t hrc; /*HDF5 return code */
+ hsize_t h5dims[2]; /*dataset dim sizes */
+ hid_t h5dset_space_id = H5I_INVALID_HID; /*dataset space ID */
+ hid_t h5mem_space_id = H5I_INVALID_HID; /*memory dataspace ID */
+ hid_t h5ds_id = H5I_INVALID_HID; /*dataset handle */
+ hsize_t h5block[2]; /*dataspace selection */
+ hsize_t h5stride[2];
+ hsize_t h5count[2];
+ hsize_t h5start[2];
+ hssize_t h5offset[2]; /* Selection offset within dataspace */
+ hid_t h5dcpl = H5I_INVALID_HID; /* Dataset creation property list */
+ hid_t h5dxpl = H5I_INVALID_HID; /* Dataset transfer property list */
/* Get the parameters from the parameter block */
- blk_size=parms->blk_size;
+ blk_size = parms->blk_size;
/* There are two kinds of transfer patterns, contiguous and interleaved.
* Let 0,1,2,...,n be data accessed by process 0,1,2,...,n
@@ -577,48 +567,47 @@ do_write(results *res, file_descr *fd, parameters *parms, long ndsets,
*/
/* 1D dataspace */
- if (!parms->dim2d){
+ if (!parms->dim2d) {
/* Contiguous Pattern: */
if (!parms->interleaved) {
- bytes_begin[0] = (off_t)(((double)nbytes*pio_mpi_rank_g)/pio_mpi_nprocs_g);
+ bytes_begin[0] = (off_t)(((double)nbytes * pio_mpi_rank_g) / pio_mpi_nprocs_g);
} /* end if */
/* Interleaved Pattern: */
else {
- bytes_begin[0] = (off_t)(blk_size*pio_mpi_rank_g);
+ bytes_begin[0] = (off_t)(blk_size * (size_t)pio_mpi_rank_g);
} /* end else */
/* Prepare buffer for verifying data */
if (parms->verify)
- memset(buffer,pio_mpi_rank_g+1,buf_size);
- }/* end if */
+ memset(buffer, pio_mpi_rank_g + 1, buf_size);
+ } /* end if */
/* 2D dataspace */
else {
/* nbytes is always the number of bytes per dataset (1D or 2D). If the
dataspace is 2D, snbytes is the size of a side of the dataset square.
*/
- snbytes = (off_t)sqrt(nbytes);
+ snbytes = sqrto(nbytes);
/* Contiguous Pattern: */
if (!parms->interleaved) {
- bytes_begin[0] = (off_t)((double)snbytes*pio_mpi_rank_g / pio_mpi_nprocs_g);
+ bytes_begin[0] = (off_t)((double)snbytes * pio_mpi_rank_g / pio_mpi_nprocs_g);
bytes_begin[1] = 0;
} /* end if */
/* Interleaved Pattern: */
else {
bytes_begin[0] = 0;
- if(!parms->h5_use_chunks || parms->io_type==PHDF5)
- bytes_begin[1] = (off_t)(blk_size*pio_mpi_rank_g);
+ if (!parms->h5_use_chunks || parms->io_type == PHDF5)
+ bytes_begin[1] = (off_t)(blk_size * (size_t)pio_mpi_rank_g);
else
- bytes_begin[1] = (off_t)(blk_size*blk_size*pio_mpi_rank_g);
+ bytes_begin[1] = (off_t)(blk_size * blk_size * (size_t)pio_mpi_rank_g);
} /* end else */
/* Prepare buffer for verifying data */
if (parms->verify)
- memset(buffer,pio_mpi_rank_g+1,buf_size*blk_size);
+ HDmemset(buffer, pio_mpi_rank_g + 1, buf_size * blk_size);
} /* end else */
-
/* Calculate the total number of bytes (bytes_count) to be
* transferred by this process. It may be different for different
* transfer pattern due to rounding to integral values.
@@ -629,857 +618,899 @@ do_write(results *res, file_descr *fd, parameters *parms, long ndsets,
* This way, it eliminates any rounding errors.
* (This is tricky, don't mess with the formula, rounding errors
* can easily get introduced) */
- bytes_count = (off_t)(((double)nbytes*(pio_mpi_rank_g+1)) / pio_mpi_nprocs_g)
- - (off_t)(((double)nbytes*pio_mpi_rank_g) / pio_mpi_nprocs_g);
+ bytes_count = (off_t)(((double)nbytes * (pio_mpi_rank_g + 1)) / pio_mpi_nprocs_g) -
+ (off_t)(((double)nbytes * pio_mpi_rank_g) / pio_mpi_nprocs_g);
/* debug */
if (pio_debug_level >= 4) {
HDprint_rank(output);
if (!parms->dim2d) {
- HDfprintf(output, "Debug(do_write): "
- "buf_size=%zu, bytes_begin=%" H5_PRINTF_LL_WIDTH "d, bytes_count=%" H5_PRINTF_LL_WIDTH "d\n",
- buf_size, (long long)bytes_begin[0],
- (long long)bytes_count);
- } else {
- HDfprintf(output, "Debug(do_write): "
- "linear buf_size=%zu, bytes_begin=(%" H5_PRINTF_LL_WIDTH "d,%" H5_PRINTF_LL_WIDTH "d), bytes_count=%" H5_PRINTF_LL_WIDTH "d\n",
- buf_size*blk_size, (long long)bytes_begin[0],
- (long long)bytes_begin[1], (long long)bytes_count);
+ HDfprintf(output,
+ "Debug(do_write): "
+ "buf_size=%zu, bytes_begin=%" H5_PRINTF_LL_WIDTH "d, bytes_count=%" H5_PRINTF_LL_WIDTH
+ "d\n",
+ buf_size, (long long)bytes_begin[0], (long long)bytes_count);
+ }
+ else {
+ HDfprintf(output,
+ "Debug(do_write): "
+ "linear buf_size=%zu, bytes_begin=(%" H5_PRINTF_LL_WIDTH "d,%" H5_PRINTF_LL_WIDTH
+ "d), bytes_count=%" H5_PRINTF_LL_WIDTH "d\n",
+ buf_size * blk_size, (long long)bytes_begin[0], (long long)bytes_begin[1],
+ (long long)bytes_count);
}
}
/* I/O Access specific setup */
switch (parms->io_type) {
- case POSIXIO:
- /* No extra setup */
- break;
-
- case MPIO: /* MPI-I/O setup */
- /* 1D dataspace */
- if (!parms->dim2d){
- /* Build block's derived type */
- mrc = MPI_Type_contiguous((int)blk_size,
- MPI_BYTE, &mpi_blk_type);
- VRFY((mrc==MPI_SUCCESS), "MPIO_TYPE_CREATE");
-
- /* Build file's derived type */
- mrc = MPI_Type_vector((int)(buf_size/blk_size), (int)1,
- (int)pio_mpi_nprocs_g, mpi_blk_type, &mpi_file_type);
- VRFY((mrc==MPI_SUCCESS), "MPIO_TYPE_CREATE");
-
- /* Commit file type */
- mrc = MPI_Type_commit( &mpi_file_type );
- VRFY((mrc==MPI_SUCCESS), "MPIO_TYPE_COMMIT");
-
- /* Commit buffer type */
- mrc = MPI_Type_commit( &mpi_blk_type );
- VRFY((mrc==MPI_SUCCESS), "MPIO_TYPE_COMMIT");
- } /* end if */
- /* 2D dataspace */
- else {
- /* Build partial buffer derived type for contiguous access */
-
- mrc = MPI_Type_contiguous((int)buf_size, MPI_BYTE,
- &mpi_partial_buffer_cont);
- VRFY((mrc==MPI_SUCCESS), "MPIO_TYPE_CREATE");
-
- /* Commit partial buffer derived type */
- mrc = MPI_Type_commit(&mpi_partial_buffer_cont);
- VRFY((mrc==MPI_SUCCESS), "MPIO_TYPE_COMMIT");
-
- /* Build contiguous file's derived type */
- mrc = MPI_Type_vector((int)blk_size, (int)1, (int)(snbytes/buf_size),
- mpi_partial_buffer_cont, &mpi_cont_type);
- VRFY((mrc==MPI_SUCCESS), "MPIO_TYPE_CREATE");
-
- /* Commit contiguous file type */
- mrc = MPI_Type_commit(&mpi_cont_type);
- VRFY((mrc==MPI_SUCCESS), "MPIO_TYPE_COMMIT");
-
- /* Build partial buffer derived type for interleaved access */
- mrc = MPI_Type_contiguous((int)blk_size, MPI_BYTE,
- &mpi_partial_buffer_inter);
- VRFY((mrc==MPI_SUCCESS), "MPIO_TYPE_CREATE");
-
- /* Commit partial buffer derived type */
- mrc = MPI_Type_commit(&mpi_partial_buffer_inter);
- VRFY((mrc==MPI_SUCCESS), "MPIO_TYPE_COMMIT");
-
- /* Build interleaved file's derived type */
- mrc = MPI_Type_vector((int)buf_size, (int)1, (int)(snbytes/blk_size),
- mpi_partial_buffer_inter, &mpi_inter_type);
- VRFY((mrc==MPI_SUCCESS), "MPIO_TYPE_CREATE");
-
- /* Commit interleaved file type */
- mrc = MPI_Type_commit(&mpi_inter_type);
- VRFY((mrc==MPI_SUCCESS), "MPIO_TYPE_COMMIT");
-
- /* Build full buffer derived type */
- mrc = MPI_Type_contiguous((int)(blk_size*buf_size), MPI_BYTE,
- &mpi_full_buffer);
- VRFY((mrc==MPI_SUCCESS), "MPIO_TYPE_CREATE");
-
- /* Commit full buffer derived type */
- mrc = MPI_Type_commit(&mpi_full_buffer);
- VRFY((mrc==MPI_SUCCESS), "MPIO_TYPE_COMMIT");
-
- /* Build full chunk derived type */
- mrc = MPI_Type_contiguous((int)(blk_size*blk_size), MPI_BYTE,
- &mpi_full_chunk);
- VRFY((mrc==MPI_SUCCESS), "MPIO_TYPE_CREATE");
-
- /* Commit full chunk derived type */
- mrc = MPI_Type_commit(&mpi_full_chunk);
- VRFY((mrc==MPI_SUCCESS), "MPIO_TYPE_COMMIT");
-
- /* Build chunk interleaved file's derived type */
- mrc = MPI_Type_vector((int)(buf_size/blk_size), (int)1, (int)(snbytes/blk_size),
- mpi_full_chunk, &mpi_chunk_inter_type);
- VRFY((mrc==MPI_SUCCESS), "MPIO_TYPE_CREATE");
-
- /* Commit chunk interleaved file type */
- mrc = MPI_Type_commit(&mpi_chunk_inter_type);
- VRFY((mrc==MPI_SUCCESS), "MPIO_TYPE_COMMIT");
-
- } /* end else */
- break;
-
- case PHDF5: /* HDF5 setup */
- /* 1D dataspace */
- if (!parms->dim2d){
- if(nbytes>0) {
- /* define a contiguous dataset of nbytes native bytes */
- h5dims[0] = nbytes;
- h5dset_space_id = H5Screate_simple(1, h5dims, NULL);
- VRFY((h5dset_space_id >= 0), "H5Screate_simple");
-
- /* Set up the file dset space id to select the pattern to access */
- if (!parms->interleaved){
- /* Contiguous pattern */
- h5start[0] = bytes_begin[0];
- h5stride[0] = h5block[0] = blk_size;
- h5count[0] = buf_size/blk_size;
- } /* end if */
- else {
- /* Interleaved access pattern */
- /* Skip offset over blocks of other processes */
- h5start[0] = bytes_begin[0];
- h5stride[0] = blk_size*pio_mpi_nprocs_g;
- h5block[0] = blk_size;
- h5count[0] = buf_size/blk_size;
- } /* end else */
- hrc = H5Sselect_hyperslab(h5dset_space_id, H5S_SELECT_SET,
- h5start, h5stride, h5count, h5block);
- VRFY((hrc >= 0), "H5Sselect_hyperslab");
- } /* end if */
- else {
- h5dset_space_id = H5Screate(H5S_SCALAR);
- VRFY((h5dset_space_id >= 0), "H5Screate");
- } /* end else */
+ case POSIXIO:
+ /* No extra setup */
+ break;
- /* Create the memory dataspace that corresponds to the xfer buffer */
- if(buf_size>0) {
- h5dims[0] = buf_size;
- h5mem_space_id = H5Screate_simple(1, h5dims, NULL);
- VRFY((h5mem_space_id >= 0), "H5Screate_simple");
- } /* end if */
- else {
- h5mem_space_id = H5Screate(H5S_SCALAR);
- VRFY((h5mem_space_id >= 0), "H5Screate");
- } /* end else */
- } /* end if */
- /* 2D dataspace */
- else {
- if(nbytes>0) {
- /* define a contiguous dataset of nbytes native bytes */
- h5dims[0] = snbytes;
- h5dims[1] = snbytes;
- h5dset_space_id = H5Screate_simple(2, h5dims, NULL);
- VRFY((h5dset_space_id >= 0), "H5Screate_simple");
-
- /* Set up the file dset space id to select the pattern to access */
- if (!parms->interleaved){
- /* Contiguous pattern */
- h5start[0] = bytes_begin[0];
- h5start[1] = bytes_begin[1];
- h5stride[0] = 1;
- h5stride[1] = h5block[0] = h5block[1] = blk_size;
- h5count[0] = 1;
- h5count[1] = buf_size/blk_size;
- } /* end if */
- else {
- /* Interleaved access pattern */
- /* Skip offset over blocks of other processes */
- h5start[0] = bytes_begin[0];
- h5start[1] = bytes_begin[1];
- h5stride[0] = blk_size;
- h5stride[1] = blk_size*pio_mpi_nprocs_g;
- h5block[0] = h5block[1] = blk_size;
- h5count[0] = buf_size/blk_size;
- h5count[1] = 1;
- } /* end else */
- hrc = H5Sselect_hyperslab(h5dset_space_id, H5S_SELECT_SET,
- h5start, h5stride, h5count, h5block);
- VRFY((hrc >= 0), "H5Sselect_hyperslab");
+ case MPIO: /* MPI-I/O setup */
+ /* 1D dataspace */
+ if (!parms->dim2d) {
+ /* Build block's derived type */
+ mrc = MPI_Type_contiguous((int)blk_size, MPI_BYTE, &mpi_blk_type);
+ VRFY((mrc == MPI_SUCCESS), "MPIO_TYPE_CREATE");
+
+ /* Build file's derived type */
+ mrc = MPI_Type_vector((int)(buf_size / blk_size), (int)1, (int)pio_mpi_nprocs_g, mpi_blk_type,
+ &mpi_file_type);
+ VRFY((mrc == MPI_SUCCESS), "MPIO_TYPE_CREATE");
+
+ /* Commit file type */
+ mrc = MPI_Type_commit(&mpi_file_type);
+ VRFY((mrc == MPI_SUCCESS), "MPIO_TYPE_COMMIT");
+
+ /* Commit buffer type */
+ mrc = MPI_Type_commit(&mpi_blk_type);
+ VRFY((mrc == MPI_SUCCESS), "MPIO_TYPE_COMMIT");
} /* end if */
+ /* 2D dataspace */
else {
- h5dset_space_id = H5Screate(H5S_SCALAR);
- VRFY((h5dset_space_id >= 0), "H5Screate");
- } /* end else */
+ /* Build partial buffer derived type for contiguous access */
- /* Create the memory dataspace that corresponds to the xfer buffer */
- if(buf_size>0) {
- if (!parms->interleaved){
- h5dims[0] = blk_size;
- h5dims[1] = buf_size;
- }else{
- h5dims[0] = buf_size;
- h5dims[1] = blk_size;
- }
- h5mem_space_id = H5Screate_simple(2, h5dims, NULL);
- VRFY((h5mem_space_id >= 0), "H5Screate_simple");
- } /* end if */
- else {
- h5mem_space_id = H5Screate(H5S_SCALAR);
- VRFY((h5mem_space_id >= 0), "H5Screate");
- } /* end else */
- } /* end else */
+ mrc = MPI_Type_contiguous((int)buf_size, MPI_BYTE, &mpi_partial_buffer_cont);
+ VRFY((mrc == MPI_SUCCESS), "MPIO_TYPE_CREATE");
- /* Create the dataset transfer property list */
- h5dxpl = H5Pcreate(H5P_DATASET_XFER);
- if (h5dxpl < 0) {
- fprintf(stderr, "HDF5 Property List Create failed\n");
- GOTOERROR(FAIL);
- }
+ /* Commit partial buffer derived type */
+ mrc = MPI_Type_commit(&mpi_partial_buffer_cont);
+ VRFY((mrc == MPI_SUCCESS), "MPIO_TYPE_COMMIT");
- /* Change to collective I/O, if asked */
- if(parms->collective) {
- hrc = H5Pset_dxpl_mpio(h5dxpl, H5FD_MPIO_COLLECTIVE);
- if (hrc < 0) {
- fprintf(stderr, "HDF5 Property List Set failed\n");
- GOTOERROR(FAIL);
- } /* end if */
- } /* end if */
- break;
- } /* end switch */
+ /* Build contiguous file's derived type */
+ mrc = MPI_Type_vector((int)blk_size, (int)1, (int)((size_t)snbytes / buf_size),
+ mpi_partial_buffer_cont, &mpi_cont_type);
+ VRFY((mrc == MPI_SUCCESS), "MPIO_TYPE_CREATE");
- for (ndset = 1; ndset <= ndsets; ++ndset) {
+ /* Commit contiguous file type */
+ mrc = MPI_Type_commit(&mpi_cont_type);
+ VRFY((mrc == MPI_SUCCESS), "MPIO_TYPE_COMMIT");
- /* Calculate dataset offset within a file */
+ /* Build partial buffer derived type for interleaved access */
+ mrc = MPI_Type_contiguous((int)blk_size, MPI_BYTE, &mpi_partial_buffer_inter);
+ VRFY((mrc == MPI_SUCCESS), "MPIO_TYPE_CREATE");
- /* create dataset */
- switch (parms->io_type) {
- case POSIXIO:
- case MPIO:
- /* both posix and mpi io just need dataset offset in file*/
- dset_offset = (ndset - 1) * nbytes;
- break;
+ /* Commit partial buffer derived type */
+ mrc = MPI_Type_commit(&mpi_partial_buffer_inter);
+ VRFY((mrc == MPI_SUCCESS), "MPIO_TYPE_COMMIT");
- case PHDF5:
- h5dcpl = H5Pcreate(H5P_DATASET_CREATE);
- if (h5dcpl < 0) {
- fprintf(stderr, "HDF5 Property List Create failed\n");
- GOTOERROR(FAIL);
- }
- /* 1D dataspace */
- if (!parms->dim2d){
- /* Make the dataset chunked if asked */
- if(parms->h5_use_chunks) {
- /* Set the chunk size to be the same as the buffer size */
- h5dims[0] = blk_size;
- hrc = H5Pset_chunk(h5dcpl, 1, h5dims);
- if (hrc < 0) {
- fprintf(stderr, "HDF5 Property List Set failed\n");
- GOTOERROR(FAIL);
- } /* end if */
- } /* end if */
- }/* end if */
- else{
- /* 2D dataspace */
- if(parms->h5_use_chunks) {
- /* Set the chunk size to be the same as the block size */
- h5dims[0] = blk_size;
- h5dims[1] = blk_size;
- hrc = H5Pset_chunk(h5dcpl, 2, h5dims);
- if (hrc < 0) {
- fprintf(stderr, "HDF5 Property List Set failed\n");
- GOTOERROR(FAIL);
- } /* end if */
- } /* end if */
- }/* end else */
+ /* Build interleaved file's derived type */
+ mrc = MPI_Type_vector((int)buf_size, (int)1, (int)((size_t)snbytes / blk_size),
+ mpi_partial_buffer_inter, &mpi_inter_type);
+ VRFY((mrc == MPI_SUCCESS), "MPIO_TYPE_CREATE");
- sprintf(dname, "Dataset_%ld", ndset);
- h5ds_id = H5DCREATE(fd->h5fd, dname, ELMT_H5_TYPE,
- h5dset_space_id, h5dcpl);
+ /* Commit interleaved file type */
+ mrc = MPI_Type_commit(&mpi_inter_type);
+ VRFY((mrc == MPI_SUCCESS), "MPIO_TYPE_COMMIT");
- if (h5ds_id < 0) {
- fprintf(stderr, "HDF5 Dataset Create failed\n");
- GOTOERROR(FAIL);
- }
+ /* Build full buffer derived type */
+ mrc = MPI_Type_contiguous((int)(blk_size * buf_size), MPI_BYTE, &mpi_full_buffer);
+ VRFY((mrc == MPI_SUCCESS), "MPIO_TYPE_CREATE");
- hrc = H5Pclose(h5dcpl);
- /* verifying the close of the dcpl */
- if (hrc < 0) {
- fprintf(stderr, "HDF5 Property List Close failed\n");
- GOTOERROR(FAIL);
- }
- break;
- }
+ /* Commit full buffer derived type */
+ mrc = MPI_Type_commit(&mpi_full_buffer);
+ VRFY((mrc == MPI_SUCCESS), "MPIO_TYPE_COMMIT");
- /* The task is to transfer bytes_count bytes, starting at
- * bytes_begin position, using transfer buffer of buf_size bytes.
- * If interleaved, select buf_size at a time, in round robin
- * fashion, according to number of process. Otherwise, select
- * all bytes_count in contiguous.
- */
- nbytes_xfer = 0 ;
+ /* Build full chunk derived type */
+ mrc = MPI_Type_contiguous((int)(blk_size * blk_size), MPI_BYTE, &mpi_full_chunk);
+ VRFY((mrc == MPI_SUCCESS), "MPIO_TYPE_CREATE");
- /* 1D dataspace */
- if (!parms->dim2d){
- /* Set base file offset for all I/O patterns and POSIX access */
- posix_file_offset = dset_offset + bytes_begin[0];
+ /* Commit full chunk derived type */
+ mrc = MPI_Type_commit(&mpi_full_chunk);
+ VRFY((mrc == MPI_SUCCESS), "MPIO_TYPE_COMMIT");
- /* Set base file offset for all I/O patterns and MPI access */
- mpi_file_offset = (MPI_Offset)(dset_offset + bytes_begin[0]);
- } /* end if */
- else {
- /* Set base file offset for all I/O patterns and POSIX access */
- posix_file_offset=dset_offset + bytes_begin[0]*snbytes+
- bytes_begin[1];
+ /* Build chunk interleaved file's derived type */
+ mrc = MPI_Type_vector((int)(buf_size / blk_size), (int)1, (int)((size_t)snbytes / blk_size),
+ mpi_full_chunk, &mpi_chunk_inter_type);
+ VRFY((mrc == MPI_SUCCESS), "MPIO_TYPE_CREATE");
- /* Set base file offset for all I/O patterns and MPI access */
- mpi_file_offset=(MPI_Offset)(dset_offset + bytes_begin[0]*snbytes+
- bytes_begin[1]);
- } /* end else */
+ /* Commit chunk interleaved file type */
+ mrc = MPI_Type_commit(&mpi_chunk_inter_type);
+ VRFY((mrc == MPI_SUCCESS), "MPIO_TYPE_COMMIT");
- /* Start "raw data" write timer */
- set_time(res->timers, HDF5_RAW_WRITE_FIXED_DIMS, TSTART);
+ } /* end else */
+ break;
- while (nbytes_xfer < bytes_count){
- /* Write */
- /* Calculate offset of write within a dataset/file */
- switch (parms->io_type) {
- case POSIXIO:
+ case PHDF5: /* HDF5 setup */
/* 1D dataspace */
- if (!parms->dim2d){
- /* Contiguous pattern */
- if (!parms->interleaved) {
- /* Compute file offset */
- file_offset = posix_file_offset + (off_t)nbytes_xfer;
-
- /* only care if seek returns error */
- rc = POSIXSEEK(fd->posixfd, file_offset) < 0 ? -1 : 0;
- VRFY((rc==0), "POSIXSEEK");
-
- /* check if all bytes are written */
- rc = ((ssize_t)buf_size ==
- POSIXWRITE(fd->posixfd, buffer, buf_size));
- VRFY((rc != 0), "POSIXWRITE");
-
- /* Advance global offset in dataset */
- nbytes_xfer+=buf_size;
+ if (!parms->dim2d) {
+ if (nbytes > 0) {
+ /* define a contiguous dataset of nbytes native bytes */
+ h5dims[0] = (hsize_t)nbytes;
+ h5dset_space_id = H5Screate_simple(1, h5dims, NULL);
+ VRFY((h5dset_space_id >= 0), "H5Screate_simple");
+
+ /* Set up the file dset space id to select the pattern to access */
+ if (!parms->interleaved) {
+ /* Contiguous pattern */
+ h5start[0] = (hsize_t)bytes_begin[0];
+ h5stride[0] = h5block[0] = blk_size;
+ h5count[0] = buf_size / blk_size;
+ } /* end if */
+ else {
+ /* Interleaved access pattern */
+ /* Skip offset over blocks of other processes */
+ h5start[0] = (hsize_t)bytes_begin[0];
+ h5stride[0] = blk_size * (size_t)pio_mpi_nprocs_g;
+ h5block[0] = blk_size;
+ h5count[0] = buf_size / blk_size;
+ } /* end else */
+ hrc = H5Sselect_hyperslab(h5dset_space_id, H5S_SELECT_SET, h5start, h5stride, h5count,
+ h5block);
+ VRFY((hrc >= 0), "H5Sselect_hyperslab");
} /* end if */
- /* Interleaved access pattern */
else {
- /* Set the base of user's buffer */
- buf_p=(unsigned char *)buffer;
-
- /* Set the number of bytes to transfer this time */
- nbytes_toxfer = buf_size;
-
- /* Loop over the buffers to write */
- while(nbytes_toxfer>0) {
- /* Skip offset over blocks of other processes */
- file_offset = posix_file_offset +
- (off_t)(nbytes_xfer*pio_mpi_nprocs_g);
-
- /* only care if seek returns error */
- rc = POSIXSEEK(fd->posixfd, file_offset) < 0 ? -1 : 0;
- VRFY((rc==0), "POSIXSEEK");
-
- /* check if all bytes are written */
- rc = ((ssize_t)blk_size ==
- POSIXWRITE(fd->posixfd, buf_p, blk_size));
- VRFY((rc != 0), "POSIXWRITE");
-
- /* Advance location in buffer */
- buf_p+=blk_size;
-
- /* Advance global offset in dataset */
- nbytes_xfer+=blk_size;
+ h5dset_space_id = H5Screate(H5S_SCALAR);
+ VRFY((h5dset_space_id >= 0), "H5Screate");
+ } /* end else */
- /* Decrement number of bytes left this time */
- nbytes_toxfer-=blk_size;
- } /* end while */
+ /* Create the memory dataspace that corresponds to the xfer buffer */
+ if (buf_size > 0) {
+ h5dims[0] = buf_size;
+ h5mem_space_id = H5Screate_simple(1, h5dims, NULL);
+ VRFY((h5mem_space_id >= 0), "H5Screate_simple");
+ } /* end if */
+ else {
+ h5mem_space_id = H5Screate(H5S_SCALAR);
+ VRFY((h5mem_space_id >= 0), "H5Screate");
} /* end else */
- } /* end if */
+ } /* end if */
/* 2D dataspace */
else {
- /* Contiguous storage */
- if (!parms->h5_use_chunks) {
- /* Contiguous access pattern */
+ if (nbytes > 0) {
+ /* define a contiguous dataset of nbytes native bytes */
+ h5dims[0] = (hsize_t)snbytes;
+ h5dims[1] = (hsize_t)snbytes;
+ h5dset_space_id = H5Screate_simple(2, h5dims, NULL);
+ VRFY((h5dset_space_id >= 0), "H5Screate_simple");
+
+ /* Set up the file dset space id to select the pattern to access */
if (!parms->interleaved) {
- /* Compute file offset */
- file_offset=posix_file_offset+(off_t)(((nbytes_xfer/blk_size)
- /snbytes)*(blk_size*snbytes)+((nbytes_xfer/blk_size)%snbytes));
-
- /* Number of bytes to be transferred per I/O operation */
- nbytes_xfer_advance = buf_size;
-
- /* Global offset advance after each I/O operation */
- file_offset_advance = (off_t)snbytes;
+ /* Contiguous pattern */
+ h5start[0] = (hsize_t)bytes_begin[0];
+ h5start[1] = (hsize_t)bytes_begin[1];
+ h5stride[0] = 1;
+ h5stride[1] = h5block[0] = h5block[1] = blk_size;
+ h5count[0] = 1;
+ h5count[1] = buf_size / blk_size;
} /* end if */
- /* Interleaved access pattern */
else {
- /* Compute file offset */
- file_offset=posix_file_offset+(off_t)((((nbytes_xfer/buf_size)
- *pio_mpi_nprocs_g)/snbytes)*(buf_size*snbytes)
- +((nbytes_xfer/buf_size)*pio_mpi_nprocs_g)%snbytes);
-
- /* Number of bytes to be transferred per I/O operation */
- nbytes_xfer_advance = blk_size;
-
- /* Global offset advance after each I/O operation */
- file_offset_advance = (off_t)snbytes;
+ /* Interleaved access pattern */
+ /* Skip offset over blocks of other processes */
+ h5start[0] = (hsize_t)bytes_begin[0];
+ h5start[1] = (hsize_t)bytes_begin[1];
+ h5stride[0] = blk_size;
+ h5stride[1] = blk_size * (size_t)pio_mpi_nprocs_g;
+ h5block[0] = h5block[1] = blk_size;
+ h5count[0] = buf_size / blk_size;
+ h5count[1] = 1;
} /* end else */
+ hrc = H5Sselect_hyperslab(h5dset_space_id, H5S_SELECT_SET, h5start, h5stride, h5count,
+ h5block);
+ VRFY((hrc >= 0), "H5Sselect_hyperslab");
} /* end if */
- /* Chunked storage */
else {
- /*Contiguous access pattern */
- if (!parms->interleaved) {
- /* Compute file offset */
- file_offset=posix_file_offset+(off_t)nbytes_xfer;
-
- /* Number of bytes to be transferred per I/O operation */
- nbytes_xfer_advance = blk_size * buf_size;
+ h5dset_space_id = H5Screate(H5S_SCALAR);
+ VRFY((h5dset_space_id >= 0), "H5Screate");
+ } /* end else */
- /* Global offset advance after each I/O operation */
- file_offset_advance = 0;
- } /* end if */
- /*Interleaved access pattern */
+ /* Create the memory dataspace that corresponds to the xfer buffer */
+ if (buf_size > 0) {
+ if (!parms->interleaved) {
+ h5dims[0] = blk_size;
+ h5dims[1] = buf_size;
+ }
else {
- /* Compute file offset */
- /* Before simplification */
- /* file_offset=posix_file_offset+(off_t)((nbytes_xfer/(buf_size/blk_size)
- *pio_mpi_nprocs_g)/(snbytes/blk_size*(blk_size*blk_size))*(buf_size/blk_size
- *snbytes/blk_size*(blk_size*blk_size))+((nbytes_xfer/(buf_size/blk_size))
- *pio_mpi_nprocs_g)%(snbytes/blk_size*(blk_size*blk_size))); */
-
- file_offset=posix_file_offset+(off_t)(((nbytes_xfer/(buf_size/blk_size)
- *pio_mpi_nprocs_g)/(snbytes*blk_size))*(buf_size*snbytes)+((nbytes_xfer/(buf_size/blk_size))
- *pio_mpi_nprocs_g)%(snbytes*blk_size));
-
- /* Number of bytes to be transferred per I/O operation */
- nbytes_xfer_advance = blk_size * blk_size;
-
- /* Global offset advance after each I/O operation */
- /* file_offset_advance = (off_t)(snbytes/blk_size*(blk_size*blk_size)); */
- file_offset_advance = (off_t)(snbytes*blk_size);
- } /* end else */
+ h5dims[0] = buf_size;
+ h5dims[1] = blk_size;
+ }
+ h5mem_space_id = H5Screate_simple(2, h5dims, NULL);
+ VRFY((h5mem_space_id >= 0), "H5Screate_simple");
+ } /* end if */
+ else {
+ h5mem_space_id = H5Screate(H5S_SCALAR);
+ VRFY((h5mem_space_id >= 0), "H5Screate");
} /* end else */
+ } /* end else */
- /* Common code for file access */
+ /* Create the dataset transfer property list */
+ h5dxpl = H5Pcreate(H5P_DATASET_XFER);
+ if (h5dxpl < 0) {
+ HDfprintf(stderr, "HDF5 Property List Create failed\n");
+ GOTOERROR(FAIL);
+ }
- /* Set the base of user's buffer */
- buf_p = (unsigned char *)buffer;
+ /* Change to collective I/O, if asked */
+ if (parms->collective) {
+ hrc = H5Pset_dxpl_mpio(h5dxpl, H5FD_MPIO_COLLECTIVE);
+ if (hrc < 0) {
+ HDfprintf(stderr, "HDF5 Property List Set failed\n");
+ GOTOERROR(FAIL);
+ } /* end if */
+ } /* end if */
+ break;
- /* Set the number of bytes to transfer this time */
- nbytes_toxfer = buf_size*blk_size;
+ default:
+ break;
+ } /* end switch */
- /* Loop over portions of the buffer to write */
- while(nbytes_toxfer>0){
- /* only care if seek returns error */
- rc = POSIXSEEK(fd->posixfd, file_offset) < 0 ? -1 : 0;
- VRFY((rc==0), "POSIXSEEK");
+ for (ndset = 1; ndset <= ndsets; ++ndset) {
- /* check if all bytes are written */
- rc = ((ssize_t)nbytes_xfer_advance ==
- POSIXWRITE(fd->posixfd, buf_p, nbytes_xfer_advance));
- VRFY((rc != 0), "POSIXWRITE");
+ /* Calculate dataset offset within a file */
- /* Advance location in buffer */
- buf_p+=nbytes_xfer_advance;
+ /* create dataset */
+ switch (parms->io_type) {
+ case POSIXIO:
+ case MPIO:
+ /* both posix and mpi io just need dataset offset in file*/
+ dset_offset = (ndset - 1) * nbytes;
+ break;
+
+ case PHDF5:
+ h5dcpl = H5Pcreate(H5P_DATASET_CREATE);
+ if (h5dcpl < 0) {
+ HDfprintf(stderr, "HDF5 Property List Create failed\n");
+ GOTOERROR(FAIL);
+ }
+ /* 1D dataspace */
+ if (!parms->dim2d) {
+ /* Make the dataset chunked if asked */
+ if (parms->h5_use_chunks) {
+ /* Set the chunk size to be the same as the buffer size */
+ h5dims[0] = blk_size;
+ hrc = H5Pset_chunk(h5dcpl, 1, h5dims);
+ if (hrc < 0) {
+ HDfprintf(stderr, "HDF5 Property List Set failed\n");
+ GOTOERROR(FAIL);
+ } /* end if */
+ } /* end if */
+ } /* end if */
+ else {
+ /* 2D dataspace */
+ if (parms->h5_use_chunks) {
+ /* Set the chunk size to be the same as the block size */
+ h5dims[0] = blk_size;
+ h5dims[1] = blk_size;
+ hrc = H5Pset_chunk(h5dcpl, 2, h5dims);
+ if (hrc < 0) {
+ HDfprintf(stderr, "HDF5 Property List Set failed\n");
+ GOTOERROR(FAIL);
+ } /* end if */
+ } /* end if */
+ } /* end else */
+
+ HDsprintf(dname, "Dataset_%ld", ndset);
+ h5ds_id = H5DCREATE(fd->h5fd, dname, ELMT_H5_TYPE, h5dset_space_id, h5dcpl);
+
+ if (h5ds_id < 0) {
+ HDfprintf(stderr, "HDF5 Dataset Create failed\n");
+ GOTOERROR(FAIL);
+ }
- /* Advance global offset in dataset */
- nbytes_xfer+=nbytes_xfer_advance;
+ hrc = H5Pclose(h5dcpl);
+ /* verifying the close of the dcpl */
+ if (hrc < 0) {
+ HDfprintf(stderr, "HDF5 Property List Close failed\n");
+ GOTOERROR(FAIL);
+ }
+ break;
- /* Decrement number of bytes left this time */
- nbytes_toxfer-=nbytes_xfer_advance;
+ default:
+ break;
+ }
- /* Partially advance file offset */
- file_offset+=file_offset_advance;
- } /* end while */
+ /* The task is to transfer bytes_count bytes, starting at
+ * bytes_begin position, using transfer buffer of buf_size bytes.
+ * If interleaved, select buf_size at a time, in round robin
+ * fashion, according to number of process. Otherwise, select
+ * all bytes_count in contiguous.
+ */
+ nbytes_xfer = 0;
- } /* end else */
+ /* 1D dataspace */
+ if (!parms->dim2d) {
+ /* Set base file offset for all I/O patterns and POSIX access */
+ posix_file_offset = dset_offset + bytes_begin[0];
- break;
+ /* Set base file offset for all I/O patterns and MPI access */
+ mpi_file_offset = (MPI_Offset)(dset_offset + bytes_begin[0]);
+ } /* end if */
+ else {
+ /* Set base file offset for all I/O patterns and POSIX access */
+ posix_file_offset = dset_offset + bytes_begin[0] * snbytes + bytes_begin[1];
- case MPIO:
- /* 1D dataspace */
- if (!parms->dim2d){
- /* Independent file access */
- if(!parms->collective) {
- /* Contiguous pattern */
- if (!parms->interleaved){
- /* Compute offset in file */
- mpi_offset = mpi_file_offset +
- nbytes_xfer;
-
- /* Perform independent write */
- mrc = MPI_File_write_at(fd->mpifd, mpi_offset, buffer,
- (int)(buf_size/blk_size), mpi_blk_type,
- &mpi_status);
- VRFY((mrc==MPI_SUCCESS), "MPIO_WRITE");
-
- /* Advance global offset in dataset */
- nbytes_xfer+=buf_size;
- } /* end if */
- /* Interleaved access pattern */
+ /* Set base file offset for all I/O patterns and MPI access */
+ mpi_file_offset = (MPI_Offset)(dset_offset + bytes_begin[0] * snbytes + bytes_begin[1]);
+ } /* end else */
+
+ /* Start "raw data" write timer */
+ io_time_set(res->timers, HDF5_RAW_WRITE_FIXED_DIMS, TSTART);
+
+ while (nbytes_xfer < bytes_count) {
+ /* Write */
+ /* Calculate offset of write within a dataset/file */
+ switch (parms->io_type) {
+ case POSIXIO:
+ /* 1D dataspace */
+ if (!parms->dim2d) {
+ /* Contiguous pattern */
+ if (!parms->interleaved) {
+ /* Compute file offset */
+ file_offset = posix_file_offset + (off_t)nbytes_xfer;
+
+ /* only care if seek returns error */
+ rc = POSIXSEEK(fd->posixfd, file_offset) < 0 ? -1 : 0;
+ VRFY((rc == 0), "POSIXSEEK");
+
+ /* check if all bytes are written */
+ rc = ((ssize_t)buf_size == POSIXWRITE(fd->posixfd, buffer, buf_size));
+ VRFY((rc != 0), "POSIXWRITE");
+
+ /* Advance global offset in dataset */
+ nbytes_xfer += (ssize_t)buf_size;
+ } /* end if */
+ /* Interleaved access pattern */
+ else {
+ /* Set the base of user's buffer */
+ buf_p = (unsigned char *)buffer;
+
+ /* Set the number of bytes to transfer this time */
+ nbytes_toxfer = buf_size;
+
+ /* Loop over the buffers to write */
+ while (nbytes_toxfer > 0) {
+ /* Skip offset over blocks of other processes */
+ file_offset = posix_file_offset + (off_t)(nbytes_xfer * pio_mpi_nprocs_g);
+
+ /* only care if seek returns error */
+ rc = POSIXSEEK(fd->posixfd, file_offset) < 0 ? -1 : 0;
+ VRFY((rc == 0), "POSIXSEEK");
+
+ /* check if all bytes are written */
+ rc = ((ssize_t)blk_size == POSIXWRITE(fd->posixfd, buf_p, blk_size));
+ VRFY((rc != 0), "POSIXWRITE");
+
+ /* Advance location in buffer */
+ buf_p += blk_size;
+
+ /* Advance global offset in dataset */
+ nbytes_xfer += (ssize_t)blk_size;
+
+ /* Decrement number of bytes left this time */
+ nbytes_toxfer -= blk_size;
+ } /* end while */
+ } /* end else */
+ } /* end if */
+ /* 2D dataspace */
else {
+ /* Contiguous storage */
+ if (!parms->h5_use_chunks) {
+ /* Contiguous access pattern */
+ if (!parms->interleaved) {
+ /* Compute file offset */
+ file_offset = posix_file_offset +
+ (off_t)((((size_t)nbytes_xfer / blk_size) / (size_t)snbytes) *
+ (blk_size * (size_t)snbytes) +
+ (((size_t)nbytes_xfer / blk_size) % (size_t)snbytes));
+
+ /* Number of bytes to be transferred per I/O operation */
+ nbytes_xfer_advance = buf_size;
+
+ /* Global offset advance after each I/O operation */
+ file_offset_advance = (off_t)snbytes;
+ } /* end if */
+ /* Interleaved access pattern */
+ else {
+ /* Compute file offset */
+ file_offset =
+ posix_file_offset +
+ (off_t)(((((size_t)nbytes_xfer / buf_size) * (size_t)pio_mpi_nprocs_g) /
+ (size_t)snbytes) *
+ (buf_size * (size_t)snbytes) +
+ (((size_t)nbytes_xfer / buf_size) * (size_t)pio_mpi_nprocs_g) %
+ (size_t)snbytes);
+
+ /* Number of bytes to be transferred per I/O operation */
+ nbytes_xfer_advance = blk_size;
+
+ /* Global offset advance after each I/O operation */
+ file_offset_advance = (off_t)snbytes;
+ } /* end else */
+ } /* end if */
+ /* Chunked storage */
+ else {
+ /*Contiguous access pattern */
+ if (!parms->interleaved) {
+ /* Compute file offset */
+ file_offset = posix_file_offset + (off_t)nbytes_xfer;
+
+ /* Number of bytes to be transferred per I/O operation */
+ nbytes_xfer_advance = blk_size * buf_size;
+
+ /* Global offset advance after each I/O operation */
+ file_offset_advance = 0;
+ } /* end if */
+ /*Interleaved access pattern */
+ else {
+ /* Compute file offset */
+ /* Before simplification */
+ /* file_offset=posix_file_offset+(off_t)((nbytes_xfer/(buf_size/blk_size)
+ *pio_mpi_nprocs_g)/(snbytes/blk_size*(blk_size*blk_size))*(buf_size/blk_size
+ *snbytes/blk_size*(blk_size*blk_size))+((nbytes_xfer/(buf_size/blk_size))
+ *pio_mpi_nprocs_g)%(snbytes/blk_size*(blk_size*blk_size))); */
+
+ file_offset = posix_file_offset +
+ (off_t)((((size_t)nbytes_xfer / (buf_size / blk_size) *
+ (size_t)pio_mpi_nprocs_g) /
+ ((size_t)snbytes * blk_size)) *
+ (buf_size * (size_t)snbytes) +
+ (((size_t)nbytes_xfer / (buf_size / blk_size)) *
+ (size_t)pio_mpi_nprocs_g) %
+ ((size_t)snbytes * blk_size));
+
+ /* Number of bytes to be transferred per I/O operation */
+ nbytes_xfer_advance = blk_size * blk_size;
+
+ /* Global offset advance after each I/O operation */
+ /* file_offset_advance = (off_t)(snbytes/blk_size*(blk_size*blk_size)); */
+ file_offset_advance = (off_t)snbytes * (off_t)blk_size;
+ } /* end else */
+ } /* end else */
+
+ /* Common code for file access */
+
/* Set the base of user's buffer */
- buf_p=(unsigned char *)buffer;
+ buf_p = (unsigned char *)buffer;
/* Set the number of bytes to transfer this time */
- nbytes_toxfer = buf_size;
+ nbytes_toxfer = buf_size * blk_size;
- /* Loop over the buffers to write */
- while(nbytes_toxfer>0) {
- /* Skip offset over blocks of other processes */
- mpi_offset = mpi_file_offset +
- (nbytes_xfer*pio_mpi_nprocs_g);
+ /* Loop over portions of the buffer to write */
+ while (nbytes_toxfer > 0) {
+ /* only care if seek returns error */
+ rc = POSIXSEEK(fd->posixfd, file_offset) < 0 ? -1 : 0;
+ VRFY((rc == 0), "POSIXSEEK");
- /* Perform independent write */
- mrc = MPI_File_write_at(fd->mpifd, mpi_offset, buf_p,
- (int)1, mpi_blk_type, &mpi_status);
- VRFY((mrc==MPI_SUCCESS), "MPIO_WRITE");
+ /* check if all bytes are written */
+ rc = ((ssize_t)nbytes_xfer_advance ==
+ POSIXWRITE(fd->posixfd, buf_p, nbytes_xfer_advance));
+ VRFY((rc != 0), "POSIXWRITE");
/* Advance location in buffer */
- buf_p+=blk_size;
+ buf_p += nbytes_xfer_advance;
/* Advance global offset in dataset */
- nbytes_xfer+=blk_size;
+ nbytes_xfer += (ssize_t)nbytes_xfer_advance;
/* Decrement number of bytes left this time */
- nbytes_toxfer-=blk_size;
- } /* end while */
- } /* end else */
- } /* end if */
- /* Collective file access */
- else {
- /* Contiguous access pattern */
- if (!parms->interleaved){
- /* Compute offset in file */
- mpi_offset = mpi_file_offset +
- nbytes_xfer;
-
- /* Perform independent write */
- mrc = MPI_File_write_at_all(fd->mpifd, mpi_offset, buffer,
- (int)(buf_size/blk_size), mpi_blk_type, &mpi_status);
- VRFY((mrc==MPI_SUCCESS), "MPIO_WRITE");
-
- /* Advance global offset in dataset */
- nbytes_xfer+=buf_size;
- } /* end if */
- /* Interleaved access pattern */
- else {
- /* Compute offset in file */
- mpi_offset = mpi_file_offset +
- (nbytes_xfer*pio_mpi_nprocs_g);
-
- /* Set the file view */
- mrc = MPI_File_set_view(fd->mpifd, mpi_offset, mpi_blk_type,
- mpi_file_type, (char*)"native", h5_io_info_g);
- VRFY((mrc==MPI_SUCCESS), "MPIO_VIEW");
-
- /* Perform write */
- mrc = MPI_File_write_at_all(fd->mpifd, 0, buffer,
- (int)(buf_size/blk_size), mpi_blk_type, &mpi_status);
- VRFY((mrc==MPI_SUCCESS), "MPIO_WRITE");
-
- /* Advance global offset in dataset */
- nbytes_xfer+=buf_size;
- } /* end else */
- } /* end else */
- } /* end if */
- /* 2D dataspace */
- else {
- /* Contiguous storage */
- if (!parms->h5_use_chunks) {
- /* Contiguous access pattern */
- if (!parms->interleaved) {
- /* Compute offset in file */
- mpi_offset=mpi_file_offset+((nbytes_xfer/blk_size)/snbytes)*
- (blk_size*snbytes)+((nbytes_xfer/blk_size)%snbytes);
+ nbytes_toxfer -= nbytes_xfer_advance;
- /* Number of bytes to be transferred per I/O operation */
- nbytes_xfer_advance = buf_size;
+ /* Partially advance file offset */
+ file_offset += file_offset_advance;
+ } /* end while */
- /* Global offset advance after each I/O operation */
- mpi_offset_advance = snbytes;
+ } /* end else */
- /* MPI type to be used for collective access */
- mpi_collective_type = mpi_cont_type;
- } /* end if */
- /* Interleaved access pattern */
+ break;
+
+ case MPIO:
+ /* 1D dataspace */
+ if (!parms->dim2d) {
+ /* Independent file access */
+ if (!parms->collective) {
+ /* Contiguous pattern */
+ if (!parms->interleaved) {
+ /* Compute offset in file */
+ mpi_offset = mpi_file_offset + nbytes_xfer;
+
+ /* Perform independent write */
+ mrc =
+ MPI_File_write_at(fd->mpifd, mpi_offset, buffer,
+ (int)(buf_size / blk_size), mpi_blk_type, &mpi_status);
+ VRFY((mrc == MPI_SUCCESS), "MPIO_WRITE");
+
+ /* Advance global offset in dataset */
+ nbytes_xfer += (ssize_t)buf_size;
+ } /* end if */
+ /* Interleaved access pattern */
+ else {
+ /* Set the base of user's buffer */
+ buf_p = (unsigned char *)buffer;
+
+ /* Set the number of bytes to transfer this time */
+ nbytes_toxfer = buf_size;
+
+ /* Loop over the buffers to write */
+ while (nbytes_toxfer > 0) {
+ /* Skip offset over blocks of other processes */
+ mpi_offset = mpi_file_offset + (nbytes_xfer * pio_mpi_nprocs_g);
+
+ /* Perform independent write */
+ mrc = MPI_File_write_at(fd->mpifd, mpi_offset, buf_p, (int)1,
+ mpi_blk_type, &mpi_status);
+ VRFY((mrc == MPI_SUCCESS), "MPIO_WRITE");
+
+ /* Advance location in buffer */
+ buf_p += blk_size;
+
+ /* Advance global offset in dataset */
+ nbytes_xfer += (ssize_t)blk_size;
+
+ /* Decrement number of bytes left this time */
+ nbytes_toxfer -= blk_size;
+ } /* end while */
+ } /* end else */
+ } /* end if */
+ /* Collective file access */
+ else {
+ /* Contiguous access pattern */
+ if (!parms->interleaved) {
+ /* Compute offset in file */
+ mpi_offset = mpi_file_offset + nbytes_xfer;
+
+ /* Perform independent write */
+ mrc = MPI_File_write_at_all(fd->mpifd, mpi_offset, buffer,
+ (int)(buf_size / blk_size), mpi_blk_type,
+ &mpi_status);
+ VRFY((mrc == MPI_SUCCESS), "MPIO_WRITE");
+
+ /* Advance global offset in dataset */
+ nbytes_xfer += (ssize_t)buf_size;
+ } /* end if */
+ /* Interleaved access pattern */
+ else {
+ /* Compute offset in file */
+ mpi_offset = mpi_file_offset + (nbytes_xfer * pio_mpi_nprocs_g);
+
+ /* Set the file view */
+ mrc = MPI_File_set_view(fd->mpifd, mpi_offset, mpi_blk_type, mpi_file_type,
+ (char *)"native", h5_io_info_g);
+ VRFY((mrc == MPI_SUCCESS), "MPIO_VIEW");
+
+ /* Perform write */
+ mrc = MPI_File_write_at_all(fd->mpifd, 0, buffer, (int)(buf_size / blk_size),
+ mpi_blk_type, &mpi_status);
+ VRFY((mrc == MPI_SUCCESS), "MPIO_WRITE");
+
+ /* Advance global offset in dataset */
+ nbytes_xfer += (ssize_t)buf_size;
+ } /* end else */
+ } /* end else */
+ } /* end if */
+ /* 2D dataspace */
else {
- /* Compute offset in file */
- mpi_offset=mpi_file_offset+(((nbytes_xfer/buf_size)*pio_mpi_nprocs_g)/snbytes)*
- (buf_size*snbytes)+((nbytes_xfer/buf_size)*pio_mpi_nprocs_g)%snbytes;
+ /* Contiguous storage */
+ if (!parms->h5_use_chunks) {
+ /* Contiguous access pattern */
+ if (!parms->interleaved) {
+ /* Compute offset in file */
+ mpi_offset =
+ mpi_file_offset +
+ (MPI_Offset)((((size_t)nbytes_xfer / blk_size) / (size_t)snbytes) *
+ (blk_size * (size_t)snbytes)) +
+ (MPI_Offset)(((size_t)nbytes_xfer / blk_size) % (size_t)snbytes);
+
+ /* Number of bytes to be transferred per I/O operation */
+ nbytes_xfer_advance = buf_size;
+
+ /* Global offset advance after each I/O operation */
+ mpi_offset_advance = snbytes;
+
+ /* MPI type to be used for collective access */
+ mpi_collective_type = mpi_cont_type;
+ } /* end if */
+ /* Interleaved access pattern */
+ else {
+ /* Compute offset in file */
+ mpi_offset =
+ mpi_file_offset +
+ (MPI_Offset)(
+ ((((size_t)nbytes_xfer / buf_size) * (size_t)pio_mpi_nprocs_g) /
+ (size_t)snbytes) *
+ (buf_size * (size_t)snbytes)) +
+ (MPI_Offset)(
+ (((size_t)nbytes_xfer / buf_size) * (size_t)pio_mpi_nprocs_g) %
+ (size_t)snbytes);
+
+ /* Number of bytes to be transferred per I/O operation */
+ nbytes_xfer_advance = blk_size;
+
+ /* Global offset advance after each I/O operation */
+ mpi_offset_advance = snbytes;
+
+ /* MPI type to be used for collective access */
+ mpi_collective_type = mpi_inter_type;
+ } /* end else */
+ } /* end if */
+ /* Chunked storage */
+ else {
+ /*Contiguous access pattern */
+ if (!parms->interleaved) {
+ /* Compute offset in file */
+ mpi_offset = mpi_file_offset + nbytes_xfer;
+
+ /* Number of bytes to be transferred per I/O operation */
+ nbytes_xfer_advance = blk_size * buf_size;
+
+ /* Global offset advance after each I/O operation */
+ mpi_offset_advance = 0;
+
+ /* MPI type to be used for collective access */
+ mpi_collective_type = mpi_full_buffer;
+ } /* end if */
+ /*Interleaved access pattern */
+ else {
+ /* Compute offset in file */
+ /* Before simplification */
+ /* mpi_offset=mpi_file_offset+(nbytes_xfer/(buf_size/blk_size)
+ *pio_mpi_nprocs_g)/(snbytes/blk_size*(blk_size*blk_size))*
+ (buf_size/blk_size*snbytes/blk_size*(blk_size*blk_size))+
+ ((nbytes_xfer/(buf_size/blk_size))*pio_mpi_nprocs_g)%(snbytes
+ /blk_size*(blk_size*blk_size)); */
+ mpi_offset = mpi_file_offset +
+ (MPI_Offset)((((size_t)nbytes_xfer / (buf_size / blk_size) *
+ (size_t)pio_mpi_nprocs_g) /
+ ((size_t)snbytes * blk_size)) *
+ (buf_size * (size_t)snbytes)) +
+ (MPI_Offset)((((size_t)nbytes_xfer / (buf_size / blk_size)) *
+ (size_t)pio_mpi_nprocs_g) %
+ ((size_t)snbytes * blk_size));
+
+ /* Number of bytes to be transferred per I/O operation */
+ nbytes_xfer_advance = blk_size * blk_size;
+
+ /* Global offset advance after each I/O operation */
+ /* mpi_offset_advance = (MPI_Offset)(snbytes/blk_size*(blk_size*blk_size)); */
+ mpi_offset_advance = (MPI_Offset)((size_t)snbytes * blk_size);
+
+ /* MPI type to be used for collective access */
+ mpi_collective_type = mpi_chunk_inter_type;
+ } /* end else */
+ } /* end else */
+
+ /* Common code for independent file access */
+ if (!parms->collective) {
+ /* Set the base of user's buffer */
+ buf_p = (unsigned char *)buffer;
+
+ /* Set the number of bytes to transfer this time */
+ nbytes_toxfer = buf_size * blk_size;
+
+ /* Loop over portions of the buffer to write */
+ while (nbytes_toxfer > 0) {
+ /* Perform independent write */
+ mrc = MPI_File_write_at(fd->mpifd, mpi_offset, buf_p,
+ (int)nbytes_xfer_advance, MPI_BYTE, &mpi_status);
+ VRFY((mrc == MPI_SUCCESS), "MPIO_WRITE");
+
+ /* Advance location in buffer */
+ buf_p += nbytes_xfer_advance;
+
+ /* Advance global offset in dataset */
+ nbytes_xfer += (ssize_t)nbytes_xfer_advance;
+
+ /* Decrement number of bytes left this time */
+ nbytes_toxfer -= nbytes_xfer_advance;
+
+ /* Partially advance global offset in dataset */
+ mpi_offset += mpi_offset_advance;
+ } /* end while */
+ } /* end if */
+
+ /* Common code for collective file access */
+ else {
+ /* Set the file view */
+ mrc = MPI_File_set_view(fd->mpifd, mpi_offset, MPI_BYTE, mpi_collective_type,
+ (char *)"native", h5_io_info_g);
+ VRFY((mrc == MPI_SUCCESS), "MPIO_VIEW");
+
+ /* Perform write */
+ MPI_File_write_at_all(fd->mpifd, 0, buffer, (int)(buf_size * blk_size), MPI_BYTE,
+ &mpi_status);
+ VRFY((mrc == MPI_SUCCESS), "MPIO_WRITE");
- /* Number of bytes to be transferred per I/O operation */
- nbytes_xfer_advance = blk_size;
-
- /* Global offset advance after each I/O operation */
- mpi_offset_advance = snbytes;
+ /* Advance global offset in dataset */
+ nbytes_xfer += (off_t)buf_size * (off_t)blk_size;
+ } /* end else */
- /* MPI type to be used for collective access */
- mpi_collective_type = mpi_inter_type;
} /* end else */
- } /* end if */
- /* Chunked storage */
- else {
- /*Contiguous access pattern */
- if (!parms->interleaved) {
- /* Compute offset in file */
- mpi_offset=mpi_file_offset+nbytes_xfer;
-
- /* Number of bytes to be transferred per I/O operation */
- nbytes_xfer_advance = blk_size * buf_size;
- /* Global offset advance after each I/O operation */
- mpi_offset_advance = 0;
-
- /* MPI type to be used for collective access */
- mpi_collective_type = mpi_full_buffer;
+ break;
+
+ case PHDF5:
+ /* 1D dataspace */
+ if (!parms->dim2d) {
+ /* Set up the file dset space id to move the selection to process */
+ if (!parms->interleaved) {
+ /* Contiguous pattern */
+ h5offset[0] = nbytes_xfer;
+ } /* end if */
+ else {
+ /* Interleaved access pattern */
+ /* Skip offset over blocks of other processes */
+ h5offset[0] = (nbytes_xfer * pio_mpi_nprocs_g);
+ } /* end else */
+ hrc = H5Soffset_simple(h5dset_space_id, h5offset);
+ VRFY((hrc >= 0), "H5Soffset_simple");
+
+ /* Write the buffer out */
+ hrc =
+ H5Dwrite(h5ds_id, ELMT_H5_TYPE, h5mem_space_id, h5dset_space_id, h5dxpl, buffer);
+ VRFY((hrc >= 0), "H5Dwrite");
+
+ /* Increment number of bytes transferred */
+ nbytes_xfer += (ssize_t)buf_size;
} /* end if */
- /*Interleaved access pattern */
+ /* 2D dataspace */
else {
- /* Compute offset in file */
- /* Before simplification */
- /* mpi_offset=mpi_file_offset+(nbytes_xfer/(buf_size/blk_size)
- *pio_mpi_nprocs_g)/(snbytes/blk_size*(blk_size*blk_size))*
- (buf_size/blk_size*snbytes/blk_size*(blk_size*blk_size))+
- ((nbytes_xfer/(buf_size/blk_size))*pio_mpi_nprocs_g)%(snbytes
- /blk_size*(blk_size*blk_size)); */
- mpi_offset=mpi_file_offset+((nbytes_xfer/(buf_size/blk_size)
- *pio_mpi_nprocs_g)/(snbytes*blk_size))*(buf_size*snbytes)
- +((nbytes_xfer/(buf_size/blk_size))*pio_mpi_nprocs_g)%(snbytes*blk_size);
-
- /* Number of bytes to be transferred per I/O operation */
- nbytes_xfer_advance = blk_size * blk_size;
-
- /* Global offset advance after each I/O operation */
- /* mpi_offset_advance = (MPI_Offset)(snbytes/blk_size*(blk_size*blk_size)); */
- mpi_offset_advance = (MPI_Offset)(snbytes*blk_size);
-
- /* MPI type to be used for collective access */
- mpi_collective_type = mpi_chunk_inter_type;
- } /* end else */
- } /* end else */
-
- /* Common code for independent file access */
- if (!parms->collective) {
- /* Set the base of user's buffer */
- buf_p = (unsigned char *)buffer;
-
- /* Set the number of bytes to transfer this time */
- nbytes_toxfer = buf_size * blk_size;
-
- /* Loop over portions of the buffer to write */
- while(nbytes_toxfer>0){
- /* Perform independent write */
- mrc = MPI_File_write_at(fd->mpifd, mpi_offset, buf_p,
- (int)nbytes_xfer_advance, MPI_BYTE, &mpi_status);
- VRFY((mrc==MPI_SUCCESS), "MPIO_WRITE");
-
- /* Advance location in buffer */
- buf_p+=nbytes_xfer_advance;
-
- /* Advance global offset in dataset */
- nbytes_xfer+=nbytes_xfer_advance;
-
- /* Decrement number of bytes left this time */
- nbytes_toxfer-=nbytes_xfer_advance;
-
- /* Partially advance global offset in dataset */
- mpi_offset+=mpi_offset_advance;
- } /* end while */
- } /* end if */
-
- /* Common code for collective file access */
- else {
- /* Set the file view */
- mrc = MPI_File_set_view(fd->mpifd, mpi_offset, MPI_BYTE,
- mpi_collective_type, (char *)"native", h5_io_info_g);
- VRFY((mrc==MPI_SUCCESS), "MPIO_VIEW");
-
- /* Perform write */
- MPI_File_write_at_all(fd->mpifd, 0, buffer,(int)(buf_size*blk_size),
- MPI_BYTE, &mpi_status);
- VRFY((mrc==MPI_SUCCESS), "MPIO_WRITE");
-
- /* Advance global offset in dataset */
- nbytes_xfer+=buf_size*blk_size;
- } /* end else */
-
- } /* end else */
-
- break;
+ /* Set up the file dset space id to move the selection to process */
+ if (!parms->interleaved) {
+ /* Contiguous pattern */
+ h5offset[0] =
+ (hssize_t)(((size_t)nbytes_xfer / ((size_t)snbytes * blk_size)) * blk_size);
+ h5offset[1] =
+ (hssize_t)(((size_t)nbytes_xfer % ((size_t)snbytes * blk_size)) / blk_size);
+
+ } /* end if */
+ else {
+ /* Interleaved access pattern */
+ /* Skip offset over blocks of other processes */
+ h5offset[0] = (hssize_t)((((size_t)nbytes_xfer * (size_t)pio_mpi_nprocs_g) /
+ ((size_t)snbytes * buf_size)) *
+ buf_size);
+ h5offset[1] = (hssize_t)((((size_t)nbytes_xfer * (size_t)pio_mpi_nprocs_g) %
+ ((size_t)snbytes * buf_size)) /
+ buf_size);
- case PHDF5:
- /* 1D dataspace */
- if (!parms->dim2d){
- /* Set up the file dset space id to move the selection to process */
- if (!parms->interleaved){
- /* Contiguous pattern */
- h5offset[0] = nbytes_xfer;
- } /* end if */
- else {
- /* Interleaved access pattern */
- /* Skip offset over blocks of other processes */
- h5offset[0] = (nbytes_xfer*pio_mpi_nprocs_g);
- } /* end else */
- hrc = H5Soffset_simple(h5dset_space_id, h5offset);
- VRFY((hrc >= 0), "H5Soffset_simple");
+ } /* end else */
+ hrc = H5Soffset_simple(h5dset_space_id, h5offset);
+ VRFY((hrc >= 0), "H5Soffset_simple");
- /* Write the buffer out */
- hrc = H5Dwrite(h5ds_id, ELMT_H5_TYPE, h5mem_space_id,
- h5dset_space_id, h5dxpl, buffer);
- VRFY((hrc >= 0), "H5Dwrite");
+ /* Write the buffer out */
+ hrc =
+ H5Dwrite(h5ds_id, ELMT_H5_TYPE, h5mem_space_id, h5dset_space_id, h5dxpl, buffer);
+ VRFY((hrc >= 0), "H5Dwrite");
- /* Increment number of bytes transferred */
- nbytes_xfer += buf_size;
- } /* end if */
- /* 2D dataspace */
- else {
- /* Set up the file dset space id to move the selection to process */
- if (!parms->interleaved){
- /* Contiguous pattern */
- h5offset[0] = (nbytes_xfer/(snbytes*blk_size))*blk_size;
- h5offset[1] = (nbytes_xfer%(snbytes*blk_size))/blk_size;
+ /* Increment number of bytes transferred */
+ nbytes_xfer += (off_t)buf_size * (off_t)blk_size;
- } /* end if */
- else {
- /* Interleaved access pattern */
- /* Skip offset over blocks of other processes */
- h5offset[0] = ((nbytes_xfer*pio_mpi_nprocs_g)/(snbytes*buf_size))*buf_size;
- h5offset[1] = ((nbytes_xfer*pio_mpi_nprocs_g)%(snbytes*buf_size))/buf_size;
-
- } /* end else */
- hrc = H5Soffset_simple(h5dset_space_id, h5offset);
- VRFY((hrc >= 0), "H5Soffset_simple");
-
- /* Write the buffer out */
- hrc = H5Dwrite(h5ds_id, ELMT_H5_TYPE, h5mem_space_id,
- h5dset_space_id, h5dxpl, buffer);
- VRFY((hrc >= 0), "H5Dwrite");
+ } /* end else */
- /* Increment number of bytes transferred */
- nbytes_xfer += buf_size*blk_size;
+ break;
- } /* end else */
+ default:
+ break;
+ } /* switch (parms->io_type) */
+ } /* end while */
- break;
- } /* switch (parms->io_type) */
- } /* end while */
+ /* Stop "raw data" write timer */
+ io_time_set(res->timers, HDF5_RAW_WRITE_FIXED_DIMS, TSTOP);
- /* Stop "raw data" write timer */
- set_time(res->timers, HDF5_RAW_WRITE_FIXED_DIMS, TSTOP);
+ /* Calculate write time */
- /* Calculate write time */
+ /* Close dataset. Only HDF5 needs to do an explicit close. */
+ if (parms->io_type == PHDF5) {
+ hrc = H5Dclose(h5ds_id);
- /* Close dataset. Only HDF5 needs to do an explicit close. */
- if (parms->io_type == PHDF5) {
- hrc = H5Dclose(h5ds_id);
-
- if (hrc < 0) {
- fprintf(stderr, "HDF5 Dataset Close failed\n");
- GOTOERROR(FAIL);
- }
+ if (hrc < 0) {
+ HDfprintf(stderr, "HDF5 Dataset Close failed\n");
+ GOTOERROR(FAIL);
+ }
- h5ds_id = -1;
- } /* end if */
- } /* end for */
+ h5ds_id = H5I_INVALID_HID;
+ } /* end if */
+ } /* end for */
done:
/* release MPI-I/O objects */
if (parms->io_type == MPIO) {
/* 1D dataspace */
- if (!parms->dim2d){
+ if (!parms->dim2d) {
/* Free file type */
- mrc = MPI_Type_free( &mpi_file_type );
- VRFY((mrc==MPI_SUCCESS), "MPIO_TYPE_FREE");
+ mrc = MPI_Type_free(&mpi_file_type);
+ VRFY((mrc == MPI_SUCCESS), "MPIO_TYPE_FREE");
/* Free buffer type */
- mrc = MPI_Type_free( &mpi_blk_type );
- VRFY((mrc==MPI_SUCCESS), "MPIO_TYPE_FREE");
+ mrc = MPI_Type_free(&mpi_blk_type);
+ VRFY((mrc == MPI_SUCCESS), "MPIO_TYPE_FREE");
} /* end if */
/* 2D dataspace */
else {
/* Free partial buffer type for contiguous access */
- mrc = MPI_Type_free( &mpi_partial_buffer_cont );
- VRFY((mrc==MPI_SUCCESS), "MPIO_TYPE_FREE");
+ mrc = MPI_Type_free(&mpi_partial_buffer_cont);
+ VRFY((mrc == MPI_SUCCESS), "MPIO_TYPE_FREE");
/* Free contiguous file type */
- mrc = MPI_Type_free( &mpi_cont_type );
- VRFY((mrc==MPI_SUCCESS), "MPIO_TYPE_FREE");
+ mrc = MPI_Type_free(&mpi_cont_type);
+ VRFY((mrc == MPI_SUCCESS), "MPIO_TYPE_FREE");
/* Free partial buffer type for interleaved access */
- mrc = MPI_Type_free( &mpi_partial_buffer_inter );
- VRFY((mrc==MPI_SUCCESS), "MPIO_TYPE_FREE");
+ mrc = MPI_Type_free(&mpi_partial_buffer_inter);
+ VRFY((mrc == MPI_SUCCESS), "MPIO_TYPE_FREE");
/* Free interleaved file type */
- mrc = MPI_Type_free( &mpi_inter_type );
- VRFY((mrc==MPI_SUCCESS), "MPIO_TYPE_FREE");
+ mrc = MPI_Type_free(&mpi_inter_type);
+ VRFY((mrc == MPI_SUCCESS), "MPIO_TYPE_FREE");
/* Free full buffer type */
mrc = MPI_Type_free(&mpi_full_buffer);
- VRFY((mrc==MPI_SUCCESS), "MPIO_TYPE_FREE");
+ VRFY((mrc == MPI_SUCCESS), "MPIO_TYPE_FREE");
/* Free full chunk type */
mrc = MPI_Type_free(&mpi_full_chunk);
- VRFY((mrc==MPI_SUCCESS), "MPIO_TYPE_FREE");
+ VRFY((mrc == MPI_SUCCESS), "MPIO_TYPE_FREE");
/* Free chunk interleaved file type */
mrc = MPI_Type_free(&mpi_chunk_inter_type);
- VRFY((mrc==MPI_SUCCESS), "MPIO_TYPE_FREE");
+ VRFY((mrc == MPI_SUCCESS), "MPIO_TYPE_FREE");
} /* end else */
- } /* end if */
+ } /* end if */
/* release HDF5 objects */
if (h5dset_space_id != -1) {
- hrc = H5Sclose(h5dset_space_id);
- if (hrc < 0){
- fprintf(stderr, "HDF5 Dataset Space Close failed\n");
- ret_code = FAIL;
- } else {
- h5dset_space_id = -1;
- }
+ hrc = H5Sclose(h5dset_space_id);
+ if (hrc < 0) {
+ HDfprintf(stderr, "HDF5 Dataset Space Close failed\n");
+ ret_code = FAIL;
+ }
+ else {
+ h5dset_space_id = H5I_INVALID_HID;
+ }
}
if (h5mem_space_id != -1) {
- hrc = H5Sclose(h5mem_space_id);
- if (hrc < 0) {
- fprintf(stderr, "HDF5 Memory Space Close failed\n");
- ret_code = FAIL;
- } else {
- h5mem_space_id = -1;
- }
+ hrc = H5Sclose(h5mem_space_id);
+ if (hrc < 0) {
+ HDfprintf(stderr, "HDF5 Memory Space Close failed\n");
+ ret_code = FAIL;
+ }
+ else {
+ h5mem_space_id = H5I_INVALID_HID;
+ }
}
if (h5dxpl != -1) {
- hrc = H5Pclose(h5dxpl);
- if (hrc < 0) {
- fprintf(stderr, "HDF5 Dataset Transfer Property List Close failed\n");
- ret_code = FAIL;
- } else {
- h5dxpl = -1;
- }
+ hrc = H5Pclose(h5dxpl);
+ if (hrc < 0) {
+ HDfprintf(stderr, "HDF5 Dataset Transfer Property List Close failed\n");
+ ret_code = FAIL;
+ }
+ else {
+ h5dxpl = H5I_INVALID_HID;
+ }
}
return ret_code;
}
+static off_t
+sqrto(off_t x)
+{
+ double root_x = sqrt((double)x);
+ return (off_t)root_x;
+}
+
/*
* Function: do_read
* Purpose: read the required amount of data from the file.
@@ -1488,62 +1519,62 @@ done:
* Modifications:
* Added 2D testing (Christian Chilan, 10. August 2005)
*/
- static herr_t
-do_read(results *res, file_descr *fd, parameters *parms, long ndsets,
- off_t nbytes, size_t buf_size, void *buffer /*out*/)
+static herr_t
+do_read(results *res, file_descr *fd, parameters *parms, long ndsets, off_t nbytes, size_t buf_size,
+ void *buffer /*out*/)
{
- int ret_code = SUCCESS;
- int rc; /*routine return code */
- long ndset;
- size_t blk_size; /* The block size to subdivide the xfer buffer into */
- size_t bsize; /* Size of the actual buffer */
- off_t nbytes_xfer; /* Total number of bytes transferred so far */
- size_t nbytes_xfer_advance; /* Number of bytes transferred in a single I/O operation */
- size_t nbytes_toxfer; /* Number of bytes to transfer a particular time */
- char dname[64];
- off_t dset_offset=0; /*dataset offset in a file */
- off_t bytes_begin[2]; /*first elmt this process transfer */
- off_t bytes_count; /*number of elmts this process transfer */
- off_t snbytes=0; /*size of a side of the dataset square */
- unsigned char *buf_p; /* Current buffer pointer */
+ int ret_code = SUCCESS;
+ int rc; /*routine return code */
+ long ndset;
+ size_t blk_size; /* The block size to subdivide the xfer buffer into */
+ size_t bsize; /* Size of the actual buffer */
+ off_t nbytes_xfer; /* Total number of bytes transferred so far */
+ size_t nbytes_xfer_advance; /* Number of bytes transferred in a single I/O operation */
+ size_t nbytes_toxfer; /* Number of bytes to transfer a particular time */
+ char dname[64];
+ off_t dset_offset = 0; /*dataset offset in a file */
+ off_t bytes_begin[2]; /*first elmt this process transfer */
+ off_t bytes_count; /*number of elmts this process transfer */
+ off_t snbytes = 0; /*size of a side of the dataset square */
+ unsigned char *buf_p; /* Current buffer pointer */
/* POSIX variables */
- off_t file_offset; /* File offset of the next transfer */
- off_t file_offset_advance; /* File offset advance after each I/O operation */
- off_t posix_file_offset; /* Base file offset of the next transfer */
+ off_t file_offset; /* File offset of the next transfer */
+ off_t file_offset_advance; /* File offset advance after each I/O operation */
+ off_t posix_file_offset; /* Base file offset of the next transfer */
/* MPI variables */
- MPI_Offset mpi_file_offset;/* Base file offset of the next transfer*/
- MPI_Offset mpi_offset; /* Offset in MPI file */
- MPI_Offset mpi_offset_advance; /* Offset advance after each I/O operation */
- MPI_Datatype mpi_file_type; /* MPI derived type for 1D file */
- MPI_Datatype mpi_blk_type; /* MPI derived type for 1D buffer */
- MPI_Datatype mpi_cont_type; /* MPI derived type for 2D contiguous file */
- MPI_Datatype mpi_partial_buffer_cont; /* MPI derived type for partial 2D contiguous buffer */
- MPI_Datatype mpi_inter_type; /* MPI derived type for 2D interleaved file */
- MPI_Datatype mpi_partial_buffer_inter; /* MPI derived type for partial 2D interleaved buffer */
- MPI_Datatype mpi_full_buffer; /* MPI derived type for 2D full buffer */
- MPI_Datatype mpi_full_chunk; /* MPI derived type for 2D full chunk */
- MPI_Datatype mpi_chunk_inter_type; /* MPI derived type for 2D chunk interleaved file */
- MPI_Datatype mpi_collective_type; /* Generic MPI derived type for 2D collective access */
- MPI_Status mpi_status;
- int mrc; /* MPI return code */
+ MPI_Offset mpi_file_offset; /* Base file offset of the next transfer*/
+ MPI_Offset mpi_offset; /* Offset in MPI file */
+ MPI_Offset mpi_offset_advance; /* Offset advance after each I/O operation */
+ MPI_Datatype mpi_file_type; /* MPI derived type for 1D file */
+ MPI_Datatype mpi_blk_type; /* MPI derived type for 1D buffer */
+ MPI_Datatype mpi_cont_type; /* MPI derived type for 2D contiguous file */
+ MPI_Datatype mpi_partial_buffer_cont; /* MPI derived type for partial 2D contiguous buffer */
+ MPI_Datatype mpi_inter_type; /* MPI derived type for 2D interleaved file */
+ MPI_Datatype mpi_partial_buffer_inter; /* MPI derived type for partial 2D interleaved buffer */
+ MPI_Datatype mpi_full_buffer; /* MPI derived type for 2D full buffer */
+ MPI_Datatype mpi_full_chunk; /* MPI derived type for 2D full chunk */
+ MPI_Datatype mpi_chunk_inter_type; /* MPI derived type for 2D chunk interleaved file */
+ MPI_Datatype mpi_collective_type; /* Generic MPI derived type for 2D collective access */
+ MPI_Status mpi_status;
+ int mrc; /* MPI return code */
/* HDF5 variables */
- herr_t hrc; /*HDF5 return code */
- hsize_t h5dims[2]; /*dataset dim sizes */
- hid_t h5dset_space_id = -1; /*dataset space ID */
- hid_t h5mem_space_id = -1; /*memory dataspace ID */
- hid_t h5ds_id = -1; /*dataset handle */
- hsize_t h5block[2]; /*dataspace selection */
- hsize_t h5stride[2];
- hsize_t h5count[2];
- hsize_t h5start[2];
- hssize_t h5offset[2]; /* Selection offset within dataspace */
- hid_t h5dxpl = -1; /* Dataset transfer property list */
+ herr_t hrc; /*HDF5 return code */
+ hsize_t h5dims[2]; /*dataset dim sizes */
+ hid_t h5dset_space_id = H5I_INVALID_HID; /*dataset space ID */
+ hid_t h5mem_space_id = H5I_INVALID_HID; /*memory dataspace ID */
+ hid_t h5ds_id = H5I_INVALID_HID; /*dataset handle */
+ hsize_t h5block[2]; /*dataspace selection */
+ hsize_t h5stride[2];
+ hsize_t h5count[2];
+ hsize_t h5start[2];
+ hssize_t h5offset[2]; /* Selection offset within dataspace */
+ hid_t h5dxpl = H5I_INVALID_HID; /* Dataset transfer property list */
/* Get the parameters from the parameter block */
- blk_size=parms->blk_size;
+ blk_size = parms->blk_size;
/* There are two kinds of transfer patterns, contiguous and interleaved.
* Let 0,1,2,...,n be data accessed by process 0,1,2,...,n
@@ -1556,41 +1587,41 @@ do_read(results *res, file_descr *fd, parameters *parms, long ndsets,
*/
/* 1D dataspace */
- if (!parms->dim2d){
+ if (!parms->dim2d) {
bsize = buf_size;
/* Contiguous Pattern: */
if (!parms->interleaved) {
- bytes_begin[0] = (off_t)(((double)nbytes*pio_mpi_rank_g)/pio_mpi_nprocs_g);
+ bytes_begin[0] = (off_t)(((double)nbytes * pio_mpi_rank_g) / pio_mpi_nprocs_g);
} /* end if */
/* Interleaved Pattern: */
else {
- bytes_begin[0] = (off_t)(blk_size*pio_mpi_rank_g);
+ bytes_begin[0] = (off_t)blk_size * (off_t)pio_mpi_rank_g;
} /* end else */
- }/* end if */
+ } /* end if */
/* 2D dataspace */
else {
/* nbytes is always the number of bytes per dataset (1D or 2D). If the
dataspace is 2D, snbytes is the size of a side of the 'dataset square'.
*/
- snbytes = (off_t)sqrt(nbytes);
+ snbytes = sqrto(nbytes);
bsize = buf_size * blk_size;
/* Contiguous Pattern: */
if (!parms->interleaved) {
- bytes_begin[0] = (off_t)((double)snbytes*pio_mpi_rank_g / pio_mpi_nprocs_g);
+ bytes_begin[0] = (off_t)((double)snbytes * pio_mpi_rank_g / pio_mpi_nprocs_g);
bytes_begin[1] = 0;
} /* end if */
/* Interleaved Pattern: */
else {
bytes_begin[0] = 0;
- if (!parms->h5_use_chunks || parms->io_type==PHDF5)
- bytes_begin[1] = (off_t)(blk_size*pio_mpi_rank_g);
+ if (!parms->h5_use_chunks || parms->io_type == PHDF5)
+ bytes_begin[1] = (off_t)blk_size * (off_t)pio_mpi_rank_g;
else
- bytes_begin[1] = (off_t)(blk_size*blk_size*pio_mpi_rank_g);
+ bytes_begin[1] = (off_t)blk_size * (off_t)blk_size * (off_t)pio_mpi_rank_g;
} /* end else */
- } /* end else */
+ } /* end else */
/* Calculate the total number of bytes (bytes_count) to be
* transferred by this process. It may be different for different
@@ -1602,834 +1633,865 @@ do_read(results *res, file_descr *fd, parameters *parms, long ndsets,
* This way, it eliminates any rounding errors.
* (This is tricky, don't mess with the formula, rounding errors
* can easily get introduced) */
- bytes_count = (off_t)(((double)nbytes*(pio_mpi_rank_g+1)) / pio_mpi_nprocs_g)
- - (off_t)(((double)nbytes*pio_mpi_rank_g) / pio_mpi_nprocs_g);
+ bytes_count = (off_t)(((double)nbytes * (pio_mpi_rank_g + 1)) / pio_mpi_nprocs_g) -
+ (off_t)(((double)nbytes * pio_mpi_rank_g) / pio_mpi_nprocs_g);
/* debug */
if (pio_debug_level >= 4) {
HDprint_rank(output);
if (!parms->dim2d) {
- HDfprintf(output, "Debug(do_write): "
- "buf_size=%zu, bytes_begin=%" H5_PRINTF_LL_WIDTH "d, bytes_count=%" H5_PRINTF_LL_WIDTH "d\n",
- buf_size, (long long)bytes_begin[0],
- (long long)bytes_count);
- } else {
- HDfprintf(output, "Debug(do_write): "
- "linear buf_size=%zu, bytes_begin=(%" H5_PRINTF_LL_WIDTH "d,%" H5_PRINTF_LL_WIDTH "d), bytes_count=%" H5_PRINTF_LL_WIDTH "d\n",
- buf_size*blk_size, (long long)bytes_begin[0],
- (long long)bytes_begin[1], (long long)bytes_count);
+ HDfprintf(output,
+ "Debug(do_write): "
+ "buf_size=%zu, bytes_begin=%" H5_PRINTF_LL_WIDTH "d, bytes_count=%" H5_PRINTF_LL_WIDTH
+ "d\n",
+ buf_size, (long long)bytes_begin[0], (long long)bytes_count);
+ }
+ else {
+ HDfprintf(output,
+ "Debug(do_write): "
+ "linear buf_size=%zu, bytes_begin=(%" H5_PRINTF_LL_WIDTH "d,%" H5_PRINTF_LL_WIDTH
+ "d), bytes_count=%" H5_PRINTF_LL_WIDTH "d\n",
+ buf_size * blk_size, (long long)bytes_begin[0], (long long)bytes_begin[1],
+ (long long)bytes_count);
}
}
/* I/O Access specific setup */
switch (parms->io_type) {
- case POSIXIO:
- /* No extra setup */
- break;
-
- case MPIO: /* MPI-I/O setup */
- /* 1D dataspace */
- if (!parms->dim2d){
- /* Build block's derived type */
- mrc = MPI_Type_contiguous((int)blk_size,
- MPI_BYTE, &mpi_blk_type);
- VRFY((mrc==MPI_SUCCESS), "MPIO_TYPE_CREATE");
-
- /* Build file's derived type */
- mrc = MPI_Type_vector((int)(buf_size/blk_size), (int)1,
- (int)pio_mpi_nprocs_g, mpi_blk_type, &mpi_file_type);
- VRFY((mrc==MPI_SUCCESS), "MPIO_TYPE_CREATE");
-
- /* Commit file type */
- mrc = MPI_Type_commit( &mpi_file_type );
- VRFY((mrc==MPI_SUCCESS), "MPIO_TYPE_COMMIT");
-
- /* Commit buffer type */
- mrc = MPI_Type_commit( &mpi_blk_type );
- VRFY((mrc==MPI_SUCCESS), "MPIO_TYPE_COMMIT");
- } /* end if */
- /* 2D dataspace */
- else {
- /* Build partial buffer derived type for contiguous access */
- mrc = MPI_Type_contiguous((int)buf_size, MPI_BYTE,
- &mpi_partial_buffer_cont);
- VRFY((mrc==MPI_SUCCESS), "MPIO_TYPE_CREATE");
-
- /* Commit partial buffer derived type */
- mrc = MPI_Type_commit(&mpi_partial_buffer_cont);
- VRFY((mrc==MPI_SUCCESS), "MPIO_TYPE_COMMIT");
-
- /* Build contiguous file's derived type */
- mrc = MPI_Type_vector((int)blk_size, (int)1, (int)(snbytes/buf_size),
- mpi_partial_buffer_cont, &mpi_cont_type);
- VRFY((mrc==MPI_SUCCESS), "MPIO_TYPE_CREATE");
-
- /* Commit contiguous file type */
- mrc = MPI_Type_commit(&mpi_cont_type);
- VRFY((mrc==MPI_SUCCESS), "MPIO_TYPE_COMMIT");
-
- /* Build partial buffer derived type for interleaved access */
- mrc = MPI_Type_contiguous((int)blk_size, MPI_BYTE,
- &mpi_partial_buffer_inter);
- VRFY((mrc==MPI_SUCCESS), "MPIO_TYPE_CREATE");
-
- /* Commit partial buffer derived type */
- mrc = MPI_Type_commit(&mpi_partial_buffer_inter);
- VRFY((mrc==MPI_SUCCESS), "MPIO_TYPE_COMMIT");
-
- /* Build interleaved file's derived type */
- mrc = MPI_Type_vector((int)buf_size, (int)1, (int)(snbytes/blk_size),
- mpi_partial_buffer_inter, &mpi_inter_type);
- VRFY((mrc==MPI_SUCCESS), "MPIO_TYPE_CREATE");
-
- /* Commit interleaved file type */
- mrc = MPI_Type_commit(&mpi_inter_type);
- VRFY((mrc==MPI_SUCCESS), "MPIO_TYPE_COMMIT");
-
- /* Build full buffer derived type */
- mrc = MPI_Type_contiguous((int)(blk_size*buf_size), MPI_BYTE,
- &mpi_full_buffer);
- VRFY((mrc==MPI_SUCCESS), "MPIO_TYPE_CREATE");
-
- /* Commit full buffer derived type */
- mrc = MPI_Type_commit(&mpi_full_buffer);
- VRFY((mrc==MPI_SUCCESS), "MPIO_TYPE_COMMIT");
-
- /* Build full chunk derived type */
- mrc = MPI_Type_contiguous((int)(blk_size*blk_size), MPI_BYTE,
- &mpi_full_chunk);
- VRFY((mrc==MPI_SUCCESS), "MPIO_TYPE_CREATE");
-
- /* Commit full chunk derived type */
- mrc = MPI_Type_commit(&mpi_full_chunk);
- VRFY((mrc==MPI_SUCCESS), "MPIO_TYPE_COMMIT");
-
- /* Build chunk interleaved file's derived type */
- mrc = MPI_Type_vector((int)(buf_size/blk_size), (int)1, (int)(snbytes/blk_size),
- mpi_full_chunk, &mpi_chunk_inter_type);
- VRFY((mrc==MPI_SUCCESS), "MPIO_TYPE_CREATE");
-
- /* Commit chunk interleaved file type */
- mrc = MPI_Type_commit(&mpi_chunk_inter_type);
- VRFY((mrc==MPI_SUCCESS), "MPIO_TYPE_COMMIT");
- } /* end else */
- break;
-
- case PHDF5: /* HDF5 setup */
- /* 1D dataspace */
- if (!parms->dim2d){
- if(nbytes>0) {
- /* define a contiguous dataset of nbytes native bytes */
- h5dims[0] = nbytes;
- h5dset_space_id = H5Screate_simple(1, h5dims, NULL);
- VRFY((h5dset_space_id >= 0), "H5Screate_simple");
-
- /* Set up the file dset space id to select the pattern to access */
- if (!parms->interleaved){
- /* Contiguous pattern */
- h5start[0] = bytes_begin[0];
- h5stride[0] = h5block[0] = blk_size;
- h5count[0] = buf_size/blk_size;
- } /* end if */
- else {
- /* Interleaved access pattern */
- /* Skip offset over blocks of other processes */
- h5start[0] = bytes_begin[0];
- h5stride[0] = blk_size*pio_mpi_nprocs_g;
- h5block[0] = blk_size;
- h5count[0] = buf_size/blk_size;
- } /* end else */
- hrc = H5Sselect_hyperslab(h5dset_space_id, H5S_SELECT_SET,
- h5start, h5stride, h5count, h5block);
- VRFY((hrc >= 0), "H5Sselect_hyperslab");
- } /* end if */
- else {
- h5dset_space_id = H5Screate(H5S_SCALAR);
- VRFY((h5dset_space_id >= 0), "H5Screate");
- } /* end else */
+ case POSIXIO:
+ /* No extra setup */
+ break;
- /* Create the memory dataspace that corresponds to the xfer buffer */
- if(buf_size>0) {
- h5dims[0] = buf_size;
- h5mem_space_id = H5Screate_simple(1, h5dims, NULL);
- VRFY((h5mem_space_id >= 0), "H5Screate_simple");
- } /* end if */
- else {
- h5mem_space_id = H5Screate(H5S_SCALAR);
- VRFY((h5mem_space_id >= 0), "H5Screate");
- } /* end else */
- } /* end if */
- /* 2D dataspace */
- else {
- if(nbytes>0) {
- /* define a contiguous dataset of nbytes native bytes */
- h5dims[0] = snbytes;
- h5dims[1] = snbytes;
- h5dset_space_id = H5Screate_simple(2, h5dims, NULL);
- VRFY((h5dset_space_id >= 0), "H5Screate_simple");
-
- /* Set up the file dset space id to select the pattern to access */
- if (!parms->interleaved){
- /* Contiguous pattern */
- h5start[0] = bytes_begin[0];
- h5start[1] = bytes_begin[1];
- h5stride[0] = 1;
- h5stride[1] = h5block[0] = h5block[1] = blk_size;
- h5count[0] = 1;
- h5count[1] = buf_size/blk_size;
+ case MPIO: /* MPI-I/O setup */
+ /* 1D dataspace */
+ if (!parms->dim2d) {
+ /* Build block's derived type */
+ mrc = MPI_Type_contiguous((int)blk_size, MPI_BYTE, &mpi_blk_type);
+ VRFY((mrc == MPI_SUCCESS), "MPIO_TYPE_CREATE");
+
+ /* Build file's derived type */
+ mrc = MPI_Type_vector((int)(buf_size / blk_size), (int)1, (int)pio_mpi_nprocs_g, mpi_blk_type,
+ &mpi_file_type);
+ VRFY((mrc == MPI_SUCCESS), "MPIO_TYPE_CREATE");
+
+ /* Commit file type */
+ mrc = MPI_Type_commit(&mpi_file_type);
+ VRFY((mrc == MPI_SUCCESS), "MPIO_TYPE_COMMIT");
+
+ /* Commit buffer type */
+ mrc = MPI_Type_commit(&mpi_blk_type);
+ VRFY((mrc == MPI_SUCCESS), "MPIO_TYPE_COMMIT");
} /* end if */
+ /* 2D dataspace */
else {
- /* Interleaved access pattern */
- /* Skip offset over blocks of other processes */
- h5start[0] = bytes_begin[0];
- h5start[1] = bytes_begin[1];
- h5stride[0] = blk_size;
- h5stride[1] = blk_size*pio_mpi_nprocs_g;
- h5block[0] = h5block[1] = blk_size;
- h5count[0] = buf_size/blk_size;
- h5count[1] = 1;
+ /* Build partial buffer derived type for contiguous access */
+ mrc = MPI_Type_contiguous((int)buf_size, MPI_BYTE, &mpi_partial_buffer_cont);
+ VRFY((mrc == MPI_SUCCESS), "MPIO_TYPE_CREATE");
+
+ /* Commit partial buffer derived type */
+ mrc = MPI_Type_commit(&mpi_partial_buffer_cont);
+ VRFY((mrc == MPI_SUCCESS), "MPIO_TYPE_COMMIT");
+
+ /* Build contiguous file's derived type */
+ mrc = MPI_Type_vector((int)blk_size, (int)1, (int)((size_t)snbytes / buf_size),
+ mpi_partial_buffer_cont, &mpi_cont_type);
+ VRFY((mrc == MPI_SUCCESS), "MPIO_TYPE_CREATE");
+
+ /* Commit contiguous file type */
+ mrc = MPI_Type_commit(&mpi_cont_type);
+ VRFY((mrc == MPI_SUCCESS), "MPIO_TYPE_COMMIT");
+
+ /* Build partial buffer derived type for interleaved access */
+ mrc = MPI_Type_contiguous((int)blk_size, MPI_BYTE, &mpi_partial_buffer_inter);
+ VRFY((mrc == MPI_SUCCESS), "MPIO_TYPE_CREATE");
+
+ /* Commit partial buffer derived type */
+ mrc = MPI_Type_commit(&mpi_partial_buffer_inter);
+ VRFY((mrc == MPI_SUCCESS), "MPIO_TYPE_COMMIT");
+
+ /* Build interleaved file's derived type */
+ mrc = MPI_Type_vector((int)buf_size, (int)1, (int)((size_t)snbytes / blk_size),
+ mpi_partial_buffer_inter, &mpi_inter_type);
+ VRFY((mrc == MPI_SUCCESS), "MPIO_TYPE_CREATE");
+
+ /* Commit interleaved file type */
+ mrc = MPI_Type_commit(&mpi_inter_type);
+ VRFY((mrc == MPI_SUCCESS), "MPIO_TYPE_COMMIT");
+
+ /* Build full buffer derived type */
+ mrc = MPI_Type_contiguous((int)(blk_size * buf_size), MPI_BYTE, &mpi_full_buffer);
+ VRFY((mrc == MPI_SUCCESS), "MPIO_TYPE_CREATE");
+
+ /* Commit full buffer derived type */
+ mrc = MPI_Type_commit(&mpi_full_buffer);
+ VRFY((mrc == MPI_SUCCESS), "MPIO_TYPE_COMMIT");
+
+ /* Build full chunk derived type */
+ mrc = MPI_Type_contiguous((int)(blk_size * blk_size), MPI_BYTE, &mpi_full_chunk);
+ VRFY((mrc == MPI_SUCCESS), "MPIO_TYPE_CREATE");
+
+ /* Commit full chunk derived type */
+ mrc = MPI_Type_commit(&mpi_full_chunk);
+ VRFY((mrc == MPI_SUCCESS), "MPIO_TYPE_COMMIT");
+
+ /* Build chunk interleaved file's derived type */
+ mrc = MPI_Type_vector((int)(buf_size / blk_size), (int)1, (int)((size_t)snbytes / blk_size),
+ mpi_full_chunk, &mpi_chunk_inter_type);
+ VRFY((mrc == MPI_SUCCESS), "MPIO_TYPE_CREATE");
+
+ /* Commit chunk interleaved file type */
+ mrc = MPI_Type_commit(&mpi_chunk_inter_type);
+ VRFY((mrc == MPI_SUCCESS), "MPIO_TYPE_COMMIT");
} /* end else */
- hrc = H5Sselect_hyperslab(h5dset_space_id, H5S_SELECT_SET,
- h5start, h5stride, h5count, h5block);
- VRFY((hrc >= 0), "H5Sselect_hyperslab");
- } /* end if */
- else {
- h5dset_space_id = H5Screate(H5S_SCALAR);
- VRFY((h5dset_space_id >= 0), "H5Screate");
- } /* end else */
-
- /* Create the memory dataspace that corresponds to the xfer buffer */
- if(buf_size>0) {
- if (!parms->interleaved){
- h5dims[0] = blk_size;
- h5dims[1] = buf_size;
- }else{
- h5dims[0] = buf_size;
- h5dims[1] = blk_size;
- }
- h5mem_space_id = H5Screate_simple(2, h5dims, NULL);
- VRFY((h5mem_space_id >= 0), "H5Screate_simple");
- } /* end if */
- else {
- h5mem_space_id = H5Screate(H5S_SCALAR);
- VRFY((h5mem_space_id >= 0), "H5Screate");
- } /* end else */
- } /* end else */
-
- /* Create the dataset transfer property list */
- h5dxpl = H5Pcreate(H5P_DATASET_XFER);
- if (h5dxpl < 0) {
- fprintf(stderr, "HDF5 Property List Create failed\n");
- GOTOERROR(FAIL);
- }
-
- /* Change to collective I/O, if asked */
- if(parms->collective) {
- hrc = H5Pset_dxpl_mpio(h5dxpl, H5FD_MPIO_COLLECTIVE);
- if (hrc < 0) {
- fprintf(stderr, "HDF5 Property List Set failed\n");
- GOTOERROR(FAIL);
- } /* end if */
- } /* end if */
- break;
- } /* end switch */
-
- for (ndset = 1; ndset <= ndsets; ++ndset) {
-
- /* Calculate dataset offset within a file */
-
- /* create dataset */
- switch (parms->io_type) {
- case POSIXIO:
- case MPIO:
- /* both posix and mpi io just need dataset offset in file*/
- dset_offset = (ndset - 1) * nbytes;
- break;
-
- case PHDF5:
- sprintf(dname, "Dataset_%ld", ndset);
- h5ds_id = H5DOPEN(fd->h5fd, dname);
- if (h5ds_id < 0) {
- fprintf(stderr, "HDF5 Dataset open failed\n");
- GOTOERROR(FAIL);
- }
-
- break;
- }
-
- /* The task is to transfer bytes_count bytes, starting at
- * bytes_begin position, using transfer buffer of buf_size bytes.
- * If interleaved, select buf_size at a time, in round robin
- * fashion, according to number of process. Otherwise, select
- * all bytes_count in contiguous.
- */
- nbytes_xfer = 0 ;
-
- /* 1D dataspace */
- if (!parms->dim2d){
- /* Set base file offset for all I/O patterns and POSIX access */
- posix_file_offset = dset_offset + bytes_begin[0];
-
- /* Set base file offset for all I/O patterns and MPI access */
- mpi_file_offset = (MPI_Offset)(dset_offset + bytes_begin[0]);
- } /* end if */
- else {
- /* Set base file offset for all I/O patterns and POSIX access */
- posix_file_offset=dset_offset + bytes_begin[0]*snbytes+
- bytes_begin[1];
-
- /* Set base file offset for all I/O patterns and MPI access */
- mpi_file_offset=(MPI_Offset)(dset_offset + bytes_begin[0]*snbytes+
- bytes_begin[1]);
- } /* end else */
-
- /* Start "raw data" read timer */
- set_time(res->timers, HDF5_RAW_READ_FIXED_DIMS, TSTART);
+ break;
- while (nbytes_xfer < bytes_count){
- /* Read */
- /* Calculate offset of read within a dataset/file */
- switch (parms->io_type) {
- case POSIXIO:
+ case PHDF5: /* HDF5 setup */
/* 1D dataspace */
- if (!parms->dim2d){
- /* Contiguous pattern */
- if (!parms->interleaved) {
- /* Compute file offset */
- file_offset = posix_file_offset + (off_t)nbytes_xfer;
-
- /* only care if seek returns error */
- rc = POSIXSEEK(fd->posixfd, file_offset) < 0 ? -1 : 0;
- VRFY((rc==0), "POSIXSEEK");
-
- /* check if all bytes are read */
- rc = ((ssize_t)buf_size ==
- POSIXREAD(fd->posixfd, buffer, buf_size));
- VRFY((rc != 0), "POSIXREAD");
-
- /* Advance global offset in dataset */
- nbytes_xfer+=buf_size;
+ if (!parms->dim2d) {
+ if (nbytes > 0) {
+ /* define a contiguous dataset of nbytes native bytes */
+ h5dims[0] = (hsize_t)nbytes;
+ h5dset_space_id = H5Screate_simple(1, h5dims, NULL);
+ VRFY((h5dset_space_id >= 0), "H5Screate_simple");
+
+ /* Set up the file dset space id to select the pattern to access */
+ if (!parms->interleaved) {
+ /* Contiguous pattern */
+ h5start[0] = (hsize_t)bytes_begin[0];
+ h5stride[0] = h5block[0] = blk_size;
+ h5count[0] = buf_size / blk_size;
+ } /* end if */
+ else {
+ /* Interleaved access pattern */
+ /* Skip offset over blocks of other processes */
+ h5start[0] = (hsize_t)bytes_begin[0];
+ h5stride[0] = blk_size * (size_t)pio_mpi_nprocs_g;
+ h5block[0] = blk_size;
+ h5count[0] = buf_size / blk_size;
+ } /* end else */
+ hrc = H5Sselect_hyperslab(h5dset_space_id, H5S_SELECT_SET, h5start, h5stride, h5count,
+ h5block);
+ VRFY((hrc >= 0), "H5Sselect_hyperslab");
} /* end if */
- /* Interleaved access pattern */
else {
- /* Set the base of user's buffer */
- buf_p=(unsigned char *)buffer;
-
- /* Set the number of bytes to transfer this time */
- nbytes_toxfer = buf_size;
-
- /* Loop over the buffers to read */
- while(nbytes_toxfer>0) {
- /* Skip offset over blocks of other processes */
- file_offset = posix_file_offset +
- (off_t)(nbytes_xfer*pio_mpi_nprocs_g);
-
- /* only care if seek returns error */
- rc = POSIXSEEK(fd->posixfd, file_offset) < 0 ? -1 : 0;
- VRFY((rc==0), "POSIXSEEK");
-
- /* check if all bytes are read */
- rc = ((ssize_t)blk_size ==
- POSIXREAD(fd->posixfd, buf_p, blk_size));
- VRFY((rc != 0), "POSIXREAD");
-
- /* Advance location in buffer */
- buf_p+=blk_size;
-
- /* Advance global offset in dataset */
- nbytes_xfer+=blk_size;
+ h5dset_space_id = H5Screate(H5S_SCALAR);
+ VRFY((h5dset_space_id >= 0), "H5Screate");
+ } /* end else */
- /* Decrement number of bytes left this time */
- nbytes_toxfer-=blk_size;
- } /* end while */
+ /* Create the memory dataspace that corresponds to the xfer buffer */
+ if (buf_size > 0) {
+ h5dims[0] = buf_size;
+ h5mem_space_id = H5Screate_simple(1, h5dims, NULL);
+ VRFY((h5mem_space_id >= 0), "H5Screate_simple");
+ } /* end if */
+ else {
+ h5mem_space_id = H5Screate(H5S_SCALAR);
+ VRFY((h5mem_space_id >= 0), "H5Screate");
} /* end else */
- } /* end if */
+ } /* end if */
/* 2D dataspace */
else {
- /* Contiguous storage */
- if (!parms->h5_use_chunks) {
- /* Contiguous access pattern */
+ if (nbytes > 0) {
+ /* define a contiguous dataset of nbytes native bytes */
+ h5dims[0] = (hsize_t)snbytes;
+ h5dims[1] = (hsize_t)snbytes;
+ h5dset_space_id = H5Screate_simple(2, h5dims, NULL);
+ VRFY((h5dset_space_id >= 0), "H5Screate_simple");
+
+ /* Set up the file dset space id to select the pattern to access */
if (!parms->interleaved) {
- /* Compute file offset */
- file_offset=posix_file_offset+(off_t)(((nbytes_xfer/blk_size)
- /snbytes)*(blk_size*snbytes)+((nbytes_xfer/blk_size)%snbytes));
-
- /* Number of bytes to be transferred per I/O operation */
- nbytes_xfer_advance = buf_size;
-
- /* Global offset advance after each I/O operation */
- file_offset_advance = (off_t)snbytes;
+ /* Contiguous pattern */
+ h5start[0] = (hsize_t)bytes_begin[0];
+ h5start[1] = (hsize_t)bytes_begin[1];
+ h5stride[0] = 1;
+ h5stride[1] = h5block[0] = h5block[1] = blk_size;
+ h5count[0] = 1;
+ h5count[1] = buf_size / blk_size;
} /* end if */
- /* Interleaved access pattern */
else {
- /* Compute file offset */
- file_offset=posix_file_offset+(off_t)((((nbytes_xfer/buf_size)
- *pio_mpi_nprocs_g)/snbytes)*(buf_size*snbytes)
- +((nbytes_xfer/buf_size)*pio_mpi_nprocs_g)%snbytes);
-
- /* Number of bytes to be transferred per I/O operation */
- nbytes_xfer_advance = blk_size;
-
- /* Global offset advance after each I/O operation */
- file_offset_advance = (off_t)snbytes;
+ /* Interleaved access pattern */
+ /* Skip offset over blocks of other processes */
+ h5start[0] = (hsize_t)bytes_begin[0];
+ h5start[1] = (hsize_t)bytes_begin[1];
+ h5stride[0] = blk_size;
+ h5stride[1] = blk_size * (size_t)pio_mpi_nprocs_g;
+ h5block[0] = h5block[1] = blk_size;
+ h5count[0] = buf_size / blk_size;
+ h5count[1] = 1;
} /* end else */
+ hrc = H5Sselect_hyperslab(h5dset_space_id, H5S_SELECT_SET, h5start, h5stride, h5count,
+ h5block);
+ VRFY((hrc >= 0), "H5Sselect_hyperslab");
} /* end if */
- /* Chunked storage */
else {
- /*Contiguous access pattern */
- if (!parms->interleaved) {
- /* Compute file offset */
- file_offset=posix_file_offset+(off_t)nbytes_xfer;
-
- /* Number of bytes to be transferred per I/O operation */
- nbytes_xfer_advance = blk_size * buf_size;
+ h5dset_space_id = H5Screate(H5S_SCALAR);
+ VRFY((h5dset_space_id >= 0), "H5Screate");
+ } /* end else */
- /* Global offset advance after each I/O operation */
- file_offset_advance = 0;
- } /* end if */
- /*Interleaved access pattern */
+ /* Create the memory dataspace that corresponds to the xfer buffer */
+ if (buf_size > 0) {
+ if (!parms->interleaved) {
+ h5dims[0] = blk_size;
+ h5dims[1] = buf_size;
+ }
else {
- /* Compute file offset */
- /* Before simplification */
- /* file_offset=posix_file_offset+(off_t)((nbytes_xfer/(buf_size/blk_size)
- *pio_mpi_nprocs_g)/(snbytes/blk_size*(blk_size*blk_size))*(buf_size/blk_size
- *snbytes/blk_size*(blk_size*blk_size))+((nbytes_xfer/(buf_size/blk_size))
- *pio_mpi_nprocs_g)%(snbytes/blk_size*(blk_size*blk_size))); */
-
- file_offset=posix_file_offset+(off_t)(((nbytes_xfer/(buf_size/blk_size)
- *pio_mpi_nprocs_g)/(snbytes*blk_size))*(buf_size*snbytes)+((nbytes_xfer/(buf_size/blk_size))
- *pio_mpi_nprocs_g)%(snbytes*blk_size));
-
- /* Number of bytes to be transferred per I/O operation */
- nbytes_xfer_advance = blk_size * blk_size;
-
- /* Global offset advance after each I/O operation */
- /* file_offset_advance = (off_t)(snbytes/blk_size*(blk_size*blk_size)); */
- file_offset_advance = (off_t)(snbytes*blk_size);
- } /* end else */
+ h5dims[0] = buf_size;
+ h5dims[1] = blk_size;
+ }
+ h5mem_space_id = H5Screate_simple(2, h5dims, NULL);
+ VRFY((h5mem_space_id >= 0), "H5Screate_simple");
+ } /* end if */
+ else {
+ h5mem_space_id = H5Screate(H5S_SCALAR);
+ VRFY((h5mem_space_id >= 0), "H5Screate");
} /* end else */
+ } /* end else */
- /* Common code for file access */
+ /* Create the dataset transfer property list */
+ h5dxpl = H5Pcreate(H5P_DATASET_XFER);
+ if (h5dxpl < 0) {
+ HDfprintf(stderr, "HDF5 Property List Create failed\n");
+ GOTOERROR(FAIL);
+ }
- /* Set the base of user's buffer */
- buf_p = (unsigned char *)buffer;
+ /* Change to collective I/O, if asked */
+ if (parms->collective) {
+ hrc = H5Pset_dxpl_mpio(h5dxpl, H5FD_MPIO_COLLECTIVE);
+ if (hrc < 0) {
+ HDfprintf(stderr, "HDF5 Property List Set failed\n");
+ GOTOERROR(FAIL);
+ } /* end if */
+ } /* end if */
+ break;
- /* Set the number of bytes to transfer this time */
- nbytes_toxfer = buf_size*blk_size;
+ default:
+ break;
+ } /* end switch */
- /* Loop over portions of the buffer to read */
- while(nbytes_toxfer>0){
- /* only care if seek returns error */
- rc = POSIXSEEK(fd->posixfd, file_offset) < 0 ? -1 : 0;
- VRFY((rc==0), "POSIXSEEK");
+ for (ndset = 1; ndset <= ndsets; ++ndset) {
- /* check if all bytes are read */
- rc = ((ssize_t)nbytes_xfer_advance ==
- POSIXREAD(fd->posixfd, buf_p, nbytes_xfer_advance));
- VRFY((rc != 0), "POSIXREAD");
+ /* Calculate dataset offset within a file */
- /* Advance location in buffer */
- buf_p+=nbytes_xfer_advance;
+ /* create dataset */
+ switch (parms->io_type) {
+ case POSIXIO:
+ case MPIO:
+ /* both posix and mpi io just need dataset offset in file*/
+ dset_offset = (ndset - 1) * nbytes;
+ break;
+
+ case PHDF5:
+ HDsprintf(dname, "Dataset_%ld", ndset);
+ h5ds_id = H5DOPEN(fd->h5fd, dname);
+ if (h5ds_id < 0) {
+ HDfprintf(stderr, "HDF5 Dataset open failed\n");
+ GOTOERROR(FAIL);
+ }
+ break;
- /* Advance global offset in dataset */
- nbytes_xfer+=nbytes_xfer_advance;
+ default:
+ break;
+ }
- /* Decrement number of bytes left this time */
- nbytes_toxfer-=nbytes_xfer_advance;
+ /* The task is to transfer bytes_count bytes, starting at
+ * bytes_begin position, using transfer buffer of buf_size bytes.
+ * If interleaved, select buf_size at a time, in round robin
+ * fashion, according to number of process. Otherwise, select
+ * all bytes_count in contiguous.
+ */
+ nbytes_xfer = 0;
- /* Partially advance file offset */
- file_offset+=file_offset_advance;
- } /* end while */
+ /* 1D dataspace */
+ if (!parms->dim2d) {
+ /* Set base file offset for all I/O patterns and POSIX access */
+ posix_file_offset = dset_offset + bytes_begin[0];
- } /* end else */
- break;
+ /* Set base file offset for all I/O patterns and MPI access */
+ mpi_file_offset = (MPI_Offset)(dset_offset + bytes_begin[0]);
+ } /* end if */
+ else {
+ /* Set base file offset for all I/O patterns and POSIX access */
+ posix_file_offset = dset_offset + bytes_begin[0] * snbytes + bytes_begin[1];
- case MPIO:
- /* 1D dataspace */
- if (!parms->dim2d){
- /* Independent file access */
- if(!parms->collective) {
- /* Contiguous pattern */
- if (!parms->interleaved){
- /* Compute offset in file */
- mpi_offset = mpi_file_offset +
- nbytes_xfer;
-
- /* Perform independent read */
- mrc = MPI_File_read_at(fd->mpifd, mpi_offset, buffer,
- (int)(buf_size/blk_size), mpi_blk_type,
- &mpi_status);
- VRFY((mrc==MPI_SUCCESS), "MPIO_READ");
-
- /* Advance global offset in dataset */
- nbytes_xfer+=buf_size;
- } /* end if */
- /* Interleaved access pattern */
+ /* Set base file offset for all I/O patterns and MPI access */
+ mpi_file_offset = (MPI_Offset)(dset_offset + bytes_begin[0] * snbytes + bytes_begin[1]);
+ } /* end else */
+
+ /* Start "raw data" read timer */
+ io_time_set(res->timers, HDF5_RAW_READ_FIXED_DIMS, TSTART);
+
+ while (nbytes_xfer < bytes_count) {
+ /* Read */
+ /* Calculate offset of read within a dataset/file */
+ switch (parms->io_type) {
+ case POSIXIO:
+ /* 1D dataspace */
+ if (!parms->dim2d) {
+ /* Contiguous pattern */
+ if (!parms->interleaved) {
+ /* Compute file offset */
+ file_offset = posix_file_offset + (off_t)nbytes_xfer;
+
+ /* only care if seek returns error */
+ rc = POSIXSEEK(fd->posixfd, file_offset) < 0 ? -1 : 0;
+ VRFY((rc == 0), "POSIXSEEK");
+
+ /* check if all bytes are read */
+ rc = ((ssize_t)buf_size == POSIXREAD(fd->posixfd, buffer, buf_size));
+ VRFY((rc != 0), "POSIXREAD");
+
+ /* Advance global offset in dataset */
+ nbytes_xfer += (off_t)buf_size;
+ } /* end if */
+ /* Interleaved access pattern */
+ else {
+ /* Set the base of user's buffer */
+ buf_p = (unsigned char *)buffer;
+
+ /* Set the number of bytes to transfer this time */
+ nbytes_toxfer = buf_size;
+
+ /* Loop over the buffers to read */
+ while (nbytes_toxfer > 0) {
+ /* Skip offset over blocks of other processes */
+ file_offset = posix_file_offset + (off_t)(nbytes_xfer * pio_mpi_nprocs_g);
+
+ /* only care if seek returns error */
+ rc = POSIXSEEK(fd->posixfd, file_offset) < 0 ? -1 : 0;
+ VRFY((rc == 0), "POSIXSEEK");
+
+ /* check if all bytes are read */
+ rc = ((ssize_t)blk_size == POSIXREAD(fd->posixfd, buf_p, blk_size));
+ VRFY((rc != 0), "POSIXREAD");
+
+ /* Advance location in buffer */
+ buf_p += blk_size;
+
+ /* Advance global offset in dataset */
+ nbytes_xfer += (off_t)blk_size;
+
+ /* Decrement number of bytes left this time */
+ nbytes_toxfer -= blk_size;
+ } /* end while */
+ } /* end else */
+ } /* end if */
+ /* 2D dataspace */
else {
+ /* Contiguous storage */
+ if (!parms->h5_use_chunks) {
+ /* Contiguous access pattern */
+ if (!parms->interleaved) {
+ /* Compute file offset */
+ file_offset = posix_file_offset +
+ (off_t)((((size_t)nbytes_xfer / blk_size) / (size_t)snbytes) *
+ (blk_size * (size_t)snbytes) +
+ (((size_t)nbytes_xfer / blk_size) % (size_t)snbytes));
+
+ /* Number of bytes to be transferred per I/O operation */
+ nbytes_xfer_advance = buf_size;
+
+ /* Global offset advance after each I/O operation */
+ file_offset_advance = (off_t)snbytes;
+ } /* end if */
+ /* Interleaved access pattern */
+ else {
+ /* Compute file offset */
+ file_offset =
+ posix_file_offset +
+ (off_t)(((((size_t)nbytes_xfer / buf_size) * (size_t)pio_mpi_nprocs_g) /
+ (size_t)snbytes) *
+ (buf_size * (size_t)snbytes) +
+ (((size_t)nbytes_xfer / buf_size) * (size_t)pio_mpi_nprocs_g) %
+ (size_t)snbytes);
+
+ /* Number of bytes to be transferred per I/O operation */
+ nbytes_xfer_advance = blk_size;
+
+ /* Global offset advance after each I/O operation */
+ file_offset_advance = (off_t)snbytes;
+ } /* end else */
+ } /* end if */
+ /* Chunked storage */
+ else {
+ /*Contiguous access pattern */
+ if (!parms->interleaved) {
+ /* Compute file offset */
+ file_offset = posix_file_offset + (off_t)nbytes_xfer;
+
+ /* Number of bytes to be transferred per I/O operation */
+ nbytes_xfer_advance = blk_size * buf_size;
+
+ /* Global offset advance after each I/O operation */
+ file_offset_advance = 0;
+ } /* end if */
+ /*Interleaved access pattern */
+ else {
+ /* Compute file offset */
+ /* Before simplification */
+ /* file_offset=posix_file_offset+(off_t)((nbytes_xfer/(buf_size/blk_size)
+ *pio_mpi_nprocs_g)/(snbytes/blk_size*(blk_size*blk_size))*(buf_size/blk_size
+ *snbytes/blk_size*(blk_size*blk_size))+((nbytes_xfer/(buf_size/blk_size))
+ *pio_mpi_nprocs_g)%(snbytes/blk_size*(blk_size*blk_size))); */
+
+ file_offset = posix_file_offset +
+ (off_t)((((size_t)nbytes_xfer / (buf_size / blk_size) *
+ (size_t)pio_mpi_nprocs_g) /
+ ((size_t)snbytes * blk_size)) *
+ (buf_size * (size_t)snbytes) +
+ (((size_t)nbytes_xfer / (buf_size / blk_size)) *
+ (size_t)pio_mpi_nprocs_g) %
+ ((size_t)snbytes * blk_size));
+
+ /* Number of bytes to be transferred per I/O operation */
+ nbytes_xfer_advance = blk_size * blk_size;
+
+ /* Global offset advance after each I/O operation */
+ /* file_offset_advance = (off_t)(snbytes/blk_size*(blk_size*blk_size)); */
+ file_offset_advance = (off_t)((size_t)snbytes * blk_size);
+ } /* end else */
+ } /* end else */
+
+ /* Common code for file access */
+
/* Set the base of user's buffer */
- buf_p=(unsigned char *)buffer;
+ buf_p = (unsigned char *)buffer;
/* Set the number of bytes to transfer this time */
- nbytes_toxfer = buf_size;
+ nbytes_toxfer = buf_size * blk_size;
- /* Loop over the buffers to read */
- while(nbytes_toxfer>0) {
- /* Skip offset over blocks of other processes */
- mpi_offset = mpi_file_offset +
- (nbytes_xfer*pio_mpi_nprocs_g);
+ /* Loop over portions of the buffer to read */
+ while (nbytes_toxfer > 0) {
+ /* only care if seek returns error */
+ rc = POSIXSEEK(fd->posixfd, file_offset) < 0 ? -1 : 0;
+ VRFY((rc == 0), "POSIXSEEK");
- /* Perform independent read */
- mrc = MPI_File_read_at(fd->mpifd, mpi_offset, buf_p,
- (int)1, mpi_blk_type, &mpi_status);
- VRFY((mrc==MPI_SUCCESS), "MPIO_READ");
+ /* check if all bytes are read */
+ rc = ((ssize_t)nbytes_xfer_advance ==
+ POSIXREAD(fd->posixfd, buf_p, nbytes_xfer_advance));
+ VRFY((rc != 0), "POSIXREAD");
/* Advance location in buffer */
- buf_p+=blk_size;
+ buf_p += nbytes_xfer_advance;
/* Advance global offset in dataset */
- nbytes_xfer+=blk_size;
+ nbytes_xfer += (off_t)nbytes_xfer_advance;
/* Decrement number of bytes left this time */
- nbytes_toxfer-=blk_size;
- } /* end while */
- } /* end else */
- } /* end if */
- /* Collective file access */
- else {
- /* Contiguous access pattern */
- if (!parms->interleaved){
- /* Compute offset in file */
- mpi_offset = mpi_file_offset +
- nbytes_xfer;
-
- /* Perform collective read */
- mrc = MPI_File_read_at_all(fd->mpifd, mpi_offset, buffer,
- (int)(buf_size/blk_size), mpi_blk_type, &mpi_status);
- VRFY((mrc==MPI_SUCCESS), "MPIO_READ");
-
- /* Advance global offset in dataset */
- nbytes_xfer+=buf_size;
- } /* end if */
- /* Interleaved access pattern */
- else {
- /* Compute offset in file */
- mpi_offset = mpi_file_offset +
- (nbytes_xfer*pio_mpi_nprocs_g);
-
- /* Set the file view */
- mrc = MPI_File_set_view(fd->mpifd, mpi_offset, mpi_blk_type,
- mpi_file_type, (char*)"native", h5_io_info_g);
- VRFY((mrc==MPI_SUCCESS), "MPIO_VIEW");
-
- /* Perform collective read */
- mrc = MPI_File_read_at_all(fd->mpifd, 0, buffer,
- (int)(buf_size/blk_size), mpi_blk_type, &mpi_status);
- VRFY((mrc==MPI_SUCCESS), "MPIO_READ");
-
- /* Advance global offset in dataset */
- nbytes_xfer+=buf_size;
- } /* end else */
- } /* end else */
- } /* end if */
- /* 2D dataspace */
- else {
- /* Contiguous storage */
- if (!parms->h5_use_chunks) {
- /* Contiguous access pattern */
- if (!parms->interleaved) {
- /* Compute offset in file */
- mpi_offset=mpi_file_offset+((nbytes_xfer/blk_size)/snbytes)*
- (blk_size*snbytes)+((nbytes_xfer/blk_size)%snbytes);
+ nbytes_toxfer -= nbytes_xfer_advance;
- /* Number of bytes to be transferred per I/O operation */
- nbytes_xfer_advance = buf_size;
-
- /* Global offset advance after each I/O operation */
- mpi_offset_advance = snbytes;
+ /* Partially advance file offset */
+ file_offset += file_offset_advance;
+ } /* end while */
- /* MPI type to be used for collective access */
- mpi_collective_type = mpi_cont_type;
- } /* end if */
- /* Interleaved access pattern */
+ } /* end else */
+ break;
+
+ case MPIO:
+ /* 1D dataspace */
+ if (!parms->dim2d) {
+ /* Independent file access */
+ if (!parms->collective) {
+ /* Contiguous pattern */
+ if (!parms->interleaved) {
+ /* Compute offset in file */
+ mpi_offset = mpi_file_offset + nbytes_xfer;
+
+ /* Perform independent read */
+ mrc = MPI_File_read_at(fd->mpifd, mpi_offset, buffer,
+ (int)(buf_size / blk_size), mpi_blk_type, &mpi_status);
+ VRFY((mrc == MPI_SUCCESS), "MPIO_READ");
+
+ /* Advance global offset in dataset */
+ nbytes_xfer += (off_t)buf_size;
+ } /* end if */
+ /* Interleaved access pattern */
+ else {
+ /* Set the base of user's buffer */
+ buf_p = (unsigned char *)buffer;
+
+ /* Set the number of bytes to transfer this time */
+ nbytes_toxfer = buf_size;
+
+ /* Loop over the buffers to read */
+ while (nbytes_toxfer > 0) {
+ /* Skip offset over blocks of other processes */
+ mpi_offset = mpi_file_offset + (nbytes_xfer * pio_mpi_nprocs_g);
+
+ /* Perform independent read */
+ mrc = MPI_File_read_at(fd->mpifd, mpi_offset, buf_p, (int)1, mpi_blk_type,
+ &mpi_status);
+ VRFY((mrc == MPI_SUCCESS), "MPIO_READ");
+
+ /* Advance location in buffer */
+ buf_p += blk_size;
+
+ /* Advance global offset in dataset */
+ nbytes_xfer += (off_t)blk_size;
+
+ /* Decrement number of bytes left this time */
+ nbytes_toxfer -= blk_size;
+ } /* end while */
+ } /* end else */
+ } /* end if */
+ /* Collective file access */
+ else {
+ /* Contiguous access pattern */
+ if (!parms->interleaved) {
+ /* Compute offset in file */
+ mpi_offset = mpi_file_offset + nbytes_xfer;
+
+ /* Perform collective read */
+ mrc = MPI_File_read_at_all(fd->mpifd, mpi_offset, buffer,
+ (int)(buf_size / blk_size), mpi_blk_type,
+ &mpi_status);
+ VRFY((mrc == MPI_SUCCESS), "MPIO_READ");
+
+ /* Advance global offset in dataset */
+ nbytes_xfer += (off_t)buf_size;
+ } /* end if */
+ /* Interleaved access pattern */
+ else {
+ /* Compute offset in file */
+ mpi_offset = mpi_file_offset + (nbytes_xfer * pio_mpi_nprocs_g);
+
+ /* Set the file view */
+ mrc = MPI_File_set_view(fd->mpifd, mpi_offset, mpi_blk_type, mpi_file_type,
+ (char *)"native", h5_io_info_g);
+ VRFY((mrc == MPI_SUCCESS), "MPIO_VIEW");
+
+ /* Perform collective read */
+ mrc = MPI_File_read_at_all(fd->mpifd, 0, buffer, (int)(buf_size / blk_size),
+ mpi_blk_type, &mpi_status);
+ VRFY((mrc == MPI_SUCCESS), "MPIO_READ");
+
+ /* Advance global offset in dataset */
+ nbytes_xfer += (off_t)buf_size;
+ } /* end else */
+ } /* end else */
+ } /* end if */
+ /* 2D dataspace */
else {
- /* Compute offset in file */
- mpi_offset=mpi_file_offset+(((nbytes_xfer/buf_size)*pio_mpi_nprocs_g)/snbytes)*
- (buf_size*snbytes)+((nbytes_xfer/buf_size)*pio_mpi_nprocs_g)%snbytes;
+ /* Contiguous storage */
+ if (!parms->h5_use_chunks) {
+ /* Contiguous access pattern */
+ if (!parms->interleaved) {
+ /* Compute offset in file */
+ mpi_offset =
+ mpi_file_offset +
+ (MPI_Offset)((((size_t)nbytes_xfer / blk_size) / (size_t)snbytes) *
+ (blk_size * (size_t)snbytes)) +
+ (MPI_Offset)(((size_t)nbytes_xfer / blk_size) % (size_t)snbytes);
+
+ /* Number of bytes to be transferred per I/O operation */
+ nbytes_xfer_advance = buf_size;
+
+ /* Global offset advance after each I/O operation */
+ mpi_offset_advance = snbytes;
+
+ /* MPI type to be used for collective access */
+ mpi_collective_type = mpi_cont_type;
+ } /* end if */
+ /* Interleaved access pattern */
+ else {
+ /* Compute offset in file */
+ mpi_offset =
+ mpi_file_offset +
+ (MPI_Offset)(
+ ((((size_t)nbytes_xfer / buf_size) * (size_t)pio_mpi_nprocs_g) /
+ (size_t)snbytes) *
+ (buf_size * (size_t)snbytes)) +
+ (MPI_Offset)(
+ (((size_t)nbytes_xfer / buf_size) * (size_t)pio_mpi_nprocs_g) %
+ (size_t)snbytes);
+
+ /* Number of bytes to be transferred per I/O operation */
+ nbytes_xfer_advance = blk_size;
+
+ /* Global offset advance after each I/O operation */
+ mpi_offset_advance = snbytes;
+
+ /* MPI type to be used for collective access */
+ mpi_collective_type = mpi_inter_type;
+ } /* end else */
+ } /* end if */
+ /* Chunked storage */
+ else {
+ /*Contiguous access pattern */
+ if (!parms->interleaved) {
+ /* Compute offset in file */
+ mpi_offset = mpi_file_offset + nbytes_xfer;
+
+ /* Number of bytes to be transferred per I/O operation */
+ nbytes_xfer_advance = blk_size * buf_size;
+
+ /* Global offset advance after each I/O operation */
+ mpi_offset_advance = 0;
+
+ /* MPI type to be used for collective access */
+ mpi_collective_type = mpi_full_buffer;
+ } /* end if */
+ /*Interleaved access pattern */
+ else {
+ /* Compute offset in file */
+ /* Before simplification */
+ /* mpi_offset=mpi_file_offset+(nbytes_xfer/(buf_size/blk_size)
+ *pio_mpi_nprocs_g)/(snbytes/blk_size*(blk_size*blk_size))*
+ (buf_size/blk_size*snbytes/blk_size*(blk_size*blk_size))+
+ ((nbytes_xfer/(buf_size/blk_size))*pio_mpi_nprocs_g)%(snbytes
+ /blk_size*(blk_size*blk_size)); */
+ mpi_offset = mpi_file_offset +
+ (MPI_Offset)((((size_t)nbytes_xfer / (buf_size / blk_size) *
+ (size_t)pio_mpi_nprocs_g) /
+ ((size_t)snbytes * blk_size)) *
+ (buf_size * (size_t)snbytes)) +
+ (MPI_Offset)((((size_t)nbytes_xfer / (buf_size / blk_size)) *
+ (size_t)pio_mpi_nprocs_g) %
+ ((size_t)snbytes * blk_size));
+
+ /* Number of bytes to be transferred per I/O operation */
+ nbytes_xfer_advance = blk_size * blk_size;
+
+ /* Global offset advance after each I/O operation */
+ /* mpi_offset_advance = (MPI_Offset)(snbytes/blk_size*(blk_size*blk_size)); */
+ mpi_offset_advance = (MPI_Offset)((size_t)snbytes * blk_size);
+
+ /* MPI type to be used for collective access */
+ mpi_collective_type = mpi_chunk_inter_type;
+ } /* end else */
+ } /* end else */
+
+ /* Common code for independent file access */
+ if (!parms->collective) {
+ /* Set the base of user's buffer */
+ buf_p = (unsigned char *)buffer;
+
+ /* Set the number of bytes to transfer this time */
+ nbytes_toxfer = buf_size * blk_size;
+
+ /* Loop over portions of the buffer to read */
+ while (nbytes_toxfer > 0) {
+ /* Perform independent read */
+ mrc = MPI_File_read_at(fd->mpifd, mpi_offset, buf_p, (int)nbytes_xfer_advance,
+ MPI_BYTE, &mpi_status);
+ VRFY((mrc == MPI_SUCCESS), "MPIO_READ");
+
+ /* Advance location in buffer */
+ buf_p += nbytes_xfer_advance;
+
+ /* Advance global offset in dataset */
+ nbytes_xfer += (off_t)nbytes_xfer_advance;
+
+ /* Decrement number of bytes left this time */
+ nbytes_toxfer -= nbytes_xfer_advance;
+
+ /* Partially advance global offset in dataset */
+ mpi_offset += mpi_offset_advance;
+ } /* end while */
+ } /* end if */
+
+ /* Common code for collective file access */
+ else {
+ /* Set the file view */
+ mrc = MPI_File_set_view(fd->mpifd, mpi_offset, MPI_BYTE, mpi_collective_type,
+ (char *)"native", h5_io_info_g);
+ VRFY((mrc == MPI_SUCCESS), "MPIO_VIEW");
+
+ /* Perform read */
+ MPI_File_read_at_all(fd->mpifd, 0, buffer, (int)(buf_size * blk_size), MPI_BYTE,
+ &mpi_status);
+ VRFY((mrc == MPI_SUCCESS), "MPIO_READ");
- /* Number of bytes to be transferred per I/O operation */
- nbytes_xfer_advance = blk_size;
-
- /* Global offset advance after each I/O operation */
- mpi_offset_advance = snbytes;
+ /* Advance global offset in dataset */
+ nbytes_xfer += (off_t)buf_size * (off_t)blk_size;
+ } /* end else */
- /* MPI type to be used for collective access */
- mpi_collective_type = mpi_inter_type;
} /* end else */
- } /* end if */
- /* Chunked storage */
- else {
- /*Contiguous access pattern */
- if (!parms->interleaved) {
- /* Compute offset in file */
- mpi_offset=mpi_file_offset+nbytes_xfer;
-
- /* Number of bytes to be transferred per I/O operation */
- nbytes_xfer_advance = blk_size * buf_size;
+ break;
+
+ case PHDF5:
+ /* 1D dataspace */
+ if (!parms->dim2d) {
+ /* Set up the file dset space id to move the selection to process */
+ if (!parms->interleaved) {
+ /* Contiguous pattern */
+ h5offset[0] = nbytes_xfer;
+ } /* end if */
+ else {
+ /* Interleaved access pattern */
+ /* Skip offset over blocks of other processes */
+ h5offset[0] = (nbytes_xfer * pio_mpi_nprocs_g);
+ } /* end else */
+ hrc = H5Soffset_simple(h5dset_space_id, h5offset);
+ VRFY((hrc >= 0), "H5Soffset_simple");
- /* Global offset advance after each I/O operation */
- mpi_offset_advance = 0;
+ /* Read the buffer in */
+ hrc = H5Dread(h5ds_id, ELMT_H5_TYPE, h5mem_space_id, h5dset_space_id, h5dxpl, buffer);
+ VRFY((hrc >= 0), "H5Dread");
- /* MPI type to be used for collective access */
- mpi_collective_type = mpi_full_buffer;
+ /* Increment number of bytes transferred */
+ nbytes_xfer += (off_t)buf_size;
} /* end if */
- /*Interleaved access pattern */
+ /* 2D dataspace */
else {
- /* Compute offset in file */
- /* Before simplification */
- /* mpi_offset=mpi_file_offset+(nbytes_xfer/(buf_size/blk_size)
- *pio_mpi_nprocs_g)/(snbytes/blk_size*(blk_size*blk_size))*
- (buf_size/blk_size*snbytes/blk_size*(blk_size*blk_size))+
- ((nbytes_xfer/(buf_size/blk_size))*pio_mpi_nprocs_g)%(snbytes
- /blk_size*(blk_size*blk_size)); */
- mpi_offset=mpi_file_offset+((nbytes_xfer/(buf_size/blk_size)
- *pio_mpi_nprocs_g)/(snbytes*blk_size))*(buf_size*snbytes)
- +((nbytes_xfer/(buf_size/blk_size))*pio_mpi_nprocs_g)%(snbytes*blk_size);
-
- /* Number of bytes to be transferred per I/O operation */
- nbytes_xfer_advance = blk_size * blk_size;
-
- /* Global offset advance after each I/O operation */
- /* mpi_offset_advance = (MPI_Offset)(snbytes/blk_size*(blk_size*blk_size)); */
- mpi_offset_advance = (MPI_Offset)(snbytes*blk_size);
-
- /* MPI type to be used for collective access */
- mpi_collective_type = mpi_chunk_inter_type;
- } /* end else */
- } /* end else */
-
- /* Common code for independent file access */
- if (!parms->collective) {
- /* Set the base of user's buffer */
- buf_p = (unsigned char *)buffer;
-
- /* Set the number of bytes to transfer this time */
- nbytes_toxfer = buf_size * blk_size;
-
- /* Loop over portions of the buffer to read */
- while(nbytes_toxfer>0){
- /* Perform independent read */
- mrc = MPI_File_read_at(fd->mpifd, mpi_offset, buf_p,
- (int)nbytes_xfer_advance, MPI_BYTE, &mpi_status);
- VRFY((mrc==MPI_SUCCESS), "MPIO_READ");
+ /* Set up the file dset space id to move the selection to process */
+ if (!parms->interleaved) {
+ /* Contiguous pattern */
+ h5offset[0] =
+ (hssize_t)(((size_t)nbytes_xfer / ((size_t)snbytes * blk_size)) * blk_size);
+ h5offset[1] =
+ (hssize_t)(((size_t)nbytes_xfer % ((size_t)snbytes * blk_size)) / blk_size);
+ } /* end if */
+ else {
+ /* Interleaved access pattern */
+ /* Skip offset over blocks of other processes */
+ h5offset[0] = (hssize_t)((((size_t)nbytes_xfer * (size_t)pio_mpi_nprocs_g) /
+ ((size_t)snbytes * buf_size)) *
+ buf_size);
+ h5offset[1] = (hssize_t)((((size_t)nbytes_xfer * (size_t)pio_mpi_nprocs_g) %
+ ((size_t)snbytes * buf_size)) /
+ buf_size);
- /* Advance location in buffer */
- buf_p+=nbytes_xfer_advance;
+ } /* end else */
+ hrc = H5Soffset_simple(h5dset_space_id, h5offset);
+ VRFY((hrc >= 0), "H5Soffset_simple");
- /* Advance global offset in dataset */
- nbytes_xfer+=nbytes_xfer_advance;
+ /* Write the buffer out */
+ hrc = H5Dread(h5ds_id, ELMT_H5_TYPE, h5mem_space_id, h5dset_space_id, h5dxpl, buffer);
+ VRFY((hrc >= 0), "H5Dread");
- /* Decrement number of bytes left this time */
- nbytes_toxfer-=nbytes_xfer_advance;
+ /* Increment number of bytes transferred */
+ nbytes_xfer += (off_t)buf_size * (off_t)blk_size;
- /* Partially advance global offset in dataset */
- mpi_offset+=mpi_offset_advance;
- } /* end while */
+ } /* end else */
+ break;
+
+ default:
+ break;
+ } /* switch (parms->io_type) */
+
+ /* Verify raw data, if asked */
+ if (parms->verify) {
+ /* Verify data read */
+ unsigned char *ucharptr = (unsigned char *)buffer;
+ size_t i;
+ int nerror = 0;
+
+ for (i = 0; i < bsize; ++i) {
+ if (*ucharptr++ != pio_mpi_rank_g + 1) {
+ if (++nerror < 20) {
+ /* report at most 20 errors */
+ HDprint_rank(output);
+ HDfprintf(output,
+ "read data error, expected (%d), "
+ "got (%d)\n",
+ pio_mpi_rank_g + 1, (int)*(ucharptr - 1));
+ } /* end if */
+ } /* end if */
+ } /* end for */
+ if (nerror >= 20) {
+ HDprint_rank(output);
+ HDfprintf(output, "...");
+ HDfprintf(output, "total read data errors=%d\n", nerror);
} /* end if */
+ } /* if (parms->verify) */
- /* Common code for collective file access */
- else {
- /* Set the file view */
- mrc = MPI_File_set_view(fd->mpifd, mpi_offset, MPI_BYTE,
- mpi_collective_type, (char *)"native", h5_io_info_g);
- VRFY((mrc==MPI_SUCCESS), "MPIO_VIEW");
-
- /* Perform read */
- MPI_File_read_at_all(fd->mpifd, 0, buffer,(int)(buf_size*blk_size),
- MPI_BYTE, &mpi_status);
- VRFY((mrc==MPI_SUCCESS), "MPIO_READ");
-
- /* Advance global offset in dataset */
- nbytes_xfer+=buf_size*blk_size;
- } /* end else */
+ } /* end while */
- } /* end else */
- break;
+ /* Stop "raw data" read timer */
+ io_time_set(res->timers, HDF5_RAW_READ_FIXED_DIMS, TSTOP);
- case PHDF5:
- /* 1D dataspace */
- if (!parms->dim2d){
- /* Set up the file dset space id to move the selection to process */
- if (!parms->interleaved){
- /* Contiguous pattern */
- h5offset[0] = nbytes_xfer;
- } /* end if */
- else {
- /* Interleaved access pattern */
- /* Skip offset over blocks of other processes */
- h5offset[0] = (nbytes_xfer*pio_mpi_nprocs_g);
- } /* end else */
- hrc = H5Soffset_simple(h5dset_space_id, h5offset);
- VRFY((hrc >= 0), "H5Soffset_simple");
+ /* Calculate read time */
- /* Read the buffer in */
- hrc = H5Dread(h5ds_id, ELMT_H5_TYPE, h5mem_space_id,
- h5dset_space_id, h5dxpl, buffer);
- VRFY((hrc >= 0), "H5Dread");
+ /* Close dataset. Only HDF5 needs to do an explicit close. */
+ if (parms->io_type == PHDF5) {
+ hrc = H5Dclose(h5ds_id);
- /* Increment number of bytes transferred */
- nbytes_xfer += buf_size;
- } /* end if */
- /* 2D dataspace */
- else {
- /* Set up the file dset space id to move the selection to process */
- if (!parms->interleaved){
- /* Contiguous pattern */
- h5offset[0] = (nbytes_xfer/(snbytes*blk_size))*blk_size;
- h5offset[1] = (nbytes_xfer%(snbytes*blk_size))/blk_size;
- } /* end if */
- else {
- /* Interleaved access pattern */
- /* Skip offset over blocks of other processes */
- h5offset[0] = ((nbytes_xfer*pio_mpi_nprocs_g)/(snbytes*buf_size))*buf_size;
- h5offset[1] = ((nbytes_xfer*pio_mpi_nprocs_g)%(snbytes*buf_size))/buf_size;
-
- } /* end else */
- hrc = H5Soffset_simple(h5dset_space_id, h5offset);
- VRFY((hrc >= 0), "H5Soffset_simple");
-
- /* Write the buffer out */
- hrc = H5Dread(h5ds_id, ELMT_H5_TYPE, h5mem_space_id,
- h5dset_space_id, h5dxpl, buffer);
- VRFY((hrc >= 0), "H5Dread");
-
- /* Increment number of bytes transferred */
- nbytes_xfer += buf_size*blk_size;
+ if (hrc < 0) {
+ HDfprintf(stderr, "HDF5 Dataset Close failed\n");
+ GOTOERROR(FAIL);
+ }
- } /* end else */
- break;
- } /* switch (parms->io_type) */
-
- /* Verify raw data, if asked */
- if (parms->verify) {
- /* Verify data read */
- unsigned char *ucharptr = (unsigned char *)buffer;
- size_t i;
- int nerror=0;
-
- for (i = 0; i < bsize; ++i){
- if (*ucharptr++ != pio_mpi_rank_g+1) {
- if (++nerror < 20){
- /* report at most 20 errors */
- HDprint_rank(output);
- HDfprintf(output, "read data error, expected (%d), "
- "got (%d)\n",
- pio_mpi_rank_g+1,
- (int)*(ucharptr-1));
- } /* end if */
- } /* end if */
- } /* end for */
- if (nerror >= 20) {
- HDprint_rank(output);
- HDfprintf(output, "...");
- HDfprintf(output, "total read data errors=%d\n",
- nerror);
+ h5ds_id = H5I_INVALID_HID;
} /* end if */
- } /* if (parms->verify) */
-
- } /* end while */
-
- /* Stop "raw data" read timer */
- set_time(res->timers, HDF5_RAW_READ_FIXED_DIMS, TSTOP);
-
- /* Calculate read time */
-
- /* Close dataset. Only HDF5 needs to do an explicit close. */
- if (parms->io_type == PHDF5) {
- hrc = H5Dclose(h5ds_id);
-
- if (hrc < 0) {
- fprintf(stderr, "HDF5 Dataset Close failed\n");
- GOTOERROR(FAIL);
- }
-
- h5ds_id = -1;
- } /* end if */
- } /* end for */
+ } /* end for */
done:
/* release MPI-I/O objects */
if (parms->io_type == MPIO) {
/* 1D dataspace */
- if (!parms->dim2d){
+ if (!parms->dim2d) {
/* Free file type */
- mrc = MPI_Type_free( &mpi_file_type );
- VRFY((mrc==MPI_SUCCESS), "MPIO_TYPE_FREE");
+ mrc = MPI_Type_free(&mpi_file_type);
+ VRFY((mrc == MPI_SUCCESS), "MPIO_TYPE_FREE");
/* Free buffer type */
- mrc = MPI_Type_free( &mpi_blk_type );
- VRFY((mrc==MPI_SUCCESS), "MPIO_TYPE_FREE");
+ mrc = MPI_Type_free(&mpi_blk_type);
+ VRFY((mrc == MPI_SUCCESS), "MPIO_TYPE_FREE");
} /* end if */
/* 2D dataspace */
else {
/* Free partial buffer type for contiguous access */
- mrc = MPI_Type_free( &mpi_partial_buffer_cont );
- VRFY((mrc==MPI_SUCCESS), "MPIO_TYPE_FREE");
+ mrc = MPI_Type_free(&mpi_partial_buffer_cont);
+ VRFY((mrc == MPI_SUCCESS), "MPIO_TYPE_FREE");
/* Free contiguous file type */
- mrc = MPI_Type_free( &mpi_cont_type );
- VRFY((mrc==MPI_SUCCESS), "MPIO_TYPE_FREE");
+ mrc = MPI_Type_free(&mpi_cont_type);
+ VRFY((mrc == MPI_SUCCESS), "MPIO_TYPE_FREE");
/* Free partial buffer type for interleaved access */
- mrc = MPI_Type_free( &mpi_partial_buffer_inter );
- VRFY((mrc==MPI_SUCCESS), "MPIO_TYPE_FREE");
+ mrc = MPI_Type_free(&mpi_partial_buffer_inter);
+ VRFY((mrc == MPI_SUCCESS), "MPIO_TYPE_FREE");
/* Free interleaved file type */
- mrc = MPI_Type_free( &mpi_inter_type );
- VRFY((mrc==MPI_SUCCESS), "MPIO_TYPE_FREE");
+ mrc = MPI_Type_free(&mpi_inter_type);
+ VRFY((mrc == MPI_SUCCESS), "MPIO_TYPE_FREE");
/* Free full buffer type */
mrc = MPI_Type_free(&mpi_full_buffer);
- VRFY((mrc==MPI_SUCCESS), "MPIO_TYPE_FREE");
+ VRFY((mrc == MPI_SUCCESS), "MPIO_TYPE_FREE");
/* Free full chunk type */
mrc = MPI_Type_free(&mpi_full_chunk);
- VRFY((mrc==MPI_SUCCESS), "MPIO_TYPE_FREE");
+ VRFY((mrc == MPI_SUCCESS), "MPIO_TYPE_FREE");
/* Free chunk interleaved file type */
mrc = MPI_Type_free(&mpi_chunk_inter_type);
- VRFY((mrc==MPI_SUCCESS), "MPIO_TYPE_FREE");
+ VRFY((mrc == MPI_SUCCESS), "MPIO_TYPE_FREE");
} /* end else */
- } /* end if */
+ } /* end if */
/* release HDF5 objects */
if (h5dset_space_id != -1) {
- hrc = H5Sclose(h5dset_space_id);
- if (hrc < 0){
- fprintf(stderr, "HDF5 Dataset Space Close failed\n");
- ret_code = FAIL;
- } else {
- h5dset_space_id = -1;
- }
+ hrc = H5Sclose(h5dset_space_id);
+ if (hrc < 0) {
+ HDfprintf(stderr, "HDF5 Dataset Space Close failed\n");
+ ret_code = FAIL;
+ }
+ else {
+ h5dset_space_id = H5I_INVALID_HID;
+ }
}
if (h5mem_space_id != -1) {
- hrc = H5Sclose(h5mem_space_id);
- if (hrc < 0) {
- fprintf(stderr, "HDF5 Memory Space Close failed\n");
- ret_code = FAIL;
- } else {
- h5mem_space_id = -1;
- }
+ hrc = H5Sclose(h5mem_space_id);
+ if (hrc < 0) {
+ HDfprintf(stderr, "HDF5 Memory Space Close failed\n");
+ ret_code = FAIL;
+ }
+ else {
+ h5mem_space_id = H5I_INVALID_HID;
+ }
}
if (h5dxpl != -1) {
- hrc = H5Pclose(h5dxpl);
- if (hrc < 0) {
- fprintf(stderr, "HDF5 Dataset Transfer Property List Close failed\n");
- ret_code = FAIL;
- } else {
- h5dxpl = -1;
- }
+ hrc = H5Pclose(h5dxpl);
+ if (hrc < 0) {
+ HDfprintf(stderr, "HDF5 Dataset Transfer Property List Close failed\n");
+ ret_code = FAIL;
+ }
+ else {
+ h5dxpl = H5I_INVALID_HID;
+ }
}
return ret_code;
@@ -2442,11 +2504,11 @@ done:
* Programmer: Albert Cheng, Bill Wendling, 2001/12/13
* Modifications:
*/
- static herr_t
+static herr_t
do_fopen(parameters *param, char *fname, file_descr *fd /*out*/, int flags)
{
- int ret_code = SUCCESS, mrc;
- hid_t acc_tpl = -1; /* file access templates */
+ int ret_code = SUCCESS, mrc;
+ hid_t acc_tpl = H5I_INVALID_HID; /* file access templates */
switch (param->io_type) {
case POSIXIO:
@@ -2455,12 +2517,11 @@ do_fopen(parameters *param, char *fname, file_descr *fd /*out*/, int flags)
else
fd->posixfd = POSIXOPEN(fname, O_RDONLY);
- if (fd->posixfd < 0 ) {
- fprintf(stderr, "POSIX File Open failed(%s)\n", fname);
+ if (fd->posixfd < 0) {
+ HDfprintf(stderr, "POSIX File Open failed(%s)\n", fname);
GOTOERROR(FAIL);
}
-
/* The perils of POSIX I/O in a parallel environment. The problem is:
*
* - Process n opens a file with truncation and then starts
@@ -2476,11 +2537,11 @@ do_fopen(parameters *param, char *fname, file_descr *fd /*out*/, int flags)
case MPIO:
if (flags & (PIO_CREATE | PIO_WRITE)) {
MPI_File_delete(fname, h5_io_info_g);
- mrc = MPI_File_open(pio_comm_g, fname, MPI_MODE_CREATE | MPI_MODE_RDWR,
- h5_io_info_g, &fd->mpifd);
+ mrc = MPI_File_open(pio_comm_g, fname, MPI_MODE_CREATE | MPI_MODE_RDWR, h5_io_info_g,
+ &fd->mpifd);
if (mrc != MPI_SUCCESS) {
- fprintf(stderr, "MPI File Open failed(%s)\n", fname);
+ HDfprintf(stderr, "MPI File Open failed(%s)\n", fname);
GOTOERROR(FAIL);
}
@@ -2488,13 +2549,14 @@ do_fopen(parameters *param, char *fname, file_descr *fd /*out*/, int flags)
/*filesize , set size to 0 explicitedly. */
mrc = MPI_File_set_size(fd->mpifd, (MPI_Offset)0);
if (mrc != MPI_SUCCESS) {
- fprintf(stderr, "MPI_File_set_size failed\n");
+ HDfprintf(stderr, "MPI_File_set_size failed\n");
GOTOERROR(FAIL);
}
- } else {
+ }
+ else {
mrc = MPI_File_open(pio_comm_g, fname, MPI_MODE_RDONLY, h5_io_info_g, &fd->mpifd);
if (mrc != MPI_SUCCESS) {
- fprintf(stderr, "MPI File Open failed(%s)\n", fname);
+ HDfprintf(stderr, "MPI File Open failed(%s)\n", fname);
GOTOERROR(FAIL);
}
}
@@ -2503,19 +2565,19 @@ do_fopen(parameters *param, char *fname, file_descr *fd /*out*/, int flags)
case PHDF5:
if ((acc_tpl = H5Pcreate(H5P_FILE_ACCESS)) < 0) {
- fprintf(stderr, "HDF5 Property List Create failed\n");
+ HDfprintf(stderr, "HDF5 Property List Create failed\n");
GOTOERROR(FAIL);
}
/* Set the file driver to the MPI-IO driver */
if (H5Pset_fapl_mpio(acc_tpl, pio_comm_g, h5_io_info_g) < 0) {
- fprintf(stderr, "HDF5 Property List Set failed\n");
+ HDfprintf(stderr, "HDF5 Property List Set failed\n");
GOTOERROR(FAIL);
}
/* Set the alignment of objects in HDF5 file */
if (H5Pset_alignment(acc_tpl, param->h5_thresh, param->h5_align) < 0) {
- fprintf(stderr, "HDF5 Property List Set failed\n");
+ HDfprintf(stderr, "HDF5 Property List Set failed\n");
GOTOERROR(FAIL);
}
@@ -2525,17 +2587,20 @@ do_fopen(parameters *param, char *fname, file_descr *fd /*out*/, int flags)
else
fd->h5fd = H5Fopen(fname, H5F_ACC_RDONLY, acc_tpl);
if (fd->h5fd < 0) {
- fprintf(stderr, "HDF5 File Create failed(%s)\n", fname);
+ HDfprintf(stderr, "HDF5 File Create failed(%s)\n", fname);
GOTOERROR(FAIL);
}
/* verifying the close of the acc_tpl */
if (H5Pclose(acc_tpl) < 0) {
- fprintf(stderr, "HDF5 Property List Close failed\n");
+ HDfprintf(stderr, "HDF5 Property List Close failed\n");
GOTOERROR(FAIL);
}
break;
+
+ default:
+ break;
}
done:
@@ -2549,52 +2614,54 @@ done:
* Programmer: Albert Cheng, Bill Wendling, 2001/12/13
* Modifications:
*/
- static herr_t
+static herr_t
do_fclose(iotype iot, file_descr *fd /*out*/)
{
herr_t ret_code = SUCCESS, hrc;
- int mrc = 0, rc = 0;
+ int mrc = 0, rc = 0;
switch (iot) {
- case POSIXIO:
- rc = POSIXCLOSE(fd->posixfd);
+ case POSIXIO:
+ rc = POSIXCLOSE(fd->posixfd);
- if (rc != 0){
- fprintf(stderr, "POSIX File Close failed\n");
- GOTOERROR(FAIL);
- }
+ if (rc != 0) {
+ HDfprintf(stderr, "POSIX File Close failed\n");
+ GOTOERROR(FAIL);
+ }
- fd->posixfd = -1;
- break;
+ fd->posixfd = -1;
+ break;
- case MPIO:
- mrc = MPI_File_close(&fd->mpifd);
+ case MPIO:
+ mrc = MPI_File_close(&fd->mpifd);
- if (mrc != MPI_SUCCESS){
- fprintf(stderr, "MPI File close failed\n");
- GOTOERROR(FAIL);
- }
+ if (mrc != MPI_SUCCESS) {
+ HDfprintf(stderr, "MPI File close failed\n");
+ GOTOERROR(FAIL);
+ }
- fd->mpifd = MPI_FILE_NULL;
- break;
+ fd->mpifd = MPI_FILE_NULL;
+ break;
- case PHDF5:
- hrc = H5Fclose(fd->h5fd);
+ case PHDF5:
+ hrc = H5Fclose(fd->h5fd);
- if (hrc < 0) {
- fprintf(stderr, "HDF5 File Close failed\n");
- GOTOERROR(FAIL);
- }
+ if (hrc < 0) {
+ HDfprintf(stderr, "HDF5 File Close failed\n");
+ GOTOERROR(FAIL);
+ }
+
+ fd->h5fd = -1;
+ break;
- fd->h5fd = -1;
- break;
+ default:
+ break;
}
done:
return ret_code;
}
-
/*
* Function: do_fclose
* Purpose: Cleanup temporary file unless HDF5_NOCLEANUP is set.
@@ -2604,25 +2671,27 @@ done:
* Programmer: Albert Cheng 2001/12/12
* Modifications:
*/
- static void
+static void
do_cleanupfile(iotype iot, char *fname)
{
if (pio_mpi_rank_g != 0)
- return;
+ return;
if (clean_file_g == -1)
- clean_file_g = (getenv("HDF5_NOCLEANUP")==NULL) ? 1 : 0;
-
- if (clean_file_g){
- switch (iot){
- case POSIXIO:
- remove(fname);
- break;
- case MPIO:
- case PHDF5:
- MPI_File_delete(fname, h5_io_info_g);
- break;
- }
+ clean_file_g = (getenv("HDF5_NOCLEANUP") == NULL) ? 1 : 0;
+
+ if (clean_file_g) {
+ switch (iot) {
+ case POSIXIO:
+ HDremove(fname);
+ break;
+ case MPIO:
+ case PHDF5:
+ MPI_File_delete(fname, h5_io_info_g);
+ break;
+ default:
+ break;
+ }
}
}
@@ -2630,51 +2699,49 @@ do_cleanupfile(iotype iot, char *fname)
/* instrument the MPI_File_wrirte_xxx and read_xxx calls to measure
* pure time spent in MPI_File code.
*/
-int MPI_File_read_at(MPI_File fh, MPI_Offset offset, void *buf,
- int count, MPI_Datatype datatype, MPI_Status *status)
+int
+MPI_File_read_at(MPI_File fh, MPI_Offset offset, void *buf, int count, MPI_Datatype datatype,
+ MPI_Status *status)
{
int err;
- set_time(timer_g, HDF5_MPI_READ, TSTART);
- err=PMPI_File_read_at(fh, offset, buf, count, datatype, status);
- set_time(timer_g, HDF5_MPI_READ, TSTOP);
+ io_time_set(timer_g, HDF5_MPI_READ, TSTART);
+ err = PMPI_File_read_at(fh, offset, buf, count, datatype, status);
+ io_time_set(timer_g, HDF5_MPI_READ, TSTOP);
return err;
}
-
-int MPI_File_read_at_all(MPI_File fh, MPI_Offset offset, void *buf,
- int count, MPI_Datatype datatype, MPI_Status *status)
+int
+MPI_File_read_at_all(MPI_File fh, MPI_Offset offset, void *buf, int count, MPI_Datatype datatype,
+ MPI_Status *status)
{
int err;
- set_time(timer_g, HDF5_MPI_READ, TSTART);
- err=PMPI_File_read_at_all(fh, offset, buf, count, datatype, status);
- set_time(timer_g, HDF5_MPI_READ, TSTOP);
+ io_time_set(timer_g, HDF5_MPI_READ, TSTART);
+ err = PMPI_File_read_at_all(fh, offset, buf, count, datatype, status);
+ io_time_set(timer_g, HDF5_MPI_READ, TSTOP);
return err;
}
-int MPI_File_write_at(MPI_File fh, MPI_Offset offset, void *buf,
- int count, MPI_Datatype datatype, MPI_Status *status)
+int
+MPI_File_write_at(MPI_File fh, MPI_Offset offset, void *buf, int count, MPI_Datatype datatype,
+ MPI_Status *status)
{
int err;
- set_time(timer_g, HDF5_MPI_WRITE, TSTART);
- err=PMPI_File_write_at(fh, offset, buf, count, datatype, status);
- set_time(timer_g, HDF5_MPI_WRITE, TSTOP);
+ io_time_set(timer_g, HDF5_MPI_WRITE, TSTART);
+ err = PMPI_File_write_at(fh, offset, buf, count, datatype, status);
+ io_time_set(timer_g, HDF5_MPI_WRITE, TSTOP);
return err;
}
-int MPI_File_write_at_all(MPI_File fh, MPI_Offset offset, void *buf,
- int count, MPI_Datatype datatype, MPI_Status *status)
+int
+MPI_File_write_at_all(MPI_File fh, MPI_Offset offset, void *buf, int count, MPI_Datatype datatype,
+ MPI_Status *status)
{
int err;
- set_time(timer_g, HDF5_MPI_WRITE, TSTART);
- err=PMPI_File_write_at_all(fh, offset, buf, count, datatype, status);
- set_time(timer_g, HDF5_MPI_WRITE, TSTOP);
+ io_time_set(timer_g, HDF5_MPI_WRITE, TSTART);
+ err = PMPI_File_write_at_all(fh, offset, buf, count, datatype, status);
+ io_time_set(timer_g, HDF5_MPI_WRITE, TSTOP);
return err;
}
-#endif /* TIME_MPI */
+#endif /* TIME_MPI */
#endif /* H5_HAVE_PARALLEL */
-
-
-
-
-