Skip to content

Latest commit

 

History

History
58 lines (39 loc) · 1.74 KB

README.md

File metadata and controls

58 lines (39 loc) · 1.74 KB

CUDA Compatible Docker Image

Requirements

Make sure you have nvidia docker extension up and running! Without this docker command wont accept --gpus flag for docker run command. For more info check out official documentation.

Usage

Build container using docker build -t pluto-notebook .

Now we can run our image with docker run -t -p 1234:1234 --gpus all pluto-notebook. You can skip building and use with docker run -t -p 1234:1234 --gpus all ghcr.io/juliapluto/pluto-cuda:latest, using our docker image from this repo. Note that for reproducible setups it's best to tag the exact @sha256:.... This will start our container and attach it to host port 1234. --gpus all flag tells docker to give container access to all Nvidia GPUs attached to the host machine.

First lets install CUDA.jl

using Pkg; Pkg.add("CUDA")

Now lets make sure that CUDA support works:

using CUDA

# Running this for the first time will take some time
# since CUDA.jl needs to download an artifact
CUDA.version()

# More detailed CUDA info
CUDA.versioninfo()

# List all available CUDA compatible devices
CUDA.devices()

If there was no errors and we got correct version printed out we can now start using CuArray

using CUDA

W = cu(rand(2, 5))
b = cu(rand(2))

predict(x) = W*x .+ b
loss(x, y) = sum((predict(x) .- y).^2)

x, y = cu(rand(5)), cu(rand(2))
loss(x, y)

Useful links: