Skip to content

MPI shared memory socket scope#1072

Open
kab163 wants to merge 22 commits into
developfrom
task/add-mpi3-socket-scope
Open

MPI shared memory socket scope#1072
kab163 wants to merge 22 commits into
developfrom
task/add-mpi3-socket-scope

Conversation

@kab163

@kab163 kab163 commented May 4, 2026

Copy link
Copy Markdown
Collaborator

No description provided.

@kab163
kab163 marked this pull request as ready for review May 11, 2026 22:55
@kab163
kab163 requested a review from davidbeckingsale May 12, 2026 17:36
@kab163
kab163 requested review from adayton1 and rhornung67 June 1, 2026 21:33
Comment thread src/umpire/resource/HostMpi3SharedMemoryResource.cpp
Comment thread src/umpire/resource/HostMpi3SharedMemoryResource.cpp Outdated
Comment thread src/umpire/resource/HostMpi3SharedMemoryResource.cpp Outdated
Comment thread src/umpire/resource/HostMpi3SharedMemoryResource.cpp Outdated
adayton1
adayton1 previously approved these changes Jun 3, 2026
@adayton1

adayton1 commented Jun 3, 2026

Copy link
Copy Markdown
Member

Would it be worth considering adding hwloc as a dependency to get the socket info?

@kab163

kab163 commented Jun 4, 2026

Copy link
Copy Markdown
Collaborator Author

Would it be worth considering adding hwloc as a dependency to get the socket info?

I think it would be worth considering... I think for now we should merge this and see how people like it. If there's a need/desire to add hwloc later, we can. (Maybe as an optional dependency - like use hwloc if detected, otherwise use the linux system calls/numa like the branch does now.)

Comment thread src/umpire/resource/HostMpi3SharedMemoryResource.cpp Outdated
Comment thread src/umpire/resource/HostMpi3SharedMemoryResource.cpp Outdated
@kab163

kab163 commented Jun 9, 2026

Copy link
Copy Markdown
Collaborator Author

Update: Hubcast doesn't understand jobs that are allowed to fail. We can either fix the job failure or try to fix within Hubcast somehow.. stay tuned

@adayton1

adayton1 commented Jun 9, 2026

Copy link
Copy Markdown
Member

Update: Hubcast doesn't understand jobs that are allowed to fail. We can either fix the job failure or try to fix within Hubcast somehow.. stay tuned

You'll need to update branch protections under settings -> branches -> develop and list the CI jobs that are required to pass (instead of ci/gitlab.lc.llnl.gov).

@kab163

kab163 commented Jun 10, 2026

Copy link
Copy Markdown
Collaborator Author

Update: Hubcast doesn't understand jobs that are allowed to fail. We can either fix the job failure or try to fix within Hubcast somehow.. stay tuned

You'll need to update branch protections under settings -> branches -> develop and list the CI jobs that are required to pass (instead of ci/gitlab.lc.llnl.gov).

I don't see where I'd be able to do this in the develop branch's settings... (I'm getting copilot to help me...)

Comment thread .github/hubcast.yml
Comment thread src/umpire/Umpire.hpp Outdated
Comment thread examples/mpi3_shared_memory.cpp
Comment thread examples/mpi3_shared_memory.cpp
Comment thread examples/mpi3_shared_memory.cpp Outdated
@kab163
kab163 requested a review from adayton1 July 9, 2026 17:06
@kab163

kab163 commented Jul 9, 2026

Copy link
Copy Markdown
Collaborator Author

@lc-hubcast approve

@lc-hubcast

lc-hubcast Bot commented Jul 9, 2026

Copy link
Copy Markdown

To approve syncing this PR, please use the GitHub review comment feature to submit an approval. This ensures approval is tied to a specific commit to avoid the sync of malicious data.

@kab163 kab163 left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

@lc-hubcast approve

Comment thread src/umpire/Umpire.hpp
*
* \return true when the affinity mask is non-empty and maps to a single socket.
*/
bool affinity_maps_to_single_socket(std::string& reason);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Is there a better place for this method?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

I made some changes for this...

Comment thread src/umpire/resource/HostMpi3SharedMemoryResource.cpp Outdated
"shared_scope::socket for MPI3 shared memory requires Linux CPU affinity information");
}

const int color = get_socket_color_from_affinity();

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I don't think this will compile on platforms other than linux. Won't the socket scope code require a macro guard (e.g. #if defined(__linux__)) rather than just an if constexpr?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

I made some changes for this...


} // end anonymous namespace

bool affinity_maps_to_single_socket(std::string& reason)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Isn't this also defined in umpire.hpp and umpire.cpp?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

I made some changes for this...

@kab163
kab163 requested a review from MrBurmark July 13, 2026 22:43
#if defined(__linux__)
namespace {

bool all_ranks_affinity_maps_to_single_socket(std::string& reason)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This function appears to be duplicated a couple of times.

#include "umpire/strategy/NamedAllocationStrategy.hpp"
#include "umpire/util/MemoryResourceTraits.hpp"

bool all_ranks_affinity_maps_to_single_socket(std::string& reason)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This is duplicated a bunch.

Comment thread src/umpire/Umpire.cpp
}
#endif

bool affinity_maps_to_single_socket(std::string& reason)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Is this wrapper function actually needed?

#if defined(__linux__) && defined(UMPIRE_ENABLE_MPI3_SHARED_MEMORY)
namespace {

bool all_ranks_affinity_maps_to_single_socket(std::string& reason)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This is the other duplicate.

GTEST_SKIP() << "Socket-scoped MPI3 shared memory requires ranks bound to a single socket (" << e.what() << ")";
}

auto comm = umpire::get_communicator_for_allocator(allocator, MPI_COMM_WORLD);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Don't these communicators need to be cleaned up at the end of the test?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Amazing, thank you for catching that. Yes they do

ASSERT_EQ(socket_data[0], 42);
ASSERT_EQ(socket_data[1], nranks);

allocator.deallocate(socket_data);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Clean up cached communicators?

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