Baike.dev
All toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
M

makani

> 编程语言
Open source

Massively parallel training of machine-learning based weather and climate models

396 stars0 likes0 views
WebsiteGitHub

About

Massively parallel training of machine-learning based weather and climate models

Makani: Massively parallel training of machine-learning based weather and climate models

Overview | Getting started | More information | Contributing | Further reading | References Makani (the Hawaiian word for wind ) is a library designed to enable the research and development of the next generation of machine-learning (ML) based weather and climate models in PyTorch. Makani was used to train FourCastNet3 [1], Spherical Fourier Neural Operators (SFNO) [2] for weather (FourCastNet2), Huge ensemble of SFNO (HENS-SFNO) [3,4], and FourCastNet1 [5].

Makani is aimed at researchers working on ML based weather prediction. Stable features are frequently ported to the earth2studio and the NVIDIA PhysicsNeMo framework. For commercial and production purposes, we recommend checking out these packages.

Overview

Makani is a research code developed by engineers and researchers at NVIDIA and NERSC for massively parallel training of weather and climate prediction models on 100+ GPUs and to enable the development of the next generation of weather and climate models. Makani is written in PyTorch and supports various forms of model- and data-parallelism, asynchronous loading of data, unpredicted channels, autoregressive training and much more. Makani is fully configurable through .yaml configuration files and support flexible development of novel models. Metrics, Losses and other components are designed in a modular fashion to support configurable, custom training- and inference-recipes at scale. Makani also supports scalable, fully online scoring modes, which are compatible with WeatherBench2. Among others, Makani was used to train the FourCastNet models, on the ERA5 dataset.

Getting started

Makani can be installed by running

bash
git clone [email protected]:NVIDIA/makani.git
cd makani
pip install -e .

Training:

Makani supports ensemble and deterministic training. Ensemble training is launched by calling ensemble.py, whereas deterministic training is launched by calling train.py. Both scripts expect the CLI arguments to specify the configuration file --yaml_config and he configuration target --config, which is contained in the configuration file:

bash
mpirun -np 8 --allow-run-as-root python -u train.py --yaml_config="config/fourcastnet3.yaml" --config="fcn3_sc2_edim45_layers10_pretrain1"

Makani supports various optimization to fit large models ino GPU memory and enable computationally efficient training. An overview of these features and corresponding CLI arguments is provided in the following table:

Feature CLI argument options
Batch size --batch_size 1,2,3,...
Ensemble size --ensemble_size 1,2,3,...
Automatic Mixed Precision --amp_mode none, fp16, bf16
Just-in-time compilation --jit_mode none, script, inductor
Activation checkpointing --checkpointing_level 0,1,2,3
Channel parallelism --fin_parallel_size, --fout_parallel_size 1,2,3,...
Spatial model parallelism --h_parallel_size, --w_parallel_size 1,2,3,...
Ensemble parallelism --ensemble_parallel_size 1,2,3,...
Multistep training --multistep_count 1,2,3,...
Skip training --skip_training
Skip validation --skip_validation

Especially larger models are enabled by using a mix of these techniques. Spatial model parallelism splits both the model and the data onto multiple GPUs, thus reducing both the memory footprint of the model and the load on the IO as each rank only needs to read a fraction of the data. A typical "large" training run of SFNO can be launched by running

bash
mpirun -np 256 --allow-run-as-root python -u makani.train --amp_mode=bf16 --multistep_count=1 --run_num="ngpu256_sp4" --yaml_config="config/sfnonet.yaml" --config="sfno_linear_73chq_sc3_layers8_edim384_asgl2" --h_parallel_size=4 --w_parallel_size=1 --batch_size=64

Here we train the model on 256 GPUs, split horizontally across 4 ranks with a batch size of 64, which amounts to a local batch size of 1/4. Memory requirements are further reduced by the use of bf16 automatic mixed precision.

Inference:

Makani supports scalable and flexible on-line inference aimed at minimizing data movement and disk I/O, which is well suited to the low inference costs of ML weather models and modern HPC infrastructure. In a similar fashion to training, inference can be called from the CLI by calling inference.py and handled by inferencer.py. To launch inference on the out-of-sample dataset, we can call:

bash
mpirun -np 256 --allow-run-as-root python -u makani.inference --run_num="ngpu256_sp4" --yaml_config="config/sfnonet.yaml" --config="sfno_linear_73chq_sc3_layers8_edim384_asgl2" --batch_size=64

By default, the inference script will perform inference on the out-of-sample dataset and compute the mtrics. The inference script supports model, data and ensemble parallelism out of the box, enabling efficient and scalable scoring. The inference script support additional CLI arguments which enable validation on a subset of the dataset, as well as writing out inferred states:

Feature CLI argument options
Start date --start_date 2018-01-01+UTC00:00:00
End date --end_date 2018-12-31+UTC24:00:00
Date step (in hours) --date_step 1,2,...
Output file --output_file file path for field outputs
Output channels --output_channels channels to write out
Metrics file --metrics_file file path for metrics output
Bias file --bias_file file path for bias output
Spectrum file --spectrum_file file path for spectra output

More about Makani

Project structure

The project is structured as follows:

…

Model and Training configuration

Model training in Makani is specified through the use of .yaml files located in the config folder. The corresponding models are located in modelf and registered in the model registry in models/model_registry.py. The following table lists the most important configuration options.

Configuration Key Description Options
nettype Network architecture. FCN3,SFNO, SNO, AFNO, ViT
loss Loss function. l2, geometric l2, amse, crps...
channel_weights Weighting function for the respective channels. constant, auto, uncertainty...
optimizer Optimizer to be used. Adam, AdamW, SGD,Sirfshampoo
lr Initial learning rate. float > 0.0
batch_size Batch size. integer > 0
ensemble_size Ensemble size. integer > 0
max_epochs Number of epochs to train for integer
scheduler Learning rate scheduler to be used. None, CosineAnnealing, ReduceLROnPlateau, StepLR
lr_warmup_steps Number of warmup steps for the learning rate scheduler. integer >= 0
weight_decay Weight decay. float
train_data_path Directory path which contains the training data. string
test_data_path Network architecture. string
exp_dir Directory path for ouputs such as model checkpoints. string
metadata_json_path Path to the metadata file data.json. string
channel_names Channels to be used for training. List[string]

For a more comprehensive overview, we suggest looking into existing .yaml configurations. More details about the available configurations can be found in this file.

Training data

Makani expects the training/test data in HDF5 format, where each file contains the data for an entire year. The dataloaders in Makani will then load the input inp and the target tar, which correspond to the state of the atmosphere at a given point in time and at a later time for the target. The time difference between input and target is determined by the parameter dt, which determines how many steps the two are apart. The physical time difference is determined by the temporal resolution dhours of the dataset.

Makani requires a metadata file named data.json, which describes important properties of the dataset such as the HDF5 variable name that contains the data. Another example are channels to load in the dataloader, which arespecified via channel names. The metadata file has the following structure:

…

The ERA5 dataset can be downloaded here. For details on obtaining datasets, converting them to Makani format, concatenating yearly files, and computing statistics, see the data processing guide in data_process/Readme.md.

Checkpoints and restarting

Makani supports 2 checkpointing formats legacy and flexible. By default, ma

Issues· 3 open

View all issuesOpen on GitHub

No open issues yet, or sync has not completed.

> Tags

Python

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 17, 2026
Category编程语言
PricingOpen source

> Related tools

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言