|
| 1 | +# How Conda and Spack Work Together in E3SM-Unified |
| 2 | + |
| 3 | +E3SM-Unified uses a hybrid approach that combines Conda and Spack to build |
| 4 | +and deploy a comprehensive software environment for E3SM analysis and |
| 5 | +diagnostics. This page explains the motivation for this strategy, how the |
| 6 | +components interact, and the shared infrastructure that supports both |
| 7 | +E3SM-Unified and related projects. |
| 8 | + |
| 9 | +--- |
| 10 | + |
| 11 | +## Why Combine Conda and Spack? |
| 12 | + |
| 13 | +Each tool solves a different part of the problem: |
| 14 | + |
| 15 | +### ✅ Conda |
| 16 | + |
| 17 | +* Excellent for managing Python packages and their dependencies |
| 18 | +* Supports rapid installation and reproducibility |
| 19 | +* Compatible with conda-forge and custom channels (e.g., `e3sm`) |
| 20 | +* User-friendly interface, especially for scientists and developers |
| 21 | + |
| 22 | +### ✅ Spack |
| 23 | + |
| 24 | +* Designed for building performance-sensitive HPC software |
| 25 | +* Allows fine-grained control over compilers, MPI implementations, and system |
| 26 | + libraries |
| 27 | +* Better suited for tools written in Fortran/C/C++ with MPI dependencies |
| 28 | + (e.g., NCO, MOAB, TempestRemap) |
| 29 | + |
| 30 | +### ❗ The Challenge |
| 31 | + |
| 32 | +Neither system alone is sufficient: |
| 33 | + |
| 34 | +* Conda cannot reliably build or run MPI-based binaries across multiple nodes |
| 35 | + on HPC systems. In our experience, Conda's MPI implementations often fail |
| 36 | + even for multi-task jobs on a single node, making them unsuitable for |
| 37 | + high-performance parallel workflows |
| 38 | +* Spack lacks strong support for modern Python environments and is generally |
| 39 | + harder to use for scientists accustomed to Conda-based workflows. While |
| 40 | + conda-forge provides access to tens of thousands of Python packages, Spack |
| 41 | + offers far fewer, meaning many familiar scientific tools are not readily |
| 42 | + available through Spack alone |
| 43 | + |
| 44 | +--- |
| 45 | + |
| 46 | +## Architecture: How They Work Together |
| 47 | + |
| 48 | +E3SM-Unified environments: |
| 49 | + |
| 50 | +1. Use **Conda** to install the core Python tools and lightweight dependencies |
| 51 | +2. Rely on **Spack** to build performance-critical tools outside Conda |
| 52 | +3. Are bundled into a single workflow that ensures compatibility across both |
| 53 | + |
| 54 | +System-specific setup scripts (e.g., `load_latest_e3sm_unified_<machine>.sh`) |
| 55 | +ensure both components are activated correctly. |
| 56 | + |
| 57 | +For MPI-based tools: |
| 58 | + |
| 59 | +* The tools are built with Spack using system compilers and MPI |
| 60 | +* Users automatically access these builds when running on compute nodes |
| 61 | + |
| 62 | +--- |
| 63 | + |
| 64 | +## Shared Infrastructure |
| 65 | + |
| 66 | +E3SM-Unified, Polaris, and Compass all rely on the same key components: |
| 67 | + |
| 68 | +* [`mache`](https://github.com/E3SM-Project/mache): A configuration library |
| 69 | + for detecting machine-specific settings (modules, compilers, paths) |
| 70 | +* [E3SM's Spack fork](https://github.com/E3SM-Project/spack): Centralized |
| 71 | + control over package versions and build settings |
| 72 | +* Conda: Used consistently to install `mache`, lightweight tools, and Python |
| 73 | + dependencies |
| 74 | + |
| 75 | +This shared foundation ensures reproducibility and consistency across |
| 76 | +workflows, testbeds, and developer tools in the E3SM ecosystem. |
| 77 | + |
| 78 | +--- |
| 79 | + |
| 80 | +## Future Alternatives |
| 81 | + |
| 82 | +As complexity grows, other strategies may be worth evaluating: |
| 83 | + |
| 84 | +### Option: **E4S (Extreme-scale Scientific Software Stack)** |
| 85 | + |
| 86 | +* Spack-based stack of curated HPC tools |
| 87 | +* E4S environments aim to replace the need for manual Spack+Conda integration |
| 88 | +* May offer better long-term sustainability, but lacks Python focus today |
| 89 | + |
| 90 | +🔗 [Explore E4S](https://e4s.io) |
| 91 | + |
| 92 | +### Other Approaches (less suitable currently): |
| 93 | + |
| 94 | +* Pure Spack builds (harder for Python workflows) |
| 95 | +* Pure Conda builds (harder for HPC performance tools) |
| 96 | +* Containers (portability gains, but complex for HPC integration) |
| 97 | + |
| 98 | +--- |
| 99 | + |
| 100 | +## Summary |
| 101 | + |
| 102 | +The hybrid Conda + Spack model in E3SM-Unified balances ease of use with HPC |
| 103 | +performance. While more complex to maintain, it provides flexibility, |
| 104 | +compatibility, and performance across diverse systems. Shared infrastructure |
| 105 | +(like `mache` and E3SM's Spack fork) reduces duplication across projects and |
| 106 | +streamlines the release process. |
0 commit comments