@@ -5,69 +5,92 @@ ARG MPI=openmpi
55ARG PLATFORM=cupy
66
77# Select CUDA version
8- ARG CUDAVERSION=12.4
8+ ARG CUDAVERSION=12.8
99
1010# Pull from mambaforge and install XML and ssh
11- FROM condaforge/mambaforge as base
11+ FROM condaforge/mambaforge AS base
1212ENV DEBIAN_FRONTEND=noninteractive
1313RUN apt-get update && apt-get install -y libxml2 ssh
1414
1515# Pull from base image and install OpenMPI/MPICH
16- FROM base as mpi
16+ FROM base AS mpi
1717ARG MPI
1818RUN mamba install -n base -c conda-forge ${MPI}
1919
20- # Pull from MPI build install core dependencies
21- FROM base as core
22- COPY ./dependencies_core.yml ./dependencies.yml
23- RUN mamba env update -n base -f dependencies.yml
20+ # Pull from MPI build and install core dependencies
21+ FROM base AS core
22+ RUN mamba install -n base -y -c conda-forge \
23+ python numpy scipy h5py pip
2424
2525# Pull from MPI build and install full dependencies
26- FROM mpi as full
27- COPY ./dependencies_full.yml ./dependencies.yml
28- RUN mamba env update -n base -f dependencies.yml
26+ FROM mpi AS full
27+ ARG MPI
28+ RUN mamba install -n base -y -c conda-forge \
29+ python numpy scipy matplotlib h5py \
30+ pyzmq mpi4py[build=*${MPI}*] packaging \
31+ pillow pyfftw pyyaml pip
2932
3033# Pull from MPI build and install accelerate/pycuda dependencies
31- FROM mpi as pycuda
32- ARG CUDAVERSION
33- COPY ./ptypy/accelerate/cuda_pycuda/dependencies.yml ./dependencies.yml
34- COPY ./cufft/dependencies.yml ./dependencies_cufft.yml
35- RUN mamba install cuda-version=${CUDAVERSION} && \
36- mamba env update -n base -f dependencies.yml && \
37- mamba env update -n base -f dependencies_cufft.yml
34+ FROM mpi AS pycuda
35+ ARG CUDAVERSION MPI
36+ RUN mamba install -n base -y -c conda-forge -c nvidia \
37+ python numpy scipy matplotlib h5py pyzmq mpi4py[build=*${MPI}*] \
38+ pillow pyfftw pyyaml compilers pip \
39+ reikna pycuda cuda-nvcc cuda-cudart-dev cuda-version=${CUDAVERSION}
3840
3941# Pull from MPI build and install accelerate/cupy dependencies
40- FROM mpi as cupy
41- ARG CUDAVERSION
42- COPY ./ptypy/accelerate/cuda_cupy/dependencies.yml ./dependencies.yml
43- COPY ./cufft/dependencies.yml ./dependencies_cufft.yml
44- RUN mamba install cuda-version=${CUDAVERSION} && \
45- mamba env update -n base -f dependencies.yml && \
46- mamba env update -n base -f dependencies_cufft.yml
42+ FROM mpi AS cupy
43+ ARG CUDAVERSION MPI
44+ RUN mamba install -n base -y -c conda-forge \
45+ python numpy scipy matplotlib h5py pyzmq mpi4py[build=*${MPI}*] \
46+ pillow pyfftw pyyaml compilers pip \
47+ cupy cuda-version=${CUDAVERSION}
48+ RUN mamba clean -y -a
4749
4850# Pull from platform specific image and install ptypy
49- FROM ${PLATFORM} as build
51+ FROM ${PLATFORM} AS build
5052COPY pyproject.toml ./
5153COPY ./templates ./templates
5254COPY ./benchmark ./benchmark
53- COPY ./cufft ./cufft
5455COPY ./ptypy ./ptypy
5556RUN pip install .
5657
57- # For core/full build, no post processing needed
58- FROM build as core-post
59- FROM build as full-post
58+ # For core build, clean up conda env
59+ FROM build AS core-post
60+ RUN mamba clean -y -a
61+
62+ # For full build, clean up conda env
63+ FROM build AS full-post
64+ RUN mamba clean -y -a
6065
6166# For pycuda build, install filtered cufft
62- FROM build as pycuda-post
67+ FROM build AS pycuda-post
68+ ARG CUDAVERSION
69+ RUN mamba install -n base -y -c conda-forge -c nvidia \
70+ python cmake>=3.8.0 pybind11 compilers \
71+ cuda-nvcc cuda-cudart-dev libcufft-dev libcufft-static cuda-version=${CUDAVERSION}
72+ COPY ./cufft ./cufft
6373RUN pip install ./cufft
74+ RUN mamba remove -n base -y \
75+ cmake pybind11 cuda-nvcc cuda-cudart-dev libcufft-dev libcufft-static
76+ RUN mamba clean -y -a
6477
65- # For pycuda build, install filtered cufft
66- FROM build as cupy-post
78+ # For cupy build, install filtered cufft
79+ FROM build AS cupy-post
80+ ARG CUDAVERSION
81+ RUN mamba install -n base -y -c conda-forge -c nvidia \
82+ python cmake>=3.8.0 pybind11 compilers \
83+ cuda-nvcc cuda-cudart-dev libcufft-dev libcufft-static cuda-version=${CUDAVERSION}
84+ COPY ./cufft ./cufft
6785RUN pip install ./cufft
86+ RUN mamba remove -n base -y \
87+ cmake pybind11 libcufft-dev libcufft-static
88+ RUN mamba clean -y -a
6889
6990# Platform specific runtime container
70- FROM ${PLATFORM}-post as runtime
91+ FROM ${PLATFORM}-post AS runtime
92+ RUN useradd --user-group ptypy-user
93+ USER ptypy-user
7194
7295# Run PtyPy run script as entrypoint
7396ENTRYPOINT ["ptypy.cli" ]
0 commit comments