Skip to content

Commit

Permalink
fix: gpu support for rp Dockerfile (#299)
Browse files Browse the repository at this point in the history
  • Loading branch information
walkah authored Aug 26, 2024
1 parent fcf3f37 commit d830232
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 9 deletions.
1 change: 1 addition & 0 deletions docker/docker-compose.dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ services:
dockerfile: ./docker/resource-provider/Dockerfile
args:
- NETWORK=dev
- COMPUTE_MODE=cpu
extra_hosts:
- "localhost:host-gateway"
volumes:
Expand Down
24 changes: 15 additions & 9 deletions docker/resource-provider/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,20 +1,16 @@
FROM docker:dind
WORKDIR /usr/src/app
ARG COMPUTE_MODE=gpu

# Build args
FROM nvidia/cuda:12.0.1-cudnn8-devel-ubuntu22.04 AS base
WORKDIR /usr/src/app
ARG NETWORK=testnet
ARG DISABLE_POW=false

# Default environment variables
ENV LOG_LEVEL=info
ENV OFFER_GPU=1
ENV BACALHAU_API_HOST="localhost"
ENV WEB3_PRIVATE_KEY=""

# Install necessary dependencies
RUN apk update
RUN apk add wget
RUN apk add bash
RUN apt update && apt install -y wget bash && apt clean

# Install Bacalhau
RUN cd /tmp && \
Expand All @@ -28,7 +24,17 @@ COPY --from=golang:1.22.4-alpine /usr/local/go/ /usr/local/go/
ENV PATH="/usr/local/go/bin:${PATH}"

COPY . .
RUN go build -v .

FROM base AS build-gpu
RUN nvcc --version && nvcc --ptx -o ./pkg/resourceprovider/cudaminer/keccak.ptx ./pkg/resourceprovider/cudaminer/keccak.cu
RUN go build -v --tags cuda
ENV DISABLE_POW=false

FROM base AS build-cpu
RUN go build -v
ENV DISABLE_POW=true

FROM build-$COMPUTE_MODE AS final
RUN mv lilypad /usr/local/bin

# Add both lilypad and bacalhau executables to PATH
Expand Down

0 comments on commit d830232

Please sign in to comment.