-
Notifications
You must be signed in to change notification settings - Fork 63
Implement collective communicator for multi-node CPUs #214
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
Conversation
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
|
@eddy16112 what else do you need to fix for the merge? unless there's anything else you want to change, feel free to merge it |
I am OK to merge it now, but it won't work until we add MPI_Init to legion_python. |
src/core/comm/coll.cc
Outdated
| if (current_unique_id > MAX_NB_COMMS) { | ||
| log_coll.fatal( | ||
| "Please increase the LEGATE_MAX_CPU_COMMS by export LEGATE_MAX_CPU_COMMS=new number, current " | ||
| "value " |
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.
Please fix this weird line formatting.
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.
I have fixed it, sometime the pre-commit can change the code into a weird format.
#264 should address the problem. |
legate/core/communicator.py
Outdated
|
|
||
| def destroy(self) -> None: | ||
| Communicator.destroy(self) | ||
| self._runtime.issue_execution_fence(block=True) |
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.
Two comments: 1) please leave a comment why we need this blocking. 2) do this only if you have any CPU communicators. many programs don't ever create them.
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.
This is the destructor of communicator, so if programs do not create them, the destroy function will not be called, 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.
Communicator.destroy is invoked unconditionally once per communicator type. it's Communicator._finalize that is invoked for each created communicator. the fence is to block on the tasks launched by those Communicator._finalize calls, so you don't need it if no communicator is created. I assume you still need to legate_cpucoll_finalize even when no CPU communicator is created. but I believe that function can be invoked without the fence in that case.
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.
Got it, I have pushed a fix for it.
10c988e
|
LGTM. Feel free to merge it when you can |
Thank you, I will update the description, and then merge it. |
Provide CPU-only collective routines including alltoall, alltoallv and allgather for the case when there are multiple ranks per node.
We adopt the similar API design from NCCL and MPI. Here are the description of APIs:
collInitandcollFinalize: similar to MPI_Init and MPI_Finalize, which are called by the top level task of each node.collGetUniqueId: similar toncclGetUniqueId, only rank 0 need to call it to get a unique id. The unique id will be used to distinguish communicators.collCommCreateandcollCommDestroy: similar toncclCommInitRankandncclCommDestroy, only ranks participated in the communicator need to call them to initialize/finalize a communicator. There are thread-safe.collAllgather,collAlltoallandcollAlltoallv: collective routines called by each rank within a communicator.It supports both with and without
LEGATE_USE_GASNET. When enablingLEGATE_USE_GASNET, we use multi-thread MPI with tagging to implement collective communications. When disablingLEGATE_USE_GASNET, we use a shared buffer to allow each rank(thread) within the same node to exchange data.