Files
TheRock/rocm-systems/projects/rocprofiler-systems/examples/hpc/jacobi-hip/CMakeLists.txt
T
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

77 lines
2.2 KiB
CMake

# Copyright (c) Advanced Micro Devices, Inc.
# SPDX-License-Identifier: MIT
check_rocprofsys_disable_examples("jacobi-hip" _JACOBI_HIP_DISABLED)
check_rocprofsys_disable_examples("mpi" _MPI_DISABLED)
if(_JACOBI_HIP_DISABLED OR _MPI_DISABLED)
return()
endif()
if(NOT HIPCC_EXECUTABLE)
rocprofiler_systems_message(AUTHOR_WARNING "hipcc not found. Cannot build jacobi-hip target.")
return()
endif()
if(NOT CMAKE_CXX_COMPILER_IS_HIPCC)
if(
CMAKE_CXX_COMPILER STREQUAL HIPCC_EXECUTABLE
OR "${CMAKE_CXX_COMPILER}" MATCHES "hipcc"
)
set(CMAKE_CXX_COMPILER_IS_HIPCC 1 CACHE BOOL "HIP compiler")
endif()
endif()
find_package(MPI QUIET COMPONENTS CXX)
if(NOT MPI_CXX_FOUND)
rocprofiler_systems_message(AUTHOR_WARNING "MPI not found, this is required for jacobi-hip example")
return()
endif()
find_library(
ROCTX_SDK_LIBRARY
NAMES rocprofiler-sdk-roctx
PATHS ${ROCM_PATH}/lib ${ROCM_PATH}/lib64
)
if(NOT ROCTX_SDK_LIBRARY)
rocprofiler_systems_message(AUTHOR_WARNING "rocprofiler-sdk-roctx not found, this is required for jacobi-hip example")
return()
endif()
set(_JACOBI_HIP_SOURCES
HaloExchange.hip
Input.hip
JacobiIteration.hip
JacobiMain.hip
JacobiRun.hip
JacobiSetup.hip
Laplacian.hip
Norm.hip
)
set_source_files_properties(${_JACOBI_HIP_SOURCES} PROPERTIES LANGUAGE CXX)
set(HPC_EXAMPLE_NAME "jacobi-hip")
add_executable(${HPC_EXAMPLE_NAME} ${_JACOBI_HIP_SOURCES})
target_compile_options(${HPC_EXAMPLE_NAME} PRIVATE -xhip)
target_compile_definitions(${HPC_EXAMPLE_NAME} PRIVATE __HIP_PLATFORM_HCC__)
target_compile_options(
${HPC_EXAMPLE_NAME}
PRIVATE -O3 -g -ggdb -fPIC -march=native -Wall -Wno-unused-result
)
foreach(arch IN LISTS ROCPROFSYS_GFX_TARGETS)
target_compile_options(${HPC_EXAMPLE_NAME} PRIVATE --offload-arch=${arch})
target_link_options(${HPC_EXAMPLE_NAME} PRIVATE --offload-arch=${arch})
endforeach()
target_link_libraries(${HPC_EXAMPLE_NAME} PRIVATE MPI::MPI_CXX ${ROCTX_SDK_LIBRARY})
if(NOT CMAKE_CXX_COMPILER_IS_HIPCC)
rocprofiler_systems_custom_compilation(COMPILER ${HIPCC_EXECUTABLE} TARGET ${HPC_EXAMPLE_NAME})
endif()
rocprofiler_systems_install_hpc_example(${HPC_EXAMPLE_NAME})