Skip to content

Intra-node shared memory (SHM) optimizations for CPU primitives #458

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

Draft
wants to merge 6 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions gloo/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ list(APPEND GLOO_SRCS
"${CMAKE_CURRENT_SOURCE_DIR}/allgatherv.cc"
"${CMAKE_CURRENT_SOURCE_DIR}/allreduce.cc"
"${CMAKE_CURRENT_SOURCE_DIR}/allreduce_local.cc"
"${CMAKE_CURRENT_SOURCE_DIR}/allreduce_shm.cc"
"${CMAKE_CURRENT_SOURCE_DIR}/alltoall.cc"
"${CMAKE_CURRENT_SOURCE_DIR}/alltoallv.cc"
"${CMAKE_CURRENT_SOURCE_DIR}/barrier.cc"
Expand All @@ -34,6 +35,7 @@ list(APPEND GLOO_HDRS
"${CMAKE_CURRENT_SOURCE_DIR}/allreduce_local.h"
"${CMAKE_CURRENT_SOURCE_DIR}/allreduce_ring.h"
"${CMAKE_CURRENT_SOURCE_DIR}/allreduce_ring_chunked.h"
"${CMAKE_CURRENT_SOURCE_DIR}/allreduce_shm.h"
"${CMAKE_CURRENT_SOURCE_DIR}/alltoall.h"
"${CMAKE_CURRENT_SOURCE_DIR}/alltoallv.h"
"${CMAKE_CURRENT_SOURCE_DIR}/barrier.h"
Expand Down
10 changes: 10 additions & 0 deletions gloo/allreduce.cc
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#include "gloo/common/logging.h"
#include "gloo/math.h"
#include "gloo/types.h"
#include "gloo/allreduce_shm.h"

namespace gloo {

Expand Down Expand Up @@ -153,6 +154,15 @@ void ring(
const auto slot = Slot::build(kAllreduceSlotPrefix, opts.tag);
const size_t totalBytes = opts.elements * opts.elementSize;


if (is_intra_node(context->size)) {
shm(opts);
return;
}

//shm(opts);
//return;

// Note: context->size > 1
const auto recvRank = (context->size + context->rank + 1) % context->size;
const auto sendRank = (context->size + context->rank - 1) % context->size;
Expand Down
Loading