diff --git a/projects/rocprofiler-compute/CHANGELOG.md b/projects/rocprofiler-compute/CHANGELOG.md index 097d9b9112..ed301db73a 100644 --- a/projects/rocprofiler-compute/CHANGELOG.md +++ b/projects/rocprofiler-compute/CHANGELOG.md @@ -2,6 +2,10 @@ Full documentation for ROCm Compute Profiler is available at [https://rocm.docs.amd.com/projects/rocprofiler-compute/en/latest/](https://rocm.docs.amd.com/projects/rocprofiler-compute/en/latest/). +## Unreleased + +* Add Docker files to package the application and dependencies into a single portable and executable standalone binary file + ## (Unreleased) ROCm Compute Profiler 3.1.0 for ROCm 6.4.0 ### Added diff --git a/projects/rocprofiler-compute/CMakeLists.txt b/projects/rocprofiler-compute/CMakeLists.txt index 40d00c7136..6004041d2c 100644 --- a/projects/rocprofiler-compute/CMakeLists.txt +++ b/projects/rocprofiler-compute/CMakeLists.txt @@ -372,6 +372,28 @@ add_custom_target( "src/${PACKAGE_NAME},cmake/Dockerfile,cmake/rocm_install.sh,docker/docker-entrypoint.sh,src/rocprof_compute_analyze/convertor/mongodb/convert" ) +# Standalone binary creation +add_custom_target( + standalonebinary + # Change working directory to src + WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/src + # Check nuitka + COMMAND ${Python3_EXECUTABLE} -m pip list | grep -i nuitka > /dev/null 2>&1 + # Check patchelf + COMMAND ${Python3_EXECUTABLE} -m pip list | grep -i patchelf > /dev/null 2>&1 + # Build standalone binary + COMMAND + ${Python3_EXECUTABLE} -m nuitka --mode=onefile + --include-data-files=${PROJECT_SOURCE_DIR}/VERSION*=./ --enable-plugin=no-qt + --include-package-data=dash_svg --include-package=dash_bootstrap_components + --include-package=plotly --include-package-data=kaleido + --include-package=rocprof_compute_soc --include-package-data=rocprof_compute_soc + --include-package-data=utils rocprof-compute + # Remove library rpath from executable + COMMAND patchelf --remove-rpath rocprof-compute.bin + # Move to build directory + COMMAND mv rocprof-compute.bin ${CMAKE_BINARY_DIR}) + install( FILES ${PROJECT_SOURCE_DIR}/LICENSE DESTINATION ${CMAKE_INSTALL_DOCDIR} diff --git a/projects/rocprofiler-compute/LICENSE b/projects/rocprofiler-compute/LICENSE index cf05f5a560..fc143f666a 100644 --- a/projects/rocprofiler-compute/LICENSE +++ b/projects/rocprofiler-compute/LICENSE @@ -19,3 +19,22 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +This application uses the following dependencies and their usage is governed by their respective licenses +Python 3 standard library: PSFL +Nuitka specific runtime code: Apache 2.0 license +astunparse python library: PSFL +colorlover python library: MIT +dash python library: MIT +matplotlib python library: PSFL +numpy python library: BSD +pandas python library: BSD +pymongo python library: Apache 2.0 license +pyyaml python library: MIT +tabulate python library: MIT +tqdm python library: MIT +dash-svg python library: MIT +dash-bootstrap-components python library: MIT +kaleido python library: MIT +setuptools python library: MIT +plotille python library: MIT \ No newline at end of file diff --git a/projects/rocprofiler-compute/README.md b/projects/rocprofiler-compute/README.md index a95bb3e360..d2b8ebf186 100644 --- a/projects/rocprofiler-compute/README.md +++ b/projects/rocprofiler-compute/README.md @@ -37,8 +37,8 @@ Users may checkout `amd-staging` to preview upcoming features. ## Testing To quickly get the environment (bash shell) for building and testing, run the following commands: -* `cd utils/docker_env` -* `docker compose run app` +* `cd docker` +* `docker compose -f docker-compose.test.yml run test` Inside the docker container, clean, build and install the project with tests enabled: ``` @@ -56,6 +56,27 @@ For manual testing, you can find the executable at `install/bin/rocprof-compute` NOTE: This Dockerfile uses `rocm/dev-ubuntu-22.04` as the base image +## Standalone binary + +To create a standalone binary, run the following commands: +* `cd docker` +* `docker compose -f docker-compose.standalone.yml run standalone` + +You should find the rocprof-compute.bin standalone binary inside the `build` folder in the root directory of the project. + +To build the binary we follow these steps: +* Use RHEL 8 image used to build ROCm as the base image +* Install python3.8 +* Install dependencies for runtime and for making standalone binary +* Call the make target which uses Nuitka to build the standalone binary + +NOTE: Since RHEL 8 ships with glibc version 2.28, this standalone binary can only be run on environment with glibc version greater than 2.28. +glibc version can be checked using `ldd --version` command. + +NOTE: libnss3.so shared library is required when using --roof-only option which generates roofline data in PDF format + +To test the standalone binary provide the `--call-binary` option to pytest. + ## How to Cite This software can be cited using a Zenodo diff --git a/projects/rocprofiler-compute/docker/Dockerfile.standalone b/projects/rocprofiler-compute/docker/Dockerfile.standalone new file mode 100644 index 0000000000..c6ece52f74 --- /dev/null +++ b/projects/rocprofiler-compute/docker/Dockerfile.standalone @@ -0,0 +1,19 @@ +FROM redhat/ubi8:8.10-1184 + +WORKDIR /app + +RUN yum install -y curl gcc cmake + +RUN yum install -y python38 python38-devel && \ + yum clean all && \ + rm -rf /var/cache/yum && \ + curl -sS https://bootstrap.pypa.io/get-pip.py -o get-pip.py && \ + python3.8 get-pip.py + +CMD ["/bin/bash", "-c", "\ + python3.8 -m pip install -r requirements.txt \ + && python3.8 -m pip install nuitka patchelf \ + && rm -rf build \ + && cmake -B build -S . \ + && make -C build standalonebinary \ +"] \ No newline at end of file diff --git a/projects/rocprofiler-compute/utils/docker_env/Dockerfile b/projects/rocprofiler-compute/docker/Dockerfile.test similarity index 77% rename from projects/rocprofiler-compute/utils/docker_env/Dockerfile rename to projects/rocprofiler-compute/docker/Dockerfile.test index 19c91b4fd0..0cdcc1a673 100644 --- a/projects/rocprofiler-compute/utils/docker_env/Dockerfile +++ b/projects/rocprofiler-compute/docker/Dockerfile.test @@ -19,11 +19,9 @@ RUN apt-get install -y python3.10 python3.10-venv python3.10-dev python3-pip # Set Python 3.10 as the default python3 RUN update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.10 1 -# Copy your application code to the container -COPY . . - # Install any dependencies specified in requirements.txt -RUN pip3 install --no-cache-dir -r requirements.txt -r requirements-test.txt - -# Command to run your application -CMD ["/bin/bash"] \ No newline at end of file +# Run interactive bash shell +CMD ["/bin/bash", "-c", "\ + python3.10 -m pip install -r requirements.txt -r requirements-test.txt \ + && exec /bin/bash \ +"] \ No newline at end of file diff --git a/projects/rocprofiler-compute/docker/docker-compose.standalone.yml b/projects/rocprofiler-compute/docker/docker-compose.standalone.yml new file mode 100644 index 0000000000..4df2557368 --- /dev/null +++ b/projects/rocprofiler-compute/docker/docker-compose.standalone.yml @@ -0,0 +1,12 @@ +services: + standalone: + build: + context: ../ + dockerfile: docker/Dockerfile.standalone + devices: + - /dev/kfd + - /dev/dri + security_opt: + - seccomp:unconfined + volumes: + - ../:/app \ No newline at end of file diff --git a/projects/rocprofiler-compute/docker/docker-compose.test.yml b/projects/rocprofiler-compute/docker/docker-compose.test.yml new file mode 100644 index 0000000000..cb20c5fdbe --- /dev/null +++ b/projects/rocprofiler-compute/docker/docker-compose.test.yml @@ -0,0 +1,12 @@ +services: + test: + build: + context: ../ + dockerfile: docker/Dockerfile.test + devices: + - /dev/kfd + - /dev/dri + security_opt: + - seccomp:unconfined + volumes: + - ../:/app \ No newline at end of file diff --git a/projects/rocprofiler-compute/tests/conftest.py b/projects/rocprofiler-compute/tests/conftest.py new file mode 100644 index 0000000000..bdcb56866d --- /dev/null +++ b/projects/rocprofiler-compute/tests/conftest.py @@ -0,0 +1,10 @@ +import pytest + + +def pytest_addoption(parser): + parser.addoption( + "--call-binary", + action="store_true", + default=False, + help="Call standalone binary instead of main function during tests", + ) diff --git a/projects/rocprofiler-compute/tests/test_analyze_commands.py b/projects/rocprofiler-compute/tests/test_analyze_commands.py index 1ef861b55a..e3a910ae3b 100644 --- a/projects/rocprofiler-compute/tests/test_analyze_commands.py +++ b/projects/rocprofiler-compute/tests/test_analyze_commands.py @@ -6,10 +6,7 @@ from unittest.mock import patch import pandas as pd import pytest import test_utils - -rocprof_compute = SourceFileLoader("rocprof-compute", "src/rocprof-compute").load_module() - -baseline_opts = ["rocprof-compute", "analyze"] +from test_utils import binary_handler_analyze_rocprof_compute config = {} config["cleanup"] = True if "PYTEST_XDIST_WORKER_COUNT" in os.environ else False @@ -23,809 +20,440 @@ indirs = [ @pytest.mark.misc -def test_valid_path(): +def test_valid_path(binary_handler_analyze_rocprof_compute): for dir in indirs: workload_dir = test_utils.setup_workload_dir(dir) - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - ["rocprof-compute", "analyze", "--path", workload_dir], - ): - rocprof_compute.main() - assert e.value.code == 0 + code = binary_handler_analyze_rocprof_compute(["analyze", "--path", workload_dir]) + assert code == 0 test_utils.clean_output_dir(config["cleanup"], workload_dir) @pytest.mark.misc -def test_list_kernels(): +def test_list_kernels(binary_handler_analyze_rocprof_compute): for dir in indirs: workload_dir = test_utils.setup_workload_dir(dir) - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - workload_dir, - "--list-stats", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", workload_dir, "--list-stats"] + ) + assert code == 0 test_utils.clean_output_dir(config["cleanup"], workload_dir) @pytest.mark.list_metrics -def test_list_metrics_gfx90a(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", ["rocprof-compute", "analyze", "--list-metrics", "gfx90a"] - ): - rocprof_compute.main() - assert e.value.code == 1 +def test_list_metrics_gfx90a(binary_handler_analyze_rocprof_compute): + code = binary_handler_analyze_rocprof_compute(["analyze", "--list-metrics", "gfx90a"]) + assert code == 1 for dir in indirs: workload_dir = test_utils.setup_workload_dir(dir) - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - workload_dir, - "--list-metrics", - "gfx90a", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", workload_dir, "--list-metrics", "gfx90a"] + ) + assert code == 0 test_utils.clean_output_dir(config["cleanup"], workload_dir) @pytest.mark.list_metrics -def test_list_metrics_gfx906(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", ["rocprof-compute", "analyze", "--list-metrics", "gfx906"] - ): - rocprof_compute.main() - assert e.value.code == 1 +def test_list_metrics_gfx906(binary_handler_analyze_rocprof_compute): + code = binary_handler_analyze_rocprof_compute(["analyze", "--list-metrics", "gfx906"]) + assert code == 1 for dir in indirs: workload_dir = test_utils.setup_workload_dir(dir) - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - workload_dir, - "--list-metrics", - "gfx906", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", workload_dir, "--list-metrics", "gfx906"] + ) + assert code == 0 test_utils.clean_output_dir(config["cleanup"], workload_dir) @pytest.mark.list_metrics -def test_list_metrics_gfx908(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", ["rocprof-compute", "analyze", "--list-metrics", "gfx908"] - ): - rocprof_compute.main() - assert e.value.code == 1 +def test_list_metrics_gfx908(binary_handler_analyze_rocprof_compute): + code = binary_handler_analyze_rocprof_compute(["analyze", "--list-metrics", "gfx908"]) + assert code == 1 for dir in indirs: workload_dir = test_utils.setup_workload_dir(dir) - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - workload_dir, - "--list-metrics", - "gfx908", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", workload_dir, "--list-metrics", "gfx908"] + ) + assert code == 0 test_utils.clean_output_dir(config["cleanup"], workload_dir) @pytest.mark.filter_block -def test_filter_block_1(): +def test_filter_block_1(binary_handler_analyze_rocprof_compute): for dir in indirs: workload_dir = test_utils.setup_workload_dir(dir) - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - workload_dir, - "--block", - "1", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", workload_dir, "--block", "1"] + ) + assert code == 0 test_utils.clean_output_dir(config["cleanup"], workload_dir) @pytest.mark.filter_block -def test_filter_block_2(): +def test_filter_block_2(binary_handler_analyze_rocprof_compute): for dir in indirs: workload_dir = test_utils.setup_workload_dir(dir) - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - workload_dir, - "--block", - "5", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", workload_dir, "--block", "5"] + ) + assert code == 0 test_utils.clean_output_dir(config["cleanup"], workload_dir) @pytest.mark.filter_block -def test_filter_block_3(): +def test_filter_block_3(binary_handler_analyze_rocprof_compute): for dir in indirs: workload_dir = test_utils.setup_workload_dir(dir) - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - workload_dir, - "--block", - "5.2.2", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", workload_dir, "--block", "5.2.2"] + ) + assert code == 0 test_utils.clean_output_dir(config["cleanup"], workload_dir) @pytest.mark.filter_block -def test_filter_block_4(): +def test_filter_block_4(binary_handler_analyze_rocprof_compute): for dir in indirs: workload_dir = test_utils.setup_workload_dir(dir) - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - workload_dir, - "--block", - "6.1", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", workload_dir, "--block", "6.1"] + ) + assert code == 0 test_utils.clean_output_dir(config["cleanup"], workload_dir) @pytest.mark.filter_block -def test_filter_block_5(): +def test_filter_block_5(binary_handler_analyze_rocprof_compute): for dir in indirs: workload_dir = test_utils.setup_workload_dir(dir) - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - workload_dir, - "--block", - "10", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", workload_dir, "--block", "10"] + ) + assert code == 0 test_utils.clean_output_dir(config["cleanup"], workload_dir) @pytest.mark.filter_block -def test_filter_block_6(): +def test_filter_block_6(binary_handler_analyze_rocprof_compute): for dir in indirs: workload_dir = test_utils.setup_workload_dir(dir) - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - workload_dir, - "--block", - "100", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", workload_dir, "--block", "100"] + ) + assert code == 0 test_utils.clean_output_dir(config["cleanup"], workload_dir) @pytest.mark.serial -def test_filter_kernel_1(): +def test_filter_kernel_1(binary_handler_analyze_rocprof_compute): for dir in indirs: workload_dir = test_utils.setup_workload_dir(dir) - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - workload_dir, - "--kernel", - "0", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", workload_dir, "--kernel", "0"] + ) + assert code == 0 test_utils.clean_output_dir(config["cleanup"], workload_dir) @pytest.mark.serial -def test_filter_kernel_2(): +def test_filter_kernel_2(binary_handler_analyze_rocprof_compute): for dir in indirs: workload_dir = test_utils.setup_workload_dir(dir) - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - workload_dir, - "--kernel", - "1", - ], - ): - rocprof_compute.main() - assert e.value.code == 1 + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", workload_dir, "--kernel", "1"] + ) + assert code == 1 test_utils.clean_output_dir(config["cleanup"], workload_dir) @pytest.mark.serial -def test_filter_kernel_3(): +def test_filter_kernel_3(binary_handler_analyze_rocprof_compute): for dir in indirs: workload_dir = test_utils.setup_workload_dir(dir) - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - workload_dir, - "--kernel", - "0", - "1", - ], - ): - rocprof_compute.main() - assert e.value.code == 1 + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", workload_dir, "--kernel", "0", "1"] + ) + assert code == 1 test_utils.clean_output_dir(config["cleanup"], workload_dir) @pytest.mark.serial -def test_dispatch_1(): +def test_dispatch_1(binary_handler_analyze_rocprof_compute): for dir in indirs: workload_dir = test_utils.setup_workload_dir(dir) - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - workload_dir, - "--dispatch", - "0", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", workload_dir, "--dispatch", "0"] + ) + assert code == 0 test_utils.clean_output_dir(config["cleanup"], workload_dir) @pytest.mark.serial -def test_dispatch_2(): +def test_dispatch_2(binary_handler_analyze_rocprof_compute): for dir in indirs: workload_dir = test_utils.setup_workload_dir(dir) - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - workload_dir, - "--dispatch", - "1", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", workload_dir, "--dispatch", "1"] + ) + assert code == 0 test_utils.clean_output_dir(config["cleanup"], workload_dir) @pytest.mark.serial -def test_dispatch_3(): +def test_dispatch_3(binary_handler_analyze_rocprof_compute): for dir in indirs: workload_dir = test_utils.setup_workload_dir(dir) - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - workload_dir, - "--dispatch", - "2", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", workload_dir, "--dispatch", "2"] + ) + assert code == 0 test_utils.clean_output_dir(config["cleanup"], workload_dir) @pytest.mark.serial -def test_dispatch_4(): +def test_dispatch_4(binary_handler_analyze_rocprof_compute): for dir in indirs: workload_dir = test_utils.setup_workload_dir(dir) - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - workload_dir, - "--dispatch", - "1", - "4", - ], - ): - rocprof_compute.main() - assert e.value.code == 1 + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", workload_dir, "--dispatch", "1", "4"] + ) + assert code == 1 test_utils.clean_output_dir(config["cleanup"], workload_dir) @pytest.mark.serial -def test_dispatch_5(): +def test_dispatch_5(binary_handler_analyze_rocprof_compute): for dir in indirs: workload_dir = test_utils.setup_workload_dir(dir) - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - workload_dir, - "--dispatch", - "5", - "6", - ], - ): - rocprof_compute.main() - assert e.value.code == 1 + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", workload_dir, "--dispatch", "5", "6"] + ) + assert code == 1 test_utils.clean_output_dir(config["cleanup"], workload_dir) @pytest.mark.misc -def test_gpu_ids(): +def test_gpu_ids(binary_handler_analyze_rocprof_compute): for dir in indirs: workload_dir = test_utils.setup_workload_dir(dir) - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - workload_dir, - "--gpu-id", - "2", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", workload_dir, "--gpu-id", "2"] + ) + assert code == 0 test_utils.clean_output_dir(config["cleanup"], workload_dir) @pytest.mark.normal_unit -def test_normal_unit_per_wave(): +def test_normal_unit_per_wave(binary_handler_analyze_rocprof_compute): for dir in indirs: workload_dir = test_utils.setup_workload_dir(dir) - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - workload_dir, - "--normal-unit", - "per_wave", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", workload_dir, "--normal-unit", "per_wave"] + ) + assert code == 0 test_utils.clean_output_dir(config["cleanup"], workload_dir) @pytest.mark.normal_unit -def test_normal_unit_per_cycle(): +def test_normal_unit_per_cycle(binary_handler_analyze_rocprof_compute): for dir in indirs: workload_dir = test_utils.setup_workload_dir(dir) - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - workload_dir, - "--normal-unit", - "per_cycle", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", workload_dir, "--normal-unit", "per_cycle"] + ) + assert code == 0 test_utils.clean_output_dir(config["cleanup"], workload_dir) @pytest.mark.normal_unit -def test_normal_unit_per_second(): +def test_normal_unit_per_second(binary_handler_analyze_rocprof_compute): for dir in indirs: workload_dir = test_utils.setup_workload_dir(dir) - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - workload_dir, - "--normal-unit", - "per_second", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", workload_dir, "--normal-unit", "per_second"] + ) + assert code == 0 test_utils.clean_output_dir(config["cleanup"], workload_dir) @pytest.mark.normal_unit -def test_normal_unit_per_kernel(): +def test_normal_unit_per_kernel(binary_handler_analyze_rocprof_compute): for dir in indirs: workload_dir = test_utils.setup_workload_dir(dir) - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - workload_dir, - "--normal-unit", - "per_kernel", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", workload_dir, "--normal-unit", "per_kernel"] + ) + assert code == 0 test_utils.clean_output_dir(config["cleanup"], workload_dir) @pytest.mark.max_stat -def test_max_stat_num_1(): +def test_max_stat_num_1(binary_handler_analyze_rocprof_compute): for dir in indirs: workload_dir = test_utils.setup_workload_dir(dir) - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - workload_dir, - "--max-stat-num", - "0", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", workload_dir, "--max-stat-num", "0"] + ) + assert code == 0 test_utils.clean_output_dir(config["cleanup"], workload_dir) @pytest.mark.max_stat -def test_max_stat_num_2(): +def test_max_stat_num_2(binary_handler_analyze_rocprof_compute): for dir in indirs: workload_dir = test_utils.setup_workload_dir(dir) - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - workload_dir, - "--max-stat-num", - "5", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", workload_dir, "--max-stat-num", "5"] + ) + assert code == 0 test_utils.clean_output_dir(config["cleanup"], workload_dir) @pytest.mark.max_stat -def test_max_stat_num_3(): +def test_max_stat_num_3(binary_handler_analyze_rocprof_compute): for dir in indirs: workload_dir = test_utils.setup_workload_dir(dir) - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - workload_dir, - "--max-stat-num", - "10", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", workload_dir, "--max-stat-num", "10"] + ) + assert code == 0 test_utils.clean_output_dir(config["cleanup"], workload_dir) @pytest.mark.max_stat -def test_max_stat_num_4(): +def test_max_stat_num_4(binary_handler_analyze_rocprof_compute): for dir in indirs: workload_dir = test_utils.setup_workload_dir(dir) - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - workload_dir, - "--max-stat-num", - "15", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", workload_dir, "--max-stat-num", "15"] + ) + assert code == 0 test_utils.clean_output_dir(config["cleanup"], workload_dir) @pytest.mark.time_unit -def test_time_unit_s(): +def test_time_unit_s(binary_handler_analyze_rocprof_compute): for dir in indirs: workload_dir = test_utils.setup_workload_dir(dir) - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - workload_dir, - "--time-unit", - "s", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", workload_dir, "--time-unit", "s"] + ) + assert code == 0 test_utils.clean_output_dir(config["cleanup"], workload_dir) @pytest.mark.time_unit -def test_time_unit_ms(): +def test_time_unit_ms(binary_handler_analyze_rocprof_compute): for dir in indirs: workload_dir = test_utils.setup_workload_dir(dir) - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - workload_dir, - "--time-unit", - "ms", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", workload_dir, "--time-unit", "ms"] + ) + assert code == 0 test_utils.clean_output_dir(config["cleanup"], workload_dir) @pytest.mark.time_unit -def test_time_unit_us(): +def test_time_unit_us(binary_handler_analyze_rocprof_compute): for dir in indirs: workload_dir = test_utils.setup_workload_dir(dir) - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - workload_dir, - "--time-unit", - "us", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", workload_dir, "--time-unit", "us"] + ) + assert code == 0 test_utils.clean_output_dir(config["cleanup"], workload_dir) @pytest.mark.time_unit -def test_time_unit_ns(): +def test_time_unit_ns(binary_handler_analyze_rocprof_compute): for dir in indirs: workload_dir = test_utils.setup_workload_dir(dir) - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - workload_dir, - "--time-unit", - "ns", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", workload_dir, "--time-unit", "ns"] + ) + assert code == 0 test_utils.clean_output_dir(config["cleanup"], workload_dir) @pytest.mark.decimal -def test_decimal_1(): +def test_decimal_1(binary_handler_analyze_rocprof_compute): for dir in indirs: workload_dir = test_utils.setup_workload_dir(dir) - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - workload_dir, - "--decimal", - "0", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", workload_dir, "--decimal", "0"] + ) + assert code == 0 test_utils.clean_output_dir(config["cleanup"], workload_dir) @pytest.mark.decimal -def test_decimal_2(): +def test_decimal_2(binary_handler_analyze_rocprof_compute): for dir in indirs: workload_dir = test_utils.setup_workload_dir(dir) - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - workload_dir, - "--decimal", - "1", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", workload_dir, "--decimal", "1"] + ) + assert code == 0 test_utils.clean_output_dir(config["cleanup"], workload_dir) @pytest.mark.decimal -def test_decimal_3(): +def test_decimal_3(binary_handler_analyze_rocprof_compute): for dir in indirs: workload_dir = test_utils.setup_workload_dir(dir) - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - workload_dir, - "--decimal", - "4", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", workload_dir, "--decimal", "4"] + ) + assert code == 0 test_utils.clean_output_dir(config["cleanup"], workload_dir) @pytest.mark.misc -def test_save_dfs(): +def test_save_dfs(binary_handler_analyze_rocprof_compute): output_path = "tests/workloads/vcopy/saved_analysis" for dir in indirs: workload_dir = test_utils.setup_workload_dir(dir) - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - workload_dir, - "--save-dfs", - output_path, - ], - ): - rocprof_compute.main() - assert e.value.code == 0 + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", workload_dir, "--save-dfs", output_path] + ) + assert code == 0 files_in_workload = os.listdir(output_path) single_row_tables = [ @@ -845,20 +473,10 @@ def test_save_dfs(): for dir in indirs: workload_dir = test_utils.setup_workload_dir(dir) - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - workload_dir, - "--save-dfs", - output_path, - ], - ): - rocprof_compute.main() - assert e.value.code == 0 + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", workload_dir, "--save-dfs", output_path] + ) + assert code == 0 files_in_workload = os.listdir(output_path) for file_name in files_in_workload: @@ -871,310 +489,179 @@ def test_save_dfs(): @pytest.mark.col -def test_col_1(): +def test_col_1(binary_handler_analyze_rocprof_compute): for dir in indirs: workload_dir = test_utils.setup_workload_dir(dir) - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - workload_dir, - "--cols", - "0", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", workload_dir, "--cols", "0"] + ) + assert code == 0 test_utils.clean_output_dir(config["cleanup"], workload_dir) @pytest.mark.col -def test_col_2(): +def test_col_2(binary_handler_analyze_rocprof_compute): for dir in indirs: workload_dir = test_utils.setup_workload_dir(dir) - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - workload_dir, - "--cols", - "2", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", workload_dir, "--cols", "2"] + ) + assert code == 0 test_utils.clean_output_dir(config["cleanup"], workload_dir) @pytest.mark.col -def test_col_3(): +def test_col_3(binary_handler_analyze_rocprof_compute): for dir in indirs: workload_dir = test_utils.setup_workload_dir(dir) - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - workload_dir, - "--cols", - "0", - "2", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", workload_dir, "--cols", "0", "2"] + ) + assert code == 0 test_utils.clean_output_dir(config["cleanup"], workload_dir) @pytest.mark.misc -def test_g(): +def test_g(binary_handler_analyze_rocprof_compute): for dir in indirs: workload_dir = test_utils.setup_workload_dir(dir) - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - workload_dir, - "-g", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", workload_dir, "-g"] + ) + assert code == 0 test_utils.clean_output_dir(config["cleanup"], workload_dir) @pytest.mark.kernel_verbose -def test_kernel_verbose_0(): +def test_kernel_verbose_0(binary_handler_analyze_rocprof_compute): for dir in indirs: workload_dir = test_utils.setup_workload_dir(dir) - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - workload_dir, - "--kernel-verbose", - "0", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", workload_dir, "--kernel-verbose", "0"] + ) + assert code == 0 test_utils.clean_output_dir(config["cleanup"], workload_dir) @pytest.mark.kernel_verbose -def test_kernel_verbose_1(): +def test_kernel_verbose_1(binary_handler_analyze_rocprof_compute): for dir in indirs: workload_dir = test_utils.setup_workload_dir(dir) - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - workload_dir, - "--kernel-verbose", - "1", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", workload_dir, "--kernel-verbose", "1"] + ) + assert code == 0 test_utils.clean_output_dir(config["cleanup"], workload_dir) @pytest.mark.kernel_verbose -def test_kernel_verbose_2(): +def test_kernel_verbose_2(binary_handler_analyze_rocprof_compute): for dir in indirs: workload_dir = test_utils.setup_workload_dir(dir) - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - workload_dir, - "--kernel-verbose", - "2", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", workload_dir, "--kernel-verbose", "2"] + ) + assert code == 0 test_utils.clean_output_dir(config["cleanup"], workload_dir) @pytest.mark.kernel_verbose -def test_kernel_verbose_3(): +def test_kernel_verbose_3(binary_handler_analyze_rocprof_compute): for dir in indirs: workload_dir = test_utils.setup_workload_dir(dir) - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - workload_dir, - "--kernel-verbose", - "3", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", workload_dir, "--kernel-verbose", "3"] + ) + assert code == 0 test_utils.clean_output_dir(config["cleanup"], workload_dir) @pytest.mark.kernel_verbose -def test_kernel_verbose_4(): +def test_kernel_verbose_4(binary_handler_analyze_rocprof_compute): for dir in indirs: workload_dir = test_utils.setup_workload_dir(dir) - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - workload_dir, - "--kernel-verbose", - "4", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", workload_dir, "--kernel-verbose", "4"] + ) + assert code == 0 test_utils.clean_output_dir(config["cleanup"], workload_dir) @pytest.mark.kernel_verbose -def test_kernel_verbose_5(): +def test_kernel_verbose_5(binary_handler_analyze_rocprof_compute): for dir in indirs: workload_dir = test_utils.setup_workload_dir(dir) - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - workload_dir, - "--kernel-verbose", - "5", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", workload_dir, "--kernel-verbose", "5"] + ) + assert code == 0 test_utils.clean_output_dir(config["cleanup"], workload_dir) @pytest.mark.kernel_verbose -def test_kernel_verbose_6(): +def test_kernel_verbose_6(binary_handler_analyze_rocprof_compute): for dir in indirs: workload_dir = test_utils.setup_workload_dir(dir) - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - workload_dir, - "--kernel-verbose", - "6", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", workload_dir, "--kernel-verbose", "6"] + ) + assert code == 0 test_utils.clean_output_dir(config["cleanup"], workload_dir) @pytest.mark.misc -def test_baseline(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - "tests/workloads/vcopy/MI200", - "--path", - "tests/workloads/vcopy/MI100", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 +def test_baseline(binary_handler_analyze_rocprof_compute): + code = binary_handler_analyze_rocprof_compute( + [ + "analyze", + "--path", + "tests/workloads/vcopy/MI200", + "--path", + "tests/workloads/vcopy/MI100", + ] + ) + assert code == 0 - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - "tests/workloads/vcopy/MI200", - "--path", - "tests/workloads/vcopy/MI200", - ], - ): - rocprof_compute.main() - assert e.value.code == 1 + code = binary_handler_analyze_rocprof_compute( + [ + "analyze", + "--path", + "tests/workloads/vcopy/MI200", + "--path", + "tests/workloads/vcopy/MI200", + ] + ) + assert code == 1 - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - "tests/workloads/vcopy/MI100", - "--path", - "tests/workloads/vcopy/MI100", - ], - ): - rocprof_compute.main() - assert e.value.code == 1 + code = binary_handler_analyze_rocprof_compute( + [ + "analyze", + "--path", + "tests/workloads/vcopy/MI100", + "--path", + "tests/workloads/vcopy/MI100", + ] + ) + assert code == 1 @pytest.mark.misc -def test_dependency_MI100(): +def test_dependency_MI100(binary_handler_analyze_rocprof_compute): for dir in indirs: workload_dir = test_utils.setup_workload_dir(dir) - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - workload_dir, - "--dependency", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", workload_dir, "--dependency"] + ) + assert code == 0 test_utils.clean_output_dir(config["cleanup"], workload_dir) diff --git a/projects/rocprofiler-compute/tests/test_analyze_workloads.py b/projects/rocprofiler-compute/tests/test_analyze_workloads.py index 3b0b315eec..eddd54937f 100644 --- a/projects/rocprofiler-compute/tests/test_analyze_workloads.py +++ b/projects/rocprofiler-compute/tests/test_analyze_workloads.py @@ -1,1947 +1,941 @@ -import inspect -import re -import shutil -import subprocess -import sys -from importlib.machinery import SourceFileLoader from unittest.mock import patch import pandas as pd import pytest -import test_utils - -rocprof_compute = SourceFileLoader("rocprof-compute", "src/rocprof-compute").load_module() +from test_utils import binary_handler_analyze_rocprof_compute ################################################## ## Generated tests ## ################################################## -def test_analyze_vcopy_MI100(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - ["rocprof-compute", "analyze", "--path", "tests/workloads/vcopy/MI100"], - ): - rocprof_compute.main() - assert e.value.code == 0 - - -def test_analyze_vcopy_MI200(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - ["rocprof-compute", "analyze", "--path", "tests/workloads/vcopy/MI200"], - ): - rocprof_compute.main() - assert e.value.code == 0 - - -def test_analyze_ipblocks_TCP_MI300X_A1(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - "tests/workloads/ipblocks_TCP/MI300X_A1", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 - - -def test_analyze_ipblocks_TCP_MI100(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - "tests/workloads/ipblocks_TCP/MI100", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 - - -def test_analyze_ipblocks_TCP_MI300A_A1(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - "tests/workloads/ipblocks_TCP/MI300A_A1", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 - - -def test_analyze_ipblocks_TCP_MI200(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - "tests/workloads/ipblocks_TCP/MI200", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 - - -def test_analyze_ipblocks_SQC_MI300X_A1(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - "tests/workloads/ipblocks_SQC/MI300X_A1", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 - - -def test_analyze_ipblocks_SQC_MI100(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - "tests/workloads/ipblocks_SQC/MI100", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 - - -def test_analyze_ipblocks_SQC_MI300A_A1(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - "tests/workloads/ipblocks_SQC/MI300A_A1", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 - - -def test_analyze_ipblocks_SQC_MI200(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - "tests/workloads/ipblocks_SQC/MI200", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 - - -def test_analyze_mem_levels_HBM_LDS_MI200(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - "tests/workloads/mem_levels_HBM_LDS/MI200", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 - - -def test_analyze_ipblocks_TCC_MI300X_A1(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - "tests/workloads/ipblocks_TCC/MI300X_A1", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 - - -def test_analyze_ipblocks_TCC_MI100(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - "tests/workloads/ipblocks_TCC/MI100", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 - - -def test_analyze_ipblocks_TCC_MI300A_A1(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - "tests/workloads/ipblocks_TCC/MI300A_A1", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 - - -def test_analyze_ipblocks_TCC_MI200(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - "tests/workloads/ipblocks_TCC/MI200", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 - - -def test_analyze_no_roof_MI300X_A1(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - "tests/workloads/no_roof/MI300X_A1", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 - - -def test_analyze_no_roof_MI100(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - ["rocprof-compute", "analyze", "--path", "tests/workloads/no_roof/MI100"], - ): - rocprof_compute.main() - assert e.value.code == 0 - - -def test_analyze_no_roof_MI300A_A1(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - "tests/workloads/no_roof/MI300A_A1", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 - - -def test_analyze_no_roof_MI200(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - ["rocprof-compute", "analyze", "--path", "tests/workloads/no_roof/MI200"], - ): - rocprof_compute.main() - assert e.value.code == 0 - - -def test_analyze_ipblocks_SQ_CPC_MI300X_A1(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - "tests/workloads/ipblocks_SQ_CPC/MI300X_A1", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 - - -def test_analyze_ipblocks_SQ_CPC_MI100(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - "tests/workloads/ipblocks_SQ_CPC/MI100", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 - - -def test_analyze_ipblocks_SQ_CPC_MI300A_A1(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - "tests/workloads/ipblocks_SQ_CPC/MI300A_A1", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 - - -def test_analyze_ipblocks_SQ_CPC_MI200(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - "tests/workloads/ipblocks_SQ_CPC/MI200", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 - - -def test_analyze_dispatch_0_MI300X_A1(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - "tests/workloads/dispatch_0/MI300X_A1", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 - - -def test_analyze_dispatch_0_MI100(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - "tests/workloads/dispatch_0/MI100", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 - - -def test_analyze_dispatch_0_MI300A_A1(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - "tests/workloads/dispatch_0/MI300A_A1", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 - - -def test_analyze_dispatch_0_MI200(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - "tests/workloads/dispatch_0/MI200", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 - - -def test_analyze_join_type_grid_MI300X_A1(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - "tests/workloads/join_type_grid/MI300X_A1", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 - - -def test_analyze_join_type_grid_MI100(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - "tests/workloads/join_type_grid/MI100", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 - - -def test_analyze_join_type_grid_MI300A_A1(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - "tests/workloads/join_type_grid/MI300A_A1", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 - - -def test_analyze_join_type_grid_MI200(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - "tests/workloads/join_type_grid/MI200", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 - - -def test_analyze_kernel_MI300X_A1(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - "tests/workloads/kernel/MI300X_A1", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 - - -def test_analyze_kernel_MI100(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - ["rocprof-compute", "analyze", "--path", "tests/workloads/kernel/MI100"], - ): - rocprof_compute.main() - assert e.value.code == 0 - - -def test_analyze_kernel_MI300A_A1(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - "tests/workloads/kernel/MI300A_A1", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 - - -def test_analyze_kernel_MI200(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - ["rocprof-compute", "analyze", "--path", "tests/workloads/kernel/MI200"], - ): - rocprof_compute.main() - assert e.value.code == 0 - - -def test_analyze_kernel_substr_MI300X_A1(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - "tests/workloads/kernel_substr/MI300X_A1", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 - - -def test_analyze_kernel_substr_MI100(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - "tests/workloads/kernel_substr/MI100", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 - - -def test_analyze_kernel_substr_MI300A_A1(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - "tests/workloads/kernel_substr/MI300A_A1", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 - - -def test_analyze_kernel_substr_MI200(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - "tests/workloads/kernel_substr/MI200", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 - - -def test_analyze_dispatch_7_MI300X_A1(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - "tests/workloads/dispatch_7/MI300X_A1", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 - - -def test_analyze_dispatch_7_MI100(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - "tests/workloads/dispatch_7/MI100", - ], - ): - rocprof_compute.main() - assert e.value.code == 1 - - -def test_analyze_dispatch_7_MI300A_A1(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - "tests/workloads/dispatch_7/MI300A_A1", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 - - -def test_analyze_dispatch_7_MI200(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - "tests/workloads/dispatch_7/MI200", - ], - ): - rocprof_compute.main() - assert e.value.code == 1 - - -def test_analyze_kernel_inv_int_MI300X_A1(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - "tests/workloads/kernel_inv_int/MI300X_A1", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 - - -def test_analyze_kernel_inv_int_MI100(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - "tests/workloads/kernel_inv_int/MI100", - ], - ): - rocprof_compute.main() - assert e.value.code == 1 - - -def test_analyze_kernel_inv_int_MI300A_A1(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - "tests/workloads/kernel_inv_int/MI300A_A1", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 - - -def test_analyze_kernel_inv_int_MI200(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - "tests/workloads/kernel_inv_int/MI200", - ], - ): - rocprof_compute.main() - assert e.value.code == 1 - - -def test_analyze_mem_levels_vL1D_MI200(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - "tests/workloads/mem_levels_vL1D/MI200", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 - - -def test_analyze_sort_kernels_MI200(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - "tests/workloads/sort_kernels/MI200", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 - - -def test_analyze_kernel_inv_str_MI300X_A1(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - "tests/workloads/kernel_inv_str/MI300X_A1", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 - - -def test_analyze_kernel_inv_str_MI100(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - "tests/workloads/kernel_inv_str/MI100", - ], - ): - rocprof_compute.main() - assert e.value.code == 1 - - -def test_analyze_kernel_inv_str_MI300A_A1(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - "tests/workloads/kernel_inv_str/MI300A_A1", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 - - -def test_analyze_kernel_inv_str_MI200(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - "tests/workloads/kernel_inv_str/MI200", - ], - ): - rocprof_compute.main() - assert e.value.code == 1 - - -def test_analyze_ipblocks_SQ_SPI_MI300X_A1(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - "tests/workloads/ipblocks_SQ_SPI/MI300X_A1", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 - - -def test_analyze_ipblocks_SQ_SPI_MI100(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - "tests/workloads/ipblocks_SQ_SPI/MI100", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 - - -def test_analyze_ipblocks_SQ_SPI_MI300A_A1(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - "tests/workloads/ipblocks_SQ_SPI/MI300A_A1", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 - - -def test_analyze_ipblocks_SQ_SPI_MI200(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - "tests/workloads/ipblocks_SQ_SPI/MI200", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 - - -def test_analyze_dispatch_2_MI300X_A1(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - "tests/workloads/dispatch_2/MI300X_A1", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 - - -def test_analyze_dispatch_2_MI100(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - "tests/workloads/dispatch_2/MI100", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 - - -def test_analyze_dispatch_2_MI300A_A1(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - "tests/workloads/dispatch_2/MI300A_A1", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 - - -def test_analyze_dispatch_2_MI200(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - "tests/workloads/dispatch_2/MI200", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 - - -def test_analyze_dispatch_0_1_MI300X_A1(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - "tests/workloads/dispatch_0_1/MI300X_A1", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 - - -def test_analyze_dispatch_0_1_MI100(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - "tests/workloads/dispatch_0_1/MI100", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 - - -def test_analyze_dispatch_0_1_MI300A_A1(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - "tests/workloads/dispatch_0_1/MI300A_A1", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 - - -def test_analyze_dispatch_0_1_MI200(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - "tests/workloads/dispatch_0_1/MI200", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 - - -def test_analyze_mem_levels_LDS_MI200(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - "tests/workloads/mem_levels_LDS/MI200", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 - - -def test_analyze_ipblocks_TA_MI300X_A1(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - "tests/workloads/ipblocks_TA/MI300X_A1", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 - - -def test_analyze_ipblocks_TA_MI100(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - "tests/workloads/ipblocks_TA/MI100", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 - - -def test_analyze_ipblocks_TA_MI300A_A1(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - "tests/workloads/ipblocks_TA/MI300A_A1", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 - - -def test_analyze_ipblocks_TA_MI200(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - "tests/workloads/ipblocks_TA/MI200", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 - - -def test_analyze_dispatch_6_8_MI300X_A1(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - "tests/workloads/dispatch_6_8/MI300X_A1", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 - - -def test_analyze_dispatch_6_8_MI100(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - "tests/workloads/dispatch_6_8/MI100", - ], - ): - rocprof_compute.main() - assert e.value.code == 1 - - -def test_analyze_dispatch_6_8_MI300A_A1(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - "tests/workloads/dispatch_6_8/MI300A_A1", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 - - -def test_analyze_dispatch_6_8_MI200(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - "tests/workloads/dispatch_6_8/MI200", - ], - ): - rocprof_compute.main() - assert e.value.code == 1 - - -def test_analyze_device_inv_int_MI300X_A1(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - "tests/workloads/device_inv_int/MI300X_A1", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 - - -def test_analyze_device_inv_int_MI100(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - "tests/workloads/device_inv_int/MI100", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 - - -def test_analyze_device_inv_int_MI300A_A1(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - "tests/workloads/device_inv_int/MI300A_A1", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 - - -def test_analyze_device_inv_int_MI200(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - "tests/workloads/device_inv_int/MI200", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 - - -def test_analyze_ipblocks_SQ_TA_MI300X_A1(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - "tests/workloads/ipblocks_SQ_TA/MI300X_A1", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 - - -def test_analyze_ipblocks_SQ_TA_MI100(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - "tests/workloads/ipblocks_SQ_TA/MI100", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 - - -def test_analyze_ipblocks_SQ_TA_MI300A_A1(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - "tests/workloads/ipblocks_SQ_TA/MI300A_A1", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 - - -def test_analyze_ipblocks_SQ_TA_MI200(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - "tests/workloads/ipblocks_SQ_TA/MI200", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 - - -def test_analyze_ipblocks_TD_MI300X_A1(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - "tests/workloads/ipblocks_TD/MI300X_A1", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 - - -def test_analyze_ipblocks_TD_MI100(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - "tests/workloads/ipblocks_TD/MI100", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 - - -def test_analyze_ipblocks_TD_MI300A_A1(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - "tests/workloads/ipblocks_TD/MI300A_A1", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 - - -def test_analyze_ipblocks_TD_MI200(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - "tests/workloads/ipblocks_TD/MI200", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 - - -def test_analyze_device_filter_MI300X_A1(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - "tests/workloads/device_filter/MI300X_A1", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 - - -def test_analyze_device_filter_MI100(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - "tests/workloads/device_filter/MI100", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 - - -def test_analyze_device_filter_MI300A_A1(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - "tests/workloads/device_filter/MI300A_A1", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 - - -def test_analyze_device_filter_MI200(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - "tests/workloads/device_filter/MI200", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 - - -def test_analyze_join_type_kernel_MI300X_A1(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - "tests/workloads/join_type_kernel/MI300X_A1", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 - - -def test_analyze_join_type_kernel_MI100(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - "tests/workloads/join_type_kernel/MI100", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 - - -def test_analyze_join_type_kernel_MI300A_A1(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - "tests/workloads/join_type_kernel/MI300A_A1", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 - - -def test_analyze_join_type_kernel_MI200(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - "tests/workloads/join_type_kernel/MI200", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 - - -def test_analyze_ipblocks_SQ_SQC_TCP_CPC_MI300X_A1(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - "tests/workloads/ipblocks_SQ_SQC_TCP_CPC/MI300X_A1", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 - - -def test_analyze_ipblocks_SQ_SQC_TCP_CPC_MI100(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - "tests/workloads/ipblocks_SQ_SQC_TCP_CPC/MI100", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 - - -def test_analyze_ipblocks_SQ_SQC_TCP_CPC_MI300A_A1(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - "tests/workloads/ipblocks_SQ_SQC_TCP_CPC/MI300A_A1", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 - - -def test_analyze_ipblocks_SQ_SQC_TCP_CPC_MI200(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - "tests/workloads/ipblocks_SQ_SQC_TCP_CPC/MI200", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 - - -def test_analyze_mem_levels_L2_vL1d_LDS_MI200(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - "tests/workloads/mem_levels_L2_vL1d_LDS/MI200", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 - - -def test_analyze_ipblocks_CPF_MI300X_A1(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - "tests/workloads/ipblocks_CPF/MI300X_A1", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 - - -def test_analyze_ipblocks_CPF_MI100(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - "tests/workloads/ipblocks_CPF/MI100", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 - - -def test_analyze_ipblocks_CPF_MI300A_A1(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - "tests/workloads/ipblocks_CPF/MI300A_A1", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 - - -def test_analyze_ipblocks_CPF_MI200(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - "tests/workloads/ipblocks_CPF/MI200", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 - - -def test_analyze_sort_dispatches_MI200(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - "tests/workloads/sort_dispatches/MI200", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 - - -def test_analyze_kernel_names_MI200(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - "tests/workloads/kernel_names/MI200", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 - - -def test_analyze_mem_levels_vL1d_LDS_MI200(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - "tests/workloads/mem_levels_vL1d_LDS/MI200", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 - - -def test_analyze_ipblocks_SQ_MI300X_A1(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - "tests/workloads/ipblocks_SQ/MI300X_A1", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 - - -def test_analyze_ipblocks_SQ_MI100(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - "tests/workloads/ipblocks_SQ/MI100", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 - - -def test_analyze_ipblocks_SQ_MI300A_A1(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - "tests/workloads/ipblocks_SQ/MI300A_A1", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 - - -def test_analyze_ipblocks_SQ_MI200(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - "tests/workloads/ipblocks_SQ/MI200", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 - - -def test_analyze_mem_levels_L2_MI200(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - "tests/workloads/mem_levels_L2/MI200", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 - - -def test_analyze_dispatch_inv_MI300X_A1(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - "tests/workloads/dispatch_inv/MI300X_A1", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 - - -def test_analyze_dispatch_inv_MI100(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - "tests/workloads/dispatch_inv/MI100", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 - - -def test_analyze_dispatch_inv_MI300A_A1(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - "tests/workloads/dispatch_inv/MI300A_A1", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 - - -def test_analyze_dispatch_inv_MI200(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - "tests/workloads/dispatch_inv/MI200", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 - - -def test_analyze_path_MI300X_A1(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - ["rocprof-compute", "analyze", "--path", "tests/workloads/path/MI300X_A1"], - ): - rocprof_compute.main() - assert e.value.code == 0 - - -def test_analyze_path_MI100(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - ["rocprof-compute", "analyze", "--path", "tests/workloads/path/MI100"], - ): - rocprof_compute.main() - assert e.value.code == 0 - - -def test_analyze_path_MI300A_A1(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - ["rocprof-compute", "analyze", "--path", "tests/workloads/path/MI300A_A1"], - ): - rocprof_compute.main() - assert e.value.code == 0 - - -def test_analyze_path_MI200(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - ["rocprof-compute", "analyze", "--path", "tests/workloads/path/MI200"], - ): - rocprof_compute.main() - assert e.value.code == 0 - - -def test_analyze_ipblocks_CPC_MI300X_A1(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - "tests/workloads/ipblocks_CPC/MI300X_A1", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 - - -def test_analyze_ipblocks_CPC_MI100(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - "tests/workloads/ipblocks_CPC/MI100", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 - - -def test_analyze_ipblocks_CPC_MI300A_A1(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - "tests/workloads/ipblocks_CPC/MI300A_A1", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 - - -def test_analyze_ipblocks_CPC_MI200(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - "tests/workloads/ipblocks_CPC/MI200", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 - - -def test_analyze_ipblocks_SQ_SPI_TA_TCC_CPF_MI300X_A1(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - "tests/workloads/ipblocks_SQ_SPI_TA_TCC_CPF/MI300X_A1", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 - - -def test_analyze_ipblocks_SQ_SPI_TA_TCC_CPF_MI100(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - "tests/workloads/ipblocks_SQ_SPI_TA_TCC_CPF/MI100", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 - - -def test_analyze_ipblocks_SQ_SPI_TA_TCC_CPF_MI300A_A1(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - "tests/workloads/ipblocks_SQ_SPI_TA_TCC_CPF/MI300A_A1", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 - - -def test_analyze_ipblocks_SQ_SPI_TA_TCC_CPF_MI200(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - "tests/workloads/ipblocks_SQ_SPI_TA_TCC_CPF/MI200", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 - - -def test_analyze_mem_levels_HBM_MI200(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - "tests/workloads/mem_levels_HBM/MI200", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 - - -def test_analyze_ipblocks_SPI_MI300X_A1(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - "tests/workloads/ipblocks_SPI/MI300X_A1", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 - - -def test_analyze_ipblocks_SPI_MI100(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - "tests/workloads/ipblocks_SPI/MI100", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 - - -def test_analyze_ipblocks_SPI_MI300A_A1(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - "tests/workloads/ipblocks_SPI/MI300A_A1", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 - - -def test_analyze_ipblocks_SPI_MI200(): - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", - [ - "rocprof-compute", - "analyze", - "--path", - "tests/workloads/ipblocks_SPI/MI200", - ], - ): - rocprof_compute.main() - assert e.value.code == 0 +def test_analyze_vcopy_MI100(binary_handler_analyze_rocprof_compute): + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", "tests/workloads/vcopy/MI100"] + ) + assert code == 0 + + +def test_analyze_vcopy_MI200(binary_handler_analyze_rocprof_compute): + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", "tests/workloads/vcopy/MI200"] + ) + assert code == 0 + + +def test_analyze_ipblocks_TCP_MI300X_A1(binary_handler_analyze_rocprof_compute): + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", "tests/workloads/ipblocks_TCP/MI300X_A1"] + ) + assert code == 0 + + +def test_analyze_ipblocks_TCP_MI100(binary_handler_analyze_rocprof_compute): + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", "tests/workloads/ipblocks_TCP/MI100"] + ) + assert code == 0 + + +def test_analyze_ipblocks_TCP_MI300A_A1(binary_handler_analyze_rocprof_compute): + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", "tests/workloads/ipblocks_TCP/MI300A_A1"] + ) + assert code == 0 + + +def test_analyze_ipblocks_TCP_MI200(binary_handler_analyze_rocprof_compute): + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", "tests/workloads/ipblocks_TCP/MI200"] + ) + assert code == 0 + + +def test_analyze_ipblocks_SQC_MI300X_A1(binary_handler_analyze_rocprof_compute): + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", "tests/workloads/ipblocks_SQC/MI300X_A1"] + ) + assert code == 0 + + +def test_analyze_ipblocks_SQC_MI100(binary_handler_analyze_rocprof_compute): + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", "tests/workloads/ipblocks_SQC/MI100"] + ) + assert code == 0 + + +def test_analyze_ipblocks_SQC_MI300A_A1(binary_handler_analyze_rocprof_compute): + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", "tests/workloads/ipblocks_SQC/MI300A_A1"] + ) + assert code == 0 + + +def test_analyze_ipblocks_SQC_MI200(binary_handler_analyze_rocprof_compute): + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", "tests/workloads/ipblocks_SQC/MI200"] + ) + assert code == 0 + + +def test_analyze_mem_levels_HBM_LDS_MI200(binary_handler_analyze_rocprof_compute): + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", "tests/workloads/mem_levels_HBM_LDS/MI200"] + ) + assert code == 0 + + +def test_analyze_ipblocks_TCC_MI300X_A1(binary_handler_analyze_rocprof_compute): + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", "tests/workloads/ipblocks_TCC/MI300X_A1"] + ) + assert code == 0 + + +def test_analyze_ipblocks_TCC_MI100(binary_handler_analyze_rocprof_compute): + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", "tests/workloads/ipblocks_TCC/MI100"] + ) + assert code == 0 + + +def test_analyze_ipblocks_TCC_MI300A_A1(binary_handler_analyze_rocprof_compute): + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", "tests/workloads/ipblocks_TCC/MI300A_A1"] + ) + assert code == 0 + + +def test_analyze_ipblocks_TCC_MI200(binary_handler_analyze_rocprof_compute): + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", "tests/workloads/ipblocks_TCC/MI200"] + ) + assert code == 0 + + +def test_analyze_no_roof_MI300X_A1(binary_handler_analyze_rocprof_compute): + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", "tests/workloads/no_roof/MI300X_A1"] + ) + assert code == 0 + + +def test_analyze_no_roof_MI100(binary_handler_analyze_rocprof_compute): + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", "tests/workloads/no_roof/MI100"] + ) + assert code == 0 + + +def test_analyze_no_roof_MI300A_A1(binary_handler_analyze_rocprof_compute): + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", "tests/workloads/no_roof/MI300A_A1"] + ) + assert code == 0 + + +def test_analyze_no_roof_MI200(binary_handler_analyze_rocprof_compute): + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", "tests/workloads/no_roof/MI200"] + ) + assert code == 0 + + +def test_analyze_ipblocks_SQ_CPC_MI300X_A1(binary_handler_analyze_rocprof_compute): + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", "tests/workloads/ipblocks_SQ_CPC/MI300X_A1"] + ) + assert code == 0 + + +def test_analyze_ipblocks_SQ_CPC_MI100(binary_handler_analyze_rocprof_compute): + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", "tests/workloads/ipblocks_SQ_CPC/MI100"] + ) + assert code == 0 + + +def test_analyze_ipblocks_SQ_CPC_MI300A_A1(binary_handler_analyze_rocprof_compute): + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", "tests/workloads/ipblocks_SQ_CPC/MI300A_A1"] + ) + assert code == 0 + + +def test_analyze_ipblocks_SQ_CPC_MI200(binary_handler_analyze_rocprof_compute): + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", "tests/workloads/ipblocks_SQ_CPC/MI200"] + ) + assert code == 0 + + +def test_analyze_dispatch_0_MI300X_A1(binary_handler_analyze_rocprof_compute): + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", "tests/workloads/dispatch_0/MI300X_A1"] + ) + assert code == 0 + + +def test_analyze_dispatch_0_MI100(binary_handler_analyze_rocprof_compute): + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", "tests/workloads/dispatch_0/MI100"] + ) + assert code == 0 + + +def test_analyze_dispatch_0_MI300A_A1(binary_handler_analyze_rocprof_compute): + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", "tests/workloads/dispatch_0/MI300A_A1"] + ) + assert code == 0 + + +def test_analyze_dispatch_0_MI200(binary_handler_analyze_rocprof_compute): + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", "tests/workloads/dispatch_0/MI200"] + ) + assert code == 0 + + +def test_analyze_join_type_grid_MI300X_A1(binary_handler_analyze_rocprof_compute): + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", "tests/workloads/join_type_grid/MI300X_A1"] + ) + assert code == 0 + + +def test_analyze_join_type_grid_MI100(binary_handler_analyze_rocprof_compute): + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", "tests/workloads/join_type_grid/MI100"] + ) + assert code == 0 + + +def test_analyze_join_type_grid_MI300A_A1(binary_handler_analyze_rocprof_compute): + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", "tests/workloads/join_type_grid/MI300A_A1"] + ) + assert code == 0 + + +def test_analyze_join_type_grid_MI200(binary_handler_analyze_rocprof_compute): + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", "tests/workloads/join_type_grid/MI200"] + ) + assert code == 0 + + +def test_analyze_kernel_MI300X_A1(binary_handler_analyze_rocprof_compute): + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", "tests/workloads/kernel/MI300X_A1"] + ) + assert code == 0 + + +def test_analyze_kernel_MI100(binary_handler_analyze_rocprof_compute): + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", "tests/workloads/kernel/MI100"] + ) + assert code == 0 + + +def test_analyze_kernel_MI300A_A1(binary_handler_analyze_rocprof_compute): + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", "tests/workloads/kernel/MI300A_A1"] + ) + assert code == 0 + + +def test_analyze_kernel_MI200(binary_handler_analyze_rocprof_compute): + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", "tests/workloads/kernel/MI200"] + ) + assert code == 0 + + +def test_analyze_kernel_substr_MI300X_A1(binary_handler_analyze_rocprof_compute): + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", "tests/workloads/kernel_substr/MI300X_A1"] + ) + assert code == 0 + + +def test_analyze_kernel_substr_MI100(binary_handler_analyze_rocprof_compute): + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", "tests/workloads/kernel_substr/MI100"] + ) + assert code == 0 + + +def test_analyze_kernel_substr_MI300A_A1(binary_handler_analyze_rocprof_compute): + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", "tests/workloads/kernel_substr/MI300A_A1"] + ) + assert code == 0 + + +def test_analyze_kernel_substr_MI200(binary_handler_analyze_rocprof_compute): + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", "tests/workloads/kernel_substr/MI200"] + ) + assert code == 0 + + +def test_analyze_dispatch_7_MI300X_A1(binary_handler_analyze_rocprof_compute): + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", "tests/workloads/dispatch_7/MI300X_A1"] + ) + assert code == 0 + + +def test_analyze_dispatch_7_MI100(binary_handler_analyze_rocprof_compute): + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", "tests/workloads/dispatch_7/MI100"] + ) + assert code == 1 + + +def test_analyze_dispatch_7_MI300A_A1(binary_handler_analyze_rocprof_compute): + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", "tests/workloads/dispatch_7/MI300A_A1"] + ) + assert code == 0 + + +def test_analyze_dispatch_7_MI200(binary_handler_analyze_rocprof_compute): + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", "tests/workloads/dispatch_7/MI200"] + ) + assert code == 1 + + +def test_analyze_kernel_inv_int_MI300X_A1(binary_handler_analyze_rocprof_compute): + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", "tests/workloads/kernel_inv_int/MI300X_A1"] + ) + assert code == 0 + + +def test_analyze_kernel_inv_int_MI100(binary_handler_analyze_rocprof_compute): + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", "tests/workloads/kernel_inv_int/MI100"] + ) + assert code == 1 + + +def test_analyze_kernel_inv_int_MI300A_A1(binary_handler_analyze_rocprof_compute): + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", "tests/workloads/kernel_inv_int/MI300A_A1"] + ) + assert code == 0 + + +def test_analyze_kernel_inv_int_MI200(binary_handler_analyze_rocprof_compute): + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", "tests/workloads/kernel_inv_int/MI200"] + ) + assert code == 1 + + +def test_analyze_mem_levels_vL1D_MI200(binary_handler_analyze_rocprof_compute): + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", "tests/workloads/mem_levels_vL1D/MI200"] + ) + assert code == 0 + + +def test_analyze_sort_kernels_MI200(binary_handler_analyze_rocprof_compute): + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", "tests/workloads/sort_kernels/MI200"] + ) + assert code == 0 + + +def test_analyze_kernel_inv_str_MI300X_A1(binary_handler_analyze_rocprof_compute): + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", "tests/workloads/kernel_inv_str/MI300X_A1"] + ) + assert code == 0 + + +def test_analyze_kernel_inv_str_MI100(binary_handler_analyze_rocprof_compute): + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", "tests/workloads/kernel_inv_str/MI100"] + ) + assert code == 1 + + +def test_analyze_kernel_inv_str_MI300A_A1(binary_handler_analyze_rocprof_compute): + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", "tests/workloads/kernel_inv_str/MI300A_A1"] + ) + assert code == 0 + + +def test_analyze_kernel_inv_str_MI200(binary_handler_analyze_rocprof_compute): + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", "tests/workloads/kernel_inv_str/MI200"] + ) + assert code == 1 + + +def test_analyze_ipblocks_SQ_SPI_MI300X_A1(binary_handler_analyze_rocprof_compute): + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", "tests/workloads/ipblocks_SQ_SPI/MI300X_A1"] + ) + assert code == 0 + + +def test_analyze_ipblocks_SQ_SPI_MI100(binary_handler_analyze_rocprof_compute): + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", "tests/workloads/ipblocks_SQ_SPI/MI100"] + ) + assert code == 0 + + +def test_analyze_ipblocks_SQ_SPI_MI300A_A1(binary_handler_analyze_rocprof_compute): + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", "tests/workloads/ipblocks_SQ_SPI/MI300A_A1"] + ) + assert code == 0 + + +def test_analyze_ipblocks_SQ_SPI_MI200(binary_handler_analyze_rocprof_compute): + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", "tests/workloads/ipblocks_SQ_SPI/MI200"] + ) + assert code == 0 + + +def test_analyze_dispatch_2_MI300X_A1(binary_handler_analyze_rocprof_compute): + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", "tests/workloads/dispatch_2/MI300X_A1"] + ) + assert code == 0 + + +def test_analyze_dispatch_2_MI100(binary_handler_analyze_rocprof_compute): + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", "tests/workloads/dispatch_2/MI100"] + ) + assert code == 0 + + +def test_analyze_dispatch_2_MI300A_A1(binary_handler_analyze_rocprof_compute): + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", "tests/workloads/dispatch_2/MI300A_A1"] + ) + assert code == 0 + + +def test_analyze_dispatch_2_MI200(binary_handler_analyze_rocprof_compute): + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", "tests/workloads/dispatch_2/MI200"] + ) + assert code == 0 + + +def test_analyze_dispatch_0_1_MI300X_A1(binary_handler_analyze_rocprof_compute): + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", "tests/workloads/dispatch_0_1/MI300X_A1"] + ) + assert code == 0 + + +def test_analyze_dispatch_0_1_MI100(binary_handler_analyze_rocprof_compute): + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", "tests/workloads/dispatch_0_1/MI100"] + ) + assert code == 0 + + +def test_analyze_dispatch_0_1_MI300A_A1(binary_handler_analyze_rocprof_compute): + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", "tests/workloads/dispatch_0_1/MI300A_A1"] + ) + assert code == 0 + + +def test_analyze_dispatch_0_1_MI200(binary_handler_analyze_rocprof_compute): + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", "tests/workloads/dispatch_0_1/MI200"] + ) + assert code == 0 + + +def test_analyze_mem_levels_LDS_MI200(binary_handler_analyze_rocprof_compute): + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", "tests/workloads/mem_levels_LDS/MI200"] + ) + assert code == 0 + + +def test_analyze_ipblocks_TA_MI300X_A1(binary_handler_analyze_rocprof_compute): + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", "tests/workloads/ipblocks_TA/MI300X_A1"] + ) + assert code == 0 + + +def test_analyze_ipblocks_TA_MI100(binary_handler_analyze_rocprof_compute): + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", "tests/workloads/ipblocks_TA/MI100"] + ) + assert code == 0 + + +def test_analyze_ipblocks_TA_MI300A_A1(binary_handler_analyze_rocprof_compute): + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", "tests/workloads/ipblocks_TA/MI300A_A1"] + ) + assert code == 0 + + +def test_analyze_ipblocks_TA_MI200(binary_handler_analyze_rocprof_compute): + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", "tests/workloads/ipblocks_TA/MI200"] + ) + assert code == 0 + + +def test_analyze_dispatch_6_8_MI300X_A1(binary_handler_analyze_rocprof_compute): + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", "tests/workloads/dispatch_6_8/MI300X_A1"] + ) + assert code == 0 + + +def test_analyze_dispatch_6_8_MI100(binary_handler_analyze_rocprof_compute): + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", "tests/workloads/dispatch_6_8/MI100"] + ) + assert code == 1 + + +def test_analyze_dispatch_6_8_MI300A_A1(binary_handler_analyze_rocprof_compute): + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", "tests/workloads/dispatch_6_8/MI300A_A1"] + ) + assert code == 0 + + +def test_analyze_dispatch_6_8_MI200(binary_handler_analyze_rocprof_compute): + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", "tests/workloads/dispatch_6_8/MI200"] + ) + assert code == 1 + + +def test_analyze_device_inv_int_MI300X_A1(binary_handler_analyze_rocprof_compute): + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", "tests/workloads/device_inv_int/MI300X_A1"] + ) + assert code == 0 + + +def test_analyze_device_inv_int_MI100(binary_handler_analyze_rocprof_compute): + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", "tests/workloads/device_inv_int/MI100"] + ) + assert code == 0 + + +def test_analyze_device_inv_int_MI300A_A1(binary_handler_analyze_rocprof_compute): + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", "tests/workloads/device_inv_int/MI300A_A1"] + ) + assert code == 0 + + +def test_analyze_device_inv_int_MI200(binary_handler_analyze_rocprof_compute): + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", "tests/workloads/device_inv_int/MI200"] + ) + assert code == 0 + + +def test_analyze_ipblocks_SQ_TA_MI300X_A1(binary_handler_analyze_rocprof_compute): + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", "tests/workloads/ipblocks_SQ_TA/MI300X_A1"] + ) + assert code == 0 + + +def test_analyze_ipblocks_SQ_TA_MI100(binary_handler_analyze_rocprof_compute): + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", "tests/workloads/ipblocks_SQ_TA/MI100"] + ) + assert code == 0 + + +def test_analyze_ipblocks_SQ_TA_MI300A_A1(binary_handler_analyze_rocprof_compute): + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", "tests/workloads/ipblocks_SQ_TA/MI300A_A1"] + ) + assert code == 0 + + +def test_analyze_ipblocks_SQ_TA_MI200(binary_handler_analyze_rocprof_compute): + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", "tests/workloads/ipblocks_SQ_TA/MI200"] + ) + assert code == 0 + + +def test_analyze_ipblocks_TD_MI300X_A1(binary_handler_analyze_rocprof_compute): + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", "tests/workloads/ipblocks_TD/MI300X_A1"] + ) + assert code == 0 + + +def test_analyze_ipblocks_TD_MI100(binary_handler_analyze_rocprof_compute): + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", "tests/workloads/ipblocks_TD/MI100"] + ) + assert code == 0 + + +def test_analyze_ipblocks_TD_MI300A_A1(binary_handler_analyze_rocprof_compute): + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", "tests/workloads/ipblocks_TD/MI300A_A1"] + ) + assert code == 0 + + +def test_analyze_ipblocks_TD_MI200(binary_handler_analyze_rocprof_compute): + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", "tests/workloads/ipblocks_TD/MI200"] + ) + assert code == 0 + + +def test_analyze_device_filter_MI300X_A1(binary_handler_analyze_rocprof_compute): + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", "tests/workloads/device_filter/MI300X_A1"] + ) + assert code == 0 + + +def test_analyze_device_filter_MI100(binary_handler_analyze_rocprof_compute): + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", "tests/workloads/device_filter/MI100"] + ) + assert code == 0 + + +def test_analyze_device_filter_MI300A_A1(binary_handler_analyze_rocprof_compute): + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", "tests/workloads/device_filter/MI300A_A1"] + ) + assert code == 0 + + +def test_analyze_device_filter_MI200(binary_handler_analyze_rocprof_compute): + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", "tests/workloads/device_filter/MI200"] + ) + assert code == 0 + + +def test_analyze_join_type_kernel_MI300X_A1(binary_handler_analyze_rocprof_compute): + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", "tests/workloads/join_type_kernel/MI300X_A1"] + ) + assert code == 0 + + +def test_analyze_join_type_kernel_MI100(binary_handler_analyze_rocprof_compute): + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", "tests/workloads/join_type_kernel/MI100"] + ) + assert code == 0 + + +def test_analyze_join_type_kernel_MI300A_A1(binary_handler_analyze_rocprof_compute): + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", "tests/workloads/join_type_kernel/MI300A_A1"] + ) + assert code == 0 + + +def test_analyze_join_type_kernel_MI200(binary_handler_analyze_rocprof_compute): + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", "tests/workloads/join_type_kernel/MI200"] + ) + assert code == 0 + + +def test_analyze_ipblocks_SQ_SQC_TCP_CPC_MI300X_A1( + binary_handler_analyze_rocprof_compute, +): + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", "tests/workloads/ipblocks_SQ_SQC_TCP_CPC/MI300X_A1"] + ) + assert code == 0 + + +def test_analyze_ipblocks_SQ_SQC_TCP_CPC_MI100(binary_handler_analyze_rocprof_compute): + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", "tests/workloads/ipblocks_SQ_SQC_TCP_CPC/MI100"] + ) + assert code == 0 + + +def test_analyze_ipblocks_SQ_SQC_TCP_CPC_MI300A_A1( + binary_handler_analyze_rocprof_compute, +): + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", "tests/workloads/ipblocks_SQ_SQC_TCP_CPC/MI300A_A1"] + ) + assert code == 0 + + +def test_analyze_ipblocks_SQ_SQC_TCP_CPC_MI200(binary_handler_analyze_rocprof_compute): + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", "tests/workloads/ipblocks_SQ_SQC_TCP_CPC/MI200"] + ) + assert code == 0 + + +def test_analyze_mem_levels_L2_vL1d_LDS_MI200(binary_handler_analyze_rocprof_compute): + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", "tests/workloads/mem_levels_L2_vL1d_LDS/MI200"] + ) + assert code == 0 + + +def test_analyze_ipblocks_CPF_MI300X_A1(binary_handler_analyze_rocprof_compute): + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", "tests/workloads/ipblocks_CPF/MI300X_A1"] + ) + assert code == 0 + + +def test_analyze_ipblocks_CPF_MI100(binary_handler_analyze_rocprof_compute): + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", "tests/workloads/ipblocks_CPF/MI100"] + ) + assert code == 0 + + +def test_analyze_ipblocks_CPF_MI300A_A1(binary_handler_analyze_rocprof_compute): + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", "tests/workloads/ipblocks_CPF/MI300A_A1"] + ) + assert code == 0 + + +def test_analyze_ipblocks_CPF_MI200(binary_handler_analyze_rocprof_compute): + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", "tests/workloads/ipblocks_CPF/MI200"] + ) + assert code == 0 + + +def test_analyze_sort_dispatches_MI200(binary_handler_analyze_rocprof_compute): + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", "tests/workloads/sort_dispatches/MI200"] + ) + assert code == 0 + + +def test_analyze_kernel_names_MI200(binary_handler_analyze_rocprof_compute): + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", "tests/workloads/kernel_names/MI200"] + ) + assert code == 0 + + +def test_analyze_mem_levels_vL1d_LDS_MI200(binary_handler_analyze_rocprof_compute): + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", "tests/workloads/mem_levels_vL1d_LDS/MI200"] + ) + assert code == 0 + + +def test_analyze_ipblocks_SQ_MI300X_A1(binary_handler_analyze_rocprof_compute): + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", "tests/workloads/ipblocks_SQ/MI300X_A1"] + ) + assert code == 0 + + +def test_analyze_ipblocks_SQ_MI100(binary_handler_analyze_rocprof_compute): + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", "tests/workloads/ipblocks_SQ/MI100"] + ) + assert code == 0 + + +def test_analyze_ipblocks_SQ_MI300A_A1(binary_handler_analyze_rocprof_compute): + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", "tests/workloads/ipblocks_SQ/MI300A_A1"] + ) + assert code == 0 + + +def test_analyze_ipblocks_SQ_MI200(binary_handler_analyze_rocprof_compute): + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", "tests/workloads/ipblocks_SQ/MI200"] + ) + assert code == 0 + + +def test_analyze_mem_levels_L2_MI200(binary_handler_analyze_rocprof_compute): + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", "tests/workloads/mem_levels_L2/MI200"] + ) + assert code == 0 + + +def test_analyze_dispatch_inv_MI300X_A1(binary_handler_analyze_rocprof_compute): + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", "tests/workloads/dispatch_inv/MI300X_A1"] + ) + assert code == 0 + + +def test_analyze_dispatch_inv_MI100(binary_handler_analyze_rocprof_compute): + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", "tests/workloads/dispatch_inv/MI100"] + ) + assert code == 0 + + +def test_analyze_dispatch_inv_MI300A_A1(binary_handler_analyze_rocprof_compute): + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", "tests/workloads/dispatch_inv/MI300A_A1"] + ) + assert code == 0 + + +def test_analyze_dispatch_inv_MI200(binary_handler_analyze_rocprof_compute): + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", "tests/workloads/dispatch_inv/MI200"] + ) + assert code == 0 + + +def test_analyze_path_MI300X_A1(binary_handler_analyze_rocprof_compute): + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", "tests/workloads/path/MI300X_A1"] + ) + assert code == 0 + + +def test_analyze_path_MI100(binary_handler_analyze_rocprof_compute): + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", "tests/workloads/path/MI100"] + ) + assert code == 0 + + +def test_analyze_path_MI300A_A1(binary_handler_analyze_rocprof_compute): + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", "tests/workloads/path/MI300A_A1"] + ) + assert code == 0 + + +def test_analyze_path_MI200(binary_handler_analyze_rocprof_compute): + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", "tests/workloads/path/MI200"] + ) + assert code == 0 + + +def test_analyze_ipblocks_CPC_MI300X_A1(binary_handler_analyze_rocprof_compute): + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", "tests/workloads/ipblocks_CPC/MI300X_A1"] + ) + assert code == 0 + + +def test_analyze_ipblocks_CPC_MI100(binary_handler_analyze_rocprof_compute): + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", "tests/workloads/ipblocks_CPC/MI100"] + ) + assert code == 0 + + +def test_analyze_ipblocks_CPC_MI300A_A1(binary_handler_analyze_rocprof_compute): + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", "tests/workloads/ipblocks_CPC/MI300A_A1"] + ) + assert code == 0 + + +def test_analyze_ipblocks_CPC_MI200(binary_handler_analyze_rocprof_compute): + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", "tests/workloads/ipblocks_CPC/MI200"] + ) + assert code == 0 + + +def test_analyze_ipblocks_SQ_SPI_TA_TCC_CPF_MI300X_A1( + binary_handler_analyze_rocprof_compute, +): + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", "tests/workloads/ipblocks_SQ_SPI_TA_TCC_CPF/MI300X_A1"] + ) + assert code == 0 + + +def test_analyze_ipblocks_SQ_SPI_TA_TCC_CPF_MI100(binary_handler_analyze_rocprof_compute): + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", "tests/workloads/ipblocks_SQ_SPI_TA_TCC_CPF/MI100"] + ) + assert code == 0 + + +def test_analyze_ipblocks_SQ_SPI_TA_TCC_CPF_MI300A_A1( + binary_handler_analyze_rocprof_compute, +): + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", "tests/workloads/ipblocks_SQ_SPI_TA_TCC_CPF/MI300A_A1"] + ) + assert code == 0 + + +def test_analyze_ipblocks_SQ_SPI_TA_TCC_CPF_MI200(binary_handler_analyze_rocprof_compute): + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", "tests/workloads/ipblocks_SQ_SPI_TA_TCC_CPF/MI200"] + ) + assert code == 0 + + +def test_analyze_mem_levels_HBM_MI200(binary_handler_analyze_rocprof_compute): + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", "tests/workloads/mem_levels_HBM/MI200"] + ) + assert code == 0 + + +def test_analyze_ipblocks_SPI_MI300X_A1(binary_handler_analyze_rocprof_compute): + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", "tests/workloads/ipblocks_SPI/MI300X_A1"] + ) + assert code == 0 + + +def test_analyze_ipblocks_SPI_MI100(binary_handler_analyze_rocprof_compute): + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", "tests/workloads/ipblocks_SPI/MI100"] + ) + assert code == 0 + + +def test_analyze_ipblocks_SPI_MI300A_A1(binary_handler_analyze_rocprof_compute): + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", "tests/workloads/ipblocks_SPI/MI300A_A1"] + ) + assert code == 0 + + +def test_analyze_ipblocks_SPI_MI200(binary_handler_analyze_rocprof_compute): + code = binary_handler_analyze_rocprof_compute( + ["analyze", "--path", "tests/workloads/ipblocks_SPI/MI200"] + ) + assert code == 0 diff --git a/projects/rocprofiler-compute/tests/test_profile_general.py b/projects/rocprofiler-compute/tests/test_profile_general.py index fe2f5ef6f1..04eeeeddc3 100644 --- a/projects/rocprofiler-compute/tests/test_profile_general.py +++ b/projects/rocprofiler-compute/tests/test_profile_general.py @@ -11,6 +11,7 @@ from unittest.mock import patch import pandas as pd import pytest import test_utils +from test_utils import binary_handler_profile_rocprof_compute # Globals @@ -35,9 +36,6 @@ MI300_CHIP_IDS = { # -- config = {} -config["rocprofiler-compute"] = SourceFileLoader( - "rocprofiler-compute", "src/rocprof-compute" -).load_module() config["kernel_name_1"] = "vecCopy" config["app_1"] = ["./tests/vcopy", "-n", "1048576", "-b", "256", "-i", "3"] config["cleanup"] = True @@ -45,13 +43,8 @@ config["COUNTER_LOGGING"] = False config["METRIC_COMPARE"] = False config["METRIC_LOGGING"] = False -# default option is no roof to reduce test run time -baseline_opts = ["rocprof-compute", "profile", "--no-roof", "-n", "app_1", "-VVV"] -baseline_with_roof_opts = ["rocprof-compute", "profile", "-n", "app_1", "-VVV"] - num_kernels = 3 num_devices = 1 -dispatch_id = 0 DEFAULT_ABS_DIFF = 15 DEFAULT_REL_DIFF = 50 @@ -497,10 +490,9 @@ def validate(test_name, workload_dir, file_dict, args=[]): @pytest.mark.misc -def test_path(): - options = baseline_opts +def test_path(binary_handler_profile_rocprof_compute): workload_dir = test_utils.get_output_dir() - test_utils.launch_rocprof_compute(config, options, workload_dir) + binary_handler_profile_rocprof_compute(config, workload_dir) file_dict = test_utils.check_csv_files(workload_dir, num_devices, num_kernels) @@ -520,22 +512,22 @@ def test_path(): @pytest.mark.misc -def test_kernel_names(): - options = baseline_with_roof_opts + ["--roof-only", "--kernel-names"] +def test_kernel_names(binary_handler_profile_rocprof_compute): + options = ["--device", "0", "--roof-only", "--kernel-names"] workload_dir = test_utils.get_output_dir() - e = test_utils.launch_rocprof_compute( - config, options, workload_dir, check_success=False + returncode = binary_handler_profile_rocprof_compute( + config, workload_dir, options, check_success=False, roof=True ) if soc == "MI100": # assert that it did not run - assert e.value.code >= 1 + assert returncode >= 1 # Do not continue testing return # assert successful run - assert e.value.code == 0 + assert returncode == 0 - file_dict = test_utils.check_csv_files(workload_dir, num_devices, num_kernels) + file_dict = test_utils.check_csv_files(workload_dir, 1, num_kernels) if soc == "MI200" or "MI300" in soc: assert sorted(list(file_dict.keys())) == sorted( ROOF_ONLY_FILES + ["kernelName_legend.pdf"] @@ -553,14 +545,10 @@ def test_kernel_names(): @pytest.mark.misc -def test_device_filter(): - device_id = "0" - # if "HIP_VISIBLE_DEVICES" in os.environ: - # device_id = os.environ["HIP_VISIBLE_DEVICES"] - - options = baseline_opts + ["--device", device_id] +def test_device_filter(binary_handler_profile_rocprof_compute): + options = ["--device", "0"] workload_dir = test_utils.get_output_dir() - test_utils.launch_rocprof_compute(config, options, workload_dir) + binary_handler_profile_rocprof_compute(config, workload_dir, options) file_dict = test_utils.check_csv_files(workload_dir, 1, num_kernels) if soc == "MI100": @@ -585,10 +573,10 @@ def test_device_filter(): @pytest.mark.kernel_execution -def test_kernel(): - options = baseline_opts + ["--kernel", config["kernel_name_1"]] +def test_kernel(binary_handler_profile_rocprof_compute): + options = ["--kernel", config["kernel_name_1"]] workload_dir = test_utils.get_output_dir() - test_utils.launch_rocprof_compute(config, options, workload_dir) + binary_handler_profile_rocprof_compute(config, workload_dir, options) file_dict = test_utils.check_csv_files(workload_dir, num_devices, num_kernels) if soc == "MI100": @@ -611,10 +599,10 @@ def test_kernel(): @pytest.mark.block -def test_block_SQ(): - options = baseline_opts + ["--block", "SQ"] +def test_block_SQ(binary_handler_profile_rocprof_compute): + options = ["--block", "SQ"] workload_dir = test_utils.get_output_dir() - test_utils.launch_rocprof_compute(config, options, workload_dir) + binary_handler_profile_rocprof_compute(config, workload_dir, options) file_dict = test_utils.check_csv_files(workload_dir, num_devices, num_kernels) expected_csvs = [ @@ -666,10 +654,10 @@ def test_block_SQ(): @pytest.mark.block -def test_block_SQC(): - options = baseline_opts + ["--block", "SQC"] +def test_block_SQC(binary_handler_profile_rocprof_compute): + options = ["--block", "SQC"] workload_dir = test_utils.get_output_dir() - test_utils.launch_rocprof_compute(config, options, workload_dir) + binary_handler_profile_rocprof_compute(config, workload_dir, options) file_dict = test_utils.check_csv_files(workload_dir, num_devices, num_kernels) expected_csvs = [ @@ -694,10 +682,10 @@ def test_block_SQC(): @pytest.mark.block -def test_block_TA(): - options = baseline_opts + ["--block", "TA"] +def test_block_TA(binary_handler_profile_rocprof_compute): + options = ["--block", "TA"] workload_dir = test_utils.get_output_dir() - test_utils.launch_rocprof_compute(config, options, workload_dir) + binary_handler_profile_rocprof_compute(config, workload_dir, options) file_dict = test_utils.check_csv_files(workload_dir, num_devices, num_kernels) expected_csvs = [ @@ -726,10 +714,10 @@ def test_block_TA(): @pytest.mark.block -def test_block_TD(): - options = baseline_opts + ["--block", "TD"] +def test_block_TD(binary_handler_profile_rocprof_compute): + options = ["--block", "TD"] workload_dir = test_utils.get_output_dir() - test_utils.launch_rocprof_compute(config, options, workload_dir) + binary_handler_profile_rocprof_compute(config, workload_dir, options) file_dict = test_utils.check_csv_files(workload_dir, num_devices, num_kernels) expected_csvs = [ @@ -763,10 +751,10 @@ def test_block_TD(): @pytest.mark.block -def test_block_TCP(): - options = baseline_opts + ["--block", "TCP"] +def test_block_TCP(binary_handler_profile_rocprof_compute): + options = ["--block", "TCP"] workload_dir = test_utils.get_output_dir() - test_utils.launch_rocprof_compute(config, options, workload_dir) + binary_handler_profile_rocprof_compute(config, workload_dir, options) file_dict = test_utils.check_csv_files(workload_dir, num_devices, num_kernels) expected_csvs = [ @@ -797,10 +785,10 @@ def test_block_TCP(): @pytest.mark.block -def test_block_TCC(): - options = baseline_opts + ["--block", "TCC"] +def test_block_TCC(binary_handler_profile_rocprof_compute): + options = ["--block", "TCC"] workload_dir = test_utils.get_output_dir() - test_utils.launch_rocprof_compute(config, options, workload_dir) + binary_handler_profile_rocprof_compute(config, workload_dir, options) file_dict = test_utils.check_csv_files(workload_dir, num_devices, num_kernels) expected_csvs = [ @@ -847,10 +835,10 @@ def test_block_TCC(): @pytest.mark.block -def test_block_SPI(): - options = baseline_opts + ["--block", "SPI"] +def test_block_SPI(binary_handler_profile_rocprof_compute): + options = ["--block", "SPI"] workload_dir = test_utils.get_output_dir() - test_utils.launch_rocprof_compute(config, options, workload_dir) + binary_handler_profile_rocprof_compute(config, workload_dir, options) file_dict = test_utils.check_csv_files(workload_dir, num_devices, num_kernels) expected_csvs = [ @@ -880,10 +868,10 @@ def test_block_SPI(): @pytest.mark.block -def test_block_CPC(): - options = baseline_opts + ["--block", "CPC"] +def test_block_CPC(binary_handler_profile_rocprof_compute): + options = ["--block", "CPC"] workload_dir = test_utils.get_output_dir() - test_utils.launch_rocprof_compute(config, options, workload_dir) + binary_handler_profile_rocprof_compute(config, workload_dir, options) file_dict = test_utils.check_csv_files(workload_dir, num_devices, num_kernels) expected_csvs = [ @@ -906,10 +894,10 @@ def test_block_CPC(): @pytest.mark.block -def test_block_CPF(): - options = baseline_opts + ["--block", "CPF"] +def test_block_CPF(binary_handler_profile_rocprof_compute): + options = ["--block", "CPF"] workload_dir = test_utils.get_output_dir() - test_utils.launch_rocprof_compute(config, options, workload_dir) + binary_handler_profile_rocprof_compute(config, workload_dir, options) file_dict = test_utils.check_csv_files(workload_dir, num_devices, num_kernels) expected_csvs = [ @@ -933,10 +921,10 @@ def test_block_CPF(): @pytest.mark.block -def test_block_SQ_CPC(): - options = baseline_opts + ["--block", "SQ", "CPC"] +def test_block_SQ_CPC(binary_handler_profile_rocprof_compute): + options = ["--block", "SQ", "CPC"] workload_dir = test_utils.get_output_dir() - test_utils.launch_rocprof_compute(config, options, workload_dir) + binary_handler_profile_rocprof_compute(config, workload_dir, options) file_dict = test_utils.check_csv_files(workload_dir, num_devices, num_kernels) expected_csvs = [ @@ -988,10 +976,10 @@ def test_block_SQ_CPC(): @pytest.mark.block -def test_block_SQ_TA(): - options = baseline_opts + ["--block", "SQ", "TA"] +def test_block_SQ_TA(binary_handler_profile_rocprof_compute): + options = ["--block", "SQ", "TA"] workload_dir = test_utils.get_output_dir() - test_utils.launch_rocprof_compute(config, options, workload_dir) + binary_handler_profile_rocprof_compute(config, workload_dir, options) file_dict = test_utils.check_csv_files(workload_dir, num_devices, num_kernels) expected_csvs = [ @@ -1039,10 +1027,10 @@ def test_block_SQ_TA(): @pytest.mark.block -def test_block_SQ_SPI(): - options = baseline_opts + ["--block", "SQ", "SPI"] +def test_block_SQ_SPI(binary_handler_profile_rocprof_compute): + options = ["--block", "SQ", "SPI"] workload_dir = test_utils.get_output_dir() - test_utils.launch_rocprof_compute(config, options, workload_dir) + binary_handler_profile_rocprof_compute(config, workload_dir, options) file_dict = test_utils.check_csv_files(workload_dir, num_devices, num_kernels) expected_csvs = [ @@ -1093,10 +1081,10 @@ def test_block_SQ_SPI(): @pytest.mark.block -def test_block_SQ_SQC_TCP_CPC(): - options = baseline_opts + ["--block", "SQ", "SQC", "TCP", "CPC"] +def test_block_SQ_SQC_TCP_CPC(binary_handler_profile_rocprof_compute): + options = ["--block", "SQ", "SQC", "TCP", "CPC"] workload_dir = test_utils.get_output_dir() - test_utils.launch_rocprof_compute(config, options, workload_dir) + binary_handler_profile_rocprof_compute(config, workload_dir, options) file_dict = test_utils.check_csv_files(workload_dir, num_devices, num_kernels) expected_csvs = [ @@ -1144,10 +1132,10 @@ def test_block_SQ_SQC_TCP_CPC(): @pytest.mark.block -def test_block_SQ_SPI_TA_TCC_CPF(): - options = baseline_opts + ["--block", "SQ", "SPI", "TA", "TCC", "CPF"] +def test_block_SQ_SPI_TA_TCC_CPF(binary_handler_profile_rocprof_compute): + options = ["--block", "SQ", "SPI", "TA", "TCC", "CPF"] workload_dir = test_utils.get_output_dir() - test_utils.launch_rocprof_compute(config, options, workload_dir) + binary_handler_profile_rocprof_compute(config, workload_dir, options) file_dict = test_utils.check_csv_files(workload_dir, num_devices, num_kernels) expected_csvs = [ @@ -1199,10 +1187,10 @@ def test_block_SQ_SPI_TA_TCC_CPF(): @pytest.mark.dispatch -def test_dispatch_0(): - options = baseline_opts + ["--dispatch", "0"] +def test_dispatch_0(binary_handler_profile_rocprof_compute): + options = ["--dispatch", "0"] workload_dir = test_utils.get_output_dir() - test_utils.launch_rocprof_compute(config, options, workload_dir) + binary_handler_profile_rocprof_compute(config, workload_dir, options) file_dict = test_utils.check_csv_files(workload_dir, num_devices, 1) if soc == "MI100": @@ -1229,10 +1217,10 @@ def test_dispatch_0(): @pytest.mark.dispatch -def test_dispatch_0_1(): - options = baseline_opts + ["--dispatch", "0:2"] +def test_dispatch_0_1(binary_handler_profile_rocprof_compute): + options = ["--dispatch", "0:2"] workload_dir = test_utils.get_output_dir() - test_utils.launch_rocprof_compute(config, options, workload_dir) + binary_handler_profile_rocprof_compute(config, workload_dir, options) file_dict = test_utils.check_csv_files(workload_dir, num_devices, 2) if soc == "MI100": @@ -1256,10 +1244,10 @@ def test_dispatch_0_1(): @pytest.mark.dispatch -def test_dispatch_2(): - options = baseline_opts + ["--dispatch", dispatch_id] +def test_dispatch_2(binary_handler_profile_rocprof_compute): + options = ["--dispatch", "0"] workload_dir = test_utils.get_output_dir() - test_utils.launch_rocprof_compute(config, options, workload_dir) + binary_handler_profile_rocprof_compute(config, workload_dir, options) file_dict = test_utils.check_csv_files(workload_dir, num_devices, 1) if soc == "MI100": @@ -1278,7 +1266,7 @@ def test_dispatch_2(): file_dict, [ "--dispatch", - str(dispatch_id), + "0", ], ) @@ -1286,10 +1274,10 @@ def test_dispatch_2(): @pytest.mark.join -def test_join_type_grid(): - options = baseline_opts + ["--join-type", "grid"] +def test_join_type_grid(binary_handler_profile_rocprof_compute): + options = ["--join-type", "grid"] workload_dir = test_utils.get_output_dir() - test_utils.launch_rocprof_compute(config, options, workload_dir) + binary_handler_profile_rocprof_compute(config, workload_dir, options) file_dict = test_utils.check_csv_files(workload_dir, num_devices, num_kernels) if soc == "MI100": @@ -1312,10 +1300,10 @@ def test_join_type_grid(): @pytest.mark.join -def test_join_type_kernel(): - options = baseline_opts + ["--join-type", "kernel"] +def test_join_type_kernel(binary_handler_profile_rocprof_compute): + options = ["--join-type", "kernel"] workload_dir = test_utils.get_output_dir() - test_utils.launch_rocprof_compute(config, options, workload_dir) + binary_handler_profile_rocprof_compute(config, workload_dir, options) file_dict = test_utils.check_csv_files(workload_dir, num_devices, num_kernels) @@ -1339,27 +1327,22 @@ def test_join_type_kernel(): @pytest.mark.sort -def test_sort_dispatches(): +def test_sort_dispatches(binary_handler_profile_rocprof_compute): # only test 1 device for roofline - device_id = "0" - options = ( - baseline_with_roof_opts - + ["--device", device_id] - + ["--roof-only", "--sort", "dispatches"] - ) + options = ["--device", "0", "--roof-only", "--sort", "dispatches"] workload_dir = test_utils.get_output_dir() - e = test_utils.launch_rocprof_compute( - config, options, workload_dir, check_success=False + returncode = binary_handler_profile_rocprof_compute( + config, workload_dir, options, check_success=False, roof=True ) if soc == "MI100": # assert that it did not run - assert e.value.code >= 1 + assert returncode >= 1 # Do not continue testing return # assert successful run - assert e.value.code == 0 + assert returncode == 0 file_dict = test_utils.check_csv_files(workload_dir, 1, num_kernels) @@ -1378,27 +1361,22 @@ def test_sort_dispatches(): @pytest.mark.sort -def test_sort_kernels(): +def test_sort_kernels(binary_handler_profile_rocprof_compute): # only test 1 device for roofline - device_id = "0" - options = ( - baseline_with_roof_opts - + ["--device", device_id] - + ["--roof-only", "--sort", "kernels"] - ) + options = ["--device", "0", "--roof-only", "--sort", "kernels"] workload_dir = test_utils.get_output_dir() - e = test_utils.launch_rocprof_compute( - config, options, workload_dir, check_success=False + returncode = binary_handler_profile_rocprof_compute( + config, workload_dir, options, check_success=False, roof=True ) if soc == "MI100": # assert that it did not run - assert e.value.code >= 1 + assert returncode >= 1 # Do not continue testing return # assert successful run - assert e.value.code == 0 + assert returncode == 0 file_dict = test_utils.check_csv_files(workload_dir, 1, num_kernels) if soc == "MI200" or "MI300" in soc: @@ -1416,27 +1394,22 @@ def test_sort_kernels(): @pytest.mark.mem -def test_mem_levels_vL1D(): +def test_mem_levels_vL1D(binary_handler_profile_rocprof_compute): # only test 1 device for roofline - device_id = "0" - options = ( - baseline_with_roof_opts - + ["--device", device_id] - + ["--roof-only", "--mem-level", "vL1D"] - ) + options = ["--device", "0", "--roof-only", "--mem-level", "vL1D"] workload_dir = test_utils.get_output_dir() - e = test_utils.launch_rocprof_compute( - config, options, workload_dir, check_success=False + returncode = binary_handler_profile_rocprof_compute( + config, workload_dir, options, check_success=False, roof=True ) if soc == "MI100": # assert that it did not run - assert e.value.code >= 1 + assert returncode >= 1 # Do not continue testing return # assert successful run - assert e.value.code == 0 + assert returncode == 0 file_dict = test_utils.check_csv_files(workload_dir, 1, num_kernels) if soc == "MI200" or "MI300" in soc: @@ -1454,27 +1427,22 @@ def test_mem_levels_vL1D(): @pytest.mark.mem -def test_mem_levels_LDS(): +def test_mem_levels_LDS(binary_handler_profile_rocprof_compute): # only test 1 device for roofline - device_id = "0" - options = ( - baseline_with_roof_opts - + ["--device", device_id] - + ["--roof-only", "--mem-level", "LDS"] - ) + options = ["--device", "0", "--roof-only", "--mem-level", "LDS"] workload_dir = test_utils.get_output_dir() - e = test_utils.launch_rocprof_compute( - config, options, workload_dir, check_success=False + returncode = binary_handler_profile_rocprof_compute( + config, workload_dir, options, check_success=False, roof=True ) if soc == "MI100": # assert that it did not run - assert e.value.code >= 1 + assert returncode >= 1 # Do not continue testing return # assert successful run - assert e.value.code == 0 + assert returncode == 0 file_dict = test_utils.check_csv_files(workload_dir, 1, num_kernels) if soc == "MI200" or "MI300" in soc: diff --git a/projects/rocprofiler-compute/tests/test_utils.py b/projects/rocprofiler-compute/tests/test_utils.py index f2beaf7e8a..e1a3c2c7e8 100644 --- a/projects/rocprofiler-compute/tests/test_utils.py +++ b/projects/rocprofiler-compute/tests/test_utils.py @@ -26,12 +26,16 @@ import inspect import os import shutil +import subprocess +from importlib.machinery import SourceFileLoader from pathlib import Path from unittest.mock import patch import pandas as pd import pytest +rocprof_compute = SourceFileLoader("rocprof-compute", "src/rocprof-compute").load_module() + def check_resource_allocation(): """Check if CTEST resource allocation is enabled for parallel testing and set @@ -128,26 +132,67 @@ def check_csv_files(output_dir, num_devices, num_kernels): return file_dict -def launch_rocprof_compute(config, options, workload_dir, check_success=True): - """Launch ROCm Compute Profiler with command-line optoins +@pytest.fixture +def binary_handler_profile_rocprof_compute(request): + def _handler(config, workload_dir, options=[], check_success=True, roof=False): + if request.config.getoption("--call-binary"): + baseline_opts = [ + "build/rocprof-compute.bin", + "profile", + "-n", + "app_1", + "-VVV", + ] + if not roof: + baseline_opts.append("--no-roof") + process = subprocess.run( + baseline_opts + + options + + ["--path", workload_dir, "--"] + + config["app_1"], + text=True, + ) + # verify run status + if check_success: + assert process.returncode == 0 + return process.returncode + else: + baseline_opts = ["rocprof-compute", "profile", "-n", "app_1", "-VVV"] + if not roof: + baseline_opts.append("--no-roof") + with pytest.raises(SystemExit) as e: + with patch( + "sys.argv", + baseline_opts + + options + + ["--path", workload_dir, "--"] + + config["app_1"], + ): + rocprof_compute.main() + # verify run status + if check_success: + assert e.value.code == 0 + return e.value.code - Args: - config (list): runtime configuration settings - options (list): command line options to provide to rocprofiler-compute - workload_dir (string): desired output directory - check_success (bool, optional): Whether to verify successful exit condition. Defaults to True. + return _handler - Returns: - exception: SystemExit exception - """ - with pytest.raises(SystemExit) as e: - with patch( - "sys.argv", options + ["--path", workload_dir, "--"] + config["app_1"] - ): - config["rocprofiler-compute"].main() - # verify run status - if check_success: - assert e.value.code == 0 +@pytest.fixture +def binary_handler_analyze_rocprof_compute(request): + def _handler(arguments): + if request.config.getoption("--call-binary"): + process = subprocess.run( + ["build/rocprof-compute.bin", *arguments], + text=True, + ) + return process.returncode + else: + with pytest.raises(SystemExit) as e: + with patch( + "sys.argv", + ["rocprof-compute", *arguments], + ): + rocprof_compute.main() + return e.value.code - return e + return _handler diff --git a/projects/rocprofiler-compute/utils/docker_env/docker-compose.yml b/projects/rocprofiler-compute/utils/docker_env/docker-compose.yml deleted file mode 100644 index c040632e71..0000000000 --- a/projects/rocprofiler-compute/utils/docker_env/docker-compose.yml +++ /dev/null @@ -1,10 +0,0 @@ -services: - app: - build: - context: ../../ - dockerfile: utils/docker_env/Dockerfile - devices: - - /dev/kfd - - /dev/dri - security_opt: - - seccomp:unconfined \ No newline at end of file