Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
3dcb0aa
initial import of functional openshmem parcelport
Sep 4, 2026
bec99c8
updated copyrights
Sep 4, 2026
176a965
minor updates to comments
Sep 4, 2026
c130fb1
fixes asio compilation issue
Sep 5, 2026
2fa6609
clang formatting fixes
Sep 5, 2026
309320d
formatting changes
Sep 5, 2026
c963497
cmake formatting fixes
Sep 5, 2026
1f2588b
Restore original parcelport_gasnet.cpp
Sep 5, 2026
2546acc
Update locality.hpp
ct-clmsn Sep 5, 2026
7f57555
working openshmem parcelport
Sep 27, 2026
ce8e814
multiple updates to fix hpx.parcel.openshmem.uniform_check
Oct 4, 2026
1a8f2c2
performance improvements for openshmem parcelport - thanks to constra…
Oct 30, 2026
816df39
Fix OpenSHMEM parcelport startup, delivery and shutdown
constracktor Nov 6, 2026
2a12d58
Run OpenSHMEM parcelport tests in gcc-14 CI
constracktor Nov 6, 2026
4065371
Apply clang-format to OpenSHMEM parcelport changes
constracktor Nov 6, 2026
79925ac
Keep OpenSHMEM parcelport inert when not selected
constracktor Nov 6, 2026
4c184e7
Run OpenSHMEM tests on UCX shared-memory transports
constracktor Nov 11, 2026
d46dc40
Install the OpenSHMEM mailbox header
constracktor Nov 11, 2026
a04e86f
Remove unused code and stats from the OpenSHMEM parcelport, load coun…
constracktor Nov 11, 2026
28853fa
Handle OpenSHMEM counter wrap-around and acquire the counters
constracktor Nov 11, 2026
c1911a7
Link OpenSHMEM by full paths, accept unbuilt parcelports in hpxrun.py
hkaiser Nov 20, 2026
f50246e
Document building and running HPX with the OpenSHMEM parcelport
hkaiser Nov 20, 2026
6b01337
Address review comments on the OpenSHMEM parcelport
hkaiser Nov 20, 2026
88c2719
Apply clang-format and cmake-format, fix inspect issues
hkaiser Nov 20, 2026
f4c94fa
Give the localities on one host different cores
hkaiser Nov 21, 2026
d0a84cb
Progress the OpenSHMEM parcelport from the worker threads by default
hkaiser Nov 21, 2026
6912c54
Document how the OpenSHMEM parcelport sends and receives parcels
hkaiser Nov 21, 2026
8c247f3
Let the processes agree on the symmetric heap address in hpxrun.py
hkaiser Nov 21, 2026
e87b932
Include <utility> for std::swap in the OpenSHMEM receiver
hkaiser Nov 22, 2026
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
9 changes: 8 additions & 1 deletion .jenkins/lsu/env-gcc-14.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,14 @@ module load openmpi
module load likwid/5.4.1

export HPXRUN_RUNWRAPPER=srun

# liboshmem and libmpi live in the Open MPI library directory, which is not on
# the default linker search path; oshrun launches the OpenSHMEM parcelport tests
openmpi_prefix="$(dirname "$(dirname "$(which mpirun)")")"
export LIBRARY_PATH=${openmpi_prefix}/lib:$LIBRARY_PATH
export HPXRUN_OSHRUN=oshrun
export CXX_STD="23"
export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:$PKG_CONFIG_PATH
export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:${openmpi_prefix}/lib/pkgconfig:$PKG_CONFIG_PATH

configure_extra_options+=" -DCMAKE_BUILD_TYPE=${build_type}"
configure_extra_options+=" -DHPX_WITH_CXX_STANDARD=${CXX_STD}"
Expand All @@ -34,6 +40,7 @@ configure_extra_options+=" -DCMAKE_C_FLAGS=-fPIC"
configure_extra_options+=" -DHPX_WITH_DATAPAR_BACKEND=STD_EXPERIMENTAL_SIMD"
configure_extra_options+=" -DHPX_LIKWID_WITH_LIKWID=ON"
configure_extra_options+=" -DHPX_WITH_TASK_SIZE_DEFAULT_PARAMETERS=ON"
configure_extra_options+=" -DHPX_WITH_PARCELPORT_OPENSHMEM=ON"

# The pwrapi library still needs to be set up properly on rostam
# configure_extra_options+=" -DHPX_WITH_POWER_COUNTER=ON"
Expand Down
32 changes: 32 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1520,6 +1520,38 @@ if(HPX_WITH_NETWORKING)
)
endif()

hpx_option(
HPX_WITH_PARCELPORT_OPENSHMEM BOOL "Enable the OpenSHMEM based parcelport."
OFF CATEGORY "Parcelport"
)
if(HPX_WITH_PARCELPORT_OPENSHMEM)
hpx_add_config_define(HPX_HAVE_PARCELPORT_OPENSHMEM)
hpx_option(
HPX_WITH_PARCELPORT_OPENSHMEM_MTU STRING
"Set the MTU for the OpenSHMEM parcelport (default: 65536)." 65536
CATEGORY "Parcelport"
)
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Resolved
if(HPX_WITH_PARCELPORT_OPENSHMEM_MTU)
hpx_add_config_define(
HPX_HAVE_PARCELPORT_OPENSHMEM_MTU ${HPX_WITH_PARCELPORT_OPENSHMEM_MTU}
)
endif()

hpx_option(
HPX_WITH_PARCELPORT_OPENSHMEM_SLOTS
STRING
"Set the number of in-flight chunks per (sender,receiver) pair for the OpenSHMEM parcelport (default: 8)."
8
CATEGORY "Parcelport"
)
if(HPX_WITH_PARCELPORT_OPENSHMEM_SLOTS)
hpx_add_config_define(
HPX_HAVE_PARCELPORT_OPENSHMEM_SLOTS
${HPX_WITH_PARCELPORT_OPENSHMEM_SLOTS}
)
endif()
endif()

hpx_option(
HPX_WITH_PARCELPORT_TCP BOOL "Enable the TCP based parcelport." ON
CATEGORY "Parcelport"
Expand Down
124 changes: 124 additions & 0 deletions cmake/FindOpenSHMEM.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
# Copyright (c) 2025 The STE||AR-Group
#
# SPDX-License-Identifier: BSL-1.0
# Distributed under the Boost Software License, Version 1.0. (See accompanying
# file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)

macro(find_openshmem)
# Only Open MPI's OpenSHMEM is supported. The package is located through
# pkg-config (pkg_check_modules uses PKG_CONFIG_PATH and the standard install
# locations), i.e. via the oshmem-c.pc, oshmem.pc or oshmem-cxx.pc module
# files. oshmem-c/oshmem are preferred because they carry the -loshmem link
# flag.
find_package(PkgConfig QUIET)
if(NOT PKG_CONFIG_FOUND)
hpx_error("pkg-config was not found; OpenSHMEM detection requires it")
endif()

set(_oshmem_pkg_names oshmem-c oshmem oshmem-cxx)
foreach(_pkg ${_oshmem_pkg_names})
pkg_check_modules(OSHMEM QUIET IMPORTED_TARGET GLOBAL ${_pkg})
if(OSHMEM_FOUND)
set(OpenSHMEM_PKG ${_pkg})
break()
endif()
endforeach()

set(OpenSHMEM_FOUND ${OSHMEM_FOUND})

if(NOT OpenSHMEM_FOUND)
hpx_error(
"Could not find Open MPI OpenSHMEM. Tried: ${_oshmem_pkg_names}. "
"Please set PKG_CONFIG_PATH to the directory containing the oshmem.pc "
"module files."
)
endif()

if(NOT OSHMEM_INCLUDE_DIRS OR NOT (OSHMEM_LIBRARY_DIRS OR OSHMEM_LIBRARIES))
hpx_error(
"Could not find OSHMEM_INCLUDE_DIRS or OSHMEM_LIBRARIES/OSHMEM_LIBRARY_DIRS"
)
endif()

# Open MPI's oshmem moves data through its `osc/ucp` component, so a
# UCX-enabled Open MPI is required for the transport to work at all. The UCX
# libraries only appear in pkg-config's `Libs.private` field; the
# pkg_check_modules call above exposes those through the generated
# <prefix>_STATIC_* results, which are used here for inspection only. The
# link line derived from the static query is intentionally not used: it drags
# in Open MPI's own private dependencies (libevent, hwloc, pmix) that would
# clash with HPX's copies.
if(NOT DEFINED HPX_OPENSHMEM_REQUIRE_UCX)
set(HPX_OPENSHMEM_REQUIRE_UCX
FALSE
CACHE BOOL
"Fail the OpenSHMEM detection if UCX was not enabled in Open MPI"
)
endif()

set(OpenSHMEM_UCX_FOUND FALSE)
set(OpenSHMEM_UCX_LIBRARIES "")
set(OpenSHMEM_UCX_LIBRARY_DIRS "")

# An oshmem module built with `--with-ucx=...` records -lucp -luct -lucs -lucm
# in `Libs.private`. Match the library names rather than directory names so
# that a UCX installed in a non-standard location still matches.
set(_oshmem_ucx_libs "")
foreach(_lib IN LISTS OSHMEM_STATIC_LIBRARIES)
if(_lib MATCHES "^(ucp|uct|ucs|ucm)$")
list(APPEND _oshmem_ucx_libs "${_lib}")
endif()
endforeach()

if(_oshmem_ucx_libs)
set(OpenSHMEM_UCX_FOUND TRUE)

# Resolve each flag to the same directory Open MPI recorded, so that the
# linker cannot silently satisfy -lucp from a different UCX that happened to
# sit on the default search path.
foreach(_lib IN LISTS _oshmem_ucx_libs)
set(_ucx_lib "")
foreach(_dir IN LISTS OSHMEM_STATIC_LIBRARY_DIRS)
if(EXISTS "${_dir}/lib${_lib}${CMAKE_SHARED_LIBRARY_SUFFIX}")
set(_ucx_lib "${_dir}/lib${_lib}${CMAKE_SHARED_LIBRARY_SUFFIX}")
list(APPEND OpenSHMEM_UCX_LIBRARY_DIRS "${_dir}")
break()
endif()
endforeach()

if(_ucx_lib)
list(APPEND OpenSHMEM_UCX_LIBRARIES "${_ucx_lib}")
else()
# No matching file next to the other Open MPI libraries; fall back to
# the plain -l flag and let the linker resolve it.
list(APPEND OpenSHMEM_UCX_LIBRARIES "-l${_lib}")
endif()
endforeach()

if(OpenSHMEM_UCX_LIBRARY_DIRS)
list(REMOVE_DUPLICATES OpenSHMEM_UCX_LIBRARY_DIRS)
endif()

hpx_info("OpenSHMEM: UCX detected in Open MPI's private libraries: "
"${OpenSHMEM_UCX_LIBRARIES}"
)
else()
set(_oshmem_ucx_hint
"OpenSHMEM was found, but UCX does not appear in the private "
"libraries of '${OpenSHMEM_PKG}.pc'. Open MPI was most likely built "
"without '--with-ucx', in which case it has no 'osc/ucp' component "
"and Open SHMEM data movement will not work as expected."
)

if(HPX_OPENSHMEM_REQUIRE_UCX)
hpx_error("${_oshmem_ucx_hint}")
else()
hpx_warn("${_oshmem_ucx_hint}")
hpx_warn(
"Set '-DHPX_OPENSHMEM_REQUIRE_UCX=ON' to turn this into a hard error."
)
endif()
endif()

message(STATUS "Found OpenSHMEM (${OpenSHMEM_PKG}): ${OSHMEM_INCLUDE_DIRS}")
endmacro()
25 changes: 25 additions & 0 deletions cmake/HPX_AddTest.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ function(add_hpx_test category name)
NO_PARCELPORT_LCI
NO_PARCELPORT_LCW
NO_PARCELPORT_GASNET
NO_PARCELPORT_OPENSHMEM
)
set(one_value_args EXECUTABLE LOCALITIES THREADS_PER_LOCALITY TIMEOUT
RUNWRAPPER PSEUDO_DEPS_NAME
Expand Down Expand Up @@ -291,6 +292,30 @@ function(add_hpx_test category name)
endif()
endif()
endif()
if(HPX_WITH_PARCELPORT_OPENSHMEM AND NOT ${name}_NO_PARCELPORT_OPENSHMEM)
set(_add_test FALSE)
if(DEFINED ${name}_PARCELPORTS)
set(PP_FOUND -1)
list(FIND ${name}_PARCELPORTS "openshmem" PP_FOUND)
if(NOT PP_FOUND EQUAL -1)
set(_add_test TRUE)
endif()
else()
set(_add_test TRUE)
endif()
if(_add_test)
set(_full_name "${category}.distributed.openshmem.${name}")
add_test(NAME "${_full_name}" COMMAND ${cmd} "-p" "openshmem" "-r"
"oshrun" ${args}
)
set_tests_properties("${_full_name}" PROPERTIES RUN_SERIAL TRUE)
if(${name}_TIMEOUT)
set_tests_properties(
"${_full_name}" PROPERTIES TIMEOUT ${${name}_TIMEOUT}
)
endif()
endif()
endif()
if(HPX_WITH_PARCELPORT_TCP AND NOT ${${name}_NO_PARCELPORT_TCP})
set(_add_test FALSE)
if(DEFINED ${name}_PARCELPORTS)
Expand Down
68 changes: 68 additions & 0 deletions cmake/HPX_SetupOpenSHMEM.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
# Copyright (c) 2025 The STE||AR-Group
#
# SPDX-License-Identifier: BSL-1.0
# Distributed under the Boost Software License, Version 1.0. (See accompanying
# file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)

include(HPX_Message)
include(${CMAKE_CURRENT_LIST_DIR}/FindOpenSHMEM.cmake)

macro(hpx_setup_openshmem)
if(NOT TARGET OpenSHMEM::openshmem)

# When this macro runs at HPX build time the OpenSHMEM location is detected
# through pkg-config (oshmem-c/oshmem/oshmem-cxx) and the resulting values
# are cached. When it runs on a consumer (find_package(HPX)) the cached
# values are reused as-is, so the consumer needs neither pkg-config nor the
# oshmem module files themselves.
if(NOT HPX_OPENSHMEM_LIBRARIES)

find_openshmem()

if(NOT OpenSHMEM_FOUND)
hpx_error("OpenSHMEM was not found")
endif()

if(COMMAND hpx_add_config_define)
hpx_add_config_define(HPX_HAVE_PARCELPORT_OPENSHMEM)
endif()

# `OSHMEM_LIBRARIES` is derived from the public `Libs` field only, so it
# does not carry the UCX libraries that Open MPI keeps in `Libs.private`.
# A shared link picks those up transitively through liboshmem.so's
# DT_NEEDED entries; a static link does not, so append the explicitly
# resolved UCX paths in that case. The paths are absolute, so they cannot
# be satisfied by a different UCX on the default search path. Use the full
# paths: OSHMEM_LIBRARIES has only the names, without directories.
set(_oshmem_link_libraries "${OSHMEM_LINK_LIBRARIES}")
if(HPX_OPENSHMEM_REQUIRE_UCX AND OpenSHMEM_UCX_LIBRARIES)
list(APPEND _oshmem_link_libraries ${OpenSHMEM_UCX_LIBRARIES})
endif()

set(HPX_OPENSHMEM_LIBRARIES
"${_oshmem_link_libraries}"
CACHE INTERNAL "OpenSHMEM libraries" FORCE
)
set(HPX_OPENSHMEM_INCLUDE_DIRS
"${OSHMEM_INCLUDE_DIRS}"
CACHE INTERNAL "OpenSHMEM include directories" FORCE
)
set(HPX_OPENSHMEM_UCX_LIBRARIES
"${OpenSHMEM_UCX_LIBRARIES}"
CACHE INTERNAL "UCX libraries backing this OpenSHMEM installation"
FORCE
)
endif()

add_library(OpenSHMEM::openshmem INTERFACE IMPORTED GLOBAL)
set_target_properties(
OpenSHMEM::openshmem
PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${HPX_OPENSHMEM_INCLUDE_DIRS}"
INTERFACE_LINK_LIBRARIES "${HPX_OPENSHMEM_LIBRARIES}"
)

hpx_info("OpenSHMEM libraries: ${HPX_OPENSHMEM_LIBRARIES}")
hpx_info("OpenSHMEM include dirs: ${HPX_OPENSHMEM_INCLUDE_DIRS}")
hpx_info("OpenSHMEM UCX libraries: ${HPX_OPENSHMEM_UCX_LIBRARIES}")
endif()
endmacro()
8 changes: 8 additions & 0 deletions cmake/templates/HPXConfig.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,14 @@ if(HPX_WITH_NETWORKING AND HPX_WITH_PARCELPORT_GASNET)
hpx_setup_gasnet()
endif()

# OpenSHMEM: recreate the imported OpenSHMEM::openshmem target from the values
# cached at HPX build time (the consumer needs neither pkg-config nor the
# oshmem module files themselves).
if(HPX_WITH_NETWORKING AND HPX_WITH_PARCELPORT_OPENSHMEM)
include(HPX_SetupOpenSHMEM)
hpx_setup_openshmem()
endif()

# Eve can be installed by HPX or externally installed. In the first case we use
# exported targets, in the second we find Eve again using find_package.
if("${HPX_WITH_DATAPAR_BACKEND}" STREQUAL "EVE")
Expand Down
Loading
Loading