- Bugfixes
- Update test instructions using docker
Этот коммит содержится в:
abchoudh-amd
2025-10-01 01:18:41 +05:30
коммит произвёл GitHub
родитель 953fd60e9b
Коммит f45c8d5f6b
6 изменённых файлов: 33 добавлений и 45 удалений
+9 -6
Просмотреть файл
@@ -30,28 +30,31 @@ Users may checkout `amd-staging` to preview upcoming features.
## Testing
Populate the empty variables in `Dockerfile.customrocmtest` based on latest CI build information.
Populate the <usename> variable in `docker/docker-compose.customrocmtest.yml`.
Populate the <rocm_build_image> variable in `docker/Dockerfile.customrocmtest` based on latest ROCm CI build information.
To quickly get the environment (bash shell) for building and testing, run the following commands:
* `cd docker`
* `docker compose -f docker-compose.customrocmtest.yml up --force-recreate -d && docker attach docker-customrocmtest-1`
* If the docker image is not available on the machine, then build the image, otherwise skip this step: `docker compose -f docker-compose.customrocmtest.yml build`
* Launch the container, and check the name of the container: `docker compose -f docker-compose.customrocmtest.yml up --force-recreate -d `
* Run bash shell on the launched container: `docker exec -it <container_name> bash`
* If testing is done, kill the container: `docker container kill <container_name>`
Inside the docker container, clean, build and install the project with tests enabled:
Inside the docker container, clean, build, then install the project with tests enabled:
```
rm -rf build install && cmake -B build -D CMAKE_INSTALL_PREFIX=install -D ENABLE_TESTS=ON -D INSTALL_TESTS=ON -DENABLE_COVERAGE=ON -S . && cmake --build build --target install --parallel 8
```
Note that per the above command, build assets will be stored under `build` directory and installed assets will be stored under `install` directory.
Then, to run the automated test suite, run the following command:
Then, to run the automated test suite, run the following commands:
```
mkdir build
ctest
```
For manual testing, you can find the executable at `install/bin/rocprof-compute`
NOTE: This Dockerfile uses `ubuntu 22.04` as the base operating system image
## Standalone binary
To create a standalone binary, run the following commands:
+10 -28
Просмотреть файл
@@ -1,5 +1,5 @@
# Use a base image
FROM ubuntu:22.04
FROM <rocm_build_image>
# Set the working directory
WORKDIR /app
@@ -18,33 +18,15 @@ RUN locale-gen en_US.UTF-8
# Install Python 3.10 and pip
RUN apt-get install -y python3.10 python3.10-venv python3.10-dev python3-pip libsqlite3-dev
# Update pip
RUN apt remove -y python3-wheel
RUN curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
RUN python3.10 get-pip.py
RUN python3.10 -m pip install --upgrade pip setuptools wheel
# Set Python 3.10 as the default python3
RUN update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.10 1
# Remove blinker python package
RUN apt-get remove -y python3-blinker
# Install rocm
# Define custom version
ARG DEB_FILE=""
ARG AMDGPU_BUILD=""
ARG ROCM_BUILD=""
RUN curl -O "https://artifactory-cdn.amd.com/artifactory/list/amdgpu-deb/${DEB_FILE}"
RUN apt-get install -y "./${DEB_FILE}"
RUN amdgpu-repo --amdgpu-build="${AMDGPU_BUILD}" --rocm-build="compute-rocm-dkms-no-npi-hipclang/${ROCM_BUILD}"
RUN DEBIAN_FRONTEND=noninteractive TZ="America/Toronto" amdgpu-install --yes --usecase=rocm
RUN python3.10 -m venv venv
ENV PATH="venv/bin:$PATH"
RUN python -m pip install --upgrade pip
# Install any dependencies specified in requirements.txt
WORKDIR /app/projects/rocprofiler-compute
COPY projects/rocprofiler-compute/requirements.txt /app/projects/rocprofiler-compute/requirements.txt
COPY projects/rocprofiler-compute/requirements-test.txt /app/projects/rocprofiler-compute/requirements-test.txt
RUN python -m pip install -r requirements.txt -r requirements-test.txt
# Run interactive bash shell
CMD ["/bin/bash", "-c", "\
cd /app/projects/rocprofiler-compute \
&& python3.10 -m pip install -r requirements.txt -r requirements-test.txt \
&& exec /bin/bash \
"]
CMD ["/bin/bash"]
+5 -1
Просмотреть файл
@@ -1,8 +1,12 @@
services:
customrocmtest: # service name
rocprofiler-compute-<username>: # service name
build:
context: ../../../
dockerfile: projects/rocprofiler-compute/docker/Dockerfile.customrocmtest
image: rocprofiler-compute-<username>
# Forward some env vars
environment:
ROCR_VISIBLE_DEVICES: ${ROCR_VISIBLE_DEVICES}
devices:
- /dev/kfd
- /dev/dri
+6 -6
Просмотреть файл
@@ -372,12 +372,12 @@ class RocProfCompute:
if not hasattr(self.__args, "name") or not self.__args.name:
console_error("-n/--name is required")
self.__args.path = str(Path(self.__args.path) / self.__args.name)
# Add node name to workload path
if self.__args.subpath == "node_name":
self.__args.path = str(Path(self.__args.path) / socket.gethostname())
# Add gpu model name to workload path
elif self.__args.subpath == "gpu_model":
self.__args.path = str(Path(self.__args.path) / self.__mspec.gpu_model)
# Add node name to workload path
if self.__args.subpath == "node_name":
self.__args.path = str(Path(self.__args.path) / socket.gethostname())
# OR, Add gpu model name to workload path
elif self.__args.subpath == "gpu_model":
self.__args.path = str(Path(self.__args.path) / self.__mspec.gpu_model)
# Create workload directory if it does not exist
p = Path(self.__args.path)
+2 -3
Просмотреть файл
@@ -32,7 +32,6 @@ from abc import abstractmethod
from pathlib import Path
from typing import Any, Optional, Union
import numpy as np
import pandas as pd
import yaml
@@ -466,7 +465,7 @@ class RocProfCompute_Base:
console_debug(output)
console_log("profiling", f"Current input file: {fname}")
options = self.get_profiler_options(fname, self._soc)
options = self.get_profiler_options(str(fname), self._soc)
start_time = time.time()
if self.__profiler == "rocprofv3" or self.__profiler == "rocprofiler-sdk":
# Only 1-run case is permitted for attach/detach
@@ -542,5 +541,5 @@ class RocProfCompute_Base:
self._soc.post_profiling()
def test_df_column_equality(df: pd.DataFrame) -> np.bool:
def test_df_column_equality(df: pd.DataFrame) -> bool:
return df.eq(df.iloc[:, 0], axis=0).all(1).all()
+1 -1
Просмотреть файл
@@ -70,7 +70,7 @@ class rocprofiler_sdk_profiler(RocProfCompute_Base):
"ROCPROFILER_LIBRARY_CTOR": "1",
"LD_PRELOAD": ":".join(ld_preload),
"ROCP_TOOL_LIBRARIES": rocprofiler_sdk_tool_path,
"LD_LIBRARY_PATH": rocm_libdir,
"LD_LIBRARY_PATH": str(rocm_libdir),
"ROCPROF_KERNEL_TRACE": "1",
"ROCPROF_OUTPUT_FORMAT": args.format_rocprof_output,
"ROCPROF_OUTPUT_PATH": f"{args.path}/out/pmc_1",