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

[Bug] cle.bounding_box() causes Unsupported error #176

Closed
thawn opened this issue Apr 7, 2024 · 1 comment · Fixed by clEsperanto/CLIc#281
Closed

[Bug] cle.bounding_box() causes Unsupported error #176

thawn opened this issue Apr 7, 2024 · 1 comment · Fixed by clEsperanto/CLIc#281
Labels
bug Something isn't working

Comments

@thawn
Copy link

thawn commented Apr 7, 2024

Describe the bug
on pyclesperanto v0.9.1 I get an UNSUPPORTED error when executing cle.bounding_box():

UNSUPPORTED (log once): buildComputeProgram: cl2Metal failed
---------------------------------------------------------------------------
RuntimeError                              Traceback (most recent call last)
Cell In[1], [line 12](vscode-notebook-cell:?execution_count=1&line=12)
      [9](vscode-notebook-cell:?execution_count=1&line=9) image[240:290, 20:260] = 1
     [11](vscode-notebook-cell:?execution_count=1&line=11) # measure the bounding box with pyclesperanto causes an UNSUPPORTED error
---> [12](vscode-notebook-cell:?execution_count=1&line=12) cle.bounding_box(image)
     [14](vscode-notebook-cell:?execution_count=1&line=14) # measure the bounding box with pyclesperanto_prototype works
     [15](vscode-notebook-cell:?execution_count=1&line=15) clep.bounding_box(image)  # returns [20.0, 10.0, 0, 259.0, 29.0, 0]

File /opt/homebrew/Caskroom/mambaforge/base/envs/vfdt/lib/python3.12/site-packages/pyclesperanto/_decorators.py:85, in plugin_function..worker_function(*args, **kwargs)
82 bound.arguments[key] = input_image.device
84 # call the decorated function
---> 85 result = function(*bound.args, **bound.kwargs)
87 # # Cast the result as an Array if it is not already
88 # if not isinstance(result, _Array):
89 # result = _Array(result)
91 return result

File /opt/homebrew/Caskroom/mambaforge/base/envs/vfdt/lib/python3.12/site-packages/pyclesperanto/_tier3.py:38, in bounding_box(input_image, device)
17 """Determines the bounding box of all nonzero pixels in a binary image. The
18 positions are returned in an array of 6 values as follows: minX, minY, minZ,
19 maxX, maxY, maxZ.
(...)
33 [1] https://clij.github.io/clij2-docs/reference_boundingBox
34 """
36 from ._pyclesperanto import _bounding_box as op
---> 38 return op(
39 device=device,
40 src=input_image
41 )

RuntimeError: Build log: Compiler encountered an internal error

To Reproduce

import pyclesperanto as cle
import pyclesperanto_prototype as clep
import numpy as np

#create sample image
image = np.zeros((300, 300), dtype=np.uint8)
image[240:290, 20:260] = 1

#measure the bounding box with pyclesperanto causes an UNSUPPORTED error
cle.bounding_box(image)

#measure the bounding box with pyclesperanto_prototype works
clep.bounding_box(image) # returns [20.0, 10.0, 0, 259.0, 29.0, 0]

Expected behavior
in the above code snippet cle.bounding_box(image) should return [20.0, 10.0, 0, 259.0, 29.0, 0]

Configuration details:

  • OS: [e.g. MacOS 12.7.2]
  • Device: [Apple M1 Max]
  • Device type: [Integrated GPU]
@thawn thawn added the bug Something isn't working label Apr 7, 2024
@StRigaud
Copy link
Member

StRigaud commented Apr 8, 2024

Same issue as #174 i guess. Will fix this soon and add a logic enforcement to prevent this incompatibility in future.

Thanks again Till!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants