-
Notifications
You must be signed in to change notification settings - Fork 36
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
Add shared file testing to test_api #487
Conversation
A new option (--shared-file) was added to test_api that will cause all of the participating ranks to share the same file with each process using a unique section of the file for its I/O operations.
This comment was marked as resolved.
This comment was marked as resolved.
Take suggested change. Co-authored-by: Adam Moody <moody20@llnl.gov>
Co-authored-by: Adam Moody <moody20@llnl.gov>
@adammoody - I have marked the comments as resolved. I attempted to simplify file creation logic at the cost of an MPI_Bcast call. Let me know if you think that is ok |
Hmm, that's shorter code, but I think it's a bit hard to follow. Let's keep with using the separate code paths as it's easier to understand. But we could simplify this section of the code by defining a new "create_file" function. That would do the magic to create/open the file (either shared or file per process) and return an opened file descriptor that is ready for writing. This part would thenreduce to something like:
while we move your previous code block into the create file function, so something like:
|
Okay take 3. I like the structure proposed, but it does expand for error handling. Thoughts? |
Looks good. Thanks! |
examples/test_api.c
Outdated
|
||
MPI_Bcast(&fd, 1, MPI_INT, 0, MPI_COMM_WORLD); /* Wait for rank 0 to complete creation */ | ||
|
||
if (fd > 0) { |
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.
oh, wait. I think fd==0
also means success, right?
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.
and if that's true, I have that bug all throughout the test_*.c code.
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.
whoops!
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.
Yeah, I had noticed that too. But it is rare that stdin, stdout, and/or stderr would be closed. But I suppose it could happen. I'll clean this up
Thanks, @mcfadden8 . This looks good to me. Ready to be merged from your view? |
This looks ready to me. I'm finished with my changes. |
Thanks @mcfadden8 ! |
A new option (--shared-file) was added to test_api that will cause all of the participating ranks to share the same file with each process using a unique section of the file for its I/O operations.