Skip to content

fix: remove duplicate failing raggedtensor test when you have a GPU on the system #3461

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

Merged
merged 3 commits into from
Apr 14, 2025

Conversation

ikrommyd
Copy link
Collaborator

@ikrommyd ikrommyd commented Apr 13, 2025

tests/test_3210_to_raggedtensor_from_raggedtensor.py::test_convert_from_raggedtensor is failing for me locally when I have a GPU on my system because tensorflow automatically uses the GPU for all operations as the default.

(ak-uproot) ➜  awkward git:(main) ✗ pytest tests/test_3210_to_raggedtensor_from_raggedtensor.py::test_convert_from_raggedtensor
================================================================================================================================ test session starts ================================================================================================================================
platform linux -- Python 3.12.10, pytest-8.3.5, pluggy-1.5.0
rootdir: /home/iason/Dropbox/work/coffea_dev/awkward
configfile: pyproject.toml
plugins: cov-6.1.1, anyio-4.9.0, xdist-3.6.1
collected 1 item

tests/test_3210_to_raggedtensor_from_raggedtensor.py F                                                                                                                                                                                                                        [100%]

===================================================================================================================================== FAILURES ======================================================================================================================================
__________________________________________________________________________________________________________________________ test_convert_from_raggedtensor ___________________________________________________________________________________________________________________________

    def test_convert_from_raggedtensor():
        tf_array1 = tf.RaggedTensor.from_row_splits(
            values=[1.1, 2.2, 3.3, 4.4, 5.5], row_splits=[0, 2, 3, 3, 5]
        )

        ak_array1 = ak.contents.ListOffsetArray(offsets1, content1)
        result1 = ak.to_layout(from_raggedtensor(tf_array1), allow_record=False)
        assert (
            result1.content.data == ak.to_backend(np_array1, result1.backend).layout.data
        ).all()
>       assert (result1.offsets.data == [0, 2, 3, 3, 5]).all()

ak_array1  = <ListOffsetArray len='4'>
    <offsets><Index dtype='int64' len='5'>[0 2 3 3 5]</Index></offsets>
    <content><NumpyArray dtype='float32' len='5'>[1.1 2.2 3.3 4.4 5.5]</NumpyArray></content>
</ListOffsetArray>
result1    = <ListOffsetArray len='4'>
    <offsets><Index dtype='int64' len='5'>[0 2 3 3 5]</Index></offsets>
    <content><NumpyArray dtype='float32' len='5'>[1.1 2.2 3.3 4.4 5.5]</NumpyArray></content>
</ListOffsetArray>
tf_array1  = <tf.RaggedTensor [[1.1, 2.2], [3.3], [], [4.4, 5.5]]>

tests/test_3210_to_raggedtensor_from_raggedtensor.py:113:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

>   ???
E   TypeError: operand type(s) all returned NotImplemented from __array_ufunc__(<ufunc 'equal'>, '__call__', array([0, 2, 3, 3, 5]), [0, 2, 3, 3, 5]): 'ndarray', 'list'


cupy/_core/core.pyx:1264: TypeError
------------------------------------------------------------------------------------------------------------------------------- Captured stderr call --------------------------------------------------------------------------------------------------------------------------------
I0000 00:00:1744507395.989245  657278 gpu_device.cc:2019] Created device /job:localhost/replica:0/task:0/device:GPU:0 with 12937 MB memory:  -> device: 0, name: NVIDIA GeForce RTX 4080 SUPER, pci bus id: 0000:01:00.0, compute capability: 8.9
============================================================================================================================== short test summary info ==============================================================================================================================
FAILED tests/test_3210_to_raggedtensor_from_raggedtensor.py::test_convert_from_raggedtensor - TypeError: operand type(s) all returned NotImplemented from __array_ufunc__(<ufunc 'equal'>, '__call__', array([0, 2, 3, 3, 5]), [0, 2, 3, 3, 5]): 'ndarray', 'list'
================================================================================================================================= 1 failed in 2.29s =================================================================================================================================

I can make it succeed if I specify CUDA_VISIBLE_DEVICES='' pytest tests/test_3210_to_raggedtensor_from_raggedtensor.py::test_convert_from_raggedtensor so that tensorflow doesn't see the GPU.
Well this test is actually a duplicate and the line below it tests the same thing properly! I'm just removing the bad line here. It's good to take care of such things for when a GPU ci is available.

@ikrommyd ikrommyd requested a review from ianna April 13, 2025 01:27
@ikrommyd ikrommyd changed the title fix: failing raggedtensor test when you have a GPU on your system fix: remove duplicate failing raggedtensor test when you have a GPU on your system Apr 13, 2025
@ikrommyd ikrommyd changed the title fix: remove duplicate failing raggedtensor test when you have a GPU on your system fix: remove duplicate failing raggedtensor test when you have a GPU on the system Apr 13, 2025
Copy link
Collaborator

@ianna ianna left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ikrommyd - thanks for fixing it!

@ianna ianna merged commit 15cdfa2 into main Apr 14, 2025
42 checks passed
@ianna ianna deleted the ikrommyd/fix-failing-raggedtensor-test-on-gpu branch April 14, 2025 17:50
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