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

Error in GPU selection #36

Open
Pacomito opened this issue Feb 6, 2023 · 7 comments
Open

Error in GPU selection #36

Pacomito opened this issue Feb 6, 2023 · 7 comments

Comments

@Pacomito
Copy link

Pacomito commented Feb 6, 2023

Hello,

Thank you very much for this software.

I just installed the plugin from napari and tried to run the Semantic Segmentation (APOC) with various 2D example data from napari.

When I click on 'run' after selecting the image and label I get this error :

File ~/anaconda3/envs/napari-env/lib/python3.9/site-packages/pyclesperanto_prototype/_tier0/_device.py:43, in get_device()
     41 def get_device() -> Device:
     42     """Get the current device GPU class."""
---> 43     return _current_device._instance or select_device()
        _current_device._instance = None

File ~/anaconda3/envs/napari-env/lib/python3.9/site-packages/pyclesperanto_prototype/_tier0/_device.py:72, in select_device(name=None, dev_type=None, score_key=None)
     68 except:
     69     pass
---> 72 device = filter_devices(name, dev_type, score_key)[-1]
        name = None
        dev_type = None
        score_key = None
     73 if _current_device._instance and device == _current_device._instance.device:
     74     return _current_device._instance

IndexError: list index out of range


Do you have any idea why and how I could debug it ?

Thank you in advance,
Pacome

@haesleinhuepf
Copy link
Owner

Hi @Pacomito ,

interesting issue! Could you please run this code in Python or a Jupyter notebook and paste its output?

import pyclesperanto_prototype as cle

print(cle.available_device_names())
print(cle.select_device())

Thanks!

Best,
Robert

@Pacomito
Copy link
Author

Pacomito commented Feb 7, 2023

Thanks for your answer,
Here is the output :

>>> print(cle.available_device_names())
cl_get_gt_device(): error, unknown device: 9bc8
[]
>>> print(cle.select_device())
cl_get_gt_device(): error, unknown device: 9bc8
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/localadmin/anaconda3/envs/napari-env/lib/python3.9/site-packages/pyclesperanto_prototype/_tier0/_device.py", line 72, in select_device
    device = filter_devices(name, dev_type, score_key)[-1]
IndexError: list index out of range
>>> 

BTW, I am on Ubuntu 22.04.1 LTS with Processor Intel® Core™ i5-10500 CPU @ 3.10GHz × 12 and graphic card Mesa Intel® UHD Graphics 630 (CML GT2)

@haesleinhuepf
Copy link
Owner

Ok, can you try to install the graphics cards driver and / or the ICD loader? See hints here:

https://github.com/clEsperanto/pyclesperanto_prototype#troubleshooting-graphics-cards-drivers

@Pacomito
Copy link
Author

Pacomito commented Feb 7, 2023

Now it works with:

>>> import pyclesperanto_prototype as cle

>>> 
>>> print(cle.available_device_names())
['pthread-Intel(R) Core(TM) i5-10500 CPU @ 3.10GHz']
>>> print(cle.select_device())
<pthread-Intel(R) Core(TM) i5-10500 CPU @ 3.10GHz on Platform: Portable Computing Language (2 refs)>

However, if i now open napari, load the sample image 'Lund' , make a label, select Semantic segmentation (APOC) and then run on 'Train' like below

image

napari closes with 'Segmentation error', here are the console logs:

WARNING: Warning: Ignoring XDG_SESSION_TYPE=wayland on Gnome. Use QT_QPA_PLATFORM=wayland to run on Wayland anyway.
09:28:16 WARNING Warning: Ignoring XDG_SESSION_TYPE=wayland on Gnome. Use QT_QPA_PLATFORM=wayland to run on Wayland anyway.
/home/localadmin/anaconda3/envs/napari-env/lib/python3.9/site-packages/jupyter_client/__init__.py:23: UserWarning: Could not import submodules
  warnings.warn("Could not import submodules")
Requirement already satisfied: torch in ./anaconda3/envs/napari-env/lib/python3.9/site-packages (1.8.1+cpu)
Requirement already satisfied: torchvision in ./anaconda3/envs/napari-env/lib/python3.9/site-packages (0.9.1+cpu)
Requirement already satisfied: torchaudio in ./anaconda3/envs/napari-env/lib/python3.9/site-packages (0.8.1)
Requirement already satisfied: grad-cam==1.4.6 in ./anaconda3/envs/napari-env/lib/python3.9/site-packages (1.4.6)
Requirement already satisfied: tqdm in ./anaconda3/envs/napari-env/lib/python3.9/site-packages (from grad-cam==1.4.6) (4.64.1)
Requirement already satisfied: scikit-learn in ./anaconda3/envs/napari-env/lib/python3.9/site-packages (from grad-cam==1.4.6) (1.2.1)
Requirement already satisfied: ttach in ./anaconda3/envs/napari-env/lib/python3.9/site-packages (from grad-cam==1.4.6) (0.0.3)
Requirement already satisfied: numpy in ./anaconda3/envs/napari-env/lib/python3.9/site-packages (from grad-cam==1.4.6) (1.23.5)
Requirement already satisfied: matplotlib in ./anaconda3/envs/napari-env/lib/python3.9/site-packages (from grad-cam==1.4.6) (3.6.3)
Requirement already satisfied: opencv-python in ./anaconda3/envs/napari-env/lib/python3.9/site-packages (from grad-cam==1.4.6) (4.5.5.62)
Requirement already satisfied: Pillow in ./anaconda3/envs/napari-env/lib/python3.9/site-packages (from grad-cam==1.4.6) (9.4.0)
Requirement already satisfied: typing-extensions in ./anaconda3/envs/napari-env/lib/python3.9/site-packages (from torch) (4.4.0)
Requirement already satisfied: fonttools>=4.22.0 in ./anaconda3/envs/napari-env/lib/python3.9/site-packages (from matplotlib->grad-cam==1.4.6) (4.38.0)
Requirement already satisfied: kiwisolver>=1.0.1 in ./anaconda3/envs/napari-env/lib/python3.9/site-packages (from matplotlib->grad-cam==1.4.6) (1.4.4)
Requirement already satisfied: python-dateutil>=2.7 in ./anaconda3/envs/napari-env/lib/python3.9/site-packages (from matplotlib->grad-cam==1.4.6) (2.8.2)
Requirement already satisfied: cycler>=0.10 in ./anaconda3/envs/napari-env/lib/python3.9/site-packages (from matplotlib->grad-cam==1.4.6) (0.11.0)
Requirement already satisfied: contourpy>=1.0.1 in ./anaconda3/envs/napari-env/lib/python3.9/site-packages (from matplotlib->grad-cam==1.4.6) (1.0.7)
Requirement already satisfied: pyparsing>=2.2.1 in ./anaconda3/envs/napari-env/lib/python3.9/site-packages (from matplotlib->grad-cam==1.4.6) (3.0.9)
Requirement already satisfied: packaging>=20.0 in ./anaconda3/envs/napari-env/lib/python3.9/site-packages (from matplotlib->grad-cam==1.4.6) (23.0)
Requirement already satisfied: scipy>=1.3.2 in ./anaconda3/envs/napari-env/lib/python3.9/site-packages (from scikit-learn->grad-cam==1.4.6) (1.10.0)
Requirement already satisfied: threadpoolctl>=2.0.0 in ./anaconda3/envs/napari-env/lib/python3.9/site-packages (from scikit-learn->grad-cam==1.4.6) (3.1.0)
Requirement already satisfied: joblib>=1.1.1 in ./anaconda3/envs/napari-env/lib/python3.9/site-packages (from scikit-learn->grad-cam==1.4.6) (1.2.0)
Requirement already satisfied: six>=1.5 in ./anaconda3/envs/napari-env/lib/python3.9/site-packages (from python-dateutil>=2.7->matplotlib->grad-cam==1.4.6) (1.16.0)
09:28:18 WARNING Java backend is not available. This could be due to a missing dependency (jpype).
train PixelClassifier
num images 1
object annotation value 2
features gaussian_blur=1 difference_of_gaussian=1 laplace_box_of_gaussian_blur=1 sobel_of_gaussian_blur=1
depth 2
num trees 100
file /home/localadmin/PixelClassifier.cl
annotation shape (100, 256, 256)
Erreur de segmentation (core dumped)

@haesleinhuepf
Copy link
Owner

Can you try if the classifier works from python, e.g. using this notebook?
https://github.com/haesleinhuepf/apoc/blob/main/demo/demo_object_segmenter.ipynb

@Pacomito
Copy link
Author

Pacomito commented Feb 7, 2023

Thank you for sticking with this issue,

Indeed running the script on jupyter notebook did not throw any error and the model managed to train.

I don't know then why napari crashes. I can run other modules such as CellPose or Stardist for example for nuclei detection without problems.

@haesleinhuepf
Copy link
Owner

Yes, for me it's also hard to debug remotely. If you have time, try different versions of napari (0.4.15, 0.4.17), qt and/or magicgui. And let us know if you figure out what's the problem

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

2 participants