-
Notifications
You must be signed in to change notification settings - Fork 16
/
Dockerfile
73 lines (59 loc) · 2.15 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
# Select MPI environment: openmpi or mpich
ARG MPI=openmpi
# Select Platform: core, full, pycuda or cupy
ARG PLATFORM=cupy
# Select CUDA version
ARG CUDAVERSION=12.4
# Pull from mambaforge and install XML and ssh
FROM condaforge/mambaforge as base
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update && apt-get install -y libxml2 ssh
# Pull from base image and install OpenMPI/MPICH
FROM base as mpi
ARG MPI
RUN mamba install -n base -c conda-forge ${MPI}
# Pull from MPI build install core dependencies
FROM base as core
COPY ./dependencies_core.yml ./dependencies.yml
RUN mamba env update -n base -f dependencies.yml
# Pull from MPI build and install full dependencies
FROM mpi as full
COPY ./dependencies_full.yml ./dependencies.yml
RUN mamba env update -n base -f dependencies.yml
# Pull from MPI build and install accelerate/pycuda dependencies
FROM mpi as pycuda
ARG CUDAVERSION
COPY ./ptypy/accelerate/cuda_pycuda/dependencies.yml ./dependencies.yml
COPY ./cufft/dependencies.yml ./dependencies_cufft.yml
RUN mamba install cuda-version=${CUDAVERSION} && \
mamba env update -n base -f dependencies.yml && \
mamba env update -n base -f dependencies_cufft.yml
# Pull from MPI build and install accelerate/cupy dependencies
FROM mpi as cupy
ARG CUDAVERSION
COPY ./ptypy/accelerate/cuda_cupy/dependencies.yml ./dependencies.yml
COPY ./cufft/dependencies.yml ./dependencies_cufft.yml
RUN mamba install cuda-version=${CUDAVERSION} && \
mamba env update -n base -f dependencies.yml && \
mamba env update -n base -f dependencies_cufft.yml
# Pull from platform specific image and install ptypy
FROM ${PLATFORM} as build
COPY pyproject.toml ./
COPY ./templates ./templates
COPY ./benchmark ./benchmark
COPY ./cufft ./cufft
COPY ./ptypy ./ptypy
RUN pip install .
# For core/full build, no post processing needed
FROM build as core-post
FROM build as full-post
# For pycuda build, install filtered cufft
FROM build as pycuda-post
RUN pip install ./cufft
# For pycuda build, install filtered cufft
FROM build as cupy-post
RUN pip install ./cufft
# Platform specific runtime container
FROM ${PLATFORM}-post as runtime
# Run PtyPy run script as entrypoint
ENTRYPOINT ["ptypy.cli"]