Using Apptainer on Windows
Designed primarily for high-performance computing, Apptainer — the containerization solution chosen for the DIAMOND project — natively works only on Linux. If it cannot be used on a Linux distribution, it is necessary to use a virtual machine that emulates a Linux system as an intermediary between Apptainer and the kernel of any other operating system (like Windows).
How to Install WSL2 on Windows
The official Apptainer documentation recommends Windows Subsystem for Linux (WSL2) as the solution to virtualize a Linux kernel on all versions of Windows 10 and later.
For more information on installing WSL2 on a Windows system, you can refer to the official Windows documentation or Apptainer’s documentation.
In summary, for all recent versions of Windows (build 19041
and later), installation is done with a single line in PowerShell (with administrator rights):
Then, you only need to restart the machine and configure the Linux subsystem you want to use (for example, Ubuntu 24.04):
Note that for the installation of Ubuntu 24.04, you will need to provide a username and a password.
Once this is done, you can launch WSL2 from any PowerShell or Windows terminal with the command:
Once WSL2 is available with the ability to emulate any Linux distribution, you can install Apptainer just like on any other Linux operating system by following the official documentation.
Performance Overhead
While WSL2 allows the use of Apptainer images produced for DIAMOND transparently on Windows, the underlying virtualization inevitably comes with a numerical overhead.
Estimating this overhead requires replicating and comparing the execution time of the same computation using Apptainer in different conditions: on a Linux distribution as a reference, and using Apptainer on Windows with WSL2. Performing such tests (details below) shows that the Windows + WSL2 solution is approximately ($\approx 4.5%$) slower than the Linux reference.
This overhead is minor when running many utility tools like visualization or data processing software. However, it can be significant in the case of intensive computations, such as those encountered with the many high-performance simulation codes available on the DIAMOND platform.
Test Conditions and Detailed Results
Calculations were performed on a dual-boot machine with Ubuntu 24.04.1 LTS/Windows 11 to have the same underlying hardware (Intel i7-11800H 2.30GHz CPU and 16GB of RAM). To maximize software similarities, WSL2 was used with the same distribution as our reference (Ubuntu 24.04.1 LTS), and in each case, we ensured the same Apptainer version (1.3.4) was used.
For each of these Apptainer installations, a test image provided for the DIAMOND tutorials was used. This image performs $M$ multiplications of square $N \times N$ random matrices. In this test, a sequential computation (on a single CPU core) was performed with $M=500$ and $N=1000$: apptainer run tutorial-openmpi.sif 500 1000
.
To account for potential performance fluctuations due to CPU load, the calculations were replicated 10 times in each case. The final average times were $t^{Ubuntu} = 118.78$ s ($\sigma = 1.41$ s) and $t^{WSL2} = 124.15$ s ($\sigma = 0.79$ s).
Given these average times and standard deviations, the additional costs associated with WSL2 appear to be significant. This can be verified by checking the compatibility of these samples, assuming identical mean times. We obtain (via the ttest_rel
function in the Python spy.stats
module) a very small p-value ($2.5 \times 10^{-6}$), which strongly suggests that the measured times follow different distributions and that virtualisation with WSL2 therefore leads to a significant increase in execution time compared to a reference Linux distribution.