Skip to content

Fail to run example code on GPU #16

@AnouarITI

Description

@AnouarITI

I tried to run your example code snippet with Pylops-GPU:

import torch
from pylops_gpu.utils.backend import device
from pylops_gpu import Diagonal

dev = device()
print(dev)

n = int(1e6)
x = torch.ones(n, dtype=torch.float64).to(dev)
d = (torch.arange(0, n, dtype=torch.float64) + 1.).to(dev)

Dop = Diagonal(d, device=dev)

y = Dop*x

But I can see that the code is running on CPU and not GPU. when I run conda list to see installed packages it seems to me that everything is in order:

blas                      1.0                         mkl
ca-certificates           2022.2.1             haa95532_0
certifi                   2021.10.8        py39haa95532_2
cudatoolkit               10.1.243             h74a9793_0
cudnn                     7.6.5                cuda10.1_0
cupy                      8.3.0            py39hd4ca531_0
fastrlock                 0.6              py39hd77b12b_0
icc_rt                    2019.0.0             h0cc432a_1
intel-openmp              2021.4.0          haa95532_3556
joblib                    1.1.0              pyhd3eb1b0_0
mkl                       2021.4.0           haa95532_640
mkl-service               2.4.0            py39h2bbff1b_0
mkl_fft                   1.3.1            py39h277e83a_0
mkl_random                1.2.2            py39hf11a4ad_0
numpy                     1.22.2                   pypi_0    pypi
numpy-base                1.21.5           py39hc2deb75_0
openssl                   1.1.1m               h2bbff1b_0
pillow                    9.0.1                    pypi_0    pypi
pip                       21.2.4           py39haa95532_0
pylops                    1.18.0                   pypi_0    pypi
pylops-gpu                0.0.1                    pypi_0    pypi
python                    3.9.7                h6244533_1
pytorch-complex-tensor    0.0.134                  pypi_0    pypi
scikit-learn              1.0.2            py39hf11a4ad_1
scipy                     1.8.0                    pypi_0    pypi
setuptools                58.0.4           py39haa95532_0
six                       1.16.0             pyhd3eb1b0_1
sqlite                    3.37.2               h2bbff1b_0
threadpoolctl             2.2.0              pyh0d69192_0
torch                     1.10.2                   pypi_0    pypi
torchvision               0.11.3                   pypi_0    pypi
typing-extensions         4.1.1                    pypi_0    pypi
tzdata                    2021e                hda174b7_0
vc                        14.2                 h21ff451_1
vs2015_runtime            14.27.29016          h5e58377_2
wheel                     0.37.1             pyhd3eb1b0_0
wincertstore              0.2              py39haa95532_2

How can I force it to run on GPU. I already have an good GPU (Nviddia RTX 2080 TI)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions