IntelPython / dpctl

Python SYCL bindings and SYCL-based Python Array API library
https://intelpython.github.io/dpctl/
Apache License 2.0
101 stars 30 forks source link

Failing on tests/test_service.py #885

Open chudur-budur opened 2 years ago

chudur-budur commented 2 years ago

When I am trying to compile it from the source, it's failing on test_service.py

pytest --pyargs dpctl
===================================== test session starts =====================================
platform linux -- Python 3.9.12, pytest-7.1.2, pluggy-1.0.0
rootdir: /localdisk/work/$USER/dpctl
collected 4105 items

tests/test_dparray.py ..............                                                    [  0%]
tests/test_service.py ..F..FFF                                                          [  0%]
tests/test_sycl_context.py ....................................................         [  1%]
tests/test_sycl_device.py .................................................sssssss..... [  3%]
..................................................sssssss.............................. [  5%]
.......................sssssssss.....................................................ss [  7%]
sssssss.......................................................sssssss.................. [  9%]
...................................sssssssss........................................... [ 11%]
..........sssssssss.....................................................sssssssss...... [ 13%]
.................................................sssssss............................... [ 16%]
......................sssssssss.....................................................sss [ 18%]
ssssss.......................................................sssssss................... [ 20%]
..................................sssssssss............................................ [ 22%]
.........sssssssss.......................................................sssssss....... [ 24%]
..............................................sssssssss................................ [ 26%]
.....................sssssssss.....................................................ssss [ 28%]
sssss.......................................................sssssss.................... [ 30%]
.........................s...                                                           [ 31%]
tests/test_sycl_device_factory.py s......s.ss..s....s.s.ss..                            [ 32%]
tests/test_sycl_event.py .................                                              [ 32%]
tests/test_sycl_kernel_submit.py ........                                               [ 32%]
tests/test_sycl_platform.py ........................................................... [ 34%]
.......................................................                                 [ 35%]
tests/test_sycl_program.py ...x.                                                        [ 35%]
tests/test_sycl_queue.py .................................................sssssss...... [ 37%]
.................................................sssssss............................... [ 39%]
......................sssssssss.....................................................sss [ 41%]
ssssss.......................................................sssssss................... [ 43%]
..................................sssssssss............................................ [ 45%]
.........sssssssss.....................................................sssssssss....... [ 47%]
................................................sssssss................................ [ 49%]
.....................sssssssss.....................................................ssss [ 52%]
sssss.......................................................sssssss.................... [ 54%]
.................................sssssssss............................................. [ 56%]
........sssssssss.......................................................sssssss........ [ 58%]
.............................................sssssssss................................. [ 60%]
....................sssssssss.....................................................sssss [ 62%]
ssss.......................................................sssssss..................... [ 64%]
....................                                                                    [ 65%]
tests/test_sycl_queue_manager.py ....s............                                      [ 65%]
tests/test_sycl_queue_memcpy.py ..                                                      [ 65%]
tests/test_sycl_usm.py ...............................................                  [ 66%]
tests/test_tensor_asarray.py ..............                                             [ 67%]
tests/test_usm_ndarray_ctor.py ........................................................ [ 68%]
....................................................................................... [ 70%]
....................................................................................... [ 72%]
....................................................................................... [ 74%]
....................................................................................... [ 77%]
....................................................................................... [ 79%]
....................................................................................... [ 81%]
....................................................................................... [ 83%]
....................................................................................... [ 85%]
....................................................................................... [ 87%]
..................................................................                      [ 89%]
tests/test_usm_ndarray_dlpack.py ...................................................... [ 90%]
....................................................................................... [ 92%]
.........................................................................               [ 94%]
tests/test_usm_ndarray_manipulation.py ................................................ [ 95%]
....................................................................................... [ 97%]
...................................................................................     [ 99%]
tests/test_usm_ndarray_operators.py ......                                              [ 99%]
tests/test_utils.py ....                                                                [100%]

========================================== FAILURES ===========================================
______________________________________ test___version__ _______________________________________

    def test___version__():
        dpctl_ver = getattr(dpctl, "__version__", None)
        assert type(dpctl_ver) is str
        assert "unknown" not in dpctl_ver
>       assert "untagged" not in dpctl_ver
E       AssertionError: assert 'untagged' not in '0+untagged.1673.gbacb140'
E         'untagged' is contained here:
E           0+untagged.1673.gbacb140
E         ?   ++++++++

../.dpctl/lib/python3.9/site-packages/dpctl/tests/test_service.py:104: AssertionError
_____________________________________ test_main_includes ______________________________________

    def test_main_includes():
        res = subprocess.run(
            [sys.executable, "-m", "dpctl", "--includes"], capture_output=True
        )
>       assert res.returncode == 0
E       AssertionError: assert 1 == 0
E        +  where 1 = CompletedProcess(args=['/localdisk/work/$USER/.dpctl/bin/python', '-m', 'dpctl', '--includes'], returncode=1, stdou..._context import SyclContext, SyclContextCreationError\nModuleNotFoundError: No module named \'dpctl._sycl_context\'\n').returncode

../.dpctl/lib/python3.9/site-packages/dpctl/tests/test_service.py:163: AssertionError
______________________________________ test_main_library ______________________________________

    def test_main_library():
        res = subprocess.run(
            [sys.executable, "-m", "dpctl", "--library"], capture_output=True
        )
>       assert res.returncode == 0
E       AssertionError: assert 1 == 0
E        +  where 1 = CompletedProcess(args=['/localdisk/work/$USER/.dpctl/bin/python', '-m', 'dpctl', '--library'], returncode=1, stdout..._context import SyclContext, SyclContextCreationError\nModuleNotFoundError: No module named \'dpctl._sycl_context\'\n').returncode

../.dpctl/lib/python3.9/site-packages/dpctl/tests/test_service.py:172: AssertionError
________________________________________ test_cmakedir ________________________________________

    def test_cmakedir():
        res = subprocess.run(
            [sys.executable, "-m", "dpctl", "--cmakedir"], capture_output=True
        )
>       assert res.returncode == 0
E       AssertionError: assert 1 == 0
E        +  where 1 = CompletedProcess(args=['/localdisk/work/$USER/.dpctl/bin/python', '-m', 'dpctl', '--cmakedir'], returncode=1, stdou..._context import SyclContext, SyclContextCreationError\nModuleNotFoundError: No module named \'dpctl._sycl_context\'\n').returncode

../.dpctl/lib/python3.9/site-packages/dpctl/tests/test_service.py:181: AssertionError
====================================== warnings summary =======================================
tests/test_sycl_device.py: 19 warnings
tests/test_sycl_queue.py: 19 warnings
  /localdisk/work/$USER/dpctl/dpctl/tests/_device_attributes_checks.py:79: DeprecationWarning: dpctl.SyclDevice.max_work_item_sizes is deprecated, use dpctl.SyclDevice.max_work_item_sizes3d instead
    max_work_item_sizes = device.max_work_item_sizes

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
=================================== short test summary info ===================================
FAILED tests/test_service.py::test___version__ - AssertionError: assert 'untagged' not in '0...
FAILED tests/test_service.py::test_main_includes - AssertionError: assert 1 == 0
FAILED tests/test_service.py::test_main_library - AssertionError: assert 1 == 0
FAILED tests/test_service.py::test_cmakedir - AssertionError: assert 1 == 0
======= 4 failed, 3775 passed, 325 skipped, 1 xfailed, 38 warnings in 65.19s (0:01:05) ========
Intel(R) OpenCL HD Graphics OpenCL 3.0
Intel(R) OpenCL HD Graphics OpenCL 3.0
Intel(R) OpenCL OpenCL 3.0 LINUX
Intel(R) OpenCL HD Graphics OpenCL 3.0
Intel(R) Level-Zero 1.3
Intel(R) OpenCL OpenCL 3.0 LINUX
Intel(R) Level-Zero 1.3
Intel(R) Level-Zero 1.3
Intel(R) OpenCL OpenCL 3.0 LINUX
Intel(R) Level-Zero 1.3
Intel(R) OpenCL HD Graphics OpenCL 3.0
Intel(R) Level-Zero 1.3
Intel(R) OpenCL OpenCL 3.0 LINUX
SYCL host platform 1.2

Any idea?

oleksandr-pavlyk commented 2 years ago

Please specify how to you got sources.

We use versioneer, which infers the package version from the latest git tag. In absence of that tag, it produces fall-back version with untagged in it. Can you consider cloning the repo instead of downloading source ZIP file?

It appears that subprocesses launched during test_main_library, test_main_includes and test_cmakedir can not find installed dpctl, but interpret the source folder as the package.

If the manual check python -m dpctl --include, python -m dpctl --library, and python -m dpctl --cmakedir work fine outside of test suite, please mute these tests.

oleksandr-pavlyk commented 2 years ago

BTW, source distribution can be created with python setup.py sdist. We can consider publishing source tar-ball as an artifact attached to the GH release.

diptorupd commented 7 months ago

Doubt it is still an issue. Feel free to reopen with new information if still applicable.

oleksandr-pavlyk commented 7 months ago

It is still an issue. Fixing it requires migrating away from versioneer. Code in versioneer is being flagged by various scanning tools, such as bandit.

We can follow the lead of scipy who did that recently.