Fix rocshmem_info not compiling in out of source builds (#160)

[ROCm/rocshmem commit: 8138d130b9]
This commit is contained in:
Aurelien Bouteiller
2025-06-16 11:49:30 -04:00
committed by GitHub
parent 66e267235f
commit b5c685ef9d
4 changed files with 22 additions and 17 deletions
+1 -14
View File
@@ -63,6 +63,7 @@ option(BUILD_FUNCTIONAL_TESTS "Build the functional tests" OFF)
option(BUILD_EXAMPLES "Build the examples" ON)
option(BUILD_UNIT_TESTS "Build the unit tests" OFF)
option(BUILD_TESTS_ONLY "Build only tests. Used to link agains rocSHMEM in a ROCm Release" OFF)
option(BUILD_TOOLS "Build binary tools (e.g., rocshmem_info)" ON)
option(BUILD_LOCAL_GPU_TARGET_ONLY "Build only for GPUs detected on this machine" OFF)
option(BUILD_CODE_COVERAGE "Build with code coverage flags (gcc only)" OFF)
@@ -124,20 +125,6 @@ else()
endif()
message(STATUS "rocSHMEM Version: " "${VERSION_STRING}")
execute_process (
COMMAND bash -c "git rev-parse HEAD;"
OUTPUT_VARIABLE GIT_HASH
)
string(STRIP ${GIT_HASH} GIT_HASH)
string(REPLACE ";" " " ROCSHMEM_DEFAULT_GPUS "${DEFAULT_GPUS}")
add_compile_definitions(
ROCSHMEM_INSTALL_PREFIX="${CMAKE_INSTALL_PREFIX}"
ROCSHMEM_GIT_HASH="${GIT_HASH}"
ROCSHMEM_DEFAULT_GPUS="${ROCSHMEM_DEFAULT_GPUS}"
)
rocm_setup_version(VERSION ${VERSION_STRING})
project(rocshmem VERSION ${VERSION_STRING} LANGUAGES CXX)
+2
View File
@@ -73,4 +73,6 @@ add_subdirectory(host)
add_subdirectory(memory)
add_subdirectory(sync)
add_subdirectory(bootstrap)
if (BUILD_TOOLS)
add_subdirectory(tools)
endif()
@@ -24,8 +24,24 @@
# SOURCES
###############################################################################
execute_process (
COMMAND bash -c "git -C ${PROJECT_SOURCE_DIR} rev-parse HEAD;"
OUTPUT_VARIABLE GIT_HASH
)
string(STRIP "${GIT_HASH}" GIT_HASH)
string(REPLACE ";" " " ROCSHMEM_OFFLOAD_TARGETS "${COMPILING_TARGETS}")
add_executable(rocshmem_info rocshmem_info.cpp)
target_compile_definitions(
rocshmem_info
PRIVATE
ROCSHMEM_INSTALL_PREFIX="${CMAKE_INSTALL_PREFIX}"
ROCSHMEM_GIT_HASH="${GIT_HASH}"
ROCSHMEM_OFFLOAD_TARGETS="${ROCSHMEM_OFFLOAD_TARGETS}"
)
target_include_directories(
rocshmem_info
PRIVATE
@@ -10,8 +10,8 @@
#include <rocm-core/rocm_version.h>
#include <rocshmem/rocshmem.hpp>
#define NAME_COLUMN_WIDTH (24)
#define INFO_COLUMN_WIDTH (51)
#define NAME_COLUMN_WIDTH (28)
#define INFO_COLUMN_WIDTH (47)
#define PRINT_ENTRY(NAME, INFO) \
printf("# %-*s: %-*s#\n", NAME_COLUMN_WIDTH, NAME, INFO_COLUMN_WIDTH, INFO)
@@ -75,7 +75,7 @@ void print_arch_info() {
int n_compiled_arch = 1;
bool supported_arch = false;
std::istringstream compiled_arch_list(ROCSHMEM_DEFAULT_GPUS);
std::istringstream compiled_arch_list(ROCSHMEM_OFFLOAD_TARGETS);
CHECK_HIP(hipGetDeviceProperties(&prop, 0));