-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile.test.cpu
68 lines (57 loc) · 2.23 KB
/
Dockerfile.test.cpu
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
# Build stage with Spack pre-installed and ready to be used
FROM spack/ubuntu-jammy:latest AS builder
ARG MPI_KIND=openmpi
ARG PYTHON_VERSION=3.10
ARG PYTORCH_VERSION=1.13.1
ARG NEOMEM_BUILD_FLAGS=""
RUN git clone https://github.com/mochi-hpc/mochi-spack-packages.git /opt/git/mochi-spack-packages
# What we want to install and how we want to install it
# is specified in a manifest file (spack.yaml)
RUN mkdir /opt/spack-environment \
&& (echo "spack:" \
&& echo " config:" \
&& echo " install_tree: /opt/software" \
&& echo " repos:" \
&& echo " - /opt/git/mochi-spack-packages" \
&& echo " packages:" \
&& echo " all:" \
&& echo " providers:" \
&& echo " mpi: [$MPI_KIND]" \
&& echo " specs:" \
&& echo " - [email protected] ^argobots ^mercury +boostsys +ofi +debug ^libfabric +debug fabrics=tcp,rxm,verbs" \
&& echo " - mpi" \
&& echo " - python@$PYTHON_VERSION" \
&& echo " - nvtx +python" \
&& echo " - py-pip" \
&& echo " - py-pybind11" \
&& echo " - py-mpi4py" \
&& echo " - py-torch@$PYTORCH_VERSION" \
&& echo " - py-pytest" \
&& echo " - cmake" \
&& echo " - pkgconfig" \
&& echo " concretizer:" \
&& echo " unify: true" \
&& echo " view: /opt/view") > /opt/spack-environment/spack.yaml
# Install the software, remove unnecessary deps
RUN cd /opt/spack-environment && spack env activate . && spack install --fail-fast && spack gc -y
# Strip all the binaries
RUN find -L /opt/view/* -type f -exec readlink -f '{}' \; | \
xargs file -i | \
grep 'charset=binary' | \
grep 'x-executable\|x-archive\|x-sharedlib' | \
awk -F: '{print $1}' | xargs strip -s
RUN echo pytest -v --capture=no --continue-on-collection-errors > /pytest.sh
RUN chmod a+x /pytest.sh
# Modifications to the environment that are necessary to run
RUN cd /opt/spack-environment && \
spack env activate --sh -d . >> /etc/profile.d/z10_spack_environment.sh
# Compile Neomem
COPY . /neomem
RUN . /etc/profile && \
cd /neomem && \
rm -f CMakeCache.txt && \
cmake . -DWITHOUT_CUDA=1 && make
RUN . /etc/profile && \
cp /neomem/src/neomem*.so $PYTHONPATH && \
cp /neomem/src/neomem_example /opt/view/bin
ENTRYPOINT ["/bin/bash", "--rcfile", "/etc/profile", "-l", "-c"]