Warewulf 101 | CIQ Webinar

Rose Stein and I talked about the latest Warewulf release, how to get involved in the Warewulf community, and what to expect in v4.5.5, and I demonstrated lifting image size limits with the new two-stage boot.

Benchmarking Containerized MPI with Apptainer on Dell PowerEdge and Cornelis Omni-Path

This article was also published via the CIQ blog on 6 September 2023.

In a previous article, I demonstrated how Warewulf makes it simple to deploy an HPC cluster. Now, I don’t know about you; but, once I have a cluster, I immediately start looking for something to run on it. But I’m a systems guy—not a domain scientist—so that usually means I start benchmarking.

Recently at CIQ, we’ve been advocating for attention and development around containerization of MPI using Apptainer. In particular, we’ve been championing the use of PMI to support completely portable MPI containerization, where the containerized application shares no MPI dependency with the host system. It’s our hope that, by making containerized MPI more portable and more broadly applicable, we’ll see even broader adoption of containerization in HPC.

But this increased adoption brings stronger questions about performance: do containerized MPI applications perform as well as the same applications running directly in the host environment?

So what are we doing here?

My focus here is on MPI performance, not necessarily CPU or memory performance. With that in mind, I selected the OSU Micro-Benchmarks suite for my test cases. In particular, I used osu_bw, osu_bibw, and osu_alltoall.

As I started to run benchmarks and follow my curiosity, the number of test cases grew: originally, this was just supposed to be a simple demonstration at the end of the previous article! But to keep even this separate writeup to a reasonable scope, I focused on these questions:

  • Does performance differ between the host Rocky Linux 8 environment and a container?

  • Does performance change if a Rocky Linux 9 container runs on a Rocky Linux 8 host?

  • Does performance differ between Apptainer containers with “user namespaces” compared to Apptainer running with its original SUID starter?

  • Does behavior change when running tasks across nodes vs. all on a single node?

Benchmark environment

To review: we’ve got a cluster of four compute nodes in a Dell PowerEdge C6525 multi-node server. Each node is equipped with 2x AMD EPYC 7702 CPUs, 256GiB system memory, and a 100Gb Cornelis Omni-Path HFI. All four nodes are connected to a single Cornelis Omni-Path switch.

To maintain consistency between the host and container environments, I used Spack v0.20.1 to build nine different versions of OSU Micro-Benchmarks, with variants for MPI (MPICH, MVAPICH, and Open MPI) and operating environment (the compute node’s Rocky Linux 8.8 environment, a Rocky Linux 8.8 SIF, and a Rocky Linux 9.2 SIF). I used Spack’s built-in “containerize” functionality to build the SIFs. The Spack “specs” for each build, and the Spack environment YAML files used for spack containerize, are included as attachments.

All tests were run on the same host kernel, 4.18.0-477.15.1.el8_8.x86_64, and all container tests used Apptainer version 1.2.2-1.el8.

All tests were run with the same Slurm arguments, including an explicit --nodelist argument to ensure that all tests were run on the same nodes. These complete commands are included in an attachment.

All three MPI implementations were built using libfabric which, in turn, was built with support for OPX, the latest and recommended libfabric provider for use with Cornelis Omni-Path. We were able to verify that OPX was being properly detected and activated using logging capabilities of libfabric common to all of our builds, and these records are attached as well.

Does performance differ between the host and a container?

Our first question is the simplest: does containerization with Apptainer reduce the MPI performance of an application? From our experience here, we can say that it does not. In fact, we saw somewhat improved latencies for osu_alltoall in containerized environments, and any bandwidth performance differences were within general run-to-run variance. In fact, some of our highest performance differences were observed simply from rebooting compute nodes and re-running the same test.

Raw results for these and other tests are included as attached CSV files at the end of the article.

Does performance change for a Rocky Linux 9 container?

Containerization isn’t just about running an application in an identical operating environment to the compute node host: it enables the flexibility to run different versions of an operating system, or even entirely different operating systems, within the container. So what if we run a different version of Rocky Linux–9.2, in our tests here–compared to the Rocky Linux 8.8 that is running on the compute node?

The question isn’t entirely unfounded: Cornelis Omni-Path support, for example, is built on a mixture of kernel and user-space components. For our tests, we’re using the support for OPA included in the Rocky Linux kernel, and each version of Rocky Linux includes user-space libraries and applications designed to work with its matching kernel components. The nature of containerization, however, implies that we’re using the kernel components from the host, regardless of what user-space code is running in the container. So what happens if we run an MPI built for a Rocky Linux 9.2 environment on a Rocky Linux 8.8 kernel?

While we obviously can’t speak for all kernel and user-space pairings, our results indicate that even this difference isn’t something to worry about. Most results were within run-to-run variance, with yet another apparent improvement in osu_alltoall latency. (This improvement probably shouldn’t carry too much weight, however, given the limitations of our testing methodology; but we’ll talk more about that in the conclusion.)

Does performance differ for Apptainer SUID and user namespace modes?

If you’ve been following Apptainer development, one of its more recent improvements is the transition, by default, from its original SUID-based runtime to the adoption of more modern Linux kernel support for user namespaces. For example, we need to be root to set up a container and, when building a container, to install packages within it. In the past, this has been accomplished with the use of starter-suid and fakeroot. Now, by default this is accomplished using Linux user namespaces.

But the questions remains: does Apptainer’s use of user namespaces impact performance?

We ran this test by physically uninstalling the apptainer-suid package. Similar to our previous results, we found that performance was effectively identical, once again with the most significant (but still only slight) variations observed in the latency of osu_alltoall.

figure1.jpg

Does behavior change for multi-node vs. single-node?

Up to now, all of our tests have been run with one MPI task per node; but we also wanted to check if behavior would change when multiple tasks were run on each node. However, there have been multiple reports of MPI breaking in Apptainer with user namespaces, particularly when using UCX. We wanted to check if the same behavior was observed with these libfabric builds of MPI without UCX.

For this particular test case, we focused specifically on osu_alltoall, as it supports running an arbitrary number of tasks. Rather than running one tasks per node across four nodes, we ran four tasks on one node, with two tasks per socket.

It is interesting to observe that MPICH and Open MPI latency degrades more in this scenario than MVAPICH. We also observed (though this is not represented in the charts) that the increase in latency is broadly similar between host and container environments. But more to the point of the test is the fact that MVAPICH breaks with 8MiB and larger messages. Our current understanding is that MVAPICH optimizes intra-node communication for different message sizes, and the method it uses for messages 8MiB and larger is blocked by different MPI tasks running in different user namespaces.

We’ve been investigating this issue upstream for some time now, including a pull request. Check back here soon for a whole article going into detail on why it’s breaking, how you might be able to work around it today, and how we’re hoping to fix it upstream!

Conclusion

While we did our best to be consistent and transparent in our methodology, these aren’t quite what we’d consider formal results. For example, we noticed significant performance variation from run-to-run, particularly after rebooting nodes that had been used for previous jobs and then sat idle. Improvements to our methodology might include reboots between each test and averaging the results from multiple runs. (We ran each test three times and used the third result.) All that said, we think that even this relatively anecdotal experience confirms what we and the Apptainer community have been saying for years: Apptainer containerization is suitable for use with HPC applications, including performance-sensitive MPI applications.

If you’re interested in learning more about the performance you can expect from your MPI applications in Apptainer, there are a number of studies:

We’re hopeful that these results can let HPC administrators and users alike proceed with confidence that they aren’t sacrificing performance when they take advantage of the operational and flexibility benefits of using Apptainer in their environment.

Deploying a Dell PowerEdge and Cornelis Omni-Path Cluster with Warewulf

This article was also published via the CIQ blog on 28 August 2023.

CIQ develops and supports open source software for HPC that simplifies your life as a cluster administrator. I recently had the opportunity to deploy and test this software in a Dell PowerEdge cluster with Cornelis Omni-Path networking, with equipment provided in generous partnership by Dell and Cornelis. Both PowerEdge and Omni-Path are frequently deployed in the HPC space due to their performance, reliability, and cost-effectiveness, so they provide a good platform to showcase how Warewulf makes it easy to deploy a cohesive HPC cluster at any scale.

figure1.jpg

Setting up the control node

The control node is a Dell PowerEdge R6525 equipped with 2x AMD EPYC 73F3 CPUs, 512GiB system memory, and a 100Gb Cornelis Omni-Path HFI. In this cluster, it runs the Warewulf server, fabric manager, and Slurm controller, starting from a Rocky Linux 8.6 base.

Installing Warewulf

Installing Warewulf v4 on the control node is a simple three-step process:

  • Install the Warewulf package.

  • Update the Warewulf configuration file.

  • Direct Warewulf to configure the system.

# dnf install https://github.com/hpcng/warewulf/releases/download/v4.4.1/warewulf-4.4.1-1.git_d6f6fed.el8.x86_64.rpm
# vi /etc/warewulf/warewulf.conf
# wwctl configure -a

Most of the work in that process goes into the configuration file; but, even then, there’s not much that is required. For reference, here’s the entirety of our warewulf.conf:

WW_INTERNAL: 43
ipaddr: 10.10.10.30
netmask: 255.255.255.0
network: 10.10.10.0
warewulf:
  port: 9873
  secure: false
  update interval: 60
  autobuild overlays: true
  host overlay: true
  syslog: false
dhcp:
  enabled: true
  template: default
  range start: 10.10.10.200
  range end: 10.10.10.209
  systemd name: dhcpd
tftp:
  enabled: true
  systemd name: tftp
nfs:
  enabled: true
  export paths:
path: /home
    export options: rw,sync
    mount options: defaults
    mount: true
path: /opt
    export options: ro,sync,no_root_squash
    mount options: defaults
    mount: true

The first step is to define ipaddr, netmask, and network. These three parameters configure the network for the control node itself and define the network and network interface that Warewulf uses to provision the cluster nodes.

Also important is dhcp range start and range end. These define the addresses that Warewulf uses during PXE provisioning. (Of particular note: these are not the addresses used by cluster nodes after they have been provisioned: nodes only use addresses from this range when they are downloading their node image.)

The Warewulf configuration file enables dhcp, tftp, and nfs by default, and we use these default settings in this test cluster. These services are then automatically configured by Warewulf using wwctl configure -a.

The fabric manager

The control and cluster nodes are connected via a single externally-managed 24-port Omni-Path 100 switch, and the control node serves as the fabric manager for the OPA network.

The OPA fabric manager software is available as a standard part of Rocky Linux.

# dnf install opa-fm
# systemctl enable –now opafm
# systemctl status opafm opa-basic-tools
# opainfo
hfi1_0:1                           PortGID:0xfe80000000000000:001175010178e59f
   PortState:     Active
   LinkSpeed      Act: 25Gb         En: 25Gb
   LinkWidth      Act: 4            En: 4
   LinkWidthDnGrd ActTx: 4  Rx: 4   En: 3,4
   LCRC           Act: 14-bit       En: 14-bit,16-bit,48-bit       Mgmt: True
   LID: 0x00000001-0x00000001       SM LID: 0x00000001 SL: 0
         QSFP Copper,       3m  Hitachi Metals    P/N IQSFP26C-30       Rev 02
   Xmit Data:               2658 MB Pkts:             15940870
   Recv Data:              11217 MB Pkts:             15170908
   Link Quality: 5 (Excellent)

Configuring Slurm

The control node is also running a Slurm controller from packages provided by OpenHPC.

# dnf install http://repos.openhpc.community/OpenHPC/2/CentOS_8/x86_64/ohpc-release-2-1.el8.x86_64.rpm
# dnf install slurm-slurmctld-ohpc
# cp /etc/slurm/slurm.conf{.example,}
# vi /etc/slurm/slurm.conf
# systemctl enable --now slurmctld munge
# scontrol ping
Slurmctld(primary) at admin1.dell-ciq.lan is UP

Configuring Slurm is somewhat out-of-scope for this article, but let’s go over some of the most pertinent directives for this deployment:

NodeName=c[5-8] Sockets=2 CoresPerSocket=64 ThreadsPerCore=1
PartitionName=opa Nodes=c[5-8] MaxTime=24:00:00 State=UP Oversubscribe=EXCLUSIVE
SlurmctldParameters=enable_configless

We’ve defined our four nodes, c[5-8] in Slurm, along with their basic CPU information. These four nodes are added to an opa partition that we can support jobs to. Finally, slurmctld itself is configured to enable “configless” mode, which allows compute nodes to get slurm.conf from the controller when they first connect, without having to distribute the config file to all nodes manually.

Compute nodes

The four compute nodes are a Dell PowerEdge C6525 multi-node server. Each node is equipped with 2x AMD EPYC 7702 CPUs, 256GiB system memory, and a 100Gb Cornelis Omni-Path HFI.

Adding compute nodes to Warewulf

Adding compute nodes to Warewulf is relatively straightforward. Our four nodes are named c[5-8], and each has an IP address for its default interface, its IPMI interface, and its OPA interface. Settings that are the same across all nodes, such as netmask, gateway, and IPMI credentials, are added to the default node profile.

# wwctl node add c5 --discoverable=yes --ipaddr=10.10.10.41 --ipmiaddr=172.29.235.41
# wwctl node add c6 --discoverable=yes --ipaddr=10.10.10.42 --ipmiaddr=172.29.235.42
# wwctl node add c7 --discoverable=yes --ipaddr=10.10.10.43 --ipmiaddr=172.29.235.43
# wwctl node add c8 --discoverable=yes --ipaddr=10.10.10.44 --ipmiaddr=172.29.235.44

# wwctl node set c5 --netname=opa --ipaddr=10.10.12.41
# wwctl node set c6 --netname=opa --ipaddr=10.10.12.42
# wwctl node set c7 --netname=opa --ipaddr=10.10.12.43
# wwctl node set c8 --netname=opa --ipaddr=10.10.12.44

# wwctl profile set default \
> --netmask=255.255.255.0 --gateway=10.10.10.30 \
> --ipmiuser=root --ipmipass=[redacted] \
> --ipminetmask=255.255.255.0 --ipmiinterface=lanplus

# wwctl profile set default --netname=opa --type=InfiniBand \
> --netdev=ib0 --onboot=true --netmask=255.255.255.0

Defining compute node images

One of the best features of Warewulf v4 is its support for OCI container images. This makes it near trivial to build and maintain compute node images for Warewulf clusters.

The compute node image in this environment is built on a community Warewulf Rocky Linux 8 image, and adds support for OpenHPC, Slurm, Apptainer, and OPA.

FROM ghcr.io/hpcng/warewulf-rockylinux:8.6

RUN dnf -y install \
      dnf-plugins-core \
      epel-release \
      http://repos.openhpc.community/OpenHPC/2/CentOS_8/$(uname -m)/ohpc-release-2-1.el8.$(uname -m).rpm \
    && dnf config-manager --set-enabled powertools \
    && dnf -y install \
         apptainer \
         ohpc-base-compute \
         ohpc-slurm-client \
         slurm-libpmi-ohpc \
         lmod-ohpc \
         chrony \
         opa-basic-tools \
         libpsm2 \
    && systemctl enable munge \
    && systemctl enable slurmd \
    && mkdir -p /var/spool/slurm \
    && dnf -y clean all

We could build and push this container to a registry to then import into Warewulf; but Warewulf can also import a saved OCI archive, which Podman can generate directly. Once the container is imported into Warewulf, we can set it as the container for the default node profile.

# podman build --tag compute-slurm-opa:latest compute-slurm-opa/
# podman save compute-slurm-opa:latest -o compute-slurm-opa.tar
# wwctl container import $(readlink -f compute-slurm-opa.tar) compute-slurm-opa
# wwctl profile set default --container=compute-slurm-opa

Overlays

We use a couple of overlays to customize the configuration of the cluster nodes. First, our slurm overlay captures distributes the munge key (used by Slurm for authentication within the cluster) and the defines the configuration server for slurmd.

# wwctl overlay create slurm
# wwctl overlay mkdir slurm /etc
# wwctl overlay mkdir slurm /etc/munge
# wwctl overlay mkdir slurm /etc/sysconfig
# wwctl overlay edit slurm /etc/sysconfig/slurmd
# wwctl overlay show slurm /etc/sysconfig/slurmd
SLURMD_OPTIONS="--conf-server admin1.dell-ciq.lan:6817"
# wwctl overlay import slurm /etc/munge/munge.key
# wwctl overlay list -a slurm
OVERLAY NAME                   FILES/DIRS
slurm                          /etc/
slurm                          /etc/munge/
slurm                          /etc/munge/munge.key
slurm                          /etc/sysconfig/
slurm                          /etc/sysconfig/slurmd

It’s important for cluster nodes to have synchronized time. Our chrony overlay configures compute nodes to synchronize time with the control node.

# wwctl overlay create chrony
# wwctl overlay import --parents chrony /etc/chrony.conf
# wwctl overlay edit chrony /etc/chrony.conf
# wwctl overlay show chrony /etc/chrony.conf | tail -n1
server admin1.dell-ciq.lan iburst

We add our newly-defined overlays to the default profile and rebuild overlays for the nodes.

# wwctl profile set default --wwinit wwinit,slurm,chrony
# wwctl overlay build

Booting the nodes

Since we configured IPMI when we added the nodes, we can use Warewulf’s IPMI support to power on our nodes remotely. Powering them on one-at-a-time ensures that node discovery correctly assigns the intended name to each discovered node.

# wwctl power on c5
# wwctl power on c6
# wwctl power on c7
# wwctl power on c8

Running a test application

In the end, we’re left with a working Slurm cluster, complete with the ability to run arbitrary containers directly from the internet with Apptainer!

$ srun --partition=opa apptainer run docker://alpine:latest sh -c 'echo $(hostname): Hello, world!'
INFO:    Using cached SIF image
c5: Hello, world!

Alternatively, OpenHPC packages can be installed on the control node and, since /opt is shared via NFS from the control node to cluster nodes, these packages are available at runtime through the lmod system.

$ srun --partition=opa sh -c 'module avail'

-------------------------- /opt/ohpc/pub/modulefiles ---------------------------
   cmake/3.24.2    hwloc/2.7.0         os            prun/2.2
   gnu9/9.4.0      libfabric/1.13.0    pmix/4.2.1    ucx/1.11.2

If the avail list is too long consider trying:

"module --default avail" or "ml -d av" to just list the default modules.
"module overview" or "ml ov" to display the number of modules for each name.

Use "module spider" to find all possible modules and extensions.
Use "module keyword key1 key2 ..." to search for all possible modules matching
any of the "keys".

Next steps

This article was originally meant to include a broad comparison of different MPI applications; but in the process of putting that together, I found a lot more interesting information than I wanted to just have here at the end. Be sure to read my next article, "Benchmarking Containerized MPI with Apptainer on Dell PowerEdge and Cornelis Omni-Path."