forked from AccelerateHS/accelerate-llvm
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
76 lines (60 loc) · 2.8 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
# vim: nospell
FROM nvidia/cuda:9.0-devel-ubuntu16.04
LABEL maintainer "Trevor L. McDonell <[email protected]>"
ARG GHC_VERSION=8.2.2
ARG CABAL_VERSION=2.0
ARG LTS_SLUG=lts-10.0
ARG DEBIAN_FRONTEND=noninteractive
ENV LANG C.UTF-8
ENV LC_ALL C.UTF-8
ENV PATH /root/.cabal/bin:/root/.local/bin:${PATH}
ENV LD_LIBRARY_PATH /usr/local/cuda/lib64:/usr/local/cuda/nvvm/lib64:${LD_LIBRARY_PATH}
RUN ln -s /usr/local/cuda/lib64/stubs/libcuda.so /usr/local/cuda/lib64/libcuda.so.1
RUN apt-get update \
&& apt-get install -y software-properties-common
RUN add-apt-repository -y ppa:hvr/ghc \
&& apt-get update \
&& apt-get install -y \
curl \
llvm-3.9 \
pkg-config \
wget
RUN curl -sSL https://get.haskellstack.org/ | sh
# Buggy versions of ld.bfd fail to link some Haskell packages:
# https://sourceware.org/bugzilla/show_bug.cgi?id=17689. Gold is
# faster anyways and uses less RAM.
RUN update-alternatives --install "/usr/bin/ld" "ld" "/usr/bin/ld.gold" 20
RUN update-alternatives --install "/usr/bin/ld" "ld" "/usr/bin/ld.bfd" 10
# GHC requires a specific LLVM version on the system PATH for its LLVM backend.
# This version is tracked here:
# https://ghc.haskell.org/trac/ghc/wiki/Commentary/Compiler/Backends/LLVM/Installing
#
# GHC 8.0 requires LLVM 3.9 tools (specifically, llc-3.9 and opt-3.9).
RUN update-alternatives --install "/usr/bin/llc" "llc" "/usr/bin/llc-3.9" 50
RUN update-alternatives --install "/usr/bin/opt" "opt" "/usr/bin/opt-3.9" 50
# Install llvm-5.0
RUN wget -O - http://apt.llvm.org/llvm-snapshot.gpg.key | apt-key add - \
&& add-apt-repository "deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial-5.0 main" \
&& apt-get update \
&& apt-get install -y llvm-5.0-dev
# Setup stack
RUN stack --no-terminal --resolver=${LTS_SLUG} setup
RUN stack --no-terminal install c2hs
# Copy over just the cabal and stack file and install dependencies
WORKDIR /opt/accelerate-llvm
COPY ./README.md /opt/accelerate-llvm/README.md
COPY ./LICENSE /opt/accelerate-llvm/LICENSE
COPY ./stack-8.2.yaml /opt/accelerate-llvm/stack.yaml
COPY ./accelerate-llvm/accelerate-llvm.cabal /opt/accelerate-llvm/accelerate-llvm/
COPY ./accelerate-llvm-native/accelerate-llvm-native.cabal /opt/accelerate-llvm/accelerate-llvm-native/
COPY ./accelerate-llvm-ptx/accelerate-llvm-ptx.cabal /opt/accelerate-llvm/accelerate-llvm-ptx/
RUN stack --no-terminal build --only-snapshot
# Copy over the actual source files and build
COPY ./accelerate-llvm /opt/accelerate-llvm/accelerate-llvm
RUN stack --no-terminal build accelerate-llvm
COPY ./accelerate-llvm-native /opt/accelerate-llvm/accelerate-llvm-native
RUN stack --no-terminal build accelerate-llvm-native
COPY ./accelerate-llvm-ptx /opt/accelerate-llvm/accelerate-llvm-ptx
RUN stack --no-terminal build accelerate-llvm-ptx
COPY ./utils/ghci /opt/accelerate-llvm/
CMD ["bash"]