ejschwartz commited on
Commit
0bf80b6
·
0 Parent(s):

Add Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +43 -0
Dockerfile ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Base image with CUDA for GPU support
2
+ #FROM nvidia/cuda:11.8.0-devel-ubuntu22.04
3
+ FROM ubuntu:latest
4
+
5
+ # Install dependencies
6
+ RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
7
+ --mount=type=cache,target=/var/lib/apt,sharing=locked \
8
+ apt-get update && apt-get install -y \
9
+ git \
10
+ build-essential \
11
+ cmake \
12
+ python-is-python3 \
13
+ python3-pip \
14
+ wget
15
+
16
+ # Install llvm
17
+ RUN wget -qO- https://apt.llvm.org/llvm-snapshot.gpg.key | tee /etc/apt/trusted.gpg.d/apt.llvm.org.asc
18
+ RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
19
+ --mount=type=cache,target=/var/lib/apt,sharing=locked \
20
+ apt-get -y update && apt-get install -y mlir-18-tools llvm-18
21
+
22
+ # Install PyTorch
23
+ RUN --mount=type=cache,target=/root/.cache pip install --break-system-packages torch
24
+
25
+ # Install PyTorch-MLIR
26
+ WORKDIR /opt
27
+ RUN git clone https://github.com/llvm/torch-mlir.git
28
+ WORKDIR /opt/torch-mlir
29
+ RUN python3 -m pip install -e . --user
30
+
31
+ # Add PyTorch-MLIR tools to PATH
32
+ ENV PATH="/root/.local/bin:${PATH}"
33
+
34
+ # Verify installations
35
+ RUN python3 -c "import torch; print(torch.__version__)" && \
36
+ mlir-opt --version && \
37
+ llvm-as --version
38
+
39
+ # Working directory for MLIR operations
40
+ WORKDIR /workspace
41
+
42
+ # Command to keep the container running
43
+ CMD ["bash"]