Skip to content

Commit 0af88b5

Browse files
committed
Added Dockerfile for NVIDIA GPUs with PTX
1 parent 340608c commit 0af88b5

File tree

1 file changed

+60
-0
lines changed

1 file changed

+60
-0
lines changed
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
## Docker File for running GPULlama3.java with TornadoVM on NVIDIA GPUs
2+
## Adapted for GPULlama3.java v0.1.0-beta
3+
FROM nvidia/cuda:12.1.1-devel-ubuntu20.04
4+
5+
LABEL MAINTAINER Athanasios Stratikopoulos <[email protected]>
6+
7+
# Base setup
8+
ENV DEBIAN_FRONTEND=noninteractive
9+
ENV TZ=Etc/UTC
10+
11+
RUN apt-get update && apt-get install -y \
12+
tzdata \
13+
build-essential git cmake maven openjdk-21-jdk python3-pip wget vim \
14+
&& rm -rf /var/lib/apt/lists/*
15+
16+
#RUN apt-get update -q && apt-get install -qy \
17+
# python3 build-essential vim git cmake maven openjdk-17-jdk python3-pip \
18+
# wget && rm -rf /var/lib/apt/lists/*
19+
20+
RUN python3 -m pip install wget
21+
22+
RUN ln -s /usr/bin/python3 /usr/bin/python
23+
24+
RUN java -version
25+
RUN javac -version
26+
27+
# Set JDK 17 explicitly
28+
ENV PATH /usr/lib/jvm/java-17-openjdk-amd64/bin:$PATH
29+
ENV JAVA_HOME /usr/lib/jvm/java-17-openjdk-amd64
30+
ENV MAVEN_CONFIG=/root/.m2
31+
32+
# Build GPULlama3.java and TornadoVM
33+
WORKDIR /gpullama3/
34+
RUN git clone --recursive https://github.com/beehive-lab/GPULlama3.java.git
35+
WORKDIR /gpullama3/GPULlama3.java
36+
RUN git checkout v0.1.0-beta && git submodule update --recursive
37+
38+
# Install TornadoVM backend
39+
WORKDIR /gpullama3/GPULlama3.java/external/tornadovm
40+
ENV CMAKE_ROOT /usr
41+
42+
# Build TornadoVM and install its artifacts
43+
RUN ./bin/tornadovm-installer --jdk jdk21 --backend ptx --mvn_single_threaded
44+
45+
# Set environment variables from set_paths manually
46+
ENV JAVA_HOME=/gpullama3/GPULlama3.java/external/tornadovm/etc/dependencies/TornadoVM-jdk21/jdk-21.0.7/
47+
ENV PATH=/gpullama3/GPULlama3.java/external/tornadovm/bin/bin:/gpullama3/GPULlama3.java/bin:$PATH
48+
ENV TORNADO_SDK=/gpullama3/GPULlama3.java/external/tornadovm/bin/sdk
49+
ENV TORNADO_ROOT=/gpullama3/GPULlama3.java/external/tornadovm
50+
ENV LLAMA_ROOT=/gpullama3/GPULlama3.java
51+
52+
# Fix InaccessibleObjectException by configuring MAVEN_OPTS
53+
ENV MAVEN_OPTS="--add-opens java.base/java.lang=ALL-UNNAMED"
54+
55+
# Build GPULlama3.java with verbose output and custom Maven repo
56+
WORKDIR /gpullama3/GPULlama3.java
57+
RUN bash -c "mvn clean package -DskipTests -Dmaven.repo.local=/root/.m2/repository/"
58+
59+
WORKDIR /data
60+
VOLUME ["/data"]

0 commit comments

Comments
 (0)