Skip to content

Commit cf21c84

Browse files
committed
Try clang@10+cuda
1 parent 6303b41 commit cf21c84

File tree

2 files changed

+67
-35
lines changed

2 files changed

+67
-35
lines changed

docker/spack.yaml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,19 @@ spack:
2626
fc: /usr/bin/gfortran-11
2727
spec: clang@15
2828
target: x86_64
29+
- compiler:
30+
environment: {}
31+
extra_rpaths: []
32+
flags: {}
33+
modules: []
34+
operating_system: ubuntu20.04
35+
paths:
36+
cc: /usr/bin/clang
37+
cxx: /usr/bin/clang++
38+
f77: /usr/bin/gfortran
39+
fc: /usr/bin/gfortran
40+
spec: clang@10
41+
target: x86_64
2942
- compiler:
3043
environment: {}
3144
extra_rpaths: []
@@ -145,6 +158,11 @@ spack:
145158
externals:
146159
- spec: cmake@3.23.1
147160
prefix: /usr/local
161+
cuda:
162+
buildable: False
163+
externals:
164+
- spec: cuda@11.8.0 +allow-unsupported-compilers
165+
prefix: /usr/local/cuda
148166
flex:
149167
version: [2.6.4]
150168
buildable: false

docker/tpl-ubuntu-clang-cuda.Dockerfile

Lines changed: 49 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -24,63 +24,77 @@ RUN ln -fs /usr/share/zoneinfo/America/Los_Angeles /etc/localtime && \
2424
openmpi-bin \
2525
libopenmpi-dev \
2626
python3 \
27-
clang
27+
clang \
28+
# Additional spack dependencies
29+
python3-pip \
30+
pkg-config \
31+
xz-utils \
32+
unzip \
33+
libmpfr-dev \
34+
lbzip2 \
35+
virtualenv
36+
37+
# Install clingo for Spack
38+
RUN python3 -m pip install --upgrade pip && \
39+
python3 -m pip install clingo
2840

2941
RUN --mount=src=.,dst=$SRC_DIR $SRC_DIR/docker/install-cmake.sh
3042

31-
ENV CC=/usr/bin/clang \
32-
CXX=/usr/bin/clang++ \
33-
MPICC=/usr/bin/mpicc \
34-
MPICXX=/usr/bin/mpicxx \
35-
MPIEXEC=/usr/bin/mpirun
36-
ENV OMPI_CC=$CC \
37-
OMPI_CXX=$CXX
38-
ENV ENABLE_CUDA=ON \
39-
CMAKE_CUDA_FLAGS="-restrict -arch sm_70 --expt-extended-lambda -Werror cross-execution-space-call,reorder,deprecated-declarations"
40-
4143
# Installing TPL's
4244
FROM tpl_toolchain_intersect_geosx_toolchain AS tpl_toolchain
4345
ARG SRC_DIR
4446
ARG BLD_DIR
4547

46-
ENV FC=/usr/bin/gfortran \
47-
MPIFC=/usr/bin/mpifort
48-
ENV OMPI_FC=$FC
49-
5048
RUN apt-get install -y --no-install-recommends \
5149
libtbb-dev \
5250
bc \
5351
file \
5452
bison \
5553
flex \
56-
patch
57-
58-
ARG HOST_CONFIG
59-
60-
ARG CUDA_TOOLKIT_ROOT_DIR=/usr/local/cuda
61-
ARG CUDA_ARCH=sm_70
62-
ARG CMAKE_CUDA_COMPILER=$CUDA_TOOLKIT_ROOT_DIR/bin/nvcc
63-
ARG CMAKE_CUDA_ARCHITECTURES=70
64-
65-
ENV HYPRE_CUDA_SM=70
66-
ENV CUDA_HOME=$CUDA_TOOLKIT_ROOT_DIR
54+
patch \
55+
# `ca-certificates` needed by `git` to download GEOS repo.
56+
ca-certificates \
57+
git
58+
59+
# Clone branch with spack configs
60+
# TODO decide landing place of spack recipes
61+
RUN git clone --branch feature/han12/wip_docker_spack_recipes \
62+
--depth 1 \
63+
--single-branch \
64+
https://github.com/GEOS-DEV/GEOS.git
65+
66+
# Run uberenv
67+
# Have to create install directory first for uberenv
68+
# -k flag is to ignore SSL errors
69+
# Remove generated host-config for lvarray
70+
RUN --mount=src=.,dst=$SRC_DIR cd GEOS && \
71+
mkdir -p ${GEOSX_TPL_DIR} && \
72+
git submodule init scripts/uberenv && \
73+
git submodule update && \
74+
./scripts/uberenv/uberenv.py \
75+
--spec "%clang@10+cuda~uncrustify~openmp~pygeosx cuda_arch=70 ^cuda@11.8.0+allow-unsupported-compilers ^caliper@2.10.0~gotcha~sampler~libunwind~libdw~papi" \
76+
--spack-env-file=${SRC_DIR}/docker/spack.yaml \
77+
--project-json=.uberenv_config.json \
78+
--prefix ${GEOSX_TPL_DIR} \
79+
-k && \
80+
# Remove host-config generated for LvArray
81+
rm lvarray* && \
82+
# Rename and copy spack-generated host-config to root directory
83+
cp *.cmake /spack-generated.cmake && \
84+
# Remove extraneous spack files
85+
cd ${GEOSX_TPL_DIR} && \
86+
rm -rf bin/ build_stage/ misc_cache/ spack/ spack-env/ .spack-db/
6787

68-
RUN --mount=src=.,dst=$SRC_DIR $SRC_DIR/docker/configure-tpl.sh \
69-
-DENABLE_CUDA=$ENABLE_CUDA \
70-
-DENABLE_HYPRE_DEVICE="CUDA" \
71-
-DCUDA_TOOLKIT_ROOT_DIR=$CUDA_TOOLKIT_ROOT_DIR \
72-
-DCUDA_ARCH=$CUDA_ARCH \
73-
-DCMAKE_CUDA_ARCHITECTURES=$CMAKE_CUDA_ARCHITECTURES \
74-
-DCMAKE_CUDA_COMPILER=$CMAKE_CUDA_COMPILER
75-
WORKDIR $BLD_DIR
76-
RUN --mount=src=.,dst=$SRC_DIR make
7788

7889
# Extract only TPL's from previous stage
7990
FROM tpl_toolchain_intersect_geosx_toolchain AS geosx_toolchain
8091
ARG SRC_DIR
8192

8293
COPY --from=tpl_toolchain $GEOSX_TPL_DIR $GEOSX_TPL_DIR
8394

95+
# Extract the generated host-config
96+
COPY --from=tpl_toolchain /spack-generated.cmake /
97+
8498
RUN apt-get install -y --no-install-recommends \
8599
openssh-client \
86100
ca-certificates \

0 commit comments

Comments
 (0)