From 3869039bc2d757773e539921c0d3acae60d8cea9 Mon Sep 17 00:00:00 2001 From: Sergey Pokhodenko Date: Mon, 4 Oct 2021 16:08:37 +0300 Subject: [PATCH 01/12] Add examples folder to Python package --- MANIFEST.in | 2 ++ 1 file changed, 2 insertions(+) diff --git a/MANIFEST.in b/MANIFEST.in index 4c02572c56..895fc6f2b4 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -6,3 +6,5 @@ recursive-include numba_dppy *.spir include versioneer.py include numba_dppy/_version.py + +recursive-include numba_dppy/examples * From cfddfb95a472c6007bca3414b2adbd48540bb8a8 Mon Sep 17 00:00:00 2001 From: Sergey Pokhodenko Date: Mon, 4 Oct 2021 16:13:54 +0300 Subject: [PATCH 02/12] Add dependency to pexpect --- conda-recipe/meta.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/conda-recipe/meta.yaml b/conda-recipe/meta.yaml index ebd5b31a96..6509d49670 100644 --- a/conda-recipe/meta.yaml +++ b/conda-recipe/meta.yaml @@ -34,6 +34,7 @@ requirements: test: requires: - pytest + - pexpect about: home: https://github.com/IntelPython/numba-dppy From d728beb1203b2632e3c4415476c6aaffbffe4fb1 Mon Sep 17 00:00:00 2001 From: Sergey Pokhodenko Date: Mon, 4 Oct 2021 16:20:27 +0300 Subject: [PATCH 03/12] Add variable NUMBA_DPPY_TESTING_GDB_ENABLE --- conda-recipe/meta.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/conda-recipe/meta.yaml b/conda-recipe/meta.yaml index 6509d49670..28c87f1ff2 100644 --- a/conda-recipe/meta.yaml +++ b/conda-recipe/meta.yaml @@ -9,6 +9,7 @@ build: number: {{ GIT_DESCRIBE_NUMBER }} script_env: - WHEELS_OUTPUT_FOLDER + - NUMBA_DPPY_TESTING_GDB_ENABLE requirements: build: From c055f94d6b461adbc58fd17b98f19ba617a592e5 Mon Sep 17 00:00:00 2001 From: Sergey Pokhodenko Date: Mon, 4 Oct 2021 16:28:07 +0300 Subject: [PATCH 04/12] Test GDb in recipe --- conda-recipe/run_test.sh | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/conda-recipe/run_test.sh b/conda-recipe/run_test.sh index b39ec427b0..a589f5d572 100644 --- a/conda-recipe/run_test.sh +++ b/conda-recipe/run_test.sh @@ -2,7 +2,21 @@ set -euxo pipefail -pytest -q -ra --disable-warnings --pyargs numba_dppy -vv +PYTEST_ARGS="-q -ra --disable-warnings" +PYARGS="numba_dppy -vv" + +if [ -n "$NUMBA_DPPY_TESTING_GDB_ENABLE" ]; then + PYARGS="$PYARGS -k test_debug_dppy_numba" + + # Activate debugger + if [[ -v ONEAPI_ROOT ]]; then + set +ux + source "${ONEAPI_ROOT}/debugger/latest/env/vars.sh" + set -ux + fi +fi + +pytest $PYTEST_ARGS --pyargs $PYARGS if [[ -v ONEAPI_ROOT ]]; then set +u From 2007713183a181b31fe087fa5b50304c12be0e97 Mon Sep 17 00:00:00 2001 From: Sergey Pokhodenko Date: Mon, 4 Oct 2021 16:41:09 +0300 Subject: [PATCH 05/12] Use DEBUGGER_VERSION --- conda-recipe/run_test.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/conda-recipe/run_test.sh b/conda-recipe/run_test.sh index a589f5d572..7fc8f1d4c3 100644 --- a/conda-recipe/run_test.sh +++ b/conda-recipe/run_test.sh @@ -4,6 +4,7 @@ set -euxo pipefail PYTEST_ARGS="-q -ra --disable-warnings" PYARGS="numba_dppy -vv" +DEBUGGER_VERSION=10.1.2 if [ -n "$NUMBA_DPPY_TESTING_GDB_ENABLE" ]; then PYARGS="$PYARGS -k test_debug_dppy_numba" @@ -11,7 +12,7 @@ if [ -n "$NUMBA_DPPY_TESTING_GDB_ENABLE" ]; then # Activate debugger if [[ -v ONEAPI_ROOT ]]; then set +ux - source "${ONEAPI_ROOT}/debugger/latest/env/vars.sh" + source "${ONEAPI_ROOT}/debugger/${DEBUGGER_VERSION}/env/vars.sh" set -ux fi fi From 7ebedaae387336feea5222671bfa3b4fee75d7ed Mon Sep 17 00:00:00 2001 From: Sergey Pokhodenko Date: Mon, 4 Oct 2021 16:45:11 +0300 Subject: [PATCH 06/12] Disable shellcheck for the line --- conda-recipe/run_test.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/conda-recipe/run_test.sh b/conda-recipe/run_test.sh index 7fc8f1d4c3..9f634b5ec2 100644 --- a/conda-recipe/run_test.sh +++ b/conda-recipe/run_test.sh @@ -17,6 +17,7 @@ if [ -n "$NUMBA_DPPY_TESTING_GDB_ENABLE" ]; then fi fi +# shellcheck disable=SC2086 pytest $PYTEST_ARGS --pyargs $PYARGS if [[ -v ONEAPI_ROOT ]]; then From 3e9573a8a0e6014c0d7e54130766eed158e5427f Mon Sep 17 00:00:00 2001 From: Sergey Pokhodenko Date: Mon, 4 Oct 2021 16:48:10 +0300 Subject: [PATCH 07/12] Disable shellcheck for the line --- conda-recipe/run_test.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/conda-recipe/run_test.sh b/conda-recipe/run_test.sh index 9f634b5ec2..a0c9a7adf7 100644 --- a/conda-recipe/run_test.sh +++ b/conda-recipe/run_test.sh @@ -12,6 +12,7 @@ if [ -n "$NUMBA_DPPY_TESTING_GDB_ENABLE" ]; then # Activate debugger if [[ -v ONEAPI_ROOT ]]; then set +ux + # shellcheck disable=SC1090 source "${ONEAPI_ROOT}/debugger/${DEBUGGER_VERSION}/env/vars.sh" set -ux fi From afcdb3fdb15b2b3d70e1152f00310336f1b0015c Mon Sep 17 00:00:00 2001 From: Sergey Pokhodenko Date: Tue, 5 Oct 2021 15:03:20 +0300 Subject: [PATCH 08/12] Run only GDB tests --- conda-recipe/run_test.sh | 38 +++++++++++++++++++++----------------- 1 file changed, 21 insertions(+), 17 deletions(-) diff --git a/conda-recipe/run_test.sh b/conda-recipe/run_test.sh index a0c9a7adf7..8c7e73ab67 100644 --- a/conda-recipe/run_test.sh +++ b/conda-recipe/run_test.sh @@ -2,24 +2,28 @@ set -euxo pipefail -PYTEST_ARGS="-q -ra --disable-warnings" -PYARGS="numba_dppy -vv" -DEBUGGER_VERSION=10.1.2 - -if [ -n "$NUMBA_DPPY_TESTING_GDB_ENABLE" ]; then - PYARGS="$PYARGS -k test_debug_dppy_numba" - - # Activate debugger - if [[ -v ONEAPI_ROOT ]]; then - set +ux - # shellcheck disable=SC1090 - source "${ONEAPI_ROOT}/debugger/${DEBUGGER_VERSION}/env/vars.sh" - set -ux - fi -fi +PYARGS="-k test_debug_dppy_numba" + +pytest -q -ra --disable-warnings --pyargs numba_dppy -vv ${PYARGS} + +# PYTEST_ARGS="-q -ra --disable-warnings" +# PYARGS="numba_dppy -vv" +# DEBUGGER_VERSION=10.1.2 + +# if [ -n "$NUMBA_DPPY_TESTING_GDB_ENABLE" ]; then +# PYARGS="$PYARGS -k test_debug_dppy_numba" + +# # Activate debugger +# if [[ -v ONEAPI_ROOT ]]; then +# set +ux +# # shellcheck disable=SC1090 +# source "${ONEAPI_ROOT}/debugger/${DEBUGGER_VERSION}/env/vars.sh" +# set -ux +# fi +# fi -# shellcheck disable=SC2086 -pytest $PYTEST_ARGS --pyargs $PYARGS +# # shellcheck disable=SC2086 +# pytest $PYTEST_ARGS --pyargs $PYARGS if [[ -v ONEAPI_ROOT ]]; then set +u From d84dbd20f54fc711208227ecf5ab98acc64c4ff1 Mon Sep 17 00:00:00 2001 From: Sergey Pokhodenko Date: Tue, 5 Oct 2021 17:15:11 +0300 Subject: [PATCH 09/12] wip --- conda-recipe/run_test.sh | 18 ++++++++++++++++-- numba_dppy/tests/test_debug_dppy_numba.py | 4 ++++ 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/conda-recipe/run_test.sh b/conda-recipe/run_test.sh index 8c7e73ab67..d10d760ca1 100644 --- a/conda-recipe/run_test.sh +++ b/conda-recipe/run_test.sh @@ -2,9 +2,23 @@ set -euxo pipefail -PYARGS="-k test_debug_dppy_numba" +echo GOOOOOOOOOOOOOOOOOOOOOOOD -pytest -q -ra --disable-warnings --pyargs numba_dppy -vv ${PYARGS} +exit 1 + +if [[ -v ONEAPI_ROOT ]]; then + DEBUGGER_VERSION=10.1.2 + DEBUGGER_DIR="${ONEAPI_ROOT}/debugger/${DEBUGGER_VERSION}" + if [[ -d "${DEBUGGER_DIR}" ]]; then + # shellcheck disable=SC1091 + . "${DEBUGGER_DIR}/env/vars.sh" + else + echo "Debugger (${DEBUGGER_DIR}) not installed." + fi +fi + +PYARGS="-k test_debug_dppy_numba -k dummy" +pytest -q -ra --disable-warnings --pyargs numba_dppy -vv "${PYARGS}" # PYTEST_ARGS="-q -ra --disable-warnings" # PYARGS="numba_dppy -vv" diff --git a/numba_dppy/tests/test_debug_dppy_numba.py b/numba_dppy/tests/test_debug_dppy_numba.py index c9ae3e3b1c..fccc55172b 100644 --- a/numba_dppy/tests/test_debug_dppy_numba.py +++ b/numba_dppy/tests/test_debug_dppy_numba.py @@ -108,6 +108,10 @@ def app(): return gdb() +def test_dummy(): + assert True + + @pytest.mark.parametrize("api", ["numba", "numba-dppy"]) def test_breakpoint_row_number(app, api): app.breakpoint("dppy_numba_basic.py:25") From 792afafe7f499692bf41b87ebba318d8432251c4 Mon Sep 17 00:00:00 2001 From: Sergey Pokhodenko Date: Tue, 5 Oct 2021 09:47:32 -0500 Subject: [PATCH 10/12] Fix enabling debugger --- conda-recipe/run_test.sh | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/conda-recipe/run_test.sh b/conda-recipe/run_test.sh index d10d760ca1..9d0738cc19 100644 --- a/conda-recipe/run_test.sh +++ b/conda-recipe/run_test.sh @@ -2,23 +2,26 @@ set -euxo pipefail -echo GOOOOOOOOOOOOOOOOOOOOOOOD - -exit 1 - +DEBUGGER_VERSION=10.1.2 if [[ -v ONEAPI_ROOT ]]; then - DEBUGGER_VERSION=10.1.2 DEBUGGER_DIR="${ONEAPI_ROOT}/debugger/${DEBUGGER_VERSION}" - if [[ -d "${DEBUGGER_DIR}" ]]; then - # shellcheck disable=SC1091 - . "${DEBUGGER_DIR}/env/vars.sh" - else - echo "Debugger (${DEBUGGER_DIR}) not installed." - fi +else + DEBUGGER_DIR="/opt/intel/oneapi/debugger/${DEBUGGER_VERSION}" +fi + +if [[ -d "${DEBUGGER_DIR}" ]]; then + set +x + # shellcheck disable=SC1091 + . "${DEBUGGER_DIR}/env/vars.sh" + set -x +else + echo "Debugger is not installed: ${DEBUGGER_DIR}" fi PYARGS="-k test_debug_dppy_numba -k dummy" -pytest -q -ra --disable-warnings --pyargs numba_dppy -vv "${PYARGS}" +pytest -q -ra --disable-warnings --pyargs numba_dppy -vv ${PYARGS} + +exit 0 # PYTEST_ARGS="-q -ra --disable-warnings" # PYARGS="numba_dppy -vv" From ba36cbc730624c623483c6d3cf20f232548770f6 Mon Sep 17 00:00:00 2001 From: Sergey Pokhodenko Date: Tue, 5 Oct 2021 09:48:51 -0500 Subject: [PATCH 11/12] Improve debugger enabling --- conda-recipe/run_test.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/conda-recipe/run_test.sh b/conda-recipe/run_test.sh index 9d0738cc19..036a9fff3e 100644 --- a/conda-recipe/run_test.sh +++ b/conda-recipe/run_test.sh @@ -10,6 +10,7 @@ else fi if [[ -d "${DEBUGGER_DIR}" ]]; then + echo "Using debugger from: ${DEBUGGER_DIR}" set +x # shellcheck disable=SC1091 . "${DEBUGGER_DIR}/env/vars.sh" From 5212992f818d4f7ef68efc4c3c36842d917b1eb1 Mon Sep 17 00:00:00 2001 From: Sergey Pokhodenko Date: Wed, 6 Oct 2021 13:01:13 +0300 Subject: [PATCH 12/12] Skip if igfxdcd is not loaded --- numba_dppy/tests/test_debug_dppy_numba.py | 28 ++++++++++++++++++----- 1 file changed, 22 insertions(+), 6 deletions(-) diff --git a/numba_dppy/tests/test_debug_dppy_numba.py b/numba_dppy/tests/test_debug_dppy_numba.py index fccc55172b..a165416a97 100644 --- a/numba_dppy/tests/test_debug_dppy_numba.py +++ b/numba_dppy/tests/test_debug_dppy_numba.py @@ -25,10 +25,26 @@ pexpect = pytest.importorskip("pexpect") -pytestmark = pytest.mark.skipif( - not shutil.which("gdb-oneapi"), - reason="IntelĀ® Distribution for GDB* is not available", -) + +def module_loaded(module_name): + import subprocess + + lsmod = subprocess.Popen(["lsmod"], stdout=subprocess.PIPE) + grep = subprocess.Popen(["grep", module_name], stdin=lsmod.stdout) + grep.communicate() + return grep.returncode == 0 + + +pytestmark = [ + pytest.mark.skipif( + not shutil.which("gdb-oneapi"), + reason="IntelĀ® Distribution for GDB* is not available", + ), + pytest.mark.skipif( + not module_loaded("igfxdcd"), + reason="Module igfxdcd is not loaded", + ), +] # TODO: go to helper @@ -45,8 +61,8 @@ def spawn(self): env["NUMBA_OPT"] = "0" self.child = pexpect.spawn("gdb-oneapi -q python", env=env, encoding="utf-8") - if config.DEBUG: - self.child.logfile = sys.stdout + # if config.DEBUG: + self.child.logfile = sys.stdout def setup_gdb(self): self.child.expect("(gdb)", timeout=5)