Skip to content

Commit

Permalink
Merge pull request #11 from rse-ops/add/spack-intel-mpi-libfabric
Browse files Browse the repository at this point in the history
add variant with intel mpi and libfabric
  • Loading branch information
vsoch authored Sep 5, 2023
2 parents 4058cd7 + 45133aa commit ff7ec17
Show file tree
Hide file tree
Showing 6 changed files with 566 additions and 0 deletions.
187 changes: 187 additions & 0 deletions spack-intel-mpi-libfabric/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,187 @@
ARG tag="8"
FROM rockylinux:${tag} as builder

ENV DEBIAN_FRONTEND=noninteractive
ENV SPACK_ROOT=/opt/spack-environment/spack
ARG spack_cpu_arch=x86_64

# Enable PowerTools for development packages
RUN yum -y update \
&& dnf -y install 'dnf-command(config-manager)' \
&& yum config-manager --set-enabled powertools \
&& yum -y update \
# Enable EPEL
&& yum -y install epel-release \
# Utilities
&& yum -y install \
wget \
man-db \
less \
xz \
lbzip2 \
fftw-devel \
fftw \
git \
curl \
bind-utils \
sudo \
munge \
ccache \
lua \
valgrind \
jq \
which \
file \
unzip \
vim \
patch \
diffutils \
# Compilers, autotools
pkgconfig \
libtool \
autoconf \
automake \
gcc-gfortran \
gcc \
gcc-c++ \
make \
cmake \
bison \
flex \
# Python
python36 \
python3-devel \
python3-cffi \
python3-six \
python3-yaml \
python3-jsonschema \
python3-sphinx \
# Development dependencies
libsodium-devel \
libyaml-devel \
libgomp \
zeromq-devel \
czmq-devel \
jansson-devel \
munge-devel \
ncurses-devel \
lz4-devel \
sqlite-devel \
boost-devel \
libuuid-devel \
hwloc-devel \
lua-devel \
libedit-devel \
valgrind-devel \
libs3-devel \
systemd-devel \
libarchive-devel \
pam-devel \
# Other deps
openssh-server \
openssh-clients \
perl-Time-HiRes \
lua-posix \
libfaketime \
cppcheck \
enchant \
aspell \
aspell-en \
sudo \
glibc-langpack-en \
hwloc \
&& yum clean all

# Set default /usr/bin/python to python3
RUN alternatives --set python /usr/bin/python3

ENV LANG=C.UTF-8
RUN printf "LANG=C.UTF-8" > /etc/locale.conf

# What we want to install and how we want to install it
# is specified in a manifest file (spack.yaml)
RUN mkdir /opt/spack-environment \
&& (echo "spack:" \
&& echo " specs:" \
&& echo " - intel-mpi@2021.8.0 target=${spack_cpu_arch}" \
&& echo " - flux-sched target=${spack_cpu_arch}" \
&& echo " - flux-core+mpi target=${spack_cpu_arch}" \
&& echo " concretizer:" \
&& echo " unify: true" \
&& echo " packages:" \
&& echo " intel-mpi:" \
&& echo " externals:" \
&& echo " - spec: intel-mpi@2021.8.0" \
&& echo " prefix: /opt/intel/mpi/2021.8.0" \
&& echo " buildable: false" \
&& echo " all:" \
&& echo " providers:"\
&& echo " mpi:" \
&& echo " - intel-mpi" \
&& echo " config:" \
&& echo " install_tree: /opt/software" \
&& echo " view: /opt/view") > /opt/spack-environment/spack.yaml

WORKDIR /opt/spack-environment
RUN git clone https://github.com/spack/spack.git && \
git clone https://github.com/GoogleCloudPlatform/hpc-tools && \
yum group install -y "Development tools" && \
cd hpc-tools/rocky_linux_8 && \
chmod +x google_install_intelmpi google_hpc_libfabric && \
# installs to /opt/intel
./google_install_intelmpi --impi_2021 && \
# And install libfabric with net/psm3
./google_hpc_libfabric --net --psm3

# And then
# FI_PROVIDER_PATH=<install_dir> to invoke the provider
# FI_PROVIDER=<net|psm3>.

# Install the software, remove unnecessary deps
RUN cd /opt/spack-environment && \
cd spack && \
# When flux-core 0.49.0 added, but flux-pmix 0.3.0 not added yet
git checkout b32edd3a72e8c39d69dea4ab0dd2066d460913d5 && \
mkdir -p /opt/spack-environment/spack/var/spack/repos/builtin/packages/flux-security

# This has openmpi replaced with virtual package mpi
# Enable Intel(R) MPI 2021 Libraries with:
# source /opt/intel/mpi/latest/env/vars.sh
COPY ./package.py /opt/spack-environment/spack/var/spack/repos/builtin/packages/flux-core/package.py
COPY ./flux-security/package.py /opt/spack-environment/spack/var/spack/repos/builtin/packages/flux-security/package.py
RUN . /opt/intel/mpi/latest/env/vars.sh && \
cd /opt/spack-environment \
&& . spack/share/spack/setup-env.sh \
&& spack env activate . \
&& spack external find intel-mpi \
&& spack external find openssh \
&& spack external find cmake \
&& spack external find python \
&& spack install --reuse --fail-fast \
&& spack gc -y

# Strip all the binaries
RUN find -L /opt/view/* -type f -exec readlink -f '{}' \; | \
xargs file -i | \
grep 'charset=binary' | \
grep 'x-executable\|x-archive\|x-sharedlib' | \
awk -F: '{print $1}' | xargs strip -s

# Modifications to the environment that are necessary to run
RUN cd /opt/spack-environment \
&& . spack/share/spack/setup-env.sh \
&& echo ". /opt/intel/mpi/latest/env/vars.sh" >> /etc/profile.d/z10_spack_environment.sh \
&& spack env activate --sh -d . >> /etc/profile.d/z10_spack_environment.sh

# Important! The versions of flux with pmix won't work without this flag
# the flux-restful api added support via version 0.0.15 of the python client
ENV FLUX_OPTION_FLAGS="-ompi=openmpi@5"

# Make sure that flux owns the spack install (so we see it)
RUN sudo adduser --password flux --uid 1000 flux && \
chown -R flux /opt && \
sudo chmod -R +r /opt

COPY ./etc.sudoers /etc/sudoers
COPY ./entrypoint.sh /entrypoint.sh
ENTRYPOINT ["/bin/bash", "/entrypoint.sh"]
5 changes: 5 additions & 0 deletions spack-intel-mpi-libfabric/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/usr/bin/env bash

. /etc/profile.d/z10_spack_environment.sh

exec "$@"
31 changes: 31 additions & 0 deletions spack-intel-mpi-libfabric/etc.sudoers
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#
# This file MUST be edited with the 'visudo' command as root.
#
# Please consider adding local content in /etc/sudoers.d/ instead of
# directly modifying this file.
#
# See the man page for details on how to write a sudoers file.
#
Defaults env_reset
Defaults mail_badpass
Defaults secure_path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin:/opt/view/bin"

# Host alias specification

# User alias specification

# Cmnd alias specification

# User privilege specification
root ALL=(ALL:ALL) ALL
flux ALL=(ALL) NOPASSWD:ALL

# Members of the admin group may gain root privileges
%admin ALL=(ALL) ALL

# Allow members of group sudo to execute any command
%sudo ALL=(ALL:ALL) ALL

# See sudoers(5) for more information on "#include" directives:

#includedir /etc/sudoers.d
62 changes: 62 additions & 0 deletions spack-intel-mpi-libfabric/flux-security/package.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# Copyright 2013-2023 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)

import os

import spack.util.executable
from spack.package import *


class FluxSecurity(AutotoolsPackage):
"""Independent project for Flux security code and APIs."""

homepage = "https://github.com/flux-framework/flux-security"
url = "https://github.com/flux-framework/flux-security/releases/download/v0.8.0/flux-security-0.8.0.tar.gz"
git = "https://github.com/flux-framework/flux-security.git"
tags = ["radiuss", "e4s"]

maintainers("grondo")

version("master", branch="master")
version("0.9.0", sha256="2258120c6f32ca0b5b13b166bae56d9bd82a44c6eeaa6bc6187e4a4419bdbcc0")
version("0.8.0", sha256="9963628063b4abdff6bece03208444c8f23fbfda33c20544c48b21e9f4819ce2")

# Need autotools when building on master:
depends_on("autoconf", type="build", when="@master")
depends_on("automake", type="build", when="@master")
depends_on("libtool", type="build", when="@master")

depends_on("pkgconfig")
depends_on("libsodium@1.0.14:")
depends_on("jansson")
depends_on("libuuid")
depends_on("munge")
depends_on("libpam")

def setup(self):
pass

@when("@master")
def setup(self):
with working_dir(self.stage.source_path):
# Allow git-describe to get last tag so flux-version works:
git = which("git")
# When using spack develop, this will already be unshallow
try:
git("fetch", "--unshallow")
git("config", "remote.origin.fetch", "+refs/heads/*:refs/remotes/origin/*")
git("fetch", "origin")
except spack.util.executable.ProcessError:
git("fetch")

def autoreconf(self, spec, prefix):
self.setup()
if os.path.exists(self.configure_abs_path):
return
# make sure configure doesn't get confused by the staging symlink
with working_dir(self.configure_directory):
# Bootstrap with autotools
bash = which("bash")
bash("./autogen.sh")
Loading

0 comments on commit ff7ec17

Please sign in to comment.