Skip to content
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

docs: add documentation for threading tuning parameters #5917

Merged
merged 3 commits into from
Apr 2, 2022

Conversation

sagarth
Copy link
Contributor

@sagarth sagarth commented Mar 29, 2022

Pull Request Description

This PR adds documentation for tuning parameters related to multi-threading (MPI_THREAD_MULTIPLE).

Author Checklist

  • Provide Description
    Particularly focus on why, not what. Reference background, issues, test failures, xfail entries, etc.
  • Commits Follow Good Practice
    Commits are self-contained and do not do two things at once.
    Commit message is of the form: module: short description
    Commit message explains what's in the commit.
  • Passes All Tests
    Whitespace checker. Warnings test. Additional tests via comments.
  • Contribution Agreement
    For non-Argonne authors, check contribution agreement.
    If necessary, request an explicit comment from your companies PR approval manager.

@sagarth sagarth force-pushed the upstream_threading_doc-03_22 branch from 6c360c3 to d39a3ac Compare March 29, 2022 16:17
@sagarth sagarth marked this pull request as ready for review March 29, 2022 16:18
@hzhou
Copy link
Contributor

hzhou commented Mar 29, 2022

👍 Looks good. Ping me when it is ready to review.

@sagarth sagarth force-pushed the upstream_threading_doc-03_22 branch from d39a3ac to 8c02136 Compare March 29, 2022 16:41

MPICH also supports a non-standard per-communicator info hint that provides the user with more control of a communicator-VCI mapping:
* `vci`: Specific sender and receiver VCI can be selected for each communicator using this hint. Applications can utilize this feature to control how messages are spread across the VCIs.
For instance, programmers can write the applications so that pairs of threads communicate by using different communicator, where each communicator can be mapped to a different VCI through the `vci` info hint. Valid values for this info hints are 0 to (total vcis - 1). This hint is also utilized by MPICH to select a progress thread to process reduction collective operation.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you wrap the text to width of less than 80 chars?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@sagarth sagarth force-pushed the upstream_threading_doc-03_22 branch 2 times, most recently from ba3fadf to f20999e Compare March 29, 2022 17:35
Copy link
Contributor

@hzhou hzhou left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's good explanations. However, it is immediately clear for a user how to configure/tune. List configure options and cvars in separate code snippet block should help.

the MPI runtime, the runtime will serialize the calls. Another strategy uses a
fine-grained lock to protect the access to each network context or VCI. With
this approach, threads trying to access the same VCI get serialized, but threads
accessing different VCIs can execute in parallel. With the fine-grained locking
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need explain how to configure/select between "global" and "find-grained".

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll add the details.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

model, MPICH supports a `direct` mode where the MPI runtime itself grabs a per
VCI lock and a `lockless` mode where MPI does not grab a lock and relies on the
network provider to provide fine grain synchronization (MPICH uses the
FI_THREAD_SAFE mode from OFI to support the `lockless` mode).
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Document the configure option and runtime cvars.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll add them.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

This document will discuss various tuning parameters in MPICH.
@sagarth sagarth force-pushed the upstream_threading_doc-03_22 branch from f20999e to 38a129b Compare April 1, 2022 22:09
@sagarth
Copy link
Contributor Author

sagarth commented Apr 1, 2022

@hzhou I've added a fixup patch with your requested changes. Could you check if it looks fine? I'll squash it after the review.

A threading synchronization strategy can be selected at the configuration time
as:
--enable-thread-cs=global to select coarse-grained locking, and
--enable-thread-cs=per-vci to select fine-grained locking.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you break the line so the command snippet is on its own line?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was debating with myself about it. Sure, let me do that.

Copy link
Contributor Author

@sagarth sagarth Apr 1, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done + squashed

@sagarth sagarth force-pushed the upstream_threading_doc-03_22 branch from 38a129b to 0241d87 Compare April 1, 2022 23:05
Copy link
Contributor

@hzhou hzhou left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I notice you are using MARKDOWN formating throughout. How about rename this document into tuning_parameters.md and then fix the part that doesn't look right (like headings)?

I am approving it as I am OK to merge it as is. It's up to you to make additional changes. Just let me know when you are happy for it to merge.

https://wiki.mpich.org/mpich/index.php/Using_the_Hydra_Process_Manager#Process-core_Binding.



Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Extra empty lines.


**1. Multi-threading**


Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

extra empty line

These are the currently supported tuning parameters for
MPI_THREAD_MULTIPLE.
@sagarth sagarth force-pushed the upstream_threading_doc-03_22 branch from 0241d87 to 58f272b Compare April 1, 2022 23:27
@sagarth
Copy link
Contributor Author

sagarth commented Apr 1, 2022

Fixed the space issues. Also converted the doc file to .md and fixed some of the formatting issues. I kept the conversion on a separate patch though.

@sagarth sagarth force-pushed the upstream_threading_doc-03_22 branch from 8bd5e78 to 6ddcd21 Compare April 1, 2022 23:42
@hzhou
Copy link
Contributor

hzhou commented Apr 1, 2022

How about add a title?

@sagarth
Copy link
Contributor Author

sagarth commented Apr 1, 2022

How about add a title?

Is the how we add title to a MARKDOWN file? :
% MPICH Tuning Parameters

@hzhou
Copy link
Contributor

hzhou commented Apr 1, 2022

How about add a title?

Is the how we add title to a MARKDOWN file? : % MPICH Tuning Parameters

Title is just bigger heading.

This is a title

Section title

This is now formatted as MARKDOWN (.md) file. This patch also
fixes some of the formatting issues that appeared during the
format change.
@sagarth sagarth force-pushed the upstream_threading_doc-03_22 branch from 6ddcd21 to 3d9ed35 Compare April 1, 2022 23:58
@sagarth
Copy link
Contributor Author

sagarth commented Apr 1, 2022

Updated

@hzhou hzhou changed the title Add documentation for threading related tuning parameters docs: add documentation for threading tuning parameters Apr 2, 2022
@hzhou hzhou merged commit e763458 into pmodels:main Apr 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants