Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add test file for top_k functionality #1938

Merged
merged 3 commits into from
Dec 27, 2024
Merged

Conversation

oleksandr-pavlyk
Copy link
Collaborator

This PR adds a test file with few basic tests for top_k. To be extended.

  • Have you provided a meaningful PR description?
  • Have you added a test, reproducer or referred to an issue with a reproducer?
  • Have you tested your changes locally for CPU and GPU devices?
  • Have you made sure that new changes do not introduce compiler warnings?
  • Have you checked performance impact of proposed changes?
  • Have you added documentation for your changes, if necessary?
  • Have you added your changes to the changelog?
  • If this PR is a work in progress, are you opening the PR as a draft?

Copy link

Copy link

Array API standard conformance tests for dpctl=0.19.0dev0=py310h93fe807_332 ran successfully.
Passed: 894
Failed: 2
Skipped: 118

@oleksandr-pavlyk
Copy link
Collaborator Author

One test failed on CPU:

=========================== short test summary info ============================
FAILED tests/test_usm_ndarray_top_k.py::test_topk_1d_largest[255-i1] - assert usm_ndarray(False)
 +  where usm_ndarray(False) = <function all at 0x7f1fbb4b6d40>(usm_ndarray([...], dtype=int8) == usm_ndarray([...], dtype=int8)
 +    where <function all at 0x7f1fbb4b6d40> = dpt.all
    
    Full diff:
    - usm_ndarray([1, 1, 1, 1, 1], dtype=int8)
    ?              ^  ^  ^  ^  ^
    + usm_ndarray([0, 0, 0, 0, 0], dtype=int8)
    ?              ^  ^  ^  ^  ^)
==== 1 failed, 16051 passed, 1897 skipped, 8 warnings in 419.43s (0:06:59) =====

@oleksandr-pavlyk
Copy link
Collaborator Author

Interestingly, there is no issue when the test is run on Xeon:

$ SYCL_CACHE_PERSISTENT=1 ONEAPI_DEVICE_SELECTOR=opencl:cpu python -m pytest dpctl/tests/test_usm_ndarray_top_k.py
=========================================================================== test session starts ============================================================================
platform linux -- Python 3.12.4, pytest-8.3.1, pluggy-1.5.0
rootdir: /localdisk/work/opavlyk/repos/dpctl
configfile: pyproject.toml
plugins: cov-5.0.0
collected 143 items

dpctl/tests/test_usm_ndarray_top_k.py .............................................................................................................................. [ 88%]
.................                                                                                                                                                    [100%]

=========================================================================== 143 passed in 3.32s ============================================================================

@ndgrigorian
Copy link
Collaborator

Interestingly, there is no issue when the test is run on Xeon

And no issue when run on another (different) AMD CPU:

$ python -m dpctl -f
Platform  0 ::
    Name        Intel(R) OpenCL
    Version     OpenCL 3.0 LINUX
    Vendor      Intel(R) Corporation
    Backend     opencl
    Num Devices 1
      # 0
        Name                AMD EPYC 7R13 Processor
        Version             2024.18.12.0.05_160000
        Filter string       opencl:cpu:0

$ SYCL_CACHE_PERSISTENT=1 ONEAPI_DEVICE_SELECTOR=opencl:cpu python -m pytest dpctl/tests/test_usm_ndarray_top_k.py
================================================= test session starts ==================================================
platform linux -- Python 3.9.21, pytest-8.3.4, pluggy-1.5.0
rootdir: /home/ubuntu/repos/dpctl
configfile: pyproject.toml
collected 143 items

dpctl/tests/test_usm_ndarray_top_k.py .......................................................................... [ 51%]
.....................................................................                                            [100%]

================================================= 143 passed in 1.14s ==================================================

Copy link

Array API standard conformance tests for dpctl=0.19.0dev0=py310h93fe807_333 ran successfully.
Passed: 894
Failed: 2
Skipped: 118

Copy link

Array API standard conformance tests for dpctl=0.19.0dev0=py310h93fe807_334 ran successfully.
Passed: 894
Failed: 2
Skipped: 118

@oleksandr-pavlyk oleksandr-pavlyk merged commit 58da416 into feature/topk Dec 27, 2024
47 of 57 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants