dizcza/docker-hashcat

No OpenCL-compatible or CUDA-compatible platform found.

presianbg opened this issue · 5 comments

Hi,

First - thanks for the wonderful project.
I would love to have a hashcat running wuth CUDA on my laptop (Solus Linux + nvidia GTX 860M), but CUDA SDK Toolkit is not supported on this OS,

Solus ships nvidia-docker in its repo:

Name                : nvidia-docker, version: 2.5.0, release: 2
Summary             : nvidia-docker CLI wrapper
Description         : Build and run Docker containers leveraging NVIDIA GPUs
Licenses            : Apache-2.0
Component           : programming.tools
Dependencies        : docker nvidia-container-runtime 
Distribution        : Solus, Dist. Release: 1
Architecture        : x86_64, Installed Size: 861.00  B

Testing it (according to the nvidia-docker docs):

sudo docker run --rm --gpus all nvidia/cuda:11.0-base nvidia-smi
Sun Feb  7 10:49:32 2021       
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 460.39       Driver Version: 460.39       CUDA Version: 11.2     |
|-------------------------------+----------------------+----------------------+
| GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
|                               |                      |               MIG M. |
|===============================+======================+======================|
|   0  GeForce GTX 860M    On   | 00000000:01:00.0 Off |                  N/A |
| N/A   28C    P8    N/A /  N/A |     85MiB /  4046MiB |      0%      Default |
|                               |                      |                  N/A |
+-------------------------------+----------------------+----------------------+
                                                                               
+-----------------------------------------------------------------------------+
| Processes:                                                                  |
|  GPU   GI   CI        PID   Type   Process name                  GPU Memory |
|        ID   ID                                                   Usage      |
|=============================================================================|
+----------------------------------------------------------------------------

Everything so far is excellent, but when try to use the :latest branch:

nvidia-docker run -it dizcza/docker-hashcat:latest /bin/bash
root@214cbf4335c8:~# hashcat -I
hashcat (v6.1.1) starting...

* Device #1: CUDA SDK Toolkit installation NOT detected.
             CUDA SDK Toolkit installation required for proper device support and utilization
             Falling back to OpenCL Runtime

OpenCL Info:
============

OpenCL Platform ID #1
  Vendor..: NVIDIA Corporation
  Name....: NVIDIA CUDA
  Version.: OpenCL 1.2 CUDA 11.2.136

  Backend Device ID #1
    Type...........: GPU
    Vendor.ID......: 32
    Vendor.........: NVIDIA Corporation
    Name...........: GeForce GTX 860M
    Version........: OpenCL 1.2 CUDA
    Processor(s)...: 5
    Clock..........: 1019
    Memory.Total...: 4046 MB (limited to 1011 MB allocatable in one block)
    Memory.Free....: 3904 MB
    OpenCL.Version.: OpenCL C 1.2 
    Driver.Version.: 460.39

root@214cbf4335c8:~# nvidia-smi 
Sun Feb  7 10:52:37 2021       
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 460.39       Driver Version: 460.39       CUDA Version: 11.2     |
|-------------------------------+----------------------+----------------------+
| GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
|                               |                      |               MIG M. |
|===============================+======================+======================|
|   0  GeForce GTX 860M    On   | 00000000:01:00.0 Off |                  N/A |
| N/A   28C    P5    N/A /  N/A |     85MiB /  4046MiB |      0%      Default |
|                               |                      |                  N/A |
+-------------------------------+----------------------+----------------------+
                                                                               
+-----------------------------------------------------------------------------+
| Processes:                                                                  |
|  GPU   GI   CI        PID   Type   Process name                  GPU Memory |
|        ID   ID                                                   Usage      |
|=============================================================================|
+-----------------------------------------------------------------------------+
root@214cbf4335c8:~# 

And the :cuda branch:

nvidia-docker run -it dizcza/docker-hashcat:cuda /bin/bash
root@a7ae6347ba0b:~# hashcat -I
hashcat (v6.1.1) starting...

clGetPlatformIDs(): CL_PLATFORM_NOT_FOUND_KHR

ATTENTION! No OpenCL-compatible or CUDA-compatible platform found.

You are probably missing the OpenCL or CUDA runtime installation.

* AMD GPUs on Linux require this driver:
  "RadeonOpenCompute (ROCm)" Software Platform (3.1 or later)
* Intel CPUs require this runtime:
  "OpenCL Runtime for Intel Core and Intel Xeon Processors" (16.1.1 or later)
* NVIDIA GPUs require this runtime and/or driver (both):
  "NVIDIA Driver" (440.64 or later)
  "CUDA Toolkit" (9.0 or later)

Note that CUDA SDK Toolkit can't be installed on the host system :(

What am I doing wrong ?

Regards,
PY

Hi PY,

that's strange. We can at least try to squeeze the space where the error occurs and pin it down.

First of all, does hashcat run successfully the benchmark with OpenCL backend (dizcza/docker-hashcat:latest)? If yes, then possible culprits are:

  1. cuda toolkit version is not compatible with your GPU card. Try building a docker image with an older cuda version manually (6 or 7 or 8 - check out the release date of your card; but hashcat might not support old CUDA versions - need to check as well);
  2. hashcat CUDA implementation fails to work with your GPU card. If it's the case (improbable though), open an issue on hashcat github after you excluded all other possible cases;
  3. a problem with Solux running an nvidia docker container. Try running dizcza/docker-hashcat:latest from within Ubuntu.

Secondly, nvidia-smi != CUDA Toolkit.
The fact that sudo docker run --rm --gpus all nvidia/cuda:11.0-base nvidia-smi and nvidia-docker run -it dizcza/docker-hashcat:latest nvidia-smi show the same info does not tell anything about the CUDA SDK toolkit. Although it at least correctly identifies the GPU.

From the official CUDA toolkit page,

The toolkit includes GPU-accelerated libraries, debugging and optimization tools, a C/C++ compiler, and a runtime library to build and deploy your application.

nvidia-smi is definitely a part of CUDA toolkit. There should be some tests to check the correctness of CUDA toolkit installation. I don't know where to look for such tests.

It's strange however that Ubuntu docker container experiences issues to fetch the installed CUDA toolkit to your GPU card. The behavior should not depend on your host OS. I'm not familiar with Solux linux and don't know whether there are pitfalls running a docker container with access to an Nvidia GPU card.

Best,
Danylo

Hi Danylo,

Thank you for the detailed information. I will definitely check everything you suggested and get back with the results.
There is should be no problems running the docker on Solus, but you are right the my card is old and there are might be some compatibility issues.

Cheers,
PY

Hi,

  1. According to the docs my GPU (GTX 860M Maxwell) is supported :
    image

I found some inconsistency between the drivers required:

image
and

image
I believe the latter is just a typo.

  1. Using the latest branch which bundles CUDA 10.2 works fine with hashcat benchmark, but cuda still undetected:
nvidia-docker run --gpus all -it dizcza/docker-hashcat:latest /bin/bash
Password: 
root@34d67b503f89:~# hashcat -b
hashcat (v6.1.1) starting in benchmark mode...

Benchmarking uses hand-optimized kernel code by default.
You can use it in your cracking session by setting the -O option.
Note: Using optimized kernel code limits the maximum supported password length.
To disable the optimized kernel code in benchmark mode, use the -w option.

* Device #1: CUDA SDK Toolkit installation NOT detected.
             CUDA SDK Toolkit installation required for proper device support and utilization
             Falling back to OpenCL Runtime

* Device #1: WARNING! Kernel exec timeout is not disabled.
             This may cause "CL_OUT_OF_RESOURCES" or related errors.
             To disable the timeout, see: https://hashcat.net/q/timeoutpatch
nvmlDeviceGetFanSpeed(): Not Supported

OpenCL API (OpenCL 1.2 CUDA 11.2.136) - Platform #1 [NVIDIA Corporation]
========================================================================
* Device #1: GeForce GTX 860M, 3904/4046 MB (1011 MB allocatable), 5MCU

Benchmark relevant options:
===========================
* --optimized-kernel-enable

Hashmode: 0 - MD5

Speed.#1.........:  3238.9 MH/s (51.74ms) @ Accel:64 Loops:512 Thr:1024 Vec:2

Hashmode: 100 - SHA1

and for some reason it shows CUDA Version: 11.2 .

I was hoping that I'm doing something wrong, but looks like there is some issues with this GPU and Solus nvidia drivers.
My aim was for better performance with CUDA, but from what I'm reading looks like using hashcat in a docker will have its performance penalties compared to native one.

Maybe I will try to install ubuntu and test, but I doubt it work anyway.

With all this, I'm going to close the issue.

Still, I'd try to build docker images from cuda version 9 (because 10 also doesn't work for you) down to 6 (just need to change the first line FROM in the Dockerfile) until the issue disappears; if the issue doesn't disappear, then it is somewhere else. In any case, it's a simple test to check.

Sure, I have never build a docker image myself. I will try. Thank you.