From 3869039bc2d757773e539921c0d3acae60d8cea9 Mon Sep 17 00:00:00 2001 From: Sergey Pokhodenko Date: Mon, 4 Oct 2021 16:08:37 +0300 Subject: [PATCH 01/17] 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/17] 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/17] 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/17] 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/17] 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/17] 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/17] 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/17] 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/17] 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/17] 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/17] 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/17] 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) From 9bbeaffd1f1b263baefe3ee18ffb14d3b8b8e6b4 Mon Sep 17 00:00:00 2001 From: Vladislav Perevezentsev Date: Fri, 12 Nov 2021 16:28:25 +0300 Subject: [PATCH 13/17] Change debugger version and remove test_dummy --- conda-recipe/run_test.sh | 7 ++++--- numba_dppy/tests/test_debug_dppy_numba.py | 4 ---- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/conda-recipe/run_test.sh b/conda-recipe/run_test.sh index 036a9fff3e..ec2f350c35 100644 --- a/conda-recipe/run_test.sh +++ b/conda-recipe/run_test.sh @@ -2,7 +2,7 @@ set -euxo pipefail -DEBUGGER_VERSION=10.1.2 +DEBUGGER_VERSION=10.2.4 if [[ -v ONEAPI_ROOT ]]; then DEBUGGER_DIR="${ONEAPI_ROOT}/debugger/${DEBUGGER_VERSION}" else @@ -19,8 +19,9 @@ 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} +PYARGS="-k test_debug_dppy_numba" +# shellcheck disable=SC2086 +pytest -q -ra --disable-warnings --pyargs numba_dppy -vv $PYARGS exit 0 diff --git a/numba_dppy/tests/test_debug_dppy_numba.py b/numba_dppy/tests/test_debug_dppy_numba.py index 0d661ac360..49a3107d3e 100644 --- a/numba_dppy/tests/test_debug_dppy_numba.py +++ b/numba_dppy/tests/test_debug_dppy_numba.py @@ -129,10 +129,6 @@ 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 98db05e5ad522e32783c81cdbf3fb60fd1db3992 Mon Sep 17 00:00:00 2001 From: Vladislav Perevezentsev Date: Fri, 12 Nov 2021 16:30:15 +0300 Subject: [PATCH 14/17] Enable config.DEBUG --- numba_dppy/tests/test_debug_dppy_numba.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/numba_dppy/tests/test_debug_dppy_numba.py b/numba_dppy/tests/test_debug_dppy_numba.py index 49a3107d3e..c42e1605ad 100644 --- a/numba_dppy/tests/test_debug_dppy_numba.py +++ b/numba_dppy/tests/test_debug_dppy_numba.py @@ -62,8 +62,8 @@ def spawn(self): env["NUMBA_EXTEND_VARIABLE_LIFETIMES"] = "1" 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) From 91b91e66a6d41731e569baa578b9f6cab1db124b Mon Sep 17 00:00:00 2001 From: Vladislav Perevezentsev Date: Mon, 15 Nov 2021 16:09:42 +0300 Subject: [PATCH 15/17] Add OS check --- numba_dppy/tests/test_debug_dppy_numba.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/numba_dppy/tests/test_debug_dppy_numba.py b/numba_dppy/tests/test_debug_dppy_numba.py index c42e1605ad..2714d8e052 100644 --- a/numba_dppy/tests/test_debug_dppy_numba.py +++ b/numba_dppy/tests/test_debug_dppy_numba.py @@ -36,6 +36,10 @@ def module_loaded(module_name): pytestmark = [ + pytest.mark.skipif( + not sys.platform == "linux", + reason="OS in not linux", + ), pytest.mark.skipif( not shutil.which("gdb-oneapi"), reason="Intel® Distribution for GDB* is not available", From eac27a92c4cd78c0e79e50bfd6c3df1aa17704cf Mon Sep 17 00:00:00 2001 From: Vladislav Perevezentsev Date: Mon, 15 Nov 2021 18:17:39 +0300 Subject: [PATCH 16/17] Run all tests --- conda-recipe/run_test.sh | 49 +++++++++++----------------------------- 1 file changed, 13 insertions(+), 36 deletions(-) diff --git a/conda-recipe/run_test.sh b/conda-recipe/run_test.sh index ec2f350c35..344ab0bb38 100644 --- a/conda-recipe/run_test.sh +++ b/conda-recipe/run_test.sh @@ -2,47 +2,24 @@ set -euxo pipefail +PYTEST_ARGS="-q -ra --disable-warnings" +PYARGS="numba_dppy -vv" DEBUGGER_VERSION=10.2.4 -if [[ -v ONEAPI_ROOT ]]; then - DEBUGGER_DIR="${ONEAPI_ROOT}/debugger/${DEBUGGER_VERSION}" -else - DEBUGGER_DIR="/opt/intel/oneapi/debugger/${DEBUGGER_VERSION}" -fi -if [[ -d "${DEBUGGER_DIR}" ]]; then - echo "Using debugger from: ${DEBUGGER_DIR}" - set +x - # shellcheck disable=SC1091 - . "${DEBUGGER_DIR}/env/vars.sh" - set -x -else - echo "Debugger is not installed: ${DEBUGGER_DIR}" +if [[ -v 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" # shellcheck disable=SC2086 -pytest -q -ra --disable-warnings --pyargs numba_dppy -vv $PYARGS - -exit 0 - -# 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 +pytest $PYTEST_ARGS --pyargs $PYARGS if [[ -v ONEAPI_ROOT ]]; then set +u From 1db692668a08e271f5b4a8c0d49f1c3737c6d8cb Mon Sep 17 00:00:00 2001 From: Vladislav Perevezentsev Date: Fri, 19 Nov 2021 18:34:44 +0300 Subject: [PATCH 17/17] Fix skipping tests on Win --- numba_dppy/tests/test_debug_dppy_numba.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/numba_dppy/tests/test_debug_dppy_numba.py b/numba_dppy/tests/test_debug_dppy_numba.py index 2714d8e052..8a0e62a5ca 100644 --- a/numba_dppy/tests/test_debug_dppy_numba.py +++ b/numba_dppy/tests/test_debug_dppy_numba.py @@ -24,6 +24,8 @@ from numba_dppy import config pexpect = pytest.importorskip("pexpect") +if not sys.platform == "linux": + pytest.skip("OS is not linux", allow_module_level=True) def module_loaded(module_name): @@ -36,10 +38,6 @@ def module_loaded(module_name): pytestmark = [ - pytest.mark.skipif( - not sys.platform == "linux", - reason="OS in not linux", - ), pytest.mark.skipif( not shutil.which("gdb-oneapi"), reason="Intel® Distribution for GDB* is not available",