serve icon indicating copy to clipboard operation
serve copied to clipboard

Docker install not finding GPUs

Open fbbradheintz opened this issue 6 years ago • 10 comments

On a p3.2xlarge, the GPU Docker install (built with the --gpu flag) is not finding GPU devices. From ts_log.log - note the "Number of GPUs" line:

model-server@a8819511cfaa:~/logs$ more ts_log.log
2020-04-16 01:53:17,099 [INFO ] main org.pytorch.serve.ModelServer -
TS Home: /usr/local/lib/python3.6/dist-packages
Current directory: /home/model-server
Temp directory: /home/model-server/tmp
Number of GPUs: 0
Number of CPUs: 8
Max heap size: 13644 M
Python executable: /usr/bin/python3
Config file: /home/model-server/config.properties
Inference address: http://0.0.0.0:8080
Management address: http://0.0.0.0:8081
Model Store: /home/model-server/model-store
Initial Models: N/A
Log dir: /home/model-server/logs
Metrics dir: /home/model-server/logs
Netty threads: 32
Netty client threads: 0
Default workers per model: 8
Blacklist Regex: N/A
Maximum Response Size: 6553500
Maximum Request Size: 6553500

When starting on a GPU machine with CUDA drivers installed, I normally see Number of GPUs: 4.

fbbradheintz avatar Apr 16 '20 02:04 fbbradheintz

Need to update the documentation for starting docker container with gpu image.

@fbbradheintz : Please use following command to start the docker with gpu image :

docker run --gpus <num_of_gpus> --rm -it -p 8080:8080 -p 8081:8081 torchserve:1.0

harshbafna avatar Apr 17 '20 06:04 harshbafna

Thanks, @harshbafna. I'll retry that and update here.

fbbradheintz avatar Apr 17 '20 16:04 fbbradheintz

That didn't work either. On a p3.8xlarge (which has 4 CUDA-compatible GPUs), I built the Docker image with the --gpu directive, as the instructions prescribed. I then issued the same command line @harshbafna listed above, and got this result:

docker: Error response from daemon: OCI runtime create failed: container_linux.go:346: starting container process caused "process_linux.go:449: container init caused \"process_linux.go:432: running prestart hook 0 caused \\\"error running hook: exit status 1, stdout: , stderr: nvidia-container-cli: initialization error: cuda error: no cuda-capable device is detected\\\\n\\\"\"": unknown.

This is on DL AMI 27, Ubuntu 18, current master branch.

fbbradheintz avatar Apr 17 '20 19:04 fbbradheintz

There are three things I think need to be remediated here:

  • We need to get to a state where we can run the GPU-enabled Docker container from the command line
  • The start.sh script needs to be updated to take an optional --gpu <number> command line arg, to pass to the docker run command
  • Docs for Docker install need to be updated with the new start.sh flag for GPU

fbbradheintz avatar Apr 17 '20 19:04 fbbradheintz

Also, the GPU Dockerfile specifies Java 8. (The CPU Dockerfile correctly specifies Java 11.)

fbbradheintz avatar Apr 17 '20 19:04 fbbradheintz

The issue seems to be with not invoking docker run with --runtime=nvidia. Passing it fixes the issue. Also

  • added the option to specify the GPU / specific GPU ids
  • fixed the documentation
  • fixed the JDK version.

dk19y avatar Apr 19 '20 09:04 dk19y

@dhanainme - is there a PR for this? I didn't see anything matching this description in the commits on master.

fbbradheintz avatar Apr 20 '20 15:04 fbbradheintz

Had rebased to fix build issues.

dk19y avatar Apr 20 '20 18:04 dk19y

Added triaged_wait tag to indicate this is waiting on my action (testing in staged_release).

fbbradheintz avatar May 01 '20 21:05 fbbradheintz

@maaquib Please see the comments left in the commit and address them.

chauhang avatar May 10 '20 10:05 chauhang