diff --git a/.github/workflows/aqlprofile-continuous_integration.yml b/.github/workflows/aqlprofile-continuous_integration.yml index 8af44fe938..bb9aea6ced 100644 --- a/.github/workflows/aqlprofile-continuous_integration.yml +++ b/.github/workflows/aqlprofile-continuous_integration.yml @@ -10,12 +10,14 @@ on: - '!projects/aqlprofile/*.md' - '!projects/aqlprofile/CODEOWNERS' - '!projects/aqlprofile/source/docs/**' + - '.github/workflows/aqlprofile-continuous_integration.yml' pull_request: paths: - 'projects/aqlprofile/**' - '!projects/aqlprofile/*.md' - '!projects/aqlprofile/CODEOWNERS' - '!projects/aqlprofile/source/docs/**' + - '.github/workflows/aqlprofile-continuous_integration.yml' concurrency: group: ${{ github.workflow }}-${{ github.ref }} @@ -106,7 +108,7 @@ jobs: fail-fast: false matrix: runner: ['mi300'] - os: ['rhel-8', 'sles-15'] + os: ['rhel-9', 'sles-15'] build-type: ['RelWithDebInfo'] ci-flags: ['--linter clang-tidy'] diff --git a/.github/workflows/rocprofiler-sdk-continuous_integration.yml b/.github/workflows/rocprofiler-sdk-continuous_integration.yml index ee6329625f..334a4c813e 100644 --- a/.github/workflows/rocprofiler-sdk-continuous_integration.yml +++ b/.github/workflows/rocprofiler-sdk-continuous_integration.yml @@ -202,7 +202,7 @@ jobs: fail-fast: false matrix: runner: ['mi300'] - os: ['rhel-8', 'sles-15'] + os: ['rhel-9', 'sles-15'] build-type: ['RelWithDebInfo'] ci-flags: [''] @@ -225,11 +225,10 @@ jobs: working-directory: projects/rocprofiler-sdk run: | git config --global --add safe.directory '*' - if [ "${OS_TYPE}" == "rhel-8" ]; then + if [ "${OS_TYPE}" == "rhel-9" ]; then dnf makecache dnf groupinstall -y "Development Tools" - dnf remove -y gcc-c++ - dnf install -y gcc-toolset-11-gcc-c++ llvm14-devel + dnf install -y llvm14-devel fi python3 -m pip install --upgrade pip python3 -m pip install -U --user -r requirements.txt @@ -258,7 +257,6 @@ jobs: shell: bash working-directory: projects/rocprofiler-sdk run: - if [ "${OS_TYPE}" == "rhel-8" ]; then source scl_source enable gcc-toolset-11; fi; /usr/bin/python3 ./source/scripts/run-ci.py -B build --name ${{ github.repository }}-${{ github.ref_name }}-${{ matrix.os }}-${{ matrix.runner }}-core --build-jobs 16 diff --git a/projects/rocprofiler-sdk/source/lib/python/rocpd/summary.py b/projects/rocprofiler-sdk/source/lib/python/rocpd/summary.py index e9295cb638..816b50b263 100644 --- a/projects/rocprofiler-sdk/source/lib/python/rocpd/summary.py +++ b/projects/rocprofiler-sdk/source/lib/python/rocpd/summary.py @@ -25,6 +25,7 @@ import argparse import os +import math from typing import Any, List, Tuple from .importer import RocpdImportData, execute_statement @@ -32,6 +33,28 @@ from .query import export_sqlite_query from . import output_config +def check_function_availability(connection, function_name): + """ + Checks if a given function exists in the SQLite database. + + Args: + connection (sqlite3 db connection): The SQLite database connection handler. + function_name (str): The name of the function to check. + + Returns: + bool: True if the function exists, False otherwise. + """ + cursor = connection.cursor() + + # Query pragma_function_list to check for the function + cursor.execute( + "SELECT EXISTS(SELECT 1 FROM pragma_function_list WHERE name=?)", (function_name,) + ) + result = cursor.fetchone()[0] + + return bool(result) + + def get_temp_view_names(connection: RocpdImportData) -> List[str]: """Return the names of all temporary views in the SQLite connection.""" return [ @@ -374,6 +397,17 @@ def generate_all_summaries(connection: RocpdImportData, **kwargs: Any) -> None: region_categories = kwargs.get("region_categories", None) output_format = kwargs.get("format", "console") + if not check_function_availability(connection, "sqrt"): + connection.create_function( + "sqrt", + 1, + lambda x: ( + math.sqrt(x) + if x is not None and isinstance(x, (int, float)) and x >= 0 + else None + ), + ) + # create the temporary summary views create_summary_views(connection, by_rank) create_summary_region_views(connection, by_rank, region_categories=region_categories)