intel / intel-extension-for-pytorch

A Python package for extending the official PyTorch that can easily obtain performance on Intel platform
Apache License 2.0
1.57k stars 241 forks source link

import issues missing mkl shared libarary #530

Closed nevakrien closed 7 months ago

nevakrien commented 7 months ago

Describe the bug

I am trying to get a working version on intel dev cloud i tried both whats on intels website the docker and the repos instruction both whats on the website and the repo failed from a link error (the docker randomly segfaulted)

import torch 
import intel_extension_for_pytorch as ipex

x=torch.Tensor([0.])
x.to('xpu:0')
x=x.to('xpu:0')
print("xpu works yay")
print(x)
(torch_xpu) sdp@gpunode:~$ python neva_workspace/test.py 
Traceback (most recent call last):
  File "/home/sdp/neva_workspace/test.py", line 1, in <module>
    import torch 
    ^^^^^^^^^^^^
  File "/home/sdp/.conda/envs/torch_xpu/lib/python3.11/site-packages/torch/__init__.py", line 234, in <module>
    _load_global_deps()
  File "/home/sdp/.conda/envs/torch_xpu/lib/python3.11/site-packages/torch/__init__.py", line 193, in _load_global_deps
    raise err
  File "/home/sdp/.conda/envs/torch_xpu/lib/python3.11/site-packages/torch/__init__.py", line 174, in _load_global_deps
    ctypes.CDLL(lib_path, mode=ctypes.RTLD_GLOBAL)
  File "/home/sdp/.conda/envs/torch_xpu/lib/python3.11/ctypes/__init__.py", line 376, in __init__
    self._handle = _dlopen(self._name, mode)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^
OSError: libmkl_intel_lp64.so.2: cannot open shared object file: No such file or directory
(torch_xpu) sdp@gpunode:~$ 

now I have oneapi on the server and I belive some other people tried runing c++ there so it works.

Versions

/home/sdp/.conda/envs/torch_xpu/lib/python3.11/site-packages/torchvision/io/image.py:13: UserWarning: Failed to load image Python extension: ''If you don't plan on using image functionality from torchvision.io, you can ignore this warning. Otherwise, there might be something wrong with your environment. Did you have libjpeg or libpng installed before building torchvision from source? warn( Collecting environment information... PyTorch version: 2.1.0a0+cxx11.abi PyTorch CXX11 ABI: Yes IPEX version: N/A IPEX commit: N/A Build type: N/A

OS: Ubuntu 22.04.3 LTS (x86_64) GCC version: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0 Clang version: N/A IGC version: 2023.2.0 (2023.2.0.20230721) CMake version: version 3.22.1 Libc version: glibc-2.35

Python version: 3.11.0 (main, Mar 1 2023, 18:26:19) [GCC 11.2.0] (64-bit runtime) Python platform: Linux-5.15.0-73-generic-x86_64-with-glibc2.35 Is XPU available: N/A DPCPP runtime version: 2023.2.1 MKL version: 2023.2.0 GPU models and configuration: N/A Intel OpenCL ICD version: 23.17.26241.33-647~22.04 Level Zero version: 1.3.26241.33-647~22.04

CPU: Architecture: x86_64 CPU op-mode(s): 32-bit, 64-bit Address sizes: 52 bits physical, 57 bits virtual Byte Order: Little Endian CPU(s): 224 On-line CPU(s) list: 0-223 Vendor ID: GenuineIntel Model name: Intel(R) Xeon(R) Platinum 8480+ CPU family: 6 Model: 143 Thread(s) per core: 2 Core(s) per socket: 56 Socket(s): 2 Stepping: 8 CPU max MHz: 3800.0000 CPU min MHz: 800.0000 BogoMIPS: 4000.00 Flags: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc art arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc cpuid aperfmperf tsc_known_freq pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid dca sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm 3dnowprefetch cpuid_fault epb cat_l3 cat_l2 cdp_l3 invpcid_single intel_ppin cdp_l2 ssbd mba ibrs ibpb stibp ibrs_enhanced tpr_shadow vnmi flexpriority ept vpid ept_ad fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid cqm rdt_a avx512f avx512dq rdseed adx smap avx512ifma clflushopt clwb intel_pt avx512cd sha_ni avx512bw avx512vl xsaveopt xsavec xgetbv1 xsaves cqm_llc cqm_occup_llc cqm_mbm_total cqm_mbm_local split_lock_detect avx_vnni avx512_bf16 wbnoinvd dtherm ida arat pln pts hwp hwp_act_window hwp_epp hwp_pkg_req avx512vbmi umip pku ospke waitpkg avx512_vbmi2 gfni vaes vpclmulqdq avx512_vnni avx512_bitalg tme avx512_vpopcntdq la57 rdpid bus_lock_detect cldemote movdiri movdir64b enqcmd fsrm md_clear serialize tsxldtrk pconfig arch_lbr amx_bf16 avx512_fp16 amx_tile amx_int8 flush_l1d arch_capabilities Virtualization: VT-x L1d cache: 5.3 MiB (112 instances) L1i cache: 3.5 MiB (112 instances) L2 cache: 224 MiB (112 instances) L3 cache: 210 MiB (2 instances) NUMA node(s): 2 NUMA node0 CPU(s): 0-55,112-167 NUMA node1 CPU(s): 56-111,168-223 Vulnerability Itlb multihit: Not affected Vulnerability L1tf: Not affected Vulnerability Mds: Not affected Vulnerability Meltdown: Not affected Vulnerability Mmio stale data: Not affected Vulnerability Retbleed: Not affected Vulnerability Spec store bypass: Mitigation; Speculative Store Bypass disabled via prctl and seccomp Vulnerability Spectre v1: Mitigation; usercopy/swapgs barriers and __user pointer sanitization Vulnerability Spectre v2: Mitigation; Enhanced IBRS, IBPB conditional, RSB filling, PBRSB-eIBRS SW sequence Vulnerability Srbds: Not affected Vulnerability Tsx async abort: Not affected

Versions of relevant libraries: [pip3] intel-extension-for-pytorch==2.1.10+xpu [pip3] numpy==1.26.4 [pip3] torch==2.1.0a0+cxx11.abi [pip3] torchaudio==2.1.0a0+cxx11.abi [pip3] torchvision==0.16.0a0+cxx11.abi [conda] intel-extension-for-pytorch 2.1.10+xpu pypi_0 pypi [conda] numpy 1.26.4 pypi_0 pypi [conda] torch 2.1.0a0+cxx11.abi pypi_0 pypi [conda] torchaudio 2.1.0a0+cxx11.abi pypi_0 pypi [conda] torchvision 0.16.0a0+cxx11.abi pypi_0 pypi (torch_xpu) sdp@gpunode:~$

hueyline commented 7 months ago

Hi @nevakrien, have you activated oneAPI MKL environment?

jingxu10 commented 7 months ago

ipex 2.1 should work with basekit 2024.0

nevakrien commented 7 months ago

I have and the kernal would not install basekit 2024. idk why that is its the newst ubuntu version with intel stuff. ik I was warned when sshing not to update the version (when u ssh in it would print a small doc). in the end reverting a major version of ipex (1.13) fixed it.

the linux kernal version was 5.x and my home kernal is 6.x . as far as I can tell thats the only diffrence. basekit is installed on my home pc (tho I did not make it work with my rtx 4090)

this is probably something intel should figure out but as far as using the code of the repo its unrelated

nevakrien commented 7 months ago

I have setup the one api enviorment and it specifcly listed an mkl latest sk yes.

In this case tho latest is 2023 and if I tell apt to update it I still get 2023. I also get a warning when sshing in saying "don't upgrade the kernal version"

I compared it to my home os (that runs ipex cpu quite well but has an nvidia gpu) and the major diffrence I see is that they are still on Linux 5 I am on Linux 6. Other than that they are both ubuntu x86_64 machines so it should work.