Skip to content
This repository has been archived by the owner on Dec 20, 2024. It is now read-only.

Support masking of unconnected nodes (LAM) #171

Merged
merged 31 commits into from
Dec 13, 2024

Conversation

JPXKQX
Copy link
Member

@JPXKQX JPXKQX commented Nov 28, 2024

This PR adds support for using masked graphs, resulting in a performance improvement in LAM by dropping unused nodes in the boundary forcing dataset.

Description

The current release of anemoi-graphs (0.4.1) supports dropping unconnected nodes from the limited area graph, with the following code:

post_processors:
  - _target_: anemoi.graphs.processors.RemoveUnconnectedNodes
    nodes_name: data
    ignore: cutout_mask # optional
    save_mask_indices_to_attr: indices_connected_nodes # optional

anemoi-graphs returns the masked graph with an additional node attribute indices_connected_nodes (in this example) representing the indices used to mask the input dataset to the new graph data nodes.

Solution

We need to specify these spatial indices in the dataloader config.

grid_indices:
    _target_: anemoi.training.data.grid_indices.MaskedGrid
    nodes_name: data
    node_attribute_name: indices_connected_nodes

The performance improvement is of 66 % (from 1,92 it/s to 3,19 it/s) for the 1 GPU default limited area model.

Screenshot 2024-11-28 at 10 58 06

This PR has been tested successfully on 1 GPU (with plot: detailed without PlotSpectrum included):

  • Limited Area Model with reader_group_size=1
  • Stretched grid with reader_group_size=1
  • Global model with reader_group_size=1

This PR has been tested successfully on 2 GPU (with plot: detailed without PlotSpectrum included):

  • Limited Area Model with reader_group_size=2
  • Stretched grid with reader_group_size=2
  • Global model with reader_group_size=2

W.I.P.: This mask must be saved to the checkpoint so that it can be used in anemoi-inference.

@JPXKQX JPXKQX self-assigned this Nov 28, 2024
b8raoult
b8raoult previously approved these changes Nov 28, 2024
@JPXKQX JPXKQX marked this pull request as ready for review December 3, 2024 12:46
@JPXKQX JPXKQX requested a review from theissenhelen December 3, 2024 17:12
Copy link
Collaborator

@theissenhelen theissenhelen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a typo to fix.

@JPXKQX JPXKQX requested a review from theissenhelen December 5, 2024 14:23
Copy link
Collaborator

@theissenhelen theissenhelen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work!

@JPXKQX JPXKQX mentioned this pull request Dec 5, 2024
@mchantry mchantry merged commit 7e4a5f7 into develop Dec 13, 2024
119 checks passed
@mchantry mchantry deleted the feature/support-lam-without-unconnected branch December 13, 2024 08:36
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants