Install Phold for Intel XPU computing

Using the xpu for phold... it speeds things up!

This approach deliberately keeps PyTorch XPU installed by pip and installs phold without dependency resolution so pip or mamba do not accidentally replace the XPU-enabled PyTorch wheel.

Install phold in a mamba environment on WSL with Intel XPU

0. Windows-side prerequisite

Install the current Intel Arc/Iris/Xe Windows graphics driver on the Windows host, then reboot.

In Windows PowerShell, confirm the GPU driver:

Get-CimInstance Win32_VideoController |
  Select-Object Name,PNPDeviceID,DriverVersion,DriverDate

For example, on an Intel Arc 140V system you may see something like:

Intel(R) Arc(TM) 140V GPU ... DriverVersion 32.0.101.xxxx

PyTorch’s XPU documentation says the Intel GPU driver should be installed before using PyTorch on Intel GPUs. (PyTorch Documentation)


1. Check WSL can see the GPU bridge

In WSL:

ls -l /dev/dxg

You should see /dev/dxg. If not, update WSL from Windows PowerShell:

wsl --update
wsl --shutdown

Then reopen WSL and check again.


2. Install Intel GPU runtime packages inside WSL

On Ubuntu 24.04 WSL, install the Intel OpenCL / Level Zero runtime packages:

sudo apt update

sudo apt install -y \
  clinfo \
  libze1 \
  libze-intel-gpu1 \
  intel-opencl-icd \
  intel-gsc \
  intel-metrics-discovery

Intel’s WSL GPU workflow requires the Windows host driver plus Linux-side GPU software/runtime packages inside WSL. (Intel) The Intel client GPU package set for Ubuntu includes Level Zero, OpenCL, metrics discovery, and GSC components such as libze-intel-gpu1, libze1, intel-opencl-icd, intel-metrics-discovery, and intel-gsc. (dgpu-docs.osgc.infra-host.com)

Check the installed versions:

apt-cache policy \
  intel-opencl-icd \
  libze1 \
  libze-intel-gpu1 \
  intel-gsc \
  intel-metrics-discovery

Optional check with OpenCL:

clinfo | egrep -i 'platform name|device name|device type|intel' | head -120

3. Create a clean mamba environment

mamba create -n phold_xpu python=3.12 pip -y
mamba activate phold_xpu

4. Install non-PyTorch dependencies with mamba

mamba install -y -c conda-forge -c bioconda \
  foldseek=10.941cd33 \
  biopython \
  alive-progress \
  datasets \
  requests \
  pyarrow \
  pandas \
  loguru \
  pyyaml \
  click \
  sentencepiece \
  transformers \
  pyrodigal-gv \
  numpy \
  pycirclize \
  h5py \
  protobuf \
  tqdm

5. Install PyTorch XPU with pip

Install PyTorch from the XPU wheel index:

pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/xpu

This follows the PyTorch XPU installation route using the XPU wheel index. (PyTorch Documentation)

Check that PyTorch sees the XPU:

python - <<'PY'
import torch

print("torch:", torch.__version__)
print("xpu available:", torch.xpu.is_available())
print("xpu count:", torch.xpu.device_count() if torch.xpu.is_available() else 0)

if torch.xpu.is_available():
    for i in range(torch.xpu.device_count()):
        print(f"[{i}]:", torch.xpu.get_device_properties(i))
PY

Expected output should include something like:

xpu available: True
xpu count: 1
[0]: _XpuDeviceProperties(name='Intel(R) Graphics ...')

6. Install phold without changing the dependency stack

For the released package:

pip install --no-deps phold

For a local development checkout:

git clone https://github.com/gbouras13/phold.git
cd phold
pip install --no-deps -e .

The --no-deps is important. It prevents pip from altering the carefully installed mamba/PyTorch XPU environment.


7. Sanity checks

which phold
phold --help
foldseek version

Then check PyTorch again, to make sure the XPU wheel was not replaced:

python - <<'PY'
import torch
print("torch:", torch.__version__)
print("torch file:", torch.__file__)
print("xpu available:", torch.xpu.is_available())
print("xpu count:", torch.xpu.device_count() if torch.xpu.is_available() else 0)
if torch.xpu.is_available():
    print(torch.xpu.get_device_name(0))
PY

8. Minimal XPU test

This verifies that PyTorch can allocate on the XPU:

cat > xpu_test.py <<'PY'
import torch

print("torch:", torch.__version__, flush=True)
print("xpu available:", torch.xpu.is_available(), flush=True)

a = torch.ones((10, 10), device="xpu")
torch.xpu.synchronize()

print(a[0, 0].cpu(), flush=True)
print("done", flush=True)
PY

python xpu_test.py

On some WSL + Intel XPU systems, this may complete computation but hang during process exit (GitHub Issue). If that happens, check from another terminal:

ps -eo pid,ppid,stat,wchan:40,cmd | egrep 'xpu_test|python|PID'

A hang in vmbus_teardown_gpadl is a lower-level WSL/Intel GPU runtime issue, not a phold install issue.


9. Run phold

For XPU-enabled inference:

phold run \
  -i input.gbk \
  -o phold_output \
  -t 8 \
  -p sample_prefix

For CPU-only mode, which is safer on WSL systems where XPU teardown hangs:

phold run \
  -i input.gbk \
  -o phold_output_cpu \
  -t 8 \
  -p sample_prefix \
  --cpu

Full copy-paste version

# Create environment
mamba create -n phold_xpu python=3.12 pip -y
mamba activate phold_xpu

# Install non-PyTorch dependencies
mamba install -y -c conda-forge -c bioconda \
  foldseek=10.941cd33 \
  biopython alive-progress datasets requests pyarrow pandas loguru pyyaml \
  click sentencepiece transformers pyrodigal-gv numpy pycirclize h5py \
  protobuf tqdm

# Install PyTorch XPU
pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/xpu

# Install phold without dependency resolution
pip install --no-deps phold

# Check XPU
python - <<'PY'
import torch
print("torch:", torch.__version__)
print("xpu available:", torch.xpu.is_available())
print("xpu count:", torch.xpu.device_count() if torch.xpu.is_available() else 0)
if torch.xpu.is_available():
    print(torch.xpu.get_device_properties(0))
PY

# Check tools
phold --help
foldseek version