Skip to content

Instantly share code, notes, and snippets.

@AlbertVeli
Last active September 20, 2024 23:38
Show Gist options
  • Save AlbertVeli/8bf70de44daec9d7169f71c6a4a56fbf to your computer and use it in GitHub Desktop.
Save AlbertVeli/8bf70de44daec9d7169f71c6a4a56fbf to your computer and use it in GitHub Desktop.
Debian/Ubuntu Intel OpenCL installation
# To make a long story short
# Install apt source
curl -fsSL https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB | sudo gpg --dearmor --output /usr/share/keyrings/intel-sw-products.gpg
echo "deb [signed-by=/usr/share/keyrings/intel-sw-products.gpg] https://apt.repos.intel.com/oneapi all main" | sudo tee /etc/apt/sources.list.d/intel-oneapi.list
apt update
# Install oneapi
apt install intel-oneapi-runtime-opencl intel-basekit clinfo opencl-headers
# source environment variables, put this in .bashrc
source /opt/intel/oneapi/setvars.sh
# Compile john
$ sudo apt install opencl-headers
$ cd JohnTheRipper/src
$ ./configure LDFLAGS=-L/opt/intel/opencl
...
OpenCL support ..................................... yes
$ ldconfig -v
...
libOpenCL.so.1 -> libOpenCL.so.1.2
make clean && make -sj8
$ cd ../run
$ ./john -list:opencl-devices
Platform #0 name: Intel(R) FPGA Emulation Platform for OpenCL(TM), version: OpenCL 1.2 Intel(R) FPGA SDK for OpenCL(TM), Version 20.3
...
Platform #1 name: Intel(R) OpenCL, version: OpenCL 3.0 LINUX
...
Platform #2 name: Portable Computing Language, version: OpenCL 2.0 pocl 1.8 Linux, None+Asserts, RELOC, LLVM 11.1.0, SLEEF, DISTRO, POCL_DEBUG
# The second device is fastest in my case and can be specified with -device=2
# Benchmark for 60 seconds
$ ./john -form=raw-MD5-opencl --device=2 -test=60
...
Device 2: 13th Gen Intel(R) Core(TM) i7-1355U
Benchmarking: raw-MD5-opencl [MD5 OpenCL]... Binary Build log: Device build started
Options used by backend compiler:
Device build done
Reload Program Binary Object.
Binary Build log: Device build started
Options used by backend compiler:
Device build done
Reload Program Binary Object.
LWS=512 GWS=4194304 DONE
Raw: 32806K c/s real, 9181K c/s virtual
# This is not very fast. The GPU is from a Lenovo Thinkpad T16 Gen 2 and the GPU is called
# Intel® Iris® Xe Graphics
# Architecture Xe
# Codename Raptor Lake-P
# Benchmark hashcat
$ cd hashcat
$ make
$ ./hashcat -D 1 -b -m 0
hashcat (v6.2.6-827-g46ce637d3) starting in benchmark mode
...
OpenCL API (OpenCL 1.2 Intel(R) FPGA SDK for OpenCL(TM), Version 20.3) - Platform #1 [Intel(R) Corporation]
===========================================================================================================
* Device #1: Intel(R) FPGA Emulation Device, skipped
OpenCL API (OpenCL 3.0 LINUX) - Platform #2 [Intel(R) Corporation]
==================================================================
* Device #2: 13th Gen Intel(R) Core(TM) i7-1355U, 15843/31751 MB (7937 MB allocatable), 12MCU
OpenCL API (OpenCL 2.0 pocl 1.8 Linux, None+Asserts, RELOC, LLVM 11.1.0, SLEEF, DISTRO, POCL_DEBUG) - Platform #3 [The pocl project]
=====================================================================================================================================
* Device #3: pthread-13th Gen Intel(R) Core(TM) i7-1355U, skipped
Benchmark relevant options:
===========================
* --backend-devices-virtual=1
* --opencl-device-types=1
* --optimized-kernel-enable
-------------------
* Hash-Mode 0 (MD5)
-------------------
Speed.#2.........: 369.7 MH/s (33.67ms) @ Accel:1024 Loops:1024 Thr:1 Vec:8
# If I interpret the result correctly hashcat is faster but it's still slow.
# I have seen benchmarks on this same card in Windows that is 10 times faster
# with hashcat. Something is wrong. It should be possible to get it to run faster.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment