Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Openblas +noavx512 "no such variant" during docker build error after using "containerize" #1453

Open
acrosby opened this issue Jan 14, 2025 · 2 comments
Labels
bug Something is not working

Comments

@acrosby
Copy link

acrosby commented Jan 14, 2025

Description

I am not sure if this is the right place to file this bug, or if it is even really a bug. However, we just ran into "No such variant 'noavx512' in package openblas" while attempting to create a gcc/openmpi based container image from the 1.8.0 release.

 => ERROR [builder 6/8] RUN cd /opt/spack-environment && spack env activate . && spack install --fail-fast && spack gc -y      11.5s 
------                                                                                                                               
 > [builder 6/8] RUN cd /opt/spack-environment && spack env activate . && spack install --fail-fast && spack gc -y:
10.20 ==> Error: cannot emit requirements for the solver: No such variant 'noavx512' in package openblas
------
Dockerfile:521
--------------------
 519 |     
 520 |     # Install the software, remove unnecessary deps
 521 | >>> RUN cd /opt/spack-environment && spack env activate . && spack install --fail-fast && spack gc -y
 522 |     
 523 |     # Modifications to the environment that are necessary to run
--------------------
ERROR: failed to solve: process "docker-shell cd /opt/spack-environment && spack env activate . && spack install --fail-fast && spack gc -y" did not complete successfully: exit code: 3
make: *** [makefile:57: jcsda-spackstack] Error 1

To Reproduce

Here is a section of our makefile that clones the JCSDA Spack-stack repo and switches to the 1.8.0 release, before running spack containerize and building the image with docker build.

SPACK_RELEASE ?= 1.8.0
DIRS := $(spack-stack spack)

spack-stack: 
	git clone --recurse-submodules https://github.com/JCSDA/spack-stack -b release/$(SPACK_RELEASE)

spackstack-ubuntu-gcc-openmpi_$(SPACK_RELEASE).dockerfile: spack-stack spack
	rm -rf spack-stack/envs/docker-ubuntu-gcc-openmpi
	source spack-stack/setup.sh; (spack stack create ctr -h && spack stack create ctr --container=docker-ubuntu-gcc-openmpi --specs=jedi-ci && cd spack-stack/envs/docker-ubuntu-gcc-openmpi && spack containerize > Dockerfile && cp Dockerfile ../../../spackstack-ubuntu-gcc-openmpi_$(SPACK_RELEASE).dockerfile) || exit 1

dockerfile: spackstack-ubuntu-gcc-openmpi_$(SPACK_RELEASE).dockerfile

jcsda-spackstack: spackstack-ubuntu-gcc-openmpi_$(SPACK_RELEASE).dockerfile
	DOCKER_BUILDKIT=1 docker build --rm --tag jcsda-spacstack:$(SPACK_RELEASE) -f spackstack-ubuntu-gcc-openmpi_$(SPACK_RELEASE).dockerfile spack-stack/envs/docker-ubuntu-gcc-openmpi

build: jcsda-spackstack spack-stack spack

Expected behavior

Completed docker build of a base 1.8.0 jcsda/spack-stack container image.

System:

The building is happening on an Ubuntu 20.04 machine.

Here is the full Dockerfile that is created:

FROM ubuntu:22.04 as bootstrap

ENV SPACK_ROOT=/opt/spack \
    CURRENTLY_BUILDING_DOCKER_IMAGE=1 \
    container=docker

ENV DEBIAN_FRONTEND=noninteractive   \
    LANGUAGE=en_US.UTF-8 \
    LANG=en_US.UTF-8 \
    LC_ALL=en_US.UTF-8

RUN apt-get -yqq update \
 && apt-get -yqq upgrade \
 && apt-get -yqq install --no-install-recommends \
        build-essential \
        ca-certificates \
        curl \
        file \
        g++ \
        gcc \
        gfortran \
        git \
        gnupg2 \
        iproute2 \
        locales \
        make \
        mercurial \
        subversion \
        python3 \
        python3-pip \
        python3-setuptools \
        unzip \
        zstd \
 && locale-gen en_US.UTF-8 \
 && pip3 install boto3 \
 && rm -rf /var/lib/apt/lists/*

RUN mkdir $SPACK_ROOT && cd $SPACK_ROOT && \
    git init --quiet && git remote add origin https://github.com/jcsda/spack && git fetch --depth=1 origin dd99fc1e177cbae412e1753f3a81499df90cee27 && git checkout --detach FETCH_HEAD && \
    mkdir -p $SPACK_ROOT/opt/spack

RUN ln -s $SPACK_ROOT/share/spack/docker/entrypoint.bash \
          /usr/local/bin/docker-shell \
 && ln -s $SPACK_ROOT/share/spack/docker/entrypoint.bash \
          /usr/local/bin/interactive-shell \
 && ln -s $SPACK_ROOT/share/spack/docker/entrypoint.bash \
          /usr/local/bin/spack-env

RUN mkdir -p /root/.spack \
 && cp $SPACK_ROOT/share/spack/docker/modules.yaml \
        /root/.spack/modules.yaml \
 && rm -rf /root/*.* /run/nologin

# [WORKAROUND]
# https://superuser.com/questions/1241548/
#     xubuntu-16-04-ttyname-failed-inappropriate-ioctl-for-device#1253889
RUN [ -f ~/.profile ]                                               \
 && sed -i 's/mesg n/( tty -s \\&\\& mesg n || true )/g' ~/.profile \
 || true


WORKDIR /root
SHELL ["docker-shell"]

# Creates the package cache
RUN spack bootstrap now \
    && spack bootstrap status --optional \
    && spack spec hdf5+mpi

ENTRYPOINT ["/bin/bash", "/opt/spack/share/spack/docker/entrypoint.bash"]
CMD ["interactive-shell"]

# Build stage with Spack pre-installed and ready to be used
FROM bootstrap as builder

# Install OS packages needed to build the software
RUN apt-get -yqq update && apt-get -yqq upgrade \
 && apt-get -yqq install bc cpp-12 g++-12 gcc-12 gfortran-12 git git-lfs make mysql-server qtbase5-dev qt5-qmake libqt5svg5-dev qt5dxcb-plugin wget \
 && rm -rf /var/lib/apt/lists/*

# Copy the spack-stack extension repo into the spack code
COPY spack-ext-/repos/spack-stack $SPACK_ROOT/var/spack/repos/spack-stack
# Register spack-stack extension repo
RUN spack repo add $SPACK_ROOT/var/spack/repos/spack-stack --scope defaults
# Set the GNU 12.x toolchain as the default compilers.
RUN ln -svf /usr/bin/gfortran-12 /usr/bin/gfortran && \
ln -svf /usr/bin/cpp-12 /usr/bin/cpp && \
ln -svf /usr/bin/gcc-12 /usr/bin/gcc && \
ln -svf /usr/bin/g++-12 /usr/bin/g++


# What we want to install and how we want to install it
# is specified in a manifest file (spack.yaml)
RUN mkdir -p /opt/spack-environment && \
set -o noclobber \
&&  (echo spack: \
&&   echo '  concretizer:' \
&&   echo '    unify: true' \
&&   echo '' \
&&   echo '  config:' \
&&   echo '    checksum: false' \
&&   echo '    build_jobs: 2' \
&&   echo '    connect_timeout: 60' \
&&   echo '' \
&&   echo '    install_tree: /opt/software' \
&&   echo '  compilers:' \
&&   echo '  - compiler:' \
&&   echo '      spec: [email protected]' \
&&   echo '      paths:' \
&&   echo '        cc: /usr/bin/gcc-12' \
&&   echo '        cxx: /usr/bin/g++-12' \
&&   echo '        f77: /usr/bin/gfortran-12' \
&&   echo '        fc: /usr/bin/gfortran-12' \
&&   echo '      flags: {}' \
&&   echo '      operating_system: ubuntu22.04' \
&&   echo '      modules: []' \
&&   echo '      environment: {}' \
&&   echo '      extra_rpaths: []' \
&&   echo '' \
&&   echo '  # Basic package config from configs/common/packages.yaml' \
&&   echo '  # Additional package config for container' \
&&   echo '  packages:' \
&&   echo '    all:' \
&&   echo '      providers:' \
&&   echo '        gl: [opengl]' \
&&   echo '        glu: [openglu]' \
&&   echo '        jpeg: [libjpeg-turbo]' \
&&   echo '        pkgconfig: [pkg-config]' \
&&   echo '        yacc: [bison]' \
&&   echo '        zlib-api: [zlib-ng]' \
&&   echo '        mpi: [[email protected]]' \
&&   echo '      require: '"'"'%gcc'"'"'' \
&&   echo '      target: [x86_64]' \
&&   echo '      compiler: [[email protected]]' \
&&   echo '    awscli-v2:' \
&&   echo '      require: ~examples' \
&&   echo '    bacio:' \
&&   echo '      require: '"'"'@2.4.1'"'"'' \
&&   echo '    bison:' \
&&   echo '      require: '"'"'@3.4:'"'"'' \
&&   echo '  # 1.85 incompatible with [email protected] - use latest '"'"'good version'"'"'' \
&&   echo '    boost:' \
&&   echo '      require:' \
&&   echo '      - '"'"'@1.84 ~atomic +chrono +date_time +exception +filesystem ~graph ~iostreams' \
&&   echo '        ~locale ~log ~math ~mpi ~numpy +pic +program_options +python ~random +regex' \
&&   echo '        +serialization ~signals +system +test +thread +timer ~wave cxxstd=17 visibility=hidden'"'"'' \
&&   echo '    bufr:' \
&&   echo '      require: '"'"'@12.1.0 +python'"'"'' \
&&   echo '    bufr-query:' \
&&   echo '      require: '"'"'@0.0.2 +python'"'"'' \
&&   echo '    cairo:' \
&&   echo '      require: +pic' \
&&   echo '    cdo:' \
&&   echo '      require: '"'"'@2.3.0 ~openmp'"'"'' \
&&   echo '    cmake:' \
&&   echo '      version: [3.27.9]' \
&&   echo '      require: +ownlibs' \
&&   echo '  # Attention - when updating also check the various jcsda-emc-bundles env packages' \
&&   echo '    crtm:' \
&&   echo '      require: +fix' \
&&   echo '    ecbuild:' \
&&   echo '      require: '"'"'@3.7.2'"'"'' \
&&   echo '    eccodes:' \
&&   echo '      require: '"'"'@2.33.0 +png +tools'"'"'' \
&&   echo '    ecflow:' \
&&   echo '      require:' \
&&   echo '      - '"'"'@5.11.4 +ui'"'"'' \
&&   echo '    eckit:' \
&&   echo '      require: '"'"'@1.27.0 linalg=eigen,lapack compression=lz4,bzip2'"'"'' \
&&   echo '    ecmwf-atlas:' \
&&   echo '      require: '"'"'@0.38.1 +fckit +trans +tesselation +fftw'"'"'' \
&&   echo '    ectrans:' \
&&   echo '      require:' \
&&   echo '      - '"'"'@1.2.0'"'"'' \
&&   echo '    eigen:' \
&&   echo '      require: '"'"'@3.4.0'"'"'' \
&&   echo '  # Attention - when updating the version also check the common modules.yaml' \
&&   echo '  # config and update the projections for lmod/tcl.' \
&&   echo '  # Also, check the acorn and derecho site configs which have esmf modifications.' \
&&   echo '    esmf:' \
&&   echo '      require:' \
&&   echo '      - ~xerces ~pnetcdf +shared +external-parallelio' \
&&   echo '      - any_of: ['"'"'@=8.6.1 snapshot=none'"'"', '"'"'@=8.7.0b11 snapshot=b11'"'"']' \
&&   echo '      - any_of: [fflags="-fp-model precise" cxxflags="-fp-model precise"]' \
&&   echo '        when: '"'"'%intel'"'"'' \
&&   echo '        message: Extra ESMF compile options for Intel' \
&&   echo '      #- any_of: ['"'"''"'"']' \
&&   echo '      #  when: "%gcc"' \
&&   echo '      #  message: "Extra ESMF compile options for GCC"' \
&&   echo '      #- any_of: ['"'"''"'"']' \
&&   echo '      #  when: "%apple-clang"' \
&&   echo '      #  message: "Extra ESMF compile options for GCC"' \
&&   echo '    fckit:' \
&&   echo '      require: '"'"'@0.11.0 +eckit'"'"'' \
&&   echo '    fftw:' \
&&   echo '      require: '"'"'@3.3.10'"'"'' \
&&   echo '    fiat:' \
&&   echo '      require: '"'"'@1.2.0'"'"'' \
&&   echo '    flex:' \
&&   echo '    # Pin version to avoid duplicates' \
&&   echo '      require: '"'"'@2.6.4'"'"'' \
&&   echo '    fms:' \
&&   echo '      require:' \
&&   echo '      - '"'"'@2024.02'"'"'' \
&&   echo '      - precision=32,64 +quad_precision +gfs_phys +openmp +pic constants=GFS build_type=Release' \
&&   echo '        +deprecated_io' \
&&   echo '    fontconfig:' \
&&   echo '      require: +pic' \
&&   echo '    freetype:' \
&&   echo '      require: +pic' \
&&   echo '    g2:' \
&&   echo '      require:' \
&&   echo '      - '"'"'@3.5.1'"'"'' \
&&   echo '    g2c:' \
&&   echo '      require: '"'"'@1.6.4'"'"'' \
&&   echo '    g2tmpl:' \
&&   echo '      require:' \
&&   echo '      - '"'"'@1.13.0'"'"'' \
&&   echo '    gcc-runtime:' \
&&   echo '      require: '"'"'%gcc'"'"'' \
&&   echo '      buildable: false' \
&&   echo '      externals:' \
&&   echo '      - spec: [email protected]' \
&&   echo '        prefix: /usr' \
&&   echo '    gfsio:' \
&&   echo '      require: '"'"'@1.4.1'"'"'' \
&&   echo '  #git-lfs:' \
&&   echo '    # Assume git-lfs is provided, hard to install' \
&&   echo '    # because of dependencies on go/go-bootstrap.' \
&&   echo '    # Note: Uncommenting this entry will break' \
&&   echo '    # the container builds.' \
&&   echo '    #require: '"'"'@2.11.0'"'"'' \
&&   echo '    grib-util:' \
&&   echo '      require: '"'"'@1.4.0'"'"'' \
&&   echo '    gsibec:' \
&&   echo '      require:' \
&&   echo '      - '"'"'@1.2.1'"'"'' \
&&   echo '    gsi-ncdiag:' \
&&   echo '      require: '"'"'@1.1.2'"'"'' \
&&   echo '    gsl-lite:' \
&&   echo '      require: '"'"'@0.37.0'"'"'' \
&&   echo '    hdf:' \
&&   echo '      require: '"'"'@4.2.15 +external-xdr ~fortran ~netcdf'"'"'' \
&&   echo '    hdf5:' \
&&   echo '      require: '"'"'@1.14.3 +hl +fortran +mpi +threadsafe ~szip'"'"'' \
&&   echo '  # Newer versions of hdf-eos2 require manual downloading, avoid' \
&&   echo '    hdf-eos2:' \
&&   echo '      require: '"'"'@2.20v1.00'"'"'' \
&&   echo '    ip:' \
&&   echo '      require: '"'"'@5.0.0 precision=4,d,8'"'"'' \
&&   echo '    ip2:' \
&&   echo '      require: '"'"'@1.1.2'"'"'' \
&&   echo '    jasper:' \
&&   echo '      require: '"'"'@2.0.32'"'"'' \
&&   echo '    jedi-cmake:' \
&&   echo '      require: '"'"'@1.4.0'"'"'' \
&&   echo '    landsfcutil:' \
&&   echo '      require: '"'"'@2.4.1'"'"'' \
&&   echo '    libjpeg-turbo:' \
&&   echo '      require: '"'"'@2.1.0'"'"'' \
&&   echo '    libpng:' \
&&   echo '      require: '"'"'@1.6.37 +pic'"'"'' \
&&   echo '  # Newest version of magics needed for oneapi compilers' \
&&   echo '    magics:' \
&&   echo '      require: '"'"'@4.15.3:'"'"'' \
&&   echo '    mapl:' \
&&   echo '      require: '"'"'@2.46.3 ~shared ~f2py'"'"'' \
&&   echo '      variants: +pflogger' \
&&   echo '  # If making changes here, also check the Discover site configs and the CI workflows' \
&&   echo '    met:' \
&&   echo '      require: '"'"'@11.1.1 +python +grib2'"'"'' \
&&   echo '    metplus:' \
&&   echo '      require: '"'"'@5.1.0'"'"'' \
&&   echo '    metis:' \
&&   echo '      require: +int64 +real64' \
&&   echo '    mpich:' \
&&   echo '      require: ~hwloc' \
&&   echo '    nco:' \
&&   echo '      require: '"'"'@5.1.6 ~doc'"'"'' \
&&   echo '  # ncview - when adding information here, also check Orion' \
&&   echo '  # and Discover site configs' \
&&   echo '    nemsio:' \
&&   echo '      require: '"'"'@2.5.4'"'"'' \
&&   echo '    nemsiogfs:' \
&&   echo '      require: '"'"'@2.5.3'"'"'' \
&&   echo '    nccmp:' \
&&   echo '      require: '"'"'@1.9.0.1'"'"'' \
&&   echo '    ncio:' \
&&   echo '      require: '"'"'@1.1.2'"'"'' \
&&   echo '    netcdf-c:' \
&&   echo '    # If using 4.9.1, turn off byterange variant to fix compile error: ~byterange' \
&&   echo '      require: '"'"'@4.9.2 +dap +mpi ~parallel-netcdf ~szip build_system=autotools'"'"'' \
&&   echo '    netcdf-cxx4:' \
&&   echo '      require: '"'"'@4.3.1'"'"'' \
&&   echo '    netcdf-fortran:' \
&&   echo '      require: '"'"'@4.6.1'"'"'' \
&&   echo '  # ninja - when adding information here, also check Discover site config' \
&&   echo '    odc:' \
&&   echo '      require: '"'"'@1.5.2 ~fortran'"'"'' \
&&   echo '    openblas:' \
&&   echo '      require: '"'"'@0.3.24 +noavx512'"'"'' \
&&   echo '    openmpi:' \
&&   echo '      require: ~internal-hwloc +two_level_namespace' \
&&   echo '    openssl:' \
&&   echo '      require: +shared' \
&&   echo '    p4est:' \
&&   echo '      require: '"'"'@2.8'"'"'' \
&&   echo '    parallelio:' \
&&   echo '      require: '"'"'@2.6.2 +pnetcdf'"'"'' \
&&   echo '    parallel-netcdf:' \
&&   echo '      require: '"'"'@1.12.3'"'"'' \
&&   echo '    pflogger:' \
&&   echo '      require: +mpi' \
&&   echo '    pixman:' \
&&   echo '      require: +pic' \
&&   echo '    prod-util:' \
&&   echo '      require: '"'"'@2.1.1'"'"'' \
&&   echo '    proj:' \
&&   echo '      require: ~tiff' \
&&   echo '    python:' \
&&   echo '      require: '"'"'@3.11.7'"'"'' \
&&   echo '    py-attrs:' \
&&   echo '    # https://github.com/JCSDA/spack-stack/issues/740' \
&&   echo '      require: '"'"'@21.4.0'"'"'' \
&&   echo '    py-cartopy:' \
&&   echo '      require: +plotting' \
&&   echo '    py-cryptography:' \
&&   echo '      require: +rust_bootstrap' \
&&   echo '  # Introduced in https://github.com/JCSDA/spack-stack/pull/894, pin py-cython' \
&&   echo '  # to avoid duplicate packages being built (cylc dependencies soft-want @3:)' \
&&   echo '    py-cython:' \
&&   echo '      require: '"'"'@0.29.36'"'"'' \
&&   echo '  # As long as we need the "delayed" variant for py-dask,' \
&&   echo '  # we are restricted to version 2021.03.0 (last one that has it)' \
&&   echo '  # and newer than 2021.01.0 because of these issues:' \
&&   echo '  # https://github.com/JCSDA/spack-stack/issues/1216' \
&&   echo '  # https://github.com/pydata/xarray/issues/8917' \
&&   echo '    py-dask:' \
&&   echo '      require: '"'"'@2021.3.0'"'"'' \
&&   echo '  # To avoid duplicate packages' \
&&   echo '    py-flit-core:' \
&&   echo '      require: '"'"'@3.8.0'"'"'' \
&&   echo '    py-h5py:' \
&&   echo '      require: ~mpi' \
&&   echo '  ## To avoid duplicate packages' \
&&   echo '  #py-jinja2:' \
&&   echo '  #  require: '"'"'@3.1.2'"'"'' \
&&   echo '  # https://github.com/JCSDA/spack-stack/issues/1276' \
&&   echo '    py-matplotlib:' \
&&   echo '      require: '"'"'@3.7.4'"'"'' \
&&   echo '    py-meson-python:' \
&&   echo '      require: '"'"'@0.15.0'"'"'' \
&&   echo '  # Comment out for now until build problems are solved' \
&&   echo '  # https://github.com/jcsda/spack-stack/issues/522' \
&&   echo '  # see also ewok-env virtual package and container' \
&&   echo '  # README.md' \
&&   echo '  #py-mysql-connector-python:' \
&&   echo '  #  require: '"'"'@8.0.32'"'"'' \
&&   echo '    py-netcdf4:' \
&&   echo '      require: '"'"'@1.5.8 ~mpi'"'"'' \
&&   echo '  # [email protected] causes many build problems with older Python packages' \
&&   echo '  # also check Nautilus site config when making changes here' \
&&   echo '  # https://github.com/JCSDA/spack-stack/issues/1276' \
&&   echo '    py-numpy:' \
&&   echo '      require:' \
&&   echo '      - '"'"'@:1.23.5'"'"'' \
&&   echo '    py-pandas:' \
&&   echo '      require: +excel' \
&&   echo '    py-pybind11:' \
&&   echo '      require: '"'"'@2.11.0'"'"'' \
&&   echo '  # Pin the py-setuptools version to avoid duplicate Python packages' \
&&   echo '    py-setuptools:' \
&&   echo '      require: '"'"'@63.4.3'"'"'' \
&&   echo '    py-setuptools-rust:' \
&&   echo '      require: +rust_bootstrap' \
&&   echo '    py-shapely:' \
&&   echo '      require: '"'"'@1.8.0'"'"'' \
&&   echo '    py-torch:' \
&&   echo '      require: +custom-protobuf ~mkldnn' \
&&   echo '  # To avoid duplicate packages' \
&&   echo '    py-urllib3:' \
&&   echo '      require: '"'"'@1.26.12'"'"'' \
&&   echo '    qt:' \
&&   echo '      require: '"'"'@5'"'"'' \
&&   echo '      buildable: false' \
&&   echo '      externals:' \
&&   echo '      - spec: [email protected]' \
&&   echo '        prefix: /usr' \
&&   echo '      version: [5.15.3]' \
&&   echo '    scotch:' \
&&   echo '      require: '"'"'@7.0.4 +mpi+metis~shared~threads~mpi_thread+noarch'"'"'' \
&&   echo '    sfcio:' \
&&   echo '      require: '"'"'@1.4.1'"'"'' \
&&   echo '    shumlib:' \
&&   echo '      require: '"'"'@macos_clang_linux_intel_port'"'"'' \
&&   echo '    sigio:' \
&&   echo '      require: '"'"'@2.3.2'"'"'' \
&&   echo '    sp:' \
&&   echo '      require: '"'"'@2.5.0 precision=4,d,8'"'"'' \
&&   echo '    udunits:' \
&&   echo '      require: '"'"'@2.2.28'"'"'' \
&&   echo '    ufs-utils:' \
&&   echo '      require: '"'"'@1.13.0'"'"'' \
&&   echo '  # Note - we can remove upp from stack at some point?' \
&&   echo '    upp:' \
&&   echo '      require: '"'"'@10.0.10'"'"'' \
&&   echo '  # Need extradeps for grib-utils, enable by default to avoid duplicate packages' \
&&   echo '    w3emc:' \
&&   echo '      require: '"'"'@2.10.0 precision=4,d,8 +extradeps'"'"'' \
&&   echo '    w3nco:' \
&&   echo '      require: '"'"'@2.4.1'"'"'' \
&&   echo '    wgrib2:' \
&&   echo '      require:' \
&&   echo '      - '"'"'@3.1.1'"'"'' \
&&   echo '    wrf-io:' \
&&   echo '      require: '"'"'@1.2.0'"'"'' \
&&   echo '    zstd:' \
&&   echo '      require: '"'"'@1.5.2 +programs'"'"'' \
&&   echo '    gcc:' \
&&   echo '      buildable: false' \
&&   echo '      externals:' \
&&   echo '      - spec: [email protected]' \
&&   echo '        prefix: /usr' \
&&   echo '    gmake:' \
&&   echo '      buildable: false' \
&&   echo '      externals:' \
&&   echo '      - spec: [email protected]' \
&&   echo '        prefix: /usr' \
&&   echo '    diffutils:' \
&&   echo '      buildable: false' \
&&   echo '      externals:' \
&&   echo '      - spec: [email protected]' \
&&   echo '        prefix: /usr' \
&&   echo '    git:' \
&&   echo '      buildable: false' \
&&   echo '      externals:' \
&&   echo '      - spec: [email protected]~tcltk' \
&&   echo '        prefix: /usr' \
&&   echo '    git-lfs:' \
&&   echo '      buildable: false' \
&&   echo '      externals:' \
&&   echo '      - spec: [email protected]' \
&&   echo '        prefix: /usr' \
&&   echo '    mysql:' \
&&   echo '      buildable: false' \
&&   echo '      externals:' \
&&   echo '      - spec: [email protected]' \
&&   echo '        prefix: /usr' \
&&   echo '    wget:' \
&&   echo '      buildable: false' \
&&   echo '      externals:' \
&&   echo '      - spec: [email protected]' \
&&   echo '        prefix: /usr' \
&&   echo '      version: [1.21.2]' \
&&   echo '' \
&&   echo '  specs:' \
&&   echo '  - [email protected]' \
&&   echo '  - [email protected]' \
&&   echo '  - [email protected]' \
&&   echo '  - [email protected]' \
&&   echo '  - [email protected]' \
&&   echo '  - [email protected]' \
&&   echo '  - [email protected]' \
&&   echo '  - [email protected]' \
&&   echo '  - [email protected]' \
&&   echo '  - [email protected]' \
&&   echo '  - [email protected]' \
&&   echo '  - [email protected]' \
&&   echo '  - [email protected]' \
&&   echo '  - [email protected] +fckit +trans +tesselation +fftw' \
&&   echo '  - [email protected]' \
&&   echo '  - [email protected] +fftw' \
&&   echo '  - [email protected]' \
&&   echo '  - [email protected]' \
&&   echo '  - [email protected]' \
&&   echo '  - [email protected]' \
&&   echo '  - [email protected]' \
&&   echo '  - [email protected]' \
&&   echo '  - [email protected]' \
&&   echo '  - [email protected]' \
&&   echo '  - [email protected]' \
&&   echo '  - [email protected]' \
&&   echo '  - [email protected]' \
&&   echo '  - [email protected]' \
&&   echo '  - [email protected]' \
&&   echo '  - [email protected]' \
&&   echo '  - [email protected]' \
&&   echo '  - [email protected]' \
&&   echo '  - [email protected] +pnetcdf' \
&&   echo '  - [email protected]' \
&&   echo '  - [email protected]' \
&&   echo '  - [email protected]' \
&&   echo '  - [email protected]' \
&&   echo '  - [email protected]' \
&&   echo '  - [email protected]' \
&&   echo '  - [email protected]' \
&&   echo '  - py-pip' \
&&   echo '  - [email protected]' \
&&   echo '  - [email protected]' \
&&   echo '  - [email protected]' \
&&   echo '  - [email protected]' \
&&   echo '  - [email protected]' \
&&   echo '  - [email protected]' \
&&   echo '  - [email protected]' \
&&   echo '  - [email protected]' \
&&   echo '  - [email protected]' \
&&   echo '  - [email protected]' \
&&   echo '  - [email protected]' \
&&   echo '  - [email protected]' \
&&   echo '  - [email protected]' \
&&   echo '  - shumlib@macos_clang_linux_intel_port' \
&&   echo '  - [email protected]' \
&&   echo '  - [email protected]' \
&&   echo '  - [email protected]' \
&&   echo '  - [email protected]' \
&&   echo '  - [email protected]' \
&&   echo '  - [email protected]' \
&&   echo '  view: /opt/views/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

# Modifications to the environment that are necessary to run
RUN cd /opt/spack-environment && \
    spack env activate --sh -d . > activate.sh

# Put output of spack find into a file
RUN cd /opt/spack-environment && \
spack env activate -d . && \
spack find 2>&1 | tee /root/spack_find.out


# Bare OS image to run the installed executables
FROM ubuntu:22.04

COPY --from=builder /opt/spack-environment /opt/spack-environment
COPY --from=builder /opt/software /opt/software

# paths.view is a symlink, so copy the parent to avoid dereferencing and duplicating it
COPY --from=builder /opt/views /opt/views

RUN { \
      echo '#!/bin/sh' \
      && echo '.' /opt/spack-environment/activate.sh \
      && echo 'exec "$@"'; \
    } > /entrypoint.sh \
&& chmod a+x /entrypoint.sh \
&& ln -s /opt/views/view /opt/view


# Set environment variables for installing tzdata
ENV DEBIAN_FRONTEND=noninteractive
ENV TZ=Etc/UTC
ENV CC=gcc
ENV CXX=g++
ENV FC=gfortran


RUN apt-get -yqq update && apt-get -yqq upgrade \
 && apt-get -yqq install bc cpp-12 g++-12 gcc-12 gfortran-12 git git-lfs make mysql-server qtbase5-dev qt5-qmake libqt5svg5-dev qt5dxcb-plugin wget ca-certificates curl file gnupg2 iproute2 locales unzip vim nano less \
 && rm -rf /var/lib/apt/lists/*

# Copy spack find output from builder
COPY --from=builder /root/spack_find.out /root/spack_find.out
# Set the GNU 12.x toolchain as the default compilers.
RUN ln -svf /usr/bin/gfortran-12 /usr/bin/gfortran && \
ln -svf /usr/bin/cpp-12 /usr/bin/cpp && \
ln -svf /usr/bin/gcc-12 /usr/bin/gcc && \
ln -svf /usr/bin/g++-12 /usr/bin/g++
# Make a non-root user:nonroot / group:nonroot for running MPI
RUN useradd -U -k /etc/skel -s /bin/bash -d /home/nonroot -m nonroot --uid 43891 && \
echo "ulimit -s unlimited" >> /home/nonroot/.bashrc && \
echo "ulimit -v unlimited" >> /home/nonroot/.bashrc && \
echo "export CC=gcc" >> /home/nonroot/.bashrc && \
echo "export CXX=g++" >> /home/nonroot/.bashrc && \
echo "export FC=gfortran" >> /home/nonroot/.bashrc && \
printf "[credential]\n    helper = cache --timeout=7200\n" >> /home/nonroot/.gitconfig && \
mkdir /home/nonroot/.pmix && \
echo "rmaps_default_mapping_policy=:oversubscribe" >> /home/nonroot/.pmix/mca-params.conf && \
chown -R nonroot:nonroot /home/nonroot/.gitconfig /home/nonroot/.pmix
# Replicate settings for root user
RUN echo "ulimit -s unlimited" >> /root/.bashrc && \
echo "ulimit -v unlimited" >> /root/.bashrc && \
echo "export CC=gcc" >> /root/.bashrc && \
echo "export CXX=g++" >> /root/.bashrc && \
echo "export FC=gfortran" >> /root/.bashrc && \
printf "[credential]\n    helper = cache --timeout=7200\n" >> /root/.gitconfig && \
mkdir /root/.pmix && \
echo "rmaps_default_mapping_policy=:oversubscribe" >> /root/.pmix/mca-params.conf
# Also set necessary environment variables for openmpi and jedi-cmake.
RUN echo "export OMPI_ALLOW_RUN_AS_ROOT=1" >> /root/.bashrc && \
echo "export OMPI_ALLOW_RUN_AS_ROOT_CONFIRM=1" >> /root/.bashrc && \
echo "export PRTE_MCA_rmaps_default_mapping_policy=:oversubscribe" >> /root/.bashrc && \
echo "export jedi_cmake_ROOT=$(ls -d /opt/software/linux-ubuntu*/gcc-*/jedi-cmake-*)" >> /root/.bashrc

LABEL "app"="jedi-ci"
LABEL "mpi"="openmpi"
ENTRYPOINT [ "/entrypoint.sh" ]
CMD [ "/bin/bash" ]

Additional

Is there an override/workaround we can employ so that our automated builds/CI won't fail without a manual edit or new Dockerfile. We are not well-versed in all of the available ways to configure a spack-stack, but not above using sed to modify the Dockerfile or yaml that is created.

@acrosby acrosby added the bug Something is not working label Jan 14, 2025
@climbfuji
Copy link
Collaborator

I checked the current spack-stack develop config, and there is no variant noavx512 for openblas anymore:

Can you sed-out the variant +noavx512 from configs/common/packages.yaml before running the spack stack create ctr command?

@acrosby
Copy link
Author

acrosby commented Jan 15, 2025

Can you sed-out the variant +noavx512 from configs/common/packages.yaml before running the spack stack create ctr command?

Yes we can, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something is not working
Projects
None yet
Development

No branches or pull requests

2 participants