From 97d9f350332ff0a9c733c370f6c1d29c2602a438 Mon Sep 17 00:00:00 2001 From: vedithal-amd Date: Fri, 8 Aug 2025 10:26:57 -0400 Subject: [PATCH] Fix ctest and docker to work with monorepo (#181) * Remove .git folder and git command check in cmake * Update docker container to work in monorepo * Update docker container to mount the top level folder in monorepo --- projects/rocprofiler-compute/CMakeLists.txt | 24 ++++++------------- .../docker/Dockerfile.customrocmtest | 3 ++- .../docker/docker-compose.customrocmtest.yml | 7 +++--- 3 files changed, 12 insertions(+), 22 deletions(-) diff --git a/projects/rocprofiler-compute/CMakeLists.txt b/projects/rocprofiler-compute/CMakeLists.txt index 632ae3cef4..39f0fa52a2 100644 --- a/projects/rocprofiler-compute/CMakeLists.txt +++ b/projects/rocprofiler-compute/CMakeLists.txt @@ -42,17 +42,13 @@ include(ExternalProject) include(GNUInstallDirs) # version control info -find_package(Git) -if(Git_FOUND AND EXISTS "${PROJECT_SOURCE_DIR}/.git") - execute_process( - COMMAND git log --pretty=format:%h -n 1 - OUTPUT_VARIABLE ROCPROFCOMPUTE_GIT_REV - OUTPUT_STRIP_TRAILING_WHITESPACE) - message(STATUS "Git revision: ${ROCPROFCOMPUTE_GIT_REV}") - set(GIT_CLONE TRUE) -else() - set(GIT_CLONE FALSER) -endif() +execute_process( + COMMAND git log --pretty=format:%h -n 1 + OUTPUT_VARIABLE ROCPROFCOMPUTE_GIT_REV + OUTPUT_STRIP_TRAILING_WHITESPACE) +message(STATUS "Git revision: ${ROCPROFCOMPUTE_GIT_REV}") +configure_file(${PROJECT_SOURCE_DIR}/cmake/VERSION.sha.in + ${PROJECT_SOURCE_DIR}/VERSION.sha @ONLY) set(CMAKE_BUILD_TYPE "Release") if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) @@ -162,12 +158,6 @@ if(LOCALHOST MATCHES "TheraS01|.*\.thera\.amd\.com|thera-hn") list(POP_BACK CMAKE_MESSAGE_INDENT) endif() -# git versioning file -if(${GIT_CLONE}) - configure_file(${PROJECT_SOURCE_DIR}/cmake/VERSION.sha.in - ${PROJECT_SOURCE_DIR}/VERSION.sha @ONLY) -endif() - # Setup testing collateral option(ENABLE_TESTS "Enable compilation of testing collateral" OFF) diff --git a/projects/rocprofiler-compute/docker/Dockerfile.customrocmtest b/projects/rocprofiler-compute/docker/Dockerfile.customrocmtest index 7efc607c28..cf2270c697 100644 --- a/projects/rocprofiler-compute/docker/Dockerfile.customrocmtest +++ b/projects/rocprofiler-compute/docker/Dockerfile.customrocmtest @@ -44,6 +44,7 @@ RUN DEBIAN_FRONTEND=noninteractive TZ="America/Toronto" amdgpu-install --yes --u # Install any dependencies specified in requirements.txt # Run interactive bash shell CMD ["/bin/bash", "-c", "\ - python3.10 -m pip install -r requirements.txt -r requirements-test.txt \ + cd /app/projects/rocprofiler-compute \ + && python3.10 -m pip install -r requirements.txt -r requirements-test.txt \ && exec /bin/bash \ "] diff --git a/projects/rocprofiler-compute/docker/docker-compose.customrocmtest.yml b/projects/rocprofiler-compute/docker/docker-compose.customrocmtest.yml index 614eb8ed9b..8b2ce9c31a 100644 --- a/projects/rocprofiler-compute/docker/docker-compose.customrocmtest.yml +++ b/projects/rocprofiler-compute/docker/docker-compose.customrocmtest.yml @@ -1,16 +1,15 @@ services: customrocmtest: # service name build: - context: ../ - dockerfile: docker/Dockerfile.customrocmtest + context: ../../../ + dockerfile: projects/rocprofiler-compute/docker/Dockerfile.customrocmtest devices: - /dev/kfd - /dev/dri security_opt: - seccomp:unconfined volumes: - - ../:/app - - ../../rocprofiler-sdk:/rocprofiler-sdk + - ../../../:/app ports: - 8050:8050 tty: true