Skip to content

Commit 8fa6e8e

Browse files
committed
opt static linking, Docker CUDA
1 parent ffe726e commit 8fa6e8e

File tree

4 files changed

+72
-3
lines changed

4 files changed

+72
-3
lines changed

Dockerfile

+50
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
FROM ubuntu:15.04
2+
MAINTAINER Tom <[email protected]>
3+
ENV DEBIAN_FRONTEND noninteractive
4+
5+
RUN echo hi
6+
RUN apt-get -qqy update
7+
RUN apt-get -qqy install mercurial
8+
RUN apt-get -qqy install build-essential
9+
RUN apt-get -qqy install g++ gdb swig2.0 scons
10+
RUN apt-get -qqy install git
11+
RUN apt-get -qqy install wget
12+
RUN cd /tmp && wget -nd http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1504/x86_64/cuda-repo-ubuntu1504_7.5-18_amd64.deb
13+
RUN cd /tmp && dpkg -i cuda-repo-ubuntu1504*.deb
14+
RUN apt-get -qqy update
15+
RUN apt-get -qqy install cuda-7-5
16+
RUN apt-get -qqy install cuda-command-line-tools-7-5
17+
RUN apt-get -qqy install cuda-core-7-5
18+
RUN apt-get -qqy install cuda-cublas-7-5
19+
RUN apt-get -qqy install cuda-cublas-dev-7-5
20+
RUN apt-get -qqy install cuda-cudart-7-5
21+
RUN apt-get -qqy install cuda-cudart-dev-7-5
22+
RUN apt-get -qqy install cuda-cufft-7-5
23+
RUN apt-get -qqy install cuda-cufft-dev-7-5
24+
RUN apt-get -qqy install cuda-curand-7-5
25+
RUN apt-get -qqy install cuda-curand-dev-7-5
26+
RUN apt-get -qqy install cuda-cusolver-7-5
27+
RUN apt-get -qqy install cuda-cusolver-dev-7-5
28+
RUN apt-get -qqy install cuda-cusparse-7-5
29+
RUN apt-get -qqy install cuda-cusparse-dev-7-5
30+
RUN apt-get -qqy install cuda-minimal-build-7-5
31+
RUN apt-get -qqy install cuda-misc-headers-7-5
32+
RUN apt-get -qqy install cuda-npp-7-5
33+
RUN apt-get -qqy install cuda-npp-dev-7-5
34+
RUN apt-get -qqy install cuda-nvrtc-7-5
35+
RUN apt-get -qqy install cuda-nvrtc-dev-7-5
36+
RUN apt-get -qqy install cuda-runtime-7-5
37+
RUN apt-get -qqy install cuda-toolkit-7-5
38+
RUN apt-get -qqy install cuda-visual-tools-7-5
39+
RUN apt-get -qqy install cuda-samples-7-5
40+
41+
RUN apt-get -qqy install apt-utils
42+
RUN apt-get -qqy install protobuf-compiler libprotobuf-dev
43+
RUN apt-get -qqy install libpng12-dev
44+
RUN cd /usr/local/include && hg clone http://bitbucket.org/eigen/eigen eigen3
45+
RUN apt-get -qqy install strace
46+
47+
RUN apt-get clean && rm -rf /tmp/* /var/lib/apt/lists/* /var/tmp/*
48+
49+
VOLUME /work
50+
WORKDIR /work

Makefile

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
DONE: Dockerfile
2+
docker build -t tmbdev/ubuntu-cuda .
3+
touch DONE

SConstruct

+13-3
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ if option("threads", 1):
5353
env.Append(CPPDEFINES={'EIGEN_USE_THREADS': '1'})
5454
env.Append(LIBS=["pthread"])
5555

56-
if option("gpu", 1):
56+
if option("gpu", 0):
5757
env.Append(CPPDEFINES={'EIGEN_USE_GPU': '1'})
5858
env.Append(LIBS=["cublas","cuda","cudart"])
5959

@@ -95,6 +95,18 @@ else:
9595
env.Append(CXXFLAGS="-g -O3".split())
9696
env.Append(CCFLAGS="-g".split())
9797

98+
# Hack for linking some libraries statically.
99+
100+
abslibs = """/usr/lib/x86_64-linux-gnu/libpng12.a
101+
/usr/lib/x86_64-linux-gnu/libprotobuf.a
102+
/usr/lib/x86_64-linux-gnu/libz.a"""
103+
104+
if not option("static", 0):
105+
env.Append(LIBS=["png", "protobuf"])
106+
else:
107+
abslibs = [File(x) for x in abslibs.split()]
108+
env.Append(LIBS=abslibs)
109+
98110
# Extra layers (old layers or testing)
99111

100112
if option("extras", 0):
@@ -121,8 +133,6 @@ if option("display", 0):
121133
else:
122134
env.Append(CPPDEFINES={'NODISPLAY': 1})
123135

124-
env.Append(LIBS=["png", "protobuf"])
125-
126136
# We need to compile the protocol buffer definition as part of the build.
127137

128138
env.Protoc("clstm.proto")

curun

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#!/bin/sh
2+
for dev in /dev/nv*; do
3+
devs="$devs --device=$dev:$dev"
4+
done
5+
uid=${uid:-$(id -u)}
6+
docker run --privileged --rm -u $uid -v $(pwd):/work -w=/work -e PATH=.:/usr/local/cuda/bin:/usr/local/bin:/usr/bin:/bin -i -t tmbdev/ubuntu-cuda "$@"

0 commit comments

Comments
 (0)