Docs · I/O adapters

An ADIOS2 engine backed by the CTE.

The ADIOS2 adapter is a plugin engine. An ADIOS2 program switches its IO to it in code or in its XML configuration, and every Put becomes a blob in the Context Transfer Engine, one per variable, step and rank. There is no file on disk.

Library
libiowarp_engine.so
Build
CLIO_CTE_ENABLE_ADIOS2_ADAPTER=ON
Select
engine type Plugin, PluginLibrary=iowarp_engine
Find
ADIOS2_PLUGIN_PATH
Install
Spack (+adios2), CMake, or the Docker image

How it maps ADIOS2 to the CTE

  • One tag per opened engine. The name passed to io.Open(name, mode) becomes the name of a CTE tag.
  • One blob per variable, step and rank. A Put of variable u during step 3 on rank 0 writes the blob u_step_3_rank_0 in that tag. The step counter starts at 0 and each BeginStep adds one, so the first step's blobs are named _step_1_. The blob size is the product of the variable's count (or its shape, if no count is set) times the element size.
  • Synchronous and deferred puts. Put(var, data, adios2::Mode::Sync) writes the blob before returning. A deferred Put (ADIOS2's default) copies the data into a shared-memory buffer, submits the write and returns; EndStep waits for all of the step's deferred writes.
  • Gets are synchronous. Both sync and deferred Get read the blob immediately.

1. Build it

shell
$ cmake -S . -B build -DCLIO_CTE_ENABLE_ADIOS2_ADAPTER=ON \
    -DCMAKE_PREFIX_PATH=/path/to/adios2
$ cmake --build build -j"$(nproc)"
$ ls build/bin/libiowarp_engine.so

Configure fails if ADIOS2 cannot be found. MPI is optional; when it is found the engine links it. The engine is in Spack (+adios2) and the Docker image, not in the pip wheel or conda; see Install.

2. Start a runtime

shell
$ build/bin/clio-run start &

The engine attaches to the runtime on the local node when it is constructed. Its configuration must compose a CTE core pool; as for the HDF5 connectors, name it clio_cte_core, the name clients look up, or set CLIO_CTE_POOL to its id. If no runtime answers, the engine retries (60 attempts about 3 s apart by default) and then throws IowarpEngine: CLIO_CTE_CLIENT_INIT failed after 60 attempts - is Clio runtime running?.

3. Select the engine

Point ADIOS2 at the directory that holds the library:

shell
$ export ADIOS2_PLUGIN_PATH=$PWD/build/bin      # or <prefix>/lib after an install

Then choose the engine for an IO, either in the ADIOS2 XML file the application already reads, with no code change:

xml · adios2.xml
<?xml version="1.0"?>
<adios-config>
  <io name="SimulationOutput">
    <engine type="Plugin">
      <parameter key="PluginName" value="iowarp" />
      <parameter key="PluginLibrary" value="iowarp_engine" />
    </engine>
  </io>
</adios-config>

or in code:

cpp
adios2::IO io = adios.DeclareIO("SimulationOutput");
io.SetEngine("Plugin");
io.SetParameters({{"PluginName", "iowarp"}, {"PluginLibrary", "iowarp_engine"}});

PluginLibrary must be iowarp_engine; ADIOS2 loads libiowarp_engine.so from ADIOS2_PLUGIN_PATH. PluginName is a label of your choice.

4. A complete writer

cpp · writer.cc
#include <adios2.h>
#include <mpi.h>
#include <vector>

int main(int argc, char **argv) {
  MPI_Init(&argc, &argv);
  int rank, nranks;
  MPI_Comm_rank(MPI_COMM_WORLD, &rank);
  MPI_Comm_size(MPI_COMM_WORLD, &nranks);

  adios2::ADIOS adios(MPI_COMM_WORLD);
  adios2::IO io = adios.DeclareIO("SimulationOutput");
  io.SetEngine("Plugin");
  io.SetParameters({{"PluginName", "iowarp"}, {"PluginLibrary", "iowarp_engine"}});

  const size_t n = 1024;
  std::vector<double> u(n);
  auto var = io.DefineVariable<double>("u", {nranks * n}, {rank * n}, {n});

  adios2::Engine w = io.Open("gs_output", adios2::Mode::Write);
  for (int step = 0; step < 3; ++step) {
    for (size_t i = 0; i < n; ++i) u[i] = step + rank;
    w.BeginStep();
    w.Put(var, u.data());          // deferred: completes at EndStep
    w.EndStep();
  }
  w.Close();
  MPI_Finalize();
  return 0;
}

The writer links only ADIOS2 and MPI, never CLIO; ADIOS2 loads the engine at run time.

cmake · CMakeLists.txt
cmake_minimum_required(VERSION 3.16)
project(writer CXX)
find_package(MPI REQUIRED)
find_package(ADIOS2 REQUIRED)
add_executable(writer writer.cc)
target_link_libraries(writer adios2::cxx11_mpi MPI::MPI_CXX)
shell
$ cmake -S . -B build-writer && cmake --build build-writer
$ mpirun -np 2 env ADIOS2_PLUGIN_PATH=$CLIO_SRC/build/bin ./build-writer/writer

$CLIO_SRC is your CLIO Core source tree. The run leaves six blobs in the tag gs_output: u_step_1_rank_0 through u_step_3_rank_1, 8 KiB each. At the info log level, rank 0 logs each step's I/O time in milliseconds and a timing summary when the engine is destroyed.

Reading data back

The engine stores only the blobs, no variable metadata (shape, offsets, type) and no step index. A reader must therefore:

  • open the same name with the plugin engine, and define each variable itself with the writer's count, because InquireVariable has no stored metadata to find;
  • run with the same number of ranks as the writer, since each rank reads the blobs carrying its own rank number;
  • call BeginStep the same number of times as the writer to reach a given step. BeginStep always returns adios2::StepStatus::OK, so a loop that waits for EndOfStream never ends; loop over a known step count.

Large runs

At start-up every rank connects to its node's runtime. To keep thousands of ranks from connecting at once, ranks on a node are staggered: local rank r (the rank modulo IOWARP_PPN, default 12) waits r × CLIO_INIT_STAGGER_MS (default 250 ms) before connecting. Set IOWARP_PPN to your ranks per node. Connection retries are tuned with CLIO_INIT_ATTEMPTS (default 60) and CLIO_INIT_SLEEP_MS (mean pause between attempts, default 3000 ms, jittered).

Limits

  • No variable metadata, no step discovery, and readers bound to the writer's rank layout, as above.
  • Data lives only in the CTE; its durability is decided by the tiers the runtime composes. Use a second IO with a file engine such as BP5 for output that must exist as files.
  • Blobs are written with placement score 1.0; see placement for how scores pick tiers.

Where to go next