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

Unable to use the assistant on 3d images #52

Open
DirkRemmers opened this issue Feb 24, 2022 · 14 comments
Open

Unable to use the assistant on 3d images #52

DirkRemmers opened this issue Feb 24, 2022 · 14 comments

Comments

@DirkRemmers
Copy link

Hello,

I recently started working with this amazing tool, and I have to say I like it a lot! It is really powerful to have all the pyclesperanto_prototype functionality in the napari viewer. All the 2d functions are working perfectly fine. However, the one thing that I can't get to work is 3d image processing (which is working fine for me with pyclesperanto_prototype).

Everytime I want to do any sort of operation on a 3d image, I get a big error that looks like this:

2022-02-24 13:23:40.414 | INFO     | napari_pyclesperanto_assistant._gui._category_widget:call_op:124 - cle.gaussian_blur (clesperanto)(..., 1.0, 1.0, 0.0)
2022-02-24 13:23:40.465 | DEBUG    | napari_pyclesperanto_assistant._gui._category_widget:_show_result:223 - creating new layer for id: 140441732163040
Traceback (most recent call last):
  File "/home/dirk/miniconda3/envs/pyclesperanto/lib/python3.9/site-packages/napari_pyclesperanto_assistant/_gui/_category_widget.py", line 216, in _show_result
    layer = next(x for x in viewer.layers if isinstance(x.metadata, dict) and x.metadata.get(OP_ID) == op_id)
StopIteration

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/dirk/miniconda3/envs/pyclesperanto/lib/python3.9/site-packages/napari_pyclesperanto_assistant/_gui/_Assistant.py", line 171, in _on_item_clicked
    self._activate(CATEGORIES.get(item.text()))
  File "/home/dirk/miniconda3/envs/pyclesperanto/lib/python3.9/site-packages/napari_pyclesperanto_assistant/_gui/_Assistant.py", line 202, in _activate
    self._layers[gui()] = (dw, gui)
  File "/home/dirk/miniconda3/envs/pyclesperanto/lib/python3.9/site-packages/magicgui/widgets/_function_gui.py", line 306, in __call__
    value = self._function(*bound.args, **bound.kwargs)
  File "/home/dirk/miniconda3/envs/pyclesperanto/lib/python3.9/site-packages/napari_pyclesperanto_assistant/_gui/_category_widget.py", line 344, in gui_function
    result_layer = _show_result(
  File "/home/dirk/miniconda3/envs/pyclesperanto/lib/python3.9/site-packages/napari_pyclesperanto_assistant/_gui/_category_widget.py", line 230, in _show_result
    layer = add_layer(data, **kwargs)
  File "/home/dirk/miniconda3/envs/pyclesperanto/lib/python3.9/site-packages/napari/components/viewer_model.py", line 731, in add_image
    layer = Image(data, **kwargs)
  File "/home/dirk/miniconda3/envs/pyclesperanto/lib/python3.9/site-packages/napari/layers/image/image.py", line 348, in __init__
    self._update_dims()
  File "/home/dirk/miniconda3/envs/pyclesperanto/lib/python3.9/site-packages/napari/layers/base/base.py", line 675, in _update_dims
    self.refresh()
  File "/home/dirk/miniconda3/envs/pyclesperanto/lib/python3.9/site-packages/napari/layers/base/base.py", line 1172, in refresh
    self.set_view_slice()
  File "/home/dirk/miniconda3/envs/pyclesperanto/lib/python3.9/site-packages/napari/layers/base/base.py", line 922, in set_view_slice
    self._set_view_slice()
  File "/home/dirk/miniconda3/envs/pyclesperanto/lib/python3.9/site-packages/napari/layers/image/image.py", line 678, in _set_view_slice
    image = self.data[image_indices]
  File "/home/dirk/miniconda3/envs/pyclesperanto/lib/python3.9/site-packages/pyclesperanto_prototype/_tier0/_array_operators.py", line 305, in __getitem__
    result = range(self, start_x=x_range.start, stop_x=x_range.stop, step_x=x_range.step,
  File "/home/dirk/miniconda3/envs/pyclesperanto/lib/python3.9/site-packages/pyclesperanto_prototype/_tier0/_plugin_function.py", line 71, in worker_function
    return function(*bound.args, **bound.kwargs)
  File "/home/dirk/miniconda3/envs/pyclesperanto/lib/python3.9/site-packages/pyclesperanto_prototype/_tier1/_range.py", line 61, in range
    execute(__file__, 'range_x.cl', 'range', destination.shape, parameters)
  File "/home/dirk/miniconda3/envs/pyclesperanto/lib/python3.9/site-packages/pyclesperanto_prototype/_tier0/_execute.py", line 3, in execute
    return Backend.get_instance().get().execute(anchor, opencl_kernel_filename, kernel_name, global_size, parameters, prog, constants, image_size_independent_kernel_compilation, device)
  File "/home/dirk/miniconda3/envs/pyclesperanto/lib/python3.9/site-packages/pyclesperanto_prototype/_tier0/_opencl_backend.py", line 41, in execute
    return execute(anchor, opencl_kernel_filename, kernel_name, global_size, parameters, prog, constants, image_size_independent_kernel_compilation, device)
  File "/home/dirk/miniconda3/envs/pyclesperanto/lib/python3.9/site-packages/pyclesperanto_prototype/_tier0/_opencl_execute.py", line 322, in execute
    prog.run_kernel(kernel_name, tuple(global_size[::-1]), None, *arguments)
  File "/home/dirk/miniconda3/envs/pyclesperanto/lib/python3.9/site-packages/pyclesperanto_prototype/_tier0/_program.py", line 34, in run_kernel
    self._kernel_dict[name](
  File "/home/dirk/miniconda3/envs/pyclesperanto/lib/python3.9/site-packages/pyopencl/__init__.py", line 896, in kernel_call
    return self._enqueue(self, queue, global_size, local_size, *args, **kwargs)
  File "<pyopencl invoker for 'range'>", line 7, in enqueue_knl_range
pyopencl._cl.LogicError: clSetKernelArg failed: INVALID_ARG_SIZE - when processing arg#13 (1-based): 

Just to be sure I don't have anything wrong in my environment, I made a new environment based on the installation instructions in the readme.
The version of napari, the assistant and numpy in this environment are:
napari (version = 0.4.14, source = pypi)
napari-pyclesperanto-assistant (version = 0.15.4, source = pypi)
numpy (version = 1.22.2, source = conda-forge)

This is a MRE to mimic what is wrong:

# use the new environment to run the following:

import numpy as np
import napari

random_array = np.random.random((500,500,500))
test = napari.Viewer()
test.add_image(random_array)
test.dims.ndisplay = 3

# in the napari viewer:
# 1) open the assistant
# 2) select any operation (remove noise for example)
# 3) the error appears and no operation is performed

Hopefully I'm not doing anything wrong here. If you need more information about this issue, please let me know.
Thank you in advance for the help, and also thank you for creating such a nice tool!

@haesleinhuepf
Copy link
Member

Hi @DirkRemmers ,

I can run the outlined procedure on my computer (with an NVidia RTX 3050 Ti mobile, 4 GB RAM) with no issues. I presume it is a hardware issue on your side. Would you mind executing this code, e.g. from a Jupyter notebook and posting its output here?

import pyclesperanto_prototype as cle
print(cle.cl_info())

Best,
Robert

@DirkRemmers
Copy link
Author

Hi Robert,

Thank you for the quick reply. The output is the following:

EXTENSIONS:cl_khr_global_int32_base_atomics cl_khr_global_int32_extended_atomics cl_khr_local_int32_base_atomics cl_khr_local_int32_extended_atomics cl_khr_fp64 cl_khr_3d_image_writes cl_khr_byte_addressable_store cl_khr_icd cl_khr_gl_sharing cl_nv_compiler_options cl_nv_device_attribute_query cl_nv_pragma_unroll cl_nv_copy_opts cl_nv_create_buffer cl_khr_int64_base_atomics cl_khr_int64_extended_atomics cl_khr_device_uuid cl_khr_pci_bus_info
EXTENSIONS_WITH_VERSION:[<pyopencl._cl.NameVersion object at 0x7fdad05c9a70>, <pyopencl._cl.NameVersion object at 0x7fdb74649930>, <pyopencl._cl.NameVersion object at 0x7fdb74649cb0>, <pyopencl._cl.NameVersion object at 0x7fdb74649970>, <pyopencl._cl.NameVersion object at 0x7fdb74649070>, <pyopencl._cl.NameVersion object at 0x7fdad04c7e70>, <pyopencl._cl.NameVersion object at 0x7fdad04851f0>, <pyopencl._cl.NameVersion object at 0x7fdad03a68b0>, <pyopencl._cl.NameVersion object at 0x7fdad04dc4b0>, <pyopencl._cl.NameVersion object at 0x7fdad04c7930>, <pyopencl._cl.NameVersion object at 0x7fdad04dc6b0>, <pyopencl._cl.NameVersion object at 0x7fdad05cd8b0>, <pyopencl._cl.NameVersion object at 0x7fdad05cdef0>, <pyopencl._cl.NameVersion object at 0x7fdad0373e70>, <pyopencl._cl.NameVersion object at 0x7fdad0373830>, <pyopencl._cl.NameVersion object at 0x7fdad1119070>, <pyopencl._cl.NameVersion object at 0x7fdad0519ef0>, <pyopencl._cl.NameVersion object at 0x7fdad05198f0>]
HOST_TIMER_RESOLUTION:0
NAME:NVIDIA CUDA
NUMERIC_VERSION:12582912
PROFILE:FULL_PROFILE
VENDOR:NVIDIA Corporation
VERSION:OpenCL 3.0 CUDA 11.4.189


    NVIDIA GeForce RTX 3060 Laptop GPU
       ADDRESS_BITS:64
       ATOMIC_FENCE_CAPABILITIES:19
       ATOMIC_MEMORY_CAPABILITIES:17
       ATTRIBUTE_ASYNC_ENGINE_COUNT_NV:2
       AVAILABLE:1
       AVAILABLE_ASYNC_QUEUES_AMD:None
       BOARD_NAME_AMD:None
       BUILT_IN_KERNELS:
       BUILT_IN_KERNELS_WITH_VERSION:[]
       COMPILER_AVAILABLE:1
       COMPUTE_CAPABILITY_MAJOR_NV:8
       COMPUTE_CAPABILITY_MINOR_NV:6
       DEVICE_ENQUEUE_CAPABILITIES:140720308486144
       DOUBLE_FP_CONFIG:63
       DRIVER_VERSION:470.103.01
       ENDIAN_LITTLE:1
       ERROR_CORRECTION_SUPPORT:0
       EXECUTION_CAPABILITIES:1
       EXTENSIONS:cl_khr_global_int32_base_atomics cl_khr_global_int32_extended_atomics cl_khr_local_int32_base_atomics cl_khr_local_int32_extended_atomics cl_khr_fp64 cl_khr_3d_image_writes cl_khr_byte_addressable_store cl_khr_icd cl_khr_gl_sharing cl_nv_compiler_options cl_nv_device_attribute_query cl_nv_pragma_unroll cl_nv_copy_opts cl_nv_create_buffer cl_khr_int64_base_atomics cl_khr_int64_extended_atomics cl_khr_device_uuid cl_khr_pci_bus_info
       EXTENSIONS_WITH_VERSION:[<pyopencl._cl.NameVersion object at 0x7fdad0567af0>, <pyopencl._cl.NameVersion object at 0x7fdad05c9a70>, <pyopencl._cl.NameVersion object at 0x7fdb74649930>, <pyopencl._cl.NameVersion object at 0x7fdb74649cb0>, <pyopencl._cl.NameVersion object at 0x7fdb74649970>, <pyopencl._cl.NameVersion object at 0x7fdad04851f0>, <pyopencl._cl.NameVersion object at 0x7fdad03a68b0>, <pyopencl._cl.NameVersion object at 0x7fdad04c7e70>, <pyopencl._cl.NameVersion object at 0x7fdad04c7930>, <pyopencl._cl.NameVersion object at 0x7fdb74649070>, <pyopencl._cl.NameVersion object at 0x7fdad04dc4b0>, <pyopencl._cl.NameVersion object at 0x7fdad04dc6b0>, <pyopencl._cl.NameVersion object at 0x7fdad05cd8b0>, <pyopencl._cl.NameVersion object at 0x7fdad05cdef0>, <pyopencl._cl.NameVersion object at 0x7fdad0373e70>, <pyopencl._cl.NameVersion object at 0x7fdad0373830>, <pyopencl._cl.NameVersion object at 0x7fdad1119070>, <pyopencl._cl.NameVersion object at 0x7fdad0519ef0>]
       EXT_MEM_PADDING_IN_BYTES_QCOM:None
       GENERIC_ADDRESS_SPACE_SUPPORT:0
       GFXIP_MAJOR_AMD:None
       GFXIP_MINOR_AMD:None
       GLOBAL_FREE_MEMORY_AMD:None
       GLOBAL_MEM_CACHELINE_SIZE:128
       GLOBAL_MEM_CACHE_SIZE:860160
       GLOBAL_MEM_CACHE_TYPE:2
       GLOBAL_MEM_CHANNELS_AMD:None
       GLOBAL_MEM_CHANNEL_BANKS_AMD:None
       GLOBAL_MEM_CHANNEL_BANK_WIDTH_AMD:None
       GLOBAL_MEM_SIZE:6235422720
       GLOBAL_VARIABLE_PREFERRED_TOTAL_SIZE:0
       GPU_OVERLAP_NV:1
       HALF_FP_CONFIG:None
       HOST_UNIFIED_MEMORY:0
       ILS_WITH_VERSION:[]
       IL_VERSION:
       IMAGE2D_MAX_HEIGHT:32768
       IMAGE2D_MAX_WIDTH:32768
       IMAGE3D_MAX_DEPTH:16384
       IMAGE3D_MAX_HEIGHT:16384
       IMAGE3D_MAX_WIDTH:16384
       IMAGE_MAX_ARRAY_SIZE:2048
       IMAGE_MAX_BUFFER_SIZE:268435456
       IMAGE_SUPPORT:1
       INTEGRATED_MEMORY_NV:0
       KERNEL_EXEC_TIMEOUT_NV:1
       LINKER_AVAILABLE:1
       LOCAL_MEM_BANKS_AMD:None
       LOCAL_MEM_SIZE:49152
       LOCAL_MEM_SIZE_PER_COMPUTE_UNIT_AMD:None
       LOCAL_MEM_TYPE:1
       MAX_CLOCK_FREQUENCY:1425
       MAX_COMPUTE_UNITS:30
       MAX_CONSTANT_ARGS:9
       MAX_CONSTANT_BUFFER_SIZE:65536
       MAX_GLOBAL_VARIABLE_SIZE:0
       MAX_MEM_ALLOC_SIZE:1558855680
       MAX_NUM_SUB_GROUPS:0
       MAX_ON_DEVICE_EVENTS:0
       MAX_ON_DEVICE_QUEUES:0
       MAX_PARAMETER_SIZE:4352
       MAX_PIPE_ARGS:0
       MAX_READ_IMAGE_ARGS:256
       MAX_READ_WRITE_IMAGE_ARGS:0
       MAX_SAMPLERS:32
       MAX_WORK_GROUP_SIZE:1024
       MAX_WORK_GROUP_SIZE_AMD:None
       MAX_WORK_ITEM_DIMENSIONS:3
       MAX_WORK_ITEM_SIZES:[1024, 1024, 64]
       MAX_WRITE_IMAGE_ARGS:32
       MEM_BASE_ADDR_ALIGN:4096
       ME_VERSION_INTEL:None
       MIN_DATA_TYPE_ALIGN_SIZE:128
       NAME:NVIDIA GeForce RTX 3060 Laptop GPU
       NATIVE_VECTOR_WIDTH_CHAR:1
       NATIVE_VECTOR_WIDTH_DOUBLE:1
       NATIVE_VECTOR_WIDTH_FLOAT:1
       NATIVE_VECTOR_WIDTH_HALF:0
       NATIVE_VECTOR_WIDTH_INT:1
       NATIVE_VECTOR_WIDTH_LONG:1
       NATIVE_VECTOR_WIDTH_SHORT:1
       NON_UNIFORM_WORK_GROUP_SUPPORT:0
       NUMERIC_VERSION:12582912
       NUM_SIMULTANEOUS_INTEROPS_INTEL:None
       OPENCL_C_ALL_VERSIONS:[<pyopencl._cl.NameVersion object at 0x7fdad079bcf0>, <pyopencl._cl.NameVersion object at 0x7fdad03b52f0>, <pyopencl._cl.NameVersion object at 0x7fdb7c22a1b0>, <pyopencl._cl.NameVersion object at 0x7fdad05198f0>]
       OPENCL_C_FEATURES:[<pyopencl._cl.NameVersion object at 0x7fdad05c27f0>, <pyopencl._cl.NameVersion object at 0x7fdad05c25f0>, <pyopencl._cl.NameVersion object at 0x7fdad0513970>, <pyopencl._cl.NameVersion object at 0x7fdad3148b70>]
       OPENCL_C_VERSION:OpenCL C 1.2 
       PAGE_SIZE_QCOM:None
       PARTITION_AFFINITY_DOMAIN:[0]
       PARTITION_MAX_SUB_DEVICES:1
       PARTITION_PROPERTIES:[0]
       PARTITION_TYPE:[0]
       PCIE_ID_AMD:None
       PCI_BUS_ID_NV:1
       PCI_DOMAIN_ID_NV:0
       PCI_SLOT_ID_NV:0
       PIPE_MAX_ACTIVE_RESERVATIONS:0
       PIPE_MAX_PACKET_SIZE:0
       PIPE_SUPPORT:0
       PLATFORM:<pyopencl.Platform 'NVIDIA CUDA' at 0x5563ffad82f0>
       PREFERRED_CONSTANT_BUFFER_SIZE_AMD:None
       PREFERRED_GLOBAL_ATOMIC_ALIGNMENT:0
       PREFERRED_INTEROP_USER_SYNC:0
       PREFERRED_LOCAL_ATOMIC_ALIGNMENT:0
       PREFERRED_PLATFORM_ATOMIC_ALIGNMENT:0
       PREFERRED_VECTOR_WIDTH_CHAR:1
       PREFERRED_VECTOR_WIDTH_DOUBLE:1
       PREFERRED_VECTOR_WIDTH_FLOAT:1
       PREFERRED_VECTOR_WIDTH_HALF:0
       PREFERRED_VECTOR_WIDTH_INT:1
       PREFERRED_VECTOR_WIDTH_LONG:1
       PREFERRED_VECTOR_WIDTH_SHORT:1
       PREFERRED_WORK_GROUP_SIZE_AMD:None
       PREFERRED_WORK_GROUP_SIZE_MULTIPLE:32
       PRINTF_BUFFER_SIZE:None
       PROFILE:FULL_PROFILE
       PROFILING_TIMER_OFFSET_AMD:None
       PROFILING_TIMER_RESOLUTION:1000
       QUEUE_ON_DEVICE_MAX_SIZE:0
       QUEUE_ON_DEVICE_PREFERRED_SIZE:0
       QUEUE_ON_DEVICE_PROPERTIES:0
       QUEUE_ON_HOST_PROPERTIES:3
       QUEUE_PROPERTIES:3
       REFERENCE_COUNT:1
       REGISTERS_PER_BLOCK_NV:65536
       SIMD_INSTRUCTION_WIDTH_AMD:None
       SIMD_PER_COMPUTE_UNIT_AMD:None
       SIMD_WIDTH_AMD:None
       SIMULTANEOUS_INTEROPS_INTEL:None
       SINGLE_FP_CONFIG:191
       SPIR_VERSIONS:None
       SUB_GROUP_INDEPENDENT_FORWARD_PROGRESS:0
       SVM_CAPABILITIES:1
       THREAD_TRACE_SUPPORTED_AMD:None
       TOPOLOGY_AMD:None
       TYPE:4
       VENDOR:NVIDIA Corporation
       VENDOR_ID:4318
       VERSION:OpenCL 3.0 CUDA
       WARP_SIZE_NV:32
       WAVEFRONT_WIDTH_AMD:None
       WORK_GROUP_COLLECTIVE_FUNCTIONS_SUPPORT:0




Current device: NVIDIA GeForce RTX 3060 Laptop GPU

Thank you,
Dirk

@DirkRemmers
Copy link
Author

DirkRemmers commented Jun 22, 2022

Hi Robert,

You are probably very busy, but I wanted to ask you if you have any clue how I can fix this?

Thanks,
Dirk

@haesleinhuepf
Copy link
Member

Hi @DirkRemmers ,

I would love to help, but unfortunately I cannot reproduce the issue. I can only recommend updating drivers and setting up a fresh conda environment with recent napari and clesperanto versions. It might also be interesting to see what happens when processing a 10x10x10 large image.

I hope that helps! Let me know if there are any updates or insights.

Best,
Robert

@carladan
Copy link

Hi Robert and Dirk,

I am experiencing the similar problems as Dirk if I want to process 3D images in the napari viewer. I created a new environment and installed the recent napari and clesperanto versions.

I tried it on a 10x10x10 large image and get the same error as with any other 3D image, and no operation is performed:
LogicError: clSetKernelArg failed: INVALID_ARG_SIZE - when processing arg#13 (1-based):

The output after executing cle.cl_info()) in a jupyter notebook is the following:

NVIDIA CUDA
EXTENSIONS:cl_khr_global_int32_base_atomics cl_khr_global_int32_extended_atomics cl_khr_local_int32_base_atomics cl_khr_local_int32_extended_atomics cl_khr_fp64 cl_khr_3d_image_writes cl_khr_byte_addressable_store cl_khr_icd cl_khr_gl_sharing cl_nv_compiler_options cl_nv_device_attribute_query cl_nv_pragma_unroll cl_nv_copy_opts cl_nv_create_buffer cl_khr_int64_base_atomics cl_khr_int64_extended_atomics cl_khr_device_uuid cl_khr_pci_bus_info
EXTENSIONS_WITH_VERSION:[<pyopencl._cl.NameVersion object at 0x7f3b379c1bb0>, <pyopencl._cl.NameVersion object at 0x7f3b379c1bf0>, <pyopencl._cl.NameVersion object at 0x7f3b379c1c30>, <pyopencl._cl.NameVersion object at 0x7f3b379c1c70>, <pyopencl._cl.NameVersion object at 0x7f3b379c1cb0>, <pyopencl._cl.NameVersion object at 0x7f3b379c1d30>, <pyopencl._cl.NameVersion object at 0x7f3b379c1d70>, <pyopencl._cl.NameVersion object at 0x7f3b379c1db0>, <pyopencl._cl.NameVersion object at 0x7f3b379c1df0>, <pyopencl._cl.NameVersion object at 0x7f3b379c1cf0>, <pyopencl._cl.NameVersion object at 0x7f3b379c1e30>, <pyopencl._cl.NameVersion object at 0x7f3b379c1e70>, <pyopencl._cl.NameVersion object at 0x7f3b379c1eb0>, <pyopencl._cl.NameVersion object at 0x7f3b379c1ef0>, <pyopencl._cl.NameVersion object at 0x7f3b379c1f30>, <pyopencl._cl.NameVersion object at 0x7f3b379c1f70>, <pyopencl._cl.NameVersion object at 0x7f3b379c1fb0>, <pyopencl._cl.NameVersion object at 0x7f3b379c4030>]
HOST_TIMER_RESOLUTION:0
NAME:NVIDIA CUDA
NUMERIC_VERSION:12582912
PROFILE:FULL_PROFILE
VENDOR:NVIDIA Corporation
VERSION:OpenCL 3.0 CUDA 11.4.231

    NVIDIA GeForce RTX 3090
       ADDRESS_BITS:64
       ATOMIC_FENCE_CAPABILITIES:19
       ATOMIC_MEMORY_CAPABILITIES:17
       ATTRIBUTE_ASYNC_ENGINE_COUNT_NV:2
       AVAILABLE:1
       AVAILABLE_ASYNC_QUEUES_AMD:None
       BOARD_NAME_AMD:None
       BUILT_IN_KERNELS:
       BUILT_IN_KERNELS_WITH_VERSION:[]
       COMPILER_AVAILABLE:1
       COMPUTE_CAPABILITY_MAJOR_NV:8
       COMPUTE_CAPABILITY_MINOR_NV:6
       DEVICE_ENQUEUE_CAPABILITIES:140728898420736
       DOUBLE_FP_CONFIG:63
       DRIVER_VERSION:470.129.06
       ENDIAN_LITTLE:1
       ERROR_CORRECTION_SUPPORT:0
       EXECUTION_CAPABILITIES:1
       EXTENSIONS:cl_khr_global_int32_base_atomics cl_khr_global_int32_extended_atomics cl_khr_local_int32_base_atomics cl_khr_local_int32_extended_atomics cl_khr_fp64 cl_khr_3d_image_writes cl_khr_byte_addressable_store cl_khr_icd cl_khr_gl_sharing cl_nv_compiler_options cl_nv_device_attribute_query cl_nv_pragma_unroll cl_nv_copy_opts cl_nv_create_buffer cl_khr_int64_base_atomics cl_khr_int64_extended_atomics cl_khr_device_uuid cl_khr_pci_bus_info
       EXTENSIONS_WITH_VERSION:[<pyopencl._cl.NameVersion object at 0x7f3b379c1c30>, <pyopencl._cl.NameVersion object at 0x7f3b379c1c70>, <pyopencl._cl.NameVersion object at 0x7f3b379c1cb0>, <pyopencl._cl.NameVersion object at 0x7f3b379c1d30>, <pyopencl._cl.NameVersion object at 0x7f3b379c1d70>, <pyopencl._cl.NameVersion object at 0x7f3b379c1df0>, <pyopencl._cl.NameVersion object at 0x7f3b379c1cf0>, <pyopencl._cl.NameVersion object at 0x7f3b379c1e30>, <pyopencl._cl.NameVersion object at 0x7f3b379c1e70>, <pyopencl._cl.NameVersion object at 0x7f3b379c1db0>, <pyopencl._cl.NameVersion object at 0x7f3b379c1eb0>, <pyopencl._cl.NameVersion object at 0x7f3b379c1ef0>, <pyopencl._cl.NameVersion object at 0x7f3b379c1f30>, <pyopencl._cl.NameVersion object at 0x7f3b379c1f70>, <pyopencl._cl.NameVersion object at 0x7f3b379c1fb0>, <pyopencl._cl.NameVersion object at 0x7f3b379c40b0>, <pyopencl._cl.NameVersion object at 0x7f3b379c4070>, <pyopencl._cl.NameVersion object at 0x7f3b379c4030>]
       EXT_MEM_PADDING_IN_BYTES_QCOM:None
       GENERIC_ADDRESS_SPACE_SUPPORT:0
       GFXIP_MAJOR_AMD:None
       GFXIP_MINOR_AMD:None
       GLOBAL_FREE_MEMORY_AMD:None
       GLOBAL_MEM_CACHELINE_SIZE:128
       GLOBAL_MEM_CACHE_SIZE:2351104
       GLOBAL_MEM_CACHE_TYPE:2
       GLOBAL_MEM_CHANNELS_AMD:None
       GLOBAL_MEM_CHANNEL_BANKS_AMD:None
       GLOBAL_MEM_CHANNEL_BANK_WIDTH_AMD:None
       GLOBAL_MEM_SIZE:25444024320
       GLOBAL_VARIABLE_PREFERRED_TOTAL_SIZE:0
       GPU_OVERLAP_NV:1
       HALF_FP_CONFIG:None
       HOST_UNIFIED_MEMORY:0
       ILS_WITH_VERSION:[]
       IL_VERSION:
       IMAGE2D_MAX_HEIGHT:32768
       IMAGE2D_MAX_WIDTH:32768
       IMAGE3D_MAX_DEPTH:16384
       IMAGE3D_MAX_HEIGHT:16384
       IMAGE3D_MAX_WIDTH:16384
       IMAGE_MAX_ARRAY_SIZE:2048
       IMAGE_MAX_BUFFER_SIZE:268435456
       IMAGE_SUPPORT:1
       INTEGRATED_MEMORY_NV:0
       KERNEL_EXEC_TIMEOUT_NV:1
       LINKER_AVAILABLE:1
       LOCAL_MEM_BANKS_AMD:None
       LOCAL_MEM_SIZE:49152
       LOCAL_MEM_SIZE_PER_COMPUTE_UNIT_AMD:None
       LOCAL_MEM_TYPE:1
       MAX_CLOCK_FREQUENCY:1740
       MAX_COMPUTE_UNITS:82
       MAX_CONSTANT_ARGS:9
       MAX_CONSTANT_BUFFER_SIZE:65536
       MAX_GLOBAL_VARIABLE_SIZE:0
       MAX_MEM_ALLOC_SIZE:6361006080
       MAX_NUM_SUB_GROUPS:0
       MAX_ON_DEVICE_EVENTS:0
       MAX_ON_DEVICE_QUEUES:0
       MAX_PARAMETER_SIZE:4352
       MAX_PIPE_ARGS:0
       MAX_READ_IMAGE_ARGS:256
       MAX_READ_WRITE_IMAGE_ARGS:0
       MAX_SAMPLERS:32
       MAX_WORK_GROUP_SIZE:1024
       MAX_WORK_GROUP_SIZE_AMD:None
       MAX_WORK_ITEM_DIMENSIONS:3
       MAX_WORK_ITEM_SIZES:[1024, 1024, 64]
       MAX_WRITE_IMAGE_ARGS:32
       MEM_BASE_ADDR_ALIGN:4096
       ME_VERSION_INTEL:None
       MIN_DATA_TYPE_ALIGN_SIZE:128
       NAME:NVIDIA GeForce RTX 3090
       NATIVE_VECTOR_WIDTH_CHAR:1
       NATIVE_VECTOR_WIDTH_DOUBLE:1
       NATIVE_VECTOR_WIDTH_FLOAT:1
       NATIVE_VECTOR_WIDTH_HALF:0
       NATIVE_VECTOR_WIDTH_INT:1
       NATIVE_VECTOR_WIDTH_LONG:1
       NATIVE_VECTOR_WIDTH_SHORT:1
       NON_UNIFORM_WORK_GROUP_SUPPORT:0
       NUMERIC_VERSION:12582912
       NUM_SIMULTANEOUS_INTEROPS_INTEL:None
       OPENCL_C_ALL_VERSIONS:[<pyopencl._cl.NameVersion object at 0x7f3b379c41b0>, <pyopencl._cl.NameVersion object at 0x7f3b379c41f0>, <pyopencl._cl.NameVersion object at 0x7f3b379c4230>, <pyopencl._cl.NameVersion object at 0x7f3b379c4270>]
       OPENCL_C_FEATURES:[<pyopencl._cl.NameVersion object at 0x7f3b379c42f0>, <pyopencl._cl.NameVersion object at 0x7f3b379c4330>, <pyopencl._cl.NameVersion object at 0x7f3b379c4370>, <pyopencl._cl.NameVersion object at 0x7f3b379c43b0>]
       OPENCL_C_VERSION:OpenCL C 1.2 
       PAGE_SIZE_QCOM:None
       PARTITION_AFFINITY_DOMAIN:[0]
       PARTITION_MAX_SUB_DEVICES:1
       PARTITION_PROPERTIES:[0]
       PARTITION_TYPE:[0]
       PCIE_ID_AMD:None
       PCI_BUS_ID_NV:193
       PCI_DOMAIN_ID_NV:0
       PCI_SLOT_ID_NV:0
       PIPE_MAX_ACTIVE_RESERVATIONS:0
       PIPE_MAX_PACKET_SIZE:0
       PIPE_SUPPORT:0
       PLATFORM:<pyopencl.Platform 'NVIDIA CUDA' at 0x557e7dbc50d0>
       PREFERRED_CONSTANT_BUFFER_SIZE_AMD:None
       PREFERRED_GLOBAL_ATOMIC_ALIGNMENT:0
       PREFERRED_INTEROP_USER_SYNC:0
       PREFERRED_LOCAL_ATOMIC_ALIGNMENT:0
       PREFERRED_PLATFORM_ATOMIC_ALIGNMENT:0
       PREFERRED_VECTOR_WIDTH_CHAR:1
       PREFERRED_VECTOR_WIDTH_DOUBLE:1
       PREFERRED_VECTOR_WIDTH_FLOAT:1
       PREFERRED_VECTOR_WIDTH_HALF:0
       PREFERRED_VECTOR_WIDTH_INT:1
       PREFERRED_VECTOR_WIDTH_LONG:1
       PREFERRED_VECTOR_WIDTH_SHORT:1
       PREFERRED_WORK_GROUP_SIZE_AMD:None
       PREFERRED_WORK_GROUP_SIZE_MULTIPLE:32
       PRINTF_BUFFER_SIZE:None
       PROFILE:FULL_PROFILE
       PROFILING_TIMER_OFFSET_AMD:None
       PROFILING_TIMER_RESOLUTION:1000
       QUEUE_ON_DEVICE_MAX_SIZE:0
       QUEUE_ON_DEVICE_PREFERRED_SIZE:0
       QUEUE_ON_DEVICE_PROPERTIES:0
       QUEUE_ON_HOST_PROPERTIES:3
       QUEUE_PROPERTIES:3
       REFERENCE_COUNT:1
       REGISTERS_PER_BLOCK_NV:65536
       SIMD_INSTRUCTION_WIDTH_AMD:None
       SIMD_PER_COMPUTE_UNIT_AMD:None
       SIMD_WIDTH_AMD:None
       SIMULTANEOUS_INTEROPS_INTEL:None
       SINGLE_FP_CONFIG:191
       SPIR_VERSIONS:None
       SUB_GROUP_INDEPENDENT_FORWARD_PROGRESS:0
       SVM_CAPABILITIES:1
       THREAD_TRACE_SUPPORTED_AMD:None
       TOPOLOGY_AMD:None
       TYPE:4
       VENDOR:NVIDIA Corporation
       VENDOR_ID:4318
       VERSION:OpenCL 3.0 CUDA
       WARP_SIZE_NV:32
       WAVEFRONT_WIDTH_AMD:None
       WORK_GROUP_COLLECTIVE_FUNCTIONS_SUPPORT:0

Current device: NVIDIA GeForce RTX 3090

Executing pyclesperanto_prototype functions via jupyter notebook works, however.

I appreciate any further ideas how to solve the issue. Thanks for your help!

Best, Carla

@haesleinhuepf
Copy link
Member

Hi @carladan and @DirkRemmers ,

if you call cle-operations from a Jupyter notebook and afterwards open napari from the notebook e.g. using the following code, does it work then?

import napari
napari.Viewer()

And one more question: what operating system (versions) are you using?

Best,
Robert

@haesleinhuepf
Copy link
Member

haesleinhuepf commented Jun 28, 2022

And one more idea: Can you go to the menu Tools > Utilities > Change CL device and tell me what devices are available in that pulldown?

Also, if you install cupy, and select it in that pulldown, does it work then?

conda install cupy -c conda-forge

@DirkRemmers
Copy link
Author

Hi @haesleinhuepf and @carladan,

I just made a fresh environment and tested Roberts suggestions. My operating system is Ubuntu 20.04.4 LTS

Before installing cupy:

When using a 10x10x10 image, I still get the same error as before, just as @carladan pointed out.
I can perform cle-operations and add the results to the napari viewer as in this small script.

import napari
import numpy as np
import pyclesperanto_prototype as cle

# visualize a random image
image = np.random.rand(10,10,10)
viewer = napari.Viewer()
viewer.add_image(image)
viewer.dims.ndisplay = 3

# perform the gaussian blur on the image outside the napari viewer
cle_image = cle.push(image)
cle_result = cle.gaussian_blur(cle_image, sigma_x=2, sigma_y=2, sigma_z=2)
result = cle.pull(cle_result)

# add result to the viewer
viewer.add_image(result)

However, when I try and use the assistant within napari to do the same operation, I get the previously mentioned error.

When I try to get to the Change CL device option, it is missing from the menu you pointed to. The only option that looks similar to what we need is the 'Tools > Utilities > Select GPU (clesperanto)' option. However, when I click this, nothing happens.

I want to let you know that I can see multiple options to open the assistant in napari as well. I see the options 'clEsperanto: Assistant', 'napari-assistant: Assistant' and 'clEsperanto' within the 'Plugins' menu, while I see 'Tools > Utilities > Assistant (na)' as well.

I tried all of these options, and I do get some error messages with some of them:

  1. `Plugins > clEsperanto: Assistant' gives me a warning and does not open any sidebar with all assisant options. The error is:
Traceback (most recent call last):
  File "/home/dirk/miniconda3/envs/cle_39/lib/python3.9/site-packages/napari/_qt/menus/plugins_menu.py", line 97, in _add_toggle_widget
    self._win.add_plugin_dock_widget(*key)
  File "/home/dirk/miniconda3/envs/cle_39/lib/python3.9/site-packages/napari/_qt/qt_main_window.py", line 699, in add_plugin_dock_widget
    wdg = _instantiate_dock_widget(Widget, self._qt_viewer.viewer)
  File "/home/dirk/miniconda3/envs/cle_39/lib/python3.9/site-packages/napari/_qt/qt_main_window.py", line 1301, in _instantiate_dock_widget
    return wdg_cls(**kwargs)
  File "/home/dirk/miniconda3/envs/cle_39/lib/python3.9/site-packages/napari_pyclesperanto_assistant/_gui/_Assistant.py", line 26, in __init__
    select_gpu()
TypeError: select_gpu() missing 1 required positional argument: 'viewer'
  1. 'Plugins > napari-assistant: Assistant' opens the assistant sidebar without any issues, but again, any functions will return the error mentioned at the start of this issue.

  2. 'Plugins > clEsperanto' is a menu that contains a number of operations. When I try to run any of these, the same error mesage as the start of the issue occurs.

  3. 'Tools > Utilities > Assistant (na) does open a sidebar, but also throws the same error mesage as the start of the issue when any operations are tried.

After installing cupy:
Unfortunately, all situations described earlier are exactly the same.

Hopefully this testing contains some value 😄
Please let me know if I can do anything else, and thanks for your help!

Dirk

@carladan
Copy link

Hi @haesleinhuepf and @DirkRemmers,
thanks for the quick answers!

I followed your instructions and opened napari from the notebook after calling cle-operations in the code. The operations work in the Jupyter notebook, but not in the napari viewer.

If I go to the menu Tools > Utilities > Select GPU I can only select my standard GPU (NVIDIA GeForce RTX 3090).
After installing CuPy, I am able to select cupy backend (experimental) as GPU, but it still does not perform any operations in the viewer. It does however not even show the error messages in the napari viewer anymore, it just doesn't do anything.

My operating system is Ubuntu 20.04.4 LTS as well.

I hope this helps! Thanks very much for your input.

Carla

@psobolewskiPhD
Copy link
Contributor

@DirkRemmers

  1. `Plugins > clEsperanto: Assistant' gives me a warning and does not open any sidebar with all assisant options. The error is:

This sounds exactly like what I got here #59
What version of napari-assistant and napari-pyclesperanto-assistant do you have?
I would assume your fresh env would have the latest versions, but maybe somehow not?

@DirkRemmers
Copy link
Author

DirkRemmers commented Jun 29, 2022

Hi @psobolewskiPhD ,

My versions are:
napari-assistant : 0.3.8 (conda-forge) (latest release)
napari-pyclesperanto-assistant : 0.18.0 (conda-forge) (this is not the latest version listed on git)

When I update the napari-pyclesperanto-assistant to 0.18.2 (latest version) via pip, the menu does show up. However, I still get the error message mentioned at the start of this issue.

Interestingly, I now do get the possibility to select the cupy backend (experimental) now. When I do this and try to run all possible assistants the following happens:

  1. Plugins > clEsperanto: Assistant now does open up. When trying to run any function, I get the following error message:
Traceback (most recent call last):
  File "/home/dirk/miniconda3/envs/cle_39/lib/python3.9/site-packages/napari_assistant/_gui/_category_widget.py", line 266, in _show_result
    layer = next(x for x in viewer.layers if isinstance(x.metadata, dict) and x.metadata.get(OP_ID) == op_id)
StopIteration

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/dirk/miniconda3/envs/cle_39/lib/python3.9/site-packages/napari_assistant/_gui/_Assistant.py", line 185, in _on_item_clicked
    self._activate(CATEGORIES.get(item.text()))
  File "/home/dirk/miniconda3/envs/cle_39/lib/python3.9/site-packages/napari_assistant/_gui/_Assistant.py", line 219, in _activate
    layer = gui()
  File "/home/dirk/miniconda3/envs/cle_39/lib/python3.9/site-packages/magicgui/widgets/_function_gui.py", line 318, in __call__
    value = self._function(*bound.args, **bound.kwargs)
  File "/home/dirk/miniconda3/envs/cle_39/lib/python3.9/site-packages/napari_assistant/_gui/_category_widget.py", line 431, in gui_function
    result_layer = _show_result(
  File "/home/dirk/miniconda3/envs/cle_39/lib/python3.9/site-packages/napari_assistant/_gui/_category_widget.py", line 281, in _show_result
    layer = add_layer(data, **kwargs)
  File "/home/dirk/miniconda3/envs/cle_39/lib/python3.9/site-packages/napari/components/viewer_model.py", line 745, in add_image
    layer = Image(data, **kwargs)
  File "/home/dirk/miniconda3/envs/cle_39/lib/python3.9/site-packages/napari/layers/image/image.py", line 365, in __init__
    self._update_dims()
  File "/home/dirk/miniconda3/envs/cle_39/lib/python3.9/site-packages/napari/layers/base/base.py", line 674, in _update_dims
    self.refresh()  # This call is need for invalidate cache of extent in LayerList. If you remove it pleas ad another workaround.
  File "/home/dirk/miniconda3/envs/cle_39/lib/python3.9/site-packages/napari/layers/base/base.py", line 1178, in refresh
    self.set_view_slice()
  File "/home/dirk/miniconda3/envs/cle_39/lib/python3.9/site-packages/napari/layers/base/base.py", line 928, in set_view_slice
    self._set_view_slice()
  File "/home/dirk/miniconda3/envs/cle_39/lib/python3.9/site-packages/napari/layers/image/image.py", line 742, in _set_view_slice
    image = self.data[image_indices]
  File "/home/dirk/miniconda3/envs/cle_39/lib/python3.9/site-packages/pyclesperanto_prototype/_tier0/_array_operators.py", line 323, in __getitem__
    result = arange(self, start_x=x_range.start, stop_x=x_range.stop, step_x=x_range.step,
  File "/home/dirk/miniconda3/envs/cle_39/lib/python3.9/site-packages/pyclesperanto_prototype/_tier0/_plugin_function.py", line 71, in worker_function
    return function(*bound.args, **bound.kwargs)
  File "/home/dirk/miniconda3/envs/cle_39/lib/python3.9/site-packages/pyclesperanto_prototype/_tier1/_range.py", line 81, in range
    execute(__file__, 'range_x.cl', 'range', destination.shape, parameters)
  File "/home/dirk/miniconda3/envs/cle_39/lib/python3.9/site-packages/pyclesperanto_prototype/_tier0/_execute.py", line 3, in execute
    return Backend.get_instance().get().execute(anchor, opencl_kernel_filename, kernel_name, global_size, parameters, prog, constants, image_size_independent_kernel_compilation, device)
  File "/home/dirk/miniconda3/envs/cle_39/lib/python3.9/site-packages/pyclesperanto_prototype/_tier0/_cuda_backend.py", line 42, in execute
    return execute(anchor, opencl_kernel_filename, kernel_name, global_size, parameters, constants)
  File "/home/dirk/miniconda3/envs/cle_39/lib/python3.9/site-packages/pyclesperanto_prototype/_tier0/_cuda_execute.py", line 395, in execute
    raise TypeError(
TypeError: other types than float and int aren`t supported yet for parameters start_z : 0 . 
function rangetype <class 'numpy.int64'>

  1. Plugins > napari-assistant: Assistant opens the assistant sidebar without any issues, however, the same error message as above occurs when running any function.

  2. Plugins > clEsperanto is a menu that contains a number of operations. When I try to run voronoi otsu labeling, the same error mesage as the start of the issue occurs.

  3. Tools > Utilities > Assistant (na) shows the same error as mentioned above when trying to run any function.

Unfortunately updating to 0.18.2 did not solve the issue, good suggestion though!

Thanks for all the help everyone!
Dirk

@haesleinhuepf
Copy link
Member

My operating system is Ubuntu 20.04.4 LTS as well.

@DirkRemmers @carladan you are obviously both running Linux. I guess that's no random coincidence. Which Nvidia driver version do you have installed?

@DirkRemmers
Copy link
Author

My nvidia driver version is 510.73.05

@carladan
Copy link

Hi,
my Nvidia driver version is 470.129.06.

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

No branches or pull requests

4 participants