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

88 lines
2.9 KiB
CMake

###############################################################################
# MIT License
#
# Copyright (c) 2025 Advanced Micro Devices, Inc.
###############################################################################
cmake_minimum_required(VERSION 3.21 FATAL_ERROR)
file(READ "${CMAKE_CURRENT_SOURCE_DIR}/pyproject.toml" _PERFXPERT_PYPROJECT)
string(
REGEX MATCH "(^|\n)[ \t]*version[ \t]*=[ \t]*\"([^\"]+)\""
_PERFXPERT_VERSION_MATCH
"${_PERFXPERT_PYPROJECT}"
)
if(NOT CMAKE_MATCH_2)
message(FATAL_ERROR "Unable to read perfxpert version from pyproject.toml")
endif()
set(PERFXPERT_VERSION "${CMAKE_MATCH_2}")
project(
perfxpert
VERSION ${PERFXPERT_VERSION}
DESCRIPTION "AI-powered GPU trace analysis for rocprofiler-sdk databases"
LANGUAGES NONE
)
# ---------------------------------------------------------------------------
# Options
# ---------------------------------------------------------------------------
option(PERFXPERT_INSTALL_PYTHON "Install perfxpert Python package" ON)
option(PERFXPERT_BUILD_TESTS "Build/configure perfxpert tests" ON)
# ---------------------------------------------------------------------------
# Python package installation
# ---------------------------------------------------------------------------
if(PERFXPERT_INSTALL_PYTHON)
find_package(Python3 REQUIRED COMPONENTS Interpreter)
# Determine site-packages install prefix
if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
set(CMAKE_INSTALL_PREFIX "/opt/rocm" CACHE PATH "Install prefix" FORCE)
endif()
# Install the perfxpert Python package into the standard site-packages
install(
CODE "execute_process(
COMMAND ${Python3_EXECUTABLE} -m pip install
--prefix \"\${CMAKE_INSTALL_PREFIX}\"
--no-deps
--no-build-isolation
\"${CMAKE_CURRENT_SOURCE_DIR}\"
RESULT_VARIABLE _pip_result
)
if(NOT _pip_result EQUAL 0)
message(FATAL_ERROR \"pip install failed: \${_pip_result}\")
endif()"
)
# Also expose the entry-point script
install(
PROGRAMS "${CMAKE_CURRENT_SOURCE_DIR}/scripts/perfxpert"
DESTINATION bin
OPTIONAL
)
endif()
# ---------------------------------------------------------------------------
# Tests
# ---------------------------------------------------------------------------
if(PERFXPERT_BUILD_TESTS AND BUILD_TESTING)
enable_testing()
find_package(Python3 REQUIRED COMPONENTS Interpreter)
add_test(
NAME perfxpert_unit_tests
COMMAND ${Python3_EXECUTABLE} -m pytest
"${CMAKE_CURRENT_SOURCE_DIR}/tests"
--noconftest
-v
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
)
set_tests_properties(perfxpert_unit_tests PROPERTIES
LABELS "perfxpert;python;unit"
ENVIRONMENT "PYTHONPATH=${CMAKE_CURRENT_SOURCE_DIR}"
)
endif()