Intel® Developer Cloud
Help connecting to or getting started on Intel® Developer Cloud
201 Discussions

Pytorch with intel gpu

kukevarius
Beginner
1,389 Views

I am unable to find how to get pytorch to work with the intel max 1100 gpu.

 

I dont know what device type i should select in the following code, and when selecting anything else than cuda or cpu it justs says something along the lines of pytorch was not linked/compiled with x

code that i want to run on the intel gpu:

 

from diffusers import DiffusionPipeline
import torch

pipe = DiffusionPipeline.from_pretrained("stabilityai/stable-diffusion-xl-base-1.0", torch_dtype=torch.float16, use_safetensors=True, variant="fp16")
pipe.to("cuda")

# if using torch < 2.0
# pipe.enable_xformers_memory_efficient_attention()

prompt = "An astronaut riding a green horse"

images = pipe(prompt=prompt).images[0]

 

 

in this case pipe.to("cuda") does not work because no cuda on intel gpu's but xpu hpu opencl all of them dont work + I have no idea which I am even supposed to select to use the gpu.

I am using the free cloud developer service so I do not have root access.
xpu-smi discovery returns all 8 installed intel max 1100 gpu's.

Could you please provide the necessary dependencies and instructions for making this work? Thanks in advance.

Labels (2)
0 Kudos
1 Solution
Wan_Intel
Moderator
1,140 Views

 

Hi kukevarius,

Thanks for the information.

 

We regret to inform you that to use Intel® Extension for PyTorch, it is required to install Intel® oneAPI Base Toolkit.

 

For your information, Intel® Developer Cloud Virtual Machine Instance does not provide sudo access while Intel® Developer Cloud Bare Metal Instance does provide sudo access.

 

Sorry for the inconvenience and thank you for your support.

 

 

Regards,

Wan

 

View solution in original post

0 Kudos
9 Replies
Wan_Intel
Moderator
1,345 Views

Hi kukevarius,

Thanks for reaching out to us.

 

To install Intel® Extension for PyTorch on your instance, you may refer to the installation steps at Intel® Extension for PyTorch Installation Guide. Once the installation succeeds, you may visit Intel® Extension for PyTorch Quick Start Guide and Intel® Extension for PyTorch Examples to start using the extension in your code. For more information, please refer to Intel® Extension for PyTorch Documentation.

 

Meanwhile, could you please provide the following information with us?

  • Severity: Low: General guidance/Medium: System impaired/High: System down/Critical: Business-critical system down
  • Backup Contact (Name/Number/Timezone):
  • System Type: BMaas - Bare Metal / Virtual Machine
  • System ID:
  • Reservation Start Date and End Date:
  • Important Data Stored: Yes / No
  • IDC Support Team Can Access The Instance?: Yes / No

 

 

Regards,

Wan

 

0 Kudos
kukevarius
Beginner
1,311 Views

Hello Wan,

Severity: Low, general guidance

System type: Free Intel Developer Cloud Machine

System ID: ubb083db7da1ae7febbf5cf6a4045f19@idc-training-gpu-compute-04

Important Data Stored: No

IDC Support Team Can Access The Instance: Yes

 

So i have installed the latest xpu/gpu library with this command,

python -m pip install torch==2.1.0.post2 torchvision==0.16.0.post2 torchaudio==2.1.0.post2 intel-extension-for-pytorch==2.1.30.post0 oneccl_bind_pt==2.1.300+xpu --extra-index-url https://pytorch-extension.intel.com/release-whl/stable/xpu/us/

and i have adapted my code according to the Quick Start Guide,

import torch
from diffusers import DiffusionPipeline
import intel_extension_for_pytorch as ipex

# Load the pipeline
pipe = DiffusionPipeline.from_pretrained(
    "stabilityai/stable-diffusion-xl-base-1.0",
    torch_dtype=torch.float16,
    use_safetensors=True,
    variant="fp16"
)

# Move pipeline to Intel Max GPU
pipe.to("xpu")

prompt = "An astronaut riding a green horse"
images = pipe(prompt=prompt).images[0]

I tried this already and I keep getting an error similar to this,

(intel_gpu) ubb083db7da1ae7febbf5cf6a4045f19@idc-training-gpu-compute-04:~$ python intel_demo.py 
/home/ubb083db7da1ae7febbf5cf6a4045f19/intel_gpu/lib/python3.9/site-packages/diffusers/models/transformers/transformer_2d.py:34: FutureWarning: `Transformer2DModelOutput` is deprecated and will be removed in version 1.0.0. Importing `Transformer2DModelOutput` from `diffusers.models.transformer_2d` is deprecated and this will be removed in a future version. Please use `from diffusers.models.modeling_outputs import Transformer2DModelOutput`, instead.
  deprecate("Transformer2DModelOutput", "1.0.0", deprecation_message)
Traceback (most recent call last):
  File "/home/ubb083db7da1ae7febbf5cf6a4045f19/intel_demo.py", line 3, in <module>
    import intel_extension_for_pytorch as ipex
  File "/home/ubb083db7da1ae7febbf5cf6a4045f19/intel_gpu/lib/python3.9/site-packages/intel_extension_for_pytorch/__init__.py", line 95, in <module>
    from .utils._proxy_module import *
  File "/home/ubb083db7da1ae7febbf5cf6a4045f19/intel_gpu/lib/python3.9/site-packages/intel_extension_for_pytorch/utils/_proxy_module.py", line 2, in <module>
    import intel_extension_for_pytorch._C
ImportError: /opt/intel/oneapi/mkl/2025.0/lib/libmkl_sycl_data_fitting.so.4: undefined symbol: _ZN4sycl3_V17handler30verifyUsedKernelBundleInternalENS0_6detail11string_viewE

 

I do not know how to solve this since i followed the installation guide and i can not find any fixes that work online. 

0 Kudos
Wan_Intel
Moderator
1,236 Views

Hi kukevarius,

Thanks for sharing the information with us.

 

Referring to the encountered error: ImportError: /opt/intel/oneapi/mkl/2025.0/lib/libmkl_sycl_data_fitting.so.4 it might be due to an incompatible version of Intel® Extension for PyTorch and Intel® oneAPI Base Toolkit.

 

For your information, different versions of Intel® Extension for PyTorch require different versions of Intel® oneAPI Base Toolkit. Could you please try the steps below and see if the issue can be resolved?

 

  1. Select Platform (CPU or GPU), Version of Intel® Extension for PyTorch, Operating System, and Package via the following link:
    https://intel.github.io/intel-extension-for-pytorch/#installation?request=platform
  2. Follow the installation instructions to re-install Intel® Extension for PyTorch and Intel® oneAPI Base Toolkit

 

 

Regards,

Wan

 

0 Kudos
kukevarius
Beginner
1,165 Views

Hello wan,

I use the free machine you get from intel so i do not have root access, meaning that i can not change the openAPI Base Toolkit version.

I have tried every single version of Intel extension for pytorch from,

https://intel.github.io/intel-extension-for-pytorch/#installation?request=platform

I selected GPU --> 'i tried all versions' --> Linux/WSL2 --> pip --> generic python.

 

But every single one of them gives exactly the same error:

(pytorch-8) (/opt/intel/oneapi/intelpython) ubb083db7da1ae7febbf5cf6a4045f19@idc-training-gpu-compute-30:~$ python test.py 
Traceback (most recent call last):
  File "/home/ubb083db7da1ae7febbf5cf6a4045f19/test.py", line 1, in <module>
    import torch
  File "/home/ubb083db7da1ae7febbf5cf6a4045f19/pytorch-8/lib/python3.9/site-packages/torch/__init__.py", line 192, in <module>
    from torch._C import *  # noqa: F403
ImportError: /home/ubb083db7da1ae7febbf5cf6a4045f19/pytorch-8/lib/python3.9/site-packages/torch/lib/libtorch_cpu.so: undefined symbol: iJIT_NotifyEvent

 

The code that I am using to test if the installations work is as follows:

 

import torch
from diffusers import DiffusionPipeline
import intel_extension_for_pytorch as ipex

# Load the pipeline
pipe = DiffusionPipeline.from_pretrained(
    "stabilityai/stable-diffusion-xl-base-1.0",
    torch_dtype=torch.float16,
    use_safetensors=True,
    variant="fp16"
)

# Move pipeline to Intel Max GPU
pipe.to("xpu")

prompt = "An astronaut riding a green horse"
images = pipe(prompt=prompt).images[0]

This code returns the aforementioned error.



I do not know what I am doing wrong.

0 Kudos
Wan_Intel
Moderator
1,141 Views

 

Hi kukevarius,

Thanks for the information.

 

We regret to inform you that to use Intel® Extension for PyTorch, it is required to install Intel® oneAPI Base Toolkit.

 

For your information, Intel® Developer Cloud Virtual Machine Instance does not provide sudo access while Intel® Developer Cloud Bare Metal Instance does provide sudo access.

 

Sorry for the inconvenience and thank you for your support.

 

 

Regards,

Wan

 

0 Kudos
kukevarius
Beginner
1,127 Views

Hello Wan,

 

Thank you for the explanation.

Is there any other way to use the GPU's available on the free cloud machine? (8x Intel max 1100 datacenter gpu, from xpu-smi discovery)

 

Regards, Kukevarius 

 

0 Kudos
Wan_Intel
Moderator
1,090 Views

Hi kukevarius,

For your information, to use Intel® Extension for PyTorch with Intel® GPU, sudo access to install the required packages is needed.

 

On another note, Intel® Developer Cloud Virtual Machine Instance does not provide sudo access, therefore, it is not possible to use Intel® Extension for PyTorch on Intel® Developer Cloud Virtual Machine Instance with Intel® GPUs.

 

On the other hand, a workaround would be requesting an Intel® Developer Cloud Bare Metal Instance which provides sudo access.

 

 

Regards,

Wan

 

0 Kudos
kukevarius
Beginner
1,069 Views

Thank you for the help Wan.

0 Kudos
Wan_Intel
Moderator
870 Views

Hi kukevarius,

If you need additional information from Intel, please submit a new question as this thread will no longer be monitored.

 

 

Regards,

Wan

 

0 Kudos
Reply