Skip to content

Conversation

@mikekryjak
Copy link
Collaborator

@mikekryjak mikekryjak commented Dec 4, 2025

Built on top of #25

This PR adds two methods to HypnotoadGrid:

  • check_decomposition tells you if the grid can be run on a particular number of cores or not. If not, it tells you a human-understandable reason why, so you can A) fix it and B) learn how the decomposition works.
  • num_processors runs check_decomposition for several core counts up to max_procs and returns a list of how what core counts work. If you enable verbose, it will explain why each core count did or did not work.

This is based on the work of @bendudson in https://github.com/boutproject/ips-bout/blob/main/ipsbout/bout_worker.py#L89. The main change is that I simplified the structure of the code so it's more readable, and added the verbose descriptions.

This definitely should be in xBOUT, but since it needs HypnotoadGrid, I propose we move it all wholesale later. Also, since I have now prepared an explanation for each failure case, we should add these to BOUT++ as well so that the errors are more verbose.

To do:

  • Implement functionality and test on MAST-U grid
  • Test on the Hypnotoad test grids
  • Implement test on all the test grids

Example output:

image

This will need to go into xBOUT.
Renaming j1_1g and adding ny_innerg
ny_innerg makes selecting easier. It's always defined as the index of the outer upper target in double null.
"selectors" are now named "slices" because that's what they do. "selecting" is now only "indexing arrays" and returning arrays or xarray datasets, not slices.
They return a dataset/dataarray that has been indexed according to the poloidal and radial indices of a slice coming from selectors.slice_2d.
to be added as separate PR
@mikekryjak mikekryjak marked this pull request as draft December 4, 2025 15:47
@ZedThree
Copy link
Member

ZedThree commented Dec 4, 2025

Looks useful! Sebastian was looking at adding something like this directly to BOUT++. It might be possible to work some magic to expose that functionality through boutpp, which would mean it would always be consistent with BOUT++.

I think this includes #25 ? Please could you just cherry-pick the relevant commits onto a new branch?

@mikekryjak
Copy link
Collaborator Author

I actually don't know what boutpp is. What does it do?
I can make a new branch with the commits.

Tells you what core counts work.
@ZedThree
Copy link
Member

ZedThree commented Dec 4, 2025

boutpp is the Python wrapper for BOUT++, you can run models directly from Python.

Not on CI yet but works with pytest
This is because we're now downloading zipped grids during tests
@mikekryjak mikekryjak marked this pull request as ready for review December 19, 2025 11:40
@mikekryjak mikekryjak requested a review from ZedThree December 19, 2025 11:40
@mikekryjak
Copy link
Collaborator Author

Added tests on the new test grids. Still no CI though. Ready for review

@mikekryjak mikekryjak requested review from ZedThree and removed request for ZedThree January 8, 2026 15:05
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.

3 participants