Yuvraj Singh

Back to all work

Taking the analysis to a supercomputer

Research Software Engineer, UNSW Climate Change Research Centre, Jul 2025 – Present

I packaged the platform's R analysis library as r-meorg and released it to NCI's Gadi through ACCESS-NRI. I also built the APIs that let HPC jobs fetch inputs and push results back. Then I tuned memory and parallelism, cutting typical analysis wall times by 30–50% with output hashes showing identical results.

Fig. 1 Measured on Gadi PBS, 42 sites. Total CPU time stayed flat while wall time fell: the extra workers parallelise a fixed amount of plotting work.

Why Gadi

Researchers run CABLE on NCI's Gadi through benchcab, ACCESS-NRI's benchmarking tool. So the analysis had to run there too, right after the model run, with results landing on modelevaluation.org. That needed a package Gadi users can load, a way for HPC jobs to move inputs and results, and evidence for what resources to request.

r-meorg: packaging someone else's science

palsR is Gab Abramowitz's R package, and it holds the science. When I started on it, it had no release process, its worker counts were hard-coded, and its name clashed with an existing CRAN package.

I built the release chain:

  1. A tag produces a GitLab release and a conda package called r-meorg, published to the me-org Anaconda channel.
  2. ACCESS-NRI builds that into a module on Gadi through their containerised-environments repo. I wrote the pull requests there: #75 shipped 1.0.5 (merged 16 Sep 2026), and #104 moved it to 1.0.7.
  3. On Gadi, a user runs module load r-meorg and then the runner.

I cut the releases from 1.0.2 to 1.0.7. Release 1.0.5 went in as five sequenced changes:

  1. a test foundation (testthat and R CMD check in CI);
  2. a versioned analysis config with a strict validator;
  3. worker counts resolved at runtime: from the config, then the PBS allocation, then local cores;
  4. a default runner that writes every run's effective config as a JSON file;
  5. a bounded scheduler for multisite plots.

The design choice I'd defend: config is split into analysis and runtime, and nothing in runtime can change the science. You can give a run more workers without wondering whether you changed its results.

Before calling 1.0.5 done, I ran the nine legacy CI fixtures on Gadi with the new module, and checked by hash that the new package route reproduced the legacy outputs. The runner became a one-file contract: input.json in; output.json, run.json and an output directory out; the exit code is the status. It's 84 lines, replacing a 339-line collector. The first benchcab analysis through it took 19 s and 0.13 SU.

Getting data in and out

Three REST endpoints let a job outside our own worker take part in the platform:

Every endpoint needs a login and reaches only what the user's workspaces can access; anything else gets the same generic 404. Presigned URLs are bearer credentials, so responses are no-store and the URLs expire after an hour. I also added a resumable, parallel downloader to the platform's Python client.

The result path has been tested end to end with a real Gadi PBS job. Gadi is the first environment, but the APIs serve runs from any external environment, and there are plans to onboard HPC systems in Europe and the US.

How many workers?

Nobody knew what CPU and memory a large analysis needed, so I measured it on a 42-site case: 930 files, 23.1 GB of input, and 1,440 input roles once three benchmarks are added. Each arm was a separate PBS job on 12 CPUs, logged with its job ID and timed per phase from markers in the analysis log.

Case Plot workers Analysis time Service units
No benchmarks 2 667 s 9.21
No benchmarks 8 341 s 4.77
Three benchmarks 4 723 s 13.21
Three benchmarks 12 511 s 9.48

Going from 2 to 8 plot workers cut analysis time by 48.9% and service units by 48.2%. With benchmarks, going from 4 to 12 cut them by 29% and 28%.

Total CPU time barely moved, and neither did the load phase. All of the gain was in single-site plotting, which got 2.7× faster in the first case and 2× in the second: the extra workers were parallelising a fixed amount of work.

Same answers. For each run I hashed the output metadata, with filenames stripped and the JSON sorted. The hash was identical across every arm of each case, so the worker count changed the time, not the results.

Noise. The arms ran concurrently on different nodes. A repeat of the 8-worker arm the next day was 3.7% slower, which is roughly the batch-to-batch noise and well inside the gains.

Past 12 CPUs. Forty-eight workers on 48 CPUs gave the fastest run (402 s), but at 11.44 SU, 31% more than 24 workers on 24 CPUs. Two identical 48-worker runs differed by 80 s, and 96% of that gap was in startup and observation loading, while their parallel phases agreed to within 3 s. So I compare phase timings, not totals.

The sweep also turned up four things to fix:

In the package, load and plot workers now follow the PBS allocation by default, and 1.0.12 lowered the automatic counts outside PBS to cut memory use.

Runtime metadata

Sweeps are one-off experiments. To size jobs from real usage, I added run metrics to the platform worker:

Every telemetry call has a deadline and falls back to null with a reason, so it can't change an analysis's outcome. The metrics are stored on the analysis record and hidden from clients. With each run's effective config, they build into a clean dataset of real runs for sizing future jobs.