Files
derek.holloway 7502bf64a4
CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
Flatten subprojects into a single base monorepo
2026-09-02 16:34:47 -07:00

80 lines
2.7 KiB
CMake

# Copyright (c) Advanced Micro Devices, Inc.
# SPDX-License-Identifier: MIT
cmake_minimum_required(VERSION 3.25 FATAL_ERROR)
project(rocprofiler-systems-shmem-examples LANGUAGES C)
# Support standalone builds
if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME)
include(${CMAKE_CURRENT_LIST_DIR}/../cmake/standalone-helpers.cmake OPTIONAL)
endif()
# oshcc is the OpenSHMEM C compiler wrapper (e.g. from Open MPI); it provides
# the correct include paths and libraries for shmem.h and OpenSHMEM runtime.
# Prefer /usr/bin/oshcc (system package) to avoid version mismatch with oshrun.
find_program(OSHCC_EXECUTABLE NAMES oshcc PATHS /usr/bin NO_DEFAULT_PATH)
if(NOT OSHCC_EXECUTABLE)
find_program(OSHCC_EXECUTABLE NAMES oshcc)
endif()
if(NOT OSHCC_EXECUTABLE)
if("${CMAKE_PROJECT_NAME}" STREQUAL "rocprofiler-systems" AND "$ENV{ROCPROFSYS_CI}")
set(_MSG_TYPE STATUS) # don't generate warnings during CI
else()
set(_MSG_TYPE AUTHOR_WARNING)
endif()
message(
${_MSG_TYPE}
"oshcc not found. Skipping SHMEM examples (shmem-hello, shmem-pingpong)."
)
return()
else()
message(STATUS "oshcc found: ${OSHCC_EXECUTABLE}")
endif()
# Build with oshcc so shmem.h and OpenSHMEM libs are found. Output to project build root.
set(_SHMEM_BINDIR ${CMAKE_BINARY_DIR})
set(_SHMEM_SRCDIR ${CMAKE_CURRENT_SOURCE_DIR})
set(_SHMEM_HELLO_EXE ${_SHMEM_BINDIR}/shmem-hello${CMAKE_EXECUTABLE_SUFFIX})
set(_SHMEM_PINGPONG_EXE ${_SHMEM_BINDIR}/shmem-pingpong${CMAKE_EXECUTABLE_SUFFIX})
add_custom_command(
OUTPUT ${_SHMEM_HELLO_EXE}
COMMAND ${OSHCC_EXECUTABLE} ${_SHMEM_SRCDIR}/shmem-hello.c -o ${_SHMEM_HELLO_EXE}
DEPENDS ${_SHMEM_SRCDIR}/shmem-hello.c
COMMENT "Building shmem-hello with oshcc"
VERBATIM
)
add_custom_target(shmem-hello ALL DEPENDS ${_SHMEM_HELLO_EXE})
add_custom_command(
OUTPUT ${_SHMEM_PINGPONG_EXE}
COMMAND
${OSHCC_EXECUTABLE} ${_SHMEM_SRCDIR}/shmem-pingpong.c -o ${_SHMEM_PINGPONG_EXE}
DEPENDS ${_SHMEM_SRCDIR}/shmem-pingpong.c
COMMENT "Building shmem-pingpong with oshcc"
VERBATIM
)
add_custom_target(shmem-pingpong ALL DEPENDS ${_SHMEM_PINGPONG_EXE})
# Export paths for rocprof-sys-shmem-tests.cmake (same project)
set(ROCPROFSYS_SHMEM_HELLO_EXE
"${_SHMEM_HELLO_EXE}"
CACHE INTERNAL
"Path to shmem-hello executable"
)
set(ROCPROFSYS_SHMEM_PINGPONG_EXE
"${_SHMEM_PINGPONG_EXE}"
CACHE INTERNAL
"Path to shmem-pingpong executable"
)
if(ROCPROFSYS_INSTALL_EXAMPLES)
install(
PROGRAMS ${_SHMEM_HELLO_EXE} ${_SHMEM_PINGPONG_EXE}
DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/rocprofiler-systems/examples
COMPONENT rocprofiler-systems-examples
OPTIONAL
)
endif()