Skip to content

Commit 30b8f90

Browse files
authored
Merge pull request #276 from conda-forge/revert-275-revert-272-cleanup_old_cuda_bits
Cleanup and consolidate CUDA images
2 parents c14df50 + 21e3178 commit 30b8f90

File tree

8 files changed

+47
-287
lines changed

8 files changed

+47
-287
lines changed

.github/workflows/ci.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,22 +36,28 @@ jobs:
3636
SHORT_DESCRIPTION: "conda-forge build image for Cent0S 7 on aarch64"
3737

3838
- DOCKERIMAGE: linux-anvil-cuda
39+
DOCKERFILE: linux-anvil-cuda
3940
DOCKERTAG: "11.8"
4041
CUDA_VER: "11.8.0"
42+
DISTRO_ARCH: "amd64"
4143
DISTRO_NAME: "centos"
4244
DISTRO_VER: "7"
4345
SHORT_DESCRIPTION: "conda-forge build image for Cent0S 7 on x86_64 with CUDA"
4446

4547
- DOCKERIMAGE: linux-anvil-ppc64le-cuda
48+
DOCKERFILE: linux-anvil-cuda
4649
DOCKERTAG: "11.8"
4750
CUDA_VER: "11.8.0"
51+
DISTRO_ARCH: "ppc64le"
4852
DISTRO_NAME: "ubi"
4953
DISTRO_VER: "8"
5054
SHORT_DESCRIPTION: "conda-forge build image for Cent0S 8 on ppc64le with CUDA"
5155

5256
- DOCKERIMAGE: linux-anvil-aarch64-cuda
57+
DOCKERFILE: linux-anvil-cuda
5358
DOCKERTAG: "11.8"
5459
CUDA_VER: "11.8.0"
60+
DISTRO_ARCH: "arm64"
5561
DISTRO_NAME: "ubi"
5662
DISTRO_VER: "8"
5763
SHORT_DESCRIPTION: "conda-forge build image for Cent0S 8 on aarch64 with CUDA"

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,15 @@ environment variables passed in to be able to build. In this case, you
1818
will want to use a command similar to the following:
1919

2020
```sh
21-
docker build --rm --build-arg DISTRO_NAME=centos --build-arg DISTRO_VER=6 --build-arg CUDA_VER=10.2 -f linux-anvil-cuda/Dockerfile .
21+
docker build --rm --build-arg DISTRO_NAME=centos --build-arg DISTRO_VER=6 --build-arg CUDA_VER=11.8.0 -f linux-anvil-cuda/Dockerfile .
2222
```
2323

2424
## Environment variables
2525

26-
* `$CUDA_VER`: This is the cuda & cudatoolkit version that will be used. The
27-
value of this variable should be in major-minor for, e.g. `9.2` for versions
28-
`9.x` and `10.x`. For versions `11.x` the variable should be in
29-
major-minor-patch format, e.g. `11.2.0`.
26+
* `CUDA_VER`: This is the cuda & cudatoolkit version that will be used. The
27+
value of this variable should be in major-minor-patch format, e.g. `11.8.0`.
28+
* `DISTRO_ARCH`: This is the Linux architecture that the image should use.
29+
Should match the upstream Docker image, e.g. `amd64`.
3030
* `DISTRO_NAME`: This is the Linux distro image name that should be built with.
3131
Should match the upstream Docker image, e.g. `centos`.
3232
* `DISTRO_VER`: This is version of Linux distro (typical CentOS) that the image

linux-anvil-aarch64-cuda/Dockerfile

Lines changed: 0 additions & 107 deletions
This file was deleted.

linux-anvil-aarch64-cuda/entrypoint_source

Lines changed: 0 additions & 5 deletions
This file was deleted.

linux-anvil-cuda/Dockerfile

Lines changed: 34 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,63 +1,72 @@
11
# Set environment variables during runtime.
22
ARG CUDA_VER
3+
ARG DISTRO_ARCH
34
ARG DISTRO_NAME
45
ARG DISTRO_VER
5-
FROM --platform=linux/amd64 nvidia/cuda:${CUDA_VER}-devel-${DISTRO_NAME}${DISTRO_VER}
6+
FROM --platform=linux/${DISTRO_ARCH} nvidia/cuda:${CUDA_VER}-devel-${DISTRO_NAME}${DISTRO_VER}
67

78
LABEL maintainer="conda-forge <[email protected]>"
89

10+
# Set `ARG`s during runtime.
911
ARG CUDA_VER
12+
ARG DISTRO_ARCH
1013
ARG DISTRO_NAME
1114
ARG DISTRO_VER
1215
ENV CUDA_VER=${CUDA_VER} \
16+
DISTRO_ARCH=${DISTRO_ARCH} \
1317
DISTRO_NAME=${DISTRO_NAME} \
1418
DISTRO_VER=${DISTRO_VER}
1519

1620
# Set an encoding to make things work smoothly.
1721
ENV LANG en_US.UTF-8
22+
ENV LANGUAGE en_US.UTF-8
1823

1924
# Set path to CUDA install (this is a symlink to /usr/local/cuda-${CUDA_VER})
2025
ENV CUDA_HOME /usr/local/cuda
2126

22-
# we want to persist a path in ldconfig (to avoid having to always set LD_LIBRARY_PATH), but *after* the existing entries;
23-
# since entries in ld.so.conf.d have precedence before the preconfigured directories, we first add the latter to the former
24-
RUN ldconfig -v 2>/dev/null | grep -v ^$'\t' | cut -f1 -d":" >> /etc/ld.so.conf.d/cuda-$CUDA_VER.conf \
25-
&& if [ ${CUDA_VER} != "9.2" ]; then \
26-
# the upstream images for 10.x all have libcuda.so under $CUDA_HOME/compat;
27-
# add this to the ldconfig so it will be found correctly.
28-
echo "$CUDA_HOME/compat" >> /etc/ld.so.conf.d/cuda-$CUDA_VER.conf ; \
29-
else \
30-
# For 9.2, the image nvidia/cuda:9.2-devel-centos6 contains neither
31-
# $CUDA_HOME/compat, nor any (non-stub) libcuda.so. We fix this by
32-
# adding cuda-compat-10.0 (which is not used for building, but to
33-
# test if loading the respective library/package works). However,
34-
# due to licensing reasons, these cannot be part of the conda-forge
35-
# docker images, but are instead added for CI purposes in:
36-
# github.com/conda-forge/conda-forge-ci-setup-feedstock/blob/master/recipe/run_conda_forge_build_setup_linux
37-
# Here we only set the ldconfig accordingly.
38-
echo "/usr/local/cuda-10.0/compat" >> /etc/ld.so.conf.d/cuda-$CUDA_VER.conf ; \
39-
fi \
40-
# don't forget to update settings by running ldconfig
41-
&& ldconfig
42-
4327
# bust the docker cache so that we always rerun the installs below
4428
ADD https://loripsum.net/api /opt/docker/etc/gibberish
4529

30+
# Add qemu in here so that we can use this image on regular linux hosts with qemu user installed
31+
ADD qemu-aarch64-static /usr/bin/qemu-aarch64-static
32+
ADD qemu-ppc64le-static /usr/bin/qemu-ppc64le-static
33+
34+
# we want to persist a path in ldconfig (to avoid having to always set LD_LIBRARY_PATH), but *after* the existing entries;
35+
# since entries in ld.so.conf.d have precedence before the preconfigured directories, we first add the latter to the former
36+
# the upstream images all have libcuda.so under $CUDA_HOME/compat;
37+
# add this to the ldconfig so it will be found correctly.
38+
# don't forget to update settings by running ldconfig
39+
RUN ldconfig -v 2>/dev/null | grep -v ^$'\t' | cut -f1 -d":" >> /etc/ld.so.conf.d/cuda-$CUDA_VER.conf && \
40+
echo "$CUDA_HOME/compat" >> /etc/ld.so.conf.d/cuda-$CUDA_VER.conf && \
41+
ldconfig
42+
4643
# Add the archived repo URL and fix RPM imports
4744
ADD centos7-repos /tmp/centos7-repos
4845
ADD scripts/fix_rpm /opt/docker/bin/fix_rpm
4946
RUN /opt/docker/bin/fix_rpm
5047

51-
# Install basic requirements.
48+
# Add custom `yum_clean_all` script before using `yum`
5249
COPY scripts/yum_clean_all /opt/docker/bin/
50+
51+
# Install basic requirements.
5352
RUN yum update -y --disablerepo=cuda && \
5453
yum install -y \
5554
bzip2 \
5655
sudo \
5756
tar \
58-
which && \
57+
which \
58+
&& \
5959
/opt/docker/bin/yum_clean_all
6060

61+
# Fix locale in UBI 8 images
62+
# See https://github.com/CentOS/sig-cloud-instance-images/issues/154
63+
RUN if [ "${DISTRO_NAME}${DISTRO_VER}" = "ubi8" ]; then \
64+
yum install -y \
65+
glibc-langpack-en \
66+
&& \
67+
/opt/docker/bin/yum_clean_all; \
68+
fi
69+
6170
# Remove preinclude system compilers
6271
RUN rpm -e --nodeps --verbose gcc gcc-c++
6372

@@ -76,26 +85,14 @@ RUN source /opt/conda/etc/profile.d/conda.sh && \
7685
chgrp -R lucky /opt/conda && \
7786
chmod -R g=u /opt/conda
7887

79-
# Symlink CUDA headers that were moved from $CUDA_HOME/include to /usr/include
80-
# in CUDA 10.1.
81-
RUN for HEADER_FILE in cublas_api.h cublas.h cublasLt.h cublas_v2.h cublasXt.h nvblas.h; do \
82-
if [[ ! -f "${CUDA_HOME}/include/${HEADER_FILE}" ]]; \
83-
then ln -s "/usr/include/${HEADER_FILE}" "${CUDA_HOME}/include/${HEADER_FILE}"; \
84-
fi; \
85-
done
86-
87-
# Add qemu in here so that we can use this image on regular linux hosts with qemu user installed
88-
ADD qemu-aarch64-static /usr/bin/qemu-aarch64-static
89-
ADD qemu-ppc64le-static /usr/bin/qemu-ppc64le-static
90-
9188
# Add a file for users to source to activate the `conda`
9289
# environment `base`. Also add a file that wraps that for
9390
# use with the `ENTRYPOINT`.
9491
COPY linux-anvil-cuda/entrypoint_source /opt/docker/bin/entrypoint_source
9592
COPY scripts/entrypoint /opt/docker/bin/entrypoint
9693

9794
# Ensure that all containers start with tini and the user selected process.
98-
# Activate the `conda` environment `base` and the devtoolset compiler.
95+
# Activate the `conda` environment `base`.
9996
# Provide a default command (`bash`), which will start if the user doesn't specify one.
10097
ENTRYPOINT [ "/opt/conda/bin/tini", "--", "/opt/docker/bin/entrypoint" ]
10198
CMD [ "/bin/bash" ]

0 commit comments

Comments
 (0)