-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
decl_hdf5 MPI-I/O Collective or Independent, fix #419 #502
Open
jmorice91
wants to merge
10
commits into
main
Choose a base branch
from
mpio_pointer
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
f89059c
decl_hdf5 MPIO Collective or Independent, fix #419
ksiero 73b8566
fix compilation error + add compatibilty test with independent I/O
jmorice91 5a47545
fix419:resolve Datatype_template_sptr error + Add change in local CHA…
jmorice91 8853f66
fix419: add mpio in full configuration example of the doc
jmorice91 425b085
fix419: fix name of parameter
jmorice91 d76154a
fixing review
jmorice91 9d1e827
replace MPIIO by MPI-I/O + add argument to main + fix some typo
jmorice91 5f87e2d
Merge branch 'main' into mpio_pointer
Yushan-Wang 53d0076
fix review
jmorice91 b20ff10
Merge branch 'main' into mpio_pointer
jmorice91 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,6 +11,12 @@ Julien Bigot - CEA ([email protected]) | |
* Run tests that depend on the filesystem in their own temporary directory | ||
* Buildsystem | ||
|
||
Jacques Morice - CEA ([email protected]) | ||
* contribution to feature improvement, validation | ||
|
||
Yacine Ould Rouis - CNRS ([email protected]) | ||
* contribution to feature design, validation | ||
|
||
Thomas Padioleau - CEA ([email protected]) | ||
* Fixed a bug with parallel file deletion | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
@@ -1,6 +1,6 @@ | ||||||||||||||
/******************************************************************************* | ||||||||||||||
* Copyright (C) 2015-2024 Commissariat a l'energie atomique et aux energies alternatives (CEA) | ||||||||||||||
* Copyright (C) 2021 Institute of Bioorganic Chemistry Polish Academy of Science (PSNC) | ||||||||||||||
* Copyright (C) 2021-2022 Institute of Bioorganic Chemistry Polish Academy of Science (PSNC) | ||||||||||||||
* All rights reserved. | ||||||||||||||
* | ||||||||||||||
* Redistribution and use in source and binary forms, with or without | ||||||||||||||
|
@@ -164,6 +164,14 @@ Dataset_op::Dataset_op(Direction dir, string name, Expression default_when, PC_t | |||||||||||||
m_fletcher = value; | ||||||||||||||
} else if (key == "attributes") { | ||||||||||||||
// pass | ||||||||||||||
} else if (key == "mpio") { | ||||||||||||||
if (to_string(value) == "INDEPENDENT") { | ||||||||||||||
m_mpio = H5FD_MPIO_INDEPENDENT; | ||||||||||||||
} else if (to_string(value) == "COLLECTIVE") { | ||||||||||||||
m_mpio = H5FD_MPIO_COLLECTIVE; | ||||||||||||||
} else { | ||||||||||||||
throw Config_error{key_tree, "Not valid mpio value: `{}'. Expecting INDEPENDENT or COLLECTIVE.", to_string(value)}; | ||||||||||||||
} | ||||||||||||||
} else if (key == "collision_policy") { | ||||||||||||||
m_collision_policy = to_collision_policy(to_string(value)); | ||||||||||||||
} else { | ||||||||||||||
|
@@ -203,8 +211,12 @@ void Dataset_op::fletcher(Context& ctx, Expression value) | |||||||||||||
} | ||||||||||||||
} | ||||||||||||||
|
||||||||||||||
void Dataset_op::execute(Context& ctx, hid_t h5_file, hid_t xfer_lst, const unordered_map<string, Datatype_template_sptr>& dsets) | ||||||||||||||
void Dataset_op::execute(Context& ctx, hid_t h5_file, bool use_mpio, const unordered_map<string, Datatype_template_sptr>& dsets) | ||||||||||||||
{ | ||||||||||||||
Raii_hid xfer_lst = make_raii_hid(H5Pcreate(H5P_DATASET_XFER), H5Pclose); | ||||||||||||||
if (use_mpio) { | ||||||||||||||
if (0 > H5Pset_dxpl_mpio(xfer_lst, m_mpio)) handle_hdf5_err(); | ||||||||||||||
} | ||||||||||||||
if (m_direction == READ) | ||||||||||||||
do_read(ctx, h5_file, xfer_lst); | ||||||||||||||
else | ||||||||||||||
Comment on lines
220
to
222
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||
|
@@ -328,7 +340,7 @@ hid_t Dataset_op::dataset_creation_plist(Context& ctx, const Datatype* dataset_t | |||||||||||||
return dset_plist; | ||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||
} | ||||||||||||||
|
||||||||||||||
void Dataset_op::do_write(Context& ctx, hid_t h5_file, hid_t write_lst, const unordered_map<string, PDI::Datatype_template_sptr>& dsets) | ||||||||||||||
void Dataset_op::do_write(Context& ctx, hid_t h5_file, hid_t write_lst, const unordered_map<string, Datatype_template_sptr>& dsets) | ||||||||||||||
{ | ||||||||||||||
string dataset_name = m_dataset.to_string(ctx); | ||||||||||||||
ctx.logger().trace("Preparing for writing `{}' dataset", dataset_name); | ||||||||||||||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
144 changes: 144 additions & 0 deletions
144
plugins/decl_hdf5/tests/compatibility_tests/HDF5_C/mpi_independent_read_test.c
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,144 @@ | ||
/******************************************************************************* | ||
* Copyright (C) 2020 Institute of Bioorganic Chemistry Polish Academy of Science (PSNC) | ||
* All rights reserved. | ||
* | ||
* Redistribution and use in source and binary forms, with or without | ||
* modification, are permitted provided that the following conditions are met: | ||
* * Redistributions of source code must retain the above copyright | ||
* notice, this list of conditions and the following disclaimer. | ||
* * Redistributions in binary form must reproduce the above copyright | ||
* notice, this list of conditions and the following disclaimer in the | ||
* documentation and/or other materials provided with the distribution. | ||
* * Neither the name of CEA nor the names of its contributors may be used to | ||
* endorse or promote products derived from this software without specific | ||
* prior written permission. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
* THE SOFTWARE. | ||
******************************************************************************/ | ||
|
||
#include <mpi.h> | ||
#include <assert.h> | ||
#include <hdf5.h> | ||
#include <unistd.h> | ||
|
||
#define FILE "mpi_independent_test.h5" | ||
|
||
/** | ||
* Test : Read a file using hdf5 parallel version with the option independent parallel pointer. | ||
*/ | ||
|
||
int main(int argc, char* argv[]) | ||
{ | ||
printf("HDF5 mpi_independent_read_test started\n"); | ||
MPI_Init(&argc, &argv); | ||
int mpi_rank; | ||
MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank); | ||
herr_t status = H5open(); | ||
if (status < 0) { | ||
return 1; | ||
} | ||
|
||
hid_t fapl_id = H5Pcreate(H5P_FILE_ACCESS); | ||
H5Pset_fapl_mpio(fapl_id, MPI_COMM_WORLD, MPI_INFO_NULL); | ||
hid_t file_id = H5Fopen(FILE, H5F_ACC_RDONLY, fapl_id); | ||
if (file_id < 0) { | ||
return 1; | ||
} | ||
|
||
int dset_data[5][5]; | ||
for (int i = 0; i < 5; i++) { | ||
for (int j = 0; j < 5; j++) { | ||
dset_data[i][j] = 0; | ||
} | ||
} | ||
|
||
hsize_t coords[2] = {5, 10}; | ||
hid_t dataspace_id = H5Screate_simple(2, coords, NULL); | ||
if (dataspace_id < 0) { | ||
return 1; | ||
} | ||
|
||
hid_t dataset_id = H5Dopen2(file_id, "array_data", H5P_DEFAULT); | ||
if (dataset_id < 0) { | ||
return 1; | ||
} | ||
|
||
hsize_t count[2] = {5, 5}; | ||
hsize_t stride[2] = {1, 1}; | ||
hsize_t dataset_offset[2] = {0, 5 * mpi_rank}; | ||
hsize_t memory_offset[2] = {0, 0}; | ||
hsize_t block[2] = {1, 1}; | ||
|
||
status = H5Sselect_hyperslab(dataspace_id, H5S_SELECT_SET, dataset_offset, stride, count, block); | ||
if (status < 0) { | ||
return 1; | ||
} | ||
hid_t memory_dataspace_id = H5Screate_simple(2, count, NULL); | ||
if (memory_dataspace_id < 0) { | ||
return 1; | ||
} | ||
status = H5Sselect_hyperslab(memory_dataspace_id, H5S_SELECT_SET, memory_offset, stride, count, block); | ||
if (status < 0) { | ||
return 1; | ||
} | ||
|
||
hid_t dxpl_id = H5Pcreate(H5P_DATASET_XFER); | ||
H5Pset_dxpl_mpio(dxpl_id, H5FD_MPIO_INDEPENDENT); | ||
|
||
status = H5Dread(dataset_id, H5T_NATIVE_INT, memory_dataspace_id, dataspace_id, dxpl_id, dset_data); | ||
if (status < 0) { | ||
return 1; | ||
} | ||
|
||
for (int i = 0; i < 5; i++) { | ||
for (int j = 0; j < 5; j++) { | ||
if (dset_data[i][j] != i * 10 + j + (5 * mpi_rank)) { | ||
fprintf(stderr, "[%d][%d] %d != %d\n ", i, j, dset_data[i][j], i * 10 + j + (5 * mpi_rank)); | ||
return 1; | ||
} | ||
} | ||
} | ||
|
||
status = H5Dclose(dataset_id); | ||
if (status < 0) { | ||
return 1; | ||
} | ||
status = H5Pclose(dxpl_id); | ||
if (status != 0) { | ||
return status; | ||
} | ||
status = H5Sclose(memory_dataspace_id); | ||
if (status < 0) { | ||
return 1; | ||
} | ||
status = H5Sclose(dataspace_id); | ||
if (status < 0) { | ||
return 1; | ||
} | ||
status = H5Fclose(file_id); | ||
if (file_id < 0) { | ||
return 1; | ||
} | ||
if (status != 0) { | ||
return status; | ||
} | ||
status = H5Pclose(fapl_id); | ||
if (status != 0) { | ||
return status; | ||
} | ||
|
||
H5close(); | ||
if (status < 0) { | ||
return 1; | ||
} | ||
MPI_Finalize(); | ||
|
||
printf("[Rank: %d] HDF5 mpi_read_test finalized\n", mpi_rank); | ||
return 0; | ||
} |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My personal opinion: I think that all if/else blocks should use curly braces, even if there is only 1 line.