-
Notifications
You must be signed in to change notification settings - Fork 359
Support async mode for shm allreduce #484
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
base: main
Are you sure you want to change the base?
Changes from 4 commits
1f5e2db
fda784d
874795c
e2f2b73
f0c4a58
b3990aa
e82036e
228bdb8
a863f42
a71bdda
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -12,8 +12,12 @@ | |
| #include <array> | ||
| #include <cstring> | ||
|
|
||
| #if !defined(_WIN32) && !defined(__aarch64__) && !defined(__arm__) | ||
| #include "gloo/allreduce_shm.h" | ||
| #endif | ||
| #include "gloo/common/logging.h" | ||
| #include "gloo/math.h" | ||
| #include "gloo/transport/device.h" | ||
| #include "gloo/types.h" | ||
|
|
||
| namespace gloo { | ||
|
|
@@ -131,14 +135,27 @@ void allreduce(const detail::AllreduceOptionsImpl& opts) { | |
| return; | ||
| } | ||
|
|
||
| switch (opts.algorithm) { | ||
| auto algorithm = opts.algorithm; | ||
|
|
||
| #if !defined(_WIN32) && !defined(__aarch64__) && !defined(__arm__) | ||
| if (context->isIntraNode() && !context->getDevice()->hasGPUDirect()) { | ||
| algorithm = detail::AllreduceOptionsImpl::SHM; | ||
|
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. I dont see users to be able to use explicit algorithm - this will override anything user explicitly specifies. should we check
Contributor
Author
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. I've modified it to make sure it will override Algorithm::UNSPECIFIED only when shm allreduce is applicable. Also I added unit test for shm allreduce in gloo/test/allreduce_test.cc |
||
| } | ||
| #endif | ||
|
|
||
| switch (algorithm) { | ||
| case detail::AllreduceOptionsImpl::UNSPECIFIED: | ||
| case detail::AllreduceOptionsImpl::RING: | ||
| ring(opts, reduceInputs, broadcastOutputs); | ||
| break; | ||
| case detail::AllreduceOptionsImpl::BCUBE: | ||
| bcube(opts, reduceInputs, broadcastOutputs); | ||
| break; | ||
| #if !defined(_WIN32) && !defined(__aarch64__) && !defined(__arm__) | ||
| case detail::AllreduceOptionsImpl::SHM: | ||
| shm(opts); | ||
| break; | ||
| #endif | ||
| default: | ||
| GLOO_ENFORCE(false, "Algorithm not handled."); | ||
| } | ||
|
|
||
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 seems to be copied in a bunch of places - can we make this a macro?
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.
Sure, I've defined a macro of this in gloo/allreduce.h, which will be used in unit test too,