Installation
If you already have fulfilled the requirements for offloading to the GPU, the installation should be as easy as opening up a shell and typing
For AMD or Intel GPUs use OpenCL backend
pip install powerfit-em[opencl]
For NVIDIA GPUs use CUDA backend
pip install powerfit-em[cuda13x]
If you are starting from a clean system, follow the instructions for your particular operating system as described below, they should get you up and running in no time.
Linux
Linux systems usually already include a Python3.11 or greater distribution. First make sure the Python header files and pip and git are available by opening up a terminal and typing for Debian and Ubuntu systems
sudo apt update
sudo apt install python3-dev python3-pip git build-essential
If you are working on Fedora, this should be replaced by
sudo yum install python3-devel python3-pip git development-c development-tools
Steps for running on AMD or Intel GPU
If you want to use the GPU version of PowerFit, you need to install the drivers for your GPU. For OpenCL, install the OpenCL development libraries and the OpenCL-enabled package. After installing the drivers, you need to install the OpenCL development libraries. For Debian/Ubuntu, this can be done by runningsudo apt install ocl-icd-opencl-dev ocl-icd-libopencl1
sudo dnf install opencl-headers ocl-icd-devel
pip install powerfit-em[opencl]
python -c 'import pyopencl as cl;from pyvkfft.fft import rfftn; ps=cl.get_platforms();print(ps);print(ps[0].get_devices())'
# Should print the name of your GPU
Steps for running on NVIDIA GPU
For the CUDA backend, make sure the CUDA toolkit/runtime is available and that `nvcc` can be found via `CUDA_PATH`, `CUDA_HOME`, or `PATH`. Without `nvcc`, CUDA support is not built and CUDA mode will not work. Install the CUDA-enabled package withpip install powerfit-em[cuda13x] # For CUDA version 13.x
# or
pip install powerfit-em[cuda12x] # For CUDA version 12.x
python -c 'import cupy; print(cupy.cuda.runtime.getDeviceProperties(0)["name"]);import pyvkfft.cuda;print(pyvkfft.cuda.cuda_runtime_version());print(pyvkfft.cuda.cuda_compile_version())'
# Should print the name of your GPU and versions of CUDA runtime and compiler
Your system is now prepared, follow the general instructions here to install PowerFit.
Linux with Conda
If you do not have system admin rights, you likely cannot compile pyvkfft locally.
However, by installing powerfit in a conda environment, you can still do computations
on GPU. If you are on a Linux system and have Conda or Mamba available, follow
these instructions;
Steps for running on AMD or Intel GPU
For AMD or Intel GPUs using OpenCL you can run the following command. Note that this relies on OpenCL drivers being available system wide (under `/etc/OpenCL/vendors/`).conda create -n powerfit -c conda-forge python=3.14 ocl-icd ocl-icd-system pyopencl pyvkfft
conda activate powerfit
pip install powerfit-em[opencl]
conda create -n powerfit -c conda-forge python=3.14 ocl-icd intel-compute-runtime pyopencl pyvkfft
conda activate powerfit
pip install powerfit-em[opencl]
python -c 'import pyopencl as cl;from pyvkfft.fft import rfftn; ps=cl.get_platforms();print(ps);print(ps[0].get_devices())'
Steps for running on NVIDIA GPU
For NVIDIA GPUs using CUDA you can run the following command.mamba create -n powerfit-cuda -c conda-forge python=3.14 cupy pyvkfft cuda-version=12
mamba activate powerfit-cuda
# We do not use extra, as we want to use binary conda packages
pip install powerfit-em
python -c 'import cupy; print(cupy.cuda.runtime.getDeviceProperties(0)["name"]);import pyvkfft.cuda;print(pyvkfft.cuda.cuda_runtime_version());print(pyvkfft.cuda.cuda_compile_version())'
# Should print the name of your GPU and versions of CUDA runtime and compiler
MacOSX
First install git by following the instructions on their website, or using a package manager such as brew
brew install git
Next install pip, the Python package manager, by following the installation instructions on the website or open a terminal and type
python -m ensurepip --upgrade
To get faster score calculation, install the pyFTTW Python package in your conda environment
with conda install -c conda-forge pyfftw.
Follow the general instructions here to install PowerFit.
Windows
You can run PowerFit on your CPU by installing it in an activated Python virtual environment with:
pip install powerfit-em
You can also run powerfit on GPU with micromamba. Expand below for instructions for your specific GPU type.
AMD or Intel GPU
# In admin PowerShell
winget install Mamba.Micromamba
# reboot to apply changes
# In PowerShell
micromamba shell
micromamba create -n powerfit pyvkfft pyopencl pip
micromamba activate powerfit
pip install powerfit-em[opencl]
powerfit <map> <resolution> <pdb> --gpu
NVIDIA GPU
# In admin PowerShell
winget install Mamba.Micromamba
# reboot to apply changes
# In PowerShell
micromamba shell
micromamba create -n powerfit pyvkfft pyopencl cupy cuda-version=13 pip
micromamba activate powerfit
pip install powerfit-em[cuda13x]
powerfit <map> <resolution> <pdb> --gpu
Windows Subsystem for Linux (WSL)
You can also run powerfit in a Windows Subsystem for Linux (WSL) terminal environment by following the Linux installation instructions.
If you have an NVIDIA GPU, you can use the CUDA GPU backend after you follow the instructions in the cuda wsl guide.
Source build with native CPU optimization
By default, binary wheels are built for portability. If you install from source,
you can opt into host-CPU optimization by setting RUSTFLAGS during install.
Building from source (rather than installing the prebuilt wheel) also requires the Rust toolchain and a C-compiler.
Linux/macOS:
RUSTFLAGS="-C target-cpu=native" pip install --no-binary powerfit-em powerfit-em
Windows (requires Rust and Microsoft C++ Build Tools; "Desktop development with C++"):
$env:RUSTFLAGS="-C target-cpu=native"; pip install --no-binary powerfit-em powerfit-em
The resulting installation is specific to the current CPU and may fail on other CPUs.
In a test using six CPU cores, using the native-optimized built was ~30% faster (34s -> 26s). ``
Usage in Docker
Powerfit can be run in a Docker container.
Install docker by following the instructions.
The Docker images of PowerFit are available in the GitHub Container Registry.
Running PowerFit in a Docker container with data located at
a hypothetical /path/to/data on your machine can be done as follows
docker run --rm -ti --user $(id -u):$(id -g) \
-v /path/to/data:/data ghcr.io/haddocking/powerfit:v5.0.2 \
/data/<map> <resolution> /data/<pdb> \
-d /data/<results-dir>
<map>, <pdb>, <results-dir> use paths relative to /path/to/data.
To run tutorial example use
# cd into powerfit-tutorial repo
docker run --rm -ti --user $(id -u):$(id -g) \
-v $PWD:/data ghcr.io/haddocking/powerfit:v5.0.2 \
/data/ribosome-KsgA.map 13 /data/KsgA.pdb \
-a 20 -p 2 -d /data/run-KsgA-docker
To run on NVIDIA GPU using NVIDIA container toolkit use the CUDA image
docker run --rm -ti \
--runtime=nvidia --gpus all \
-v $PWD:/data ghcr.io/haddocking/powerfit-cuda13:v5.0.2 \
/data/ribosome-KsgA.map 13 /data/KsgA.pdb \
-a 20 -d /data/run-KsgA-docker-nv --gpu
ghcr.io/haddocking/powerfit-cuda12:v5.0.2 if you have CUDA version 12 (see nvidia-smi for version).
To run on Intel integrated graphics use
docker run --rm -ti \
--device=/dev/dri \
-v $PWD:/data ghcr.io/haddocking/powerfit:v5.0.2 \
/data/ribosome-KsgA.map 13 /data/KsgA.pdb \
-a 20 -d /data/run-KsgA-docker-nv --gpu
To run on AMD GPU use
sudo docker run --rm -ti \
--device=/dev/kfd --device=/dev/dri \
--security-opt seccomp=unconfined \
--group-add video --ipc=host \
-v $PWD:/data ghcr.io/haddocking/powerfit-rocm:v5.0.2 \
/data/ribosome-KsgA.map 13 /data/KsgA.pdb \
-a 20 -d /data/run-KsgA-docker-amd --gpu
Tested platforms
| Operating System | CPU single | CPU multi | OpenCL | CUDA |
|---|---|---|---|---|
| Linux | Yes | Yes | Yes | Yes |
| MacOSX | Yes | Yes | No | No |
| Windows (native) | Yes | Yes | Yes | Yes |
| Windows via WSL | Yes | Yes | No | Yes |
The GPU version has been successfully tested on Linux and with a Docker container for the following devices;
- NVIDIA GeForce GTX 3050
- NVIDIA GeForce RTX 4070
- AMD Radeon RX 7700 XT
- AMD Radeon RX 7800 XT
- AMD Radeon RX 7900 XTX
- Intel Iris Xe Graphics (on a Core i7-1185G7)
The integrated graphics of AMD Ryzen CPUs do not officially support OpenCL. If they do seem available in PyOpenCL be aware that this may lead to incorrect results.