Skip to content

Conversation

@romanc
Copy link
Collaborator

@romanc romanc commented Feb 10, 2026

Description

We can't do any allocation in DaCe code (for good reasons). This PR fixes fallout from #97 where we accidentally introduced the allocaiton of NullTimer() in DaCe-owned code. This PR moves the construction of the Timer up to calling code.

How Has This Been Tested?

To be tested locally by running the FVDynamics translate test in stencil mode and orchestrated. Both translate tests were still passing.

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas: N/A
  • I have made corresponding changes to the documentation: N/A
  • My changes generate no new warnings
  • Any dependent changes have been merged and published in downstream modules: N/A
  • New check tests, if applicable, are included: N/A
  • Targeted model if this changed was triggered by a model need/shortcoming: N/A

@romanc romanc changed the title WIP: fix: DyCore orchestration without timer allocation fix: DyCore orchestration without timer allocation Feb 11, 2026
We can't do any allocation in DaCe code (for good reasons). This PR
fixes fallout from NOAA-GFDL#97 where we
accidentally introduced the allocaiton of `NullTimer()` in DaCe-owned
code. This PR moves the construction of the `Timer` up to calling code.

Unrelated, the PR reduces the indet level by adding early returns and
adds a couple of type hints here and there.
@romanc romanc force-pushed the romanc/orch-fv-dynamics-no-alloc-in-dace branch from 4d300ce to 8929dd7 Compare February 11, 2026 12:33
@romanc romanc marked this pull request as ready for review February 11, 2026 12:33
Copy link
Collaborator Author

@romanc romanc left a comment

Choose a reason for hiding this comment

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

The PR contain a couple small unrelated changes, which are explained in this self-review.

self._compute(state, timer)
self._checkpoint_fvdynamics(state=state, tag="Out")

def compute_preamble(self, state: DycoreState, is_root_rank: bool):
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

unrelated: is_root_rank is unused and can thus be removed

"Dynamical Core (fv_dynamics): Adiabatic with positive kord_tm"
" is not implemented."
)
else:
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

unrelated: no else needed because the if branch just raises

)

def __call__(self, *args, **kwargs):
return self.step_dynamics(*args, **kwargs)
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

unrelated: no need to explicitly return from the __call__(..) function. step_dynamics(..) also doesn't return any value.

Copy link
Collaborator

@FlorianDeconinck FlorianDeconinck left a comment

Choose a reason for hiding this comment

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

So you removed the optional Timer and is forcing user to pass in a Timer. It doesn't match the original idea.

@twicki : opinion on this? I could go both way, though forcing user to learn about NullTimer for a simple run might be a bit of a stretch

Side note: the timing should be handled via the NDSLRuntime in a non destructive way, know that we have some form of control over runtime code.

@romanc
Copy link
Collaborator Author

romanc commented Feb 11, 2026

So you removed the optional Timer and is forcing user to pass in a Timer. It doesn't match the original idea.

Tell me to change it and I will. This seemed a lot simpler, especially given the context that we are likely to re-do timers based on NDSLRuntime anyway.

@FlorianDeconinck
Copy link
Collaborator

So you removed the optional Timer and is forcing user to pass in a Timer. It doesn't match the original idea.

Tell me to change it and I will. This seemed a lot simpler, especially given the context that we are likely to re-do timers based on NDSLRuntime anyway.

Good point, keep it as you change it as indeed this needs work to be transparent to users rather than in code.

@FlorianDeconinck FlorianDeconinck added this pull request to the merge queue Feb 11, 2026
Merged via the queue into NOAA-GFDL:develop with commit 765db3b Feb 11, 2026
5 checks passed
@romanc romanc deleted the romanc/orch-fv-dynamics-no-alloc-in-dace branch February 11, 2026 18:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants