OCR-D / ocrd_anybaseocr

DFKI Layout Detection for OCR-D
Apache License 2.0
47 stars 12 forks source link

ocrd/all:maximum not detecting GPUs #50

Closed sepastian closed 4 years ago

sepastian commented 4 years ago

Inside the Docker container ocrd/all:maximum, the processor ocrd-anybaseocr-dewarp fails to run, because no GPUs can be detected.

$ docker run --gpus all --rm -it -v "${PWD}/data/:/data" ocrd/all:maximum
root@18f58a93eeae:/data# cd ocrd_test/
root@18f58a93eeae:/data/ocrd_test# ocrd-anybaseocr-dewarp -I img-BINPAGE -O img-DEWARP
12:34:26.607 INFO matplotlib.font_manager - generated new fontManager
Using TensorFlow backend.
12:34:27.988 INFO ocrd.workspace_validator - input_file_grp=['img-BINPAGE'] output_file_grp=['img-DEWARP']
12:34:27.989 INFO OcrdAnybaseocrDewarper - No output file group for images specified, falling back to 'OCR-D-IMG-DEWARP'
12:34:27.990 ERROR OcrdAnybaseocrDewarper - Your system has no CUDA installed. No GPU detected.

However, running nvidia-smi reveals that a GPU is available inside the Docker container.

root@18f58a93eeae:/data/ocrd_test# nvidia-smi
Tue Mar  3 12:34:38 2020       
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 440.33.01    Driver Version: 440.33.01    CUDA Version: N/A      |
|-------------------------------+----------------------+----------------------+
| GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
|===============================+======================+======================|
|   0  Quadro P2000        On   | 00000000:01:00.0 Off |                  N/A |
| 44%   30C    P8     4W /  75W |      1MiB /  5049MiB |      0%      Default |
+-------------------------------+----------------------+----------------------+

+-----------------------------------------------------------------------------+
| Processes:                                                       GPU Memory |
|  GPU       PID   Type   Process name                             Usage      |
|=============================================================================|
|  No running processes found                                                 |
+-----------------------------------------------------------------------------+
root@18f58a93eeae:/data/ocrd_test# 

Does the system (inside the Docker container) require additional packages?

VolkerHartmann commented 4 years ago

The main problem seems to be the missing CUDA. Anyway GPU inside Container is not tested yet.

kba commented 4 years ago

The fix is to use a CUDA-enabled docker base image, see https://github.com/OCR-D/core/pull/452 and https://github.com/OCR-D/core/pull/454

bertsky commented 4 years ago

The fix is to use a CUDA-enabled docker base image, see OCR-D/core#452 and OCR-D/core#454

Does that actually work?

(I thought currently the only way to get GPU support was doing a CUDA installation in your OS and using ocrd_all natively.)

kba commented 4 years ago

From what @sepastian writes in https://github.com/OCR-D/core/pull/452#issuecomment-594014728 I understand he got ocrd_anybaseocr running in Docker with CUDA (which must run on a CUDA-enabled host of course). I wanted to update https://github.com/OCR-D/core/pull/454 with your proposals in https://github.com/OCR-D/core/pull/454#pullrequestreview-406639090 so we can support -cuda or -gpu variants in ocrd_all eventually.