Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bnb/misc #65

Merged
merged 15 commits into from
Jul 28, 2022
Merged

Bnb/misc #65

merged 15 commits into from
Jul 28, 2022

Conversation

bnb32
Copy link
Collaborator

@bnb32 bnb32 commented Jul 26, 2022

Some small tweaks to accommodate new wtk data handling. Added physical limit enforcement on output handling.

msg = (f'Full size of forward pass output ({fwp_out_mem / 1e9} GB) is '
'too large to hold in memory. Run with smaller '
'fwp_chunk_shape[2] or smaller spatial extent. ')
assert (mem.total - mem.used) > fwp_out_mem, msg
Copy link
Member

Choose a reason for hiding this comment

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

Recommend this as a warning instead of an assertion error. I'm pretty sure that sometimes python can hold memory and not free it, but it can use this memory for allocating new data. In any case, shouldnt we get an OOM error pretty quickly?

Also recommend you log the mem available in the msg for comparison purposes.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Well currently the array to hold the fwp output is declared after the data extraction so it can take some time to get an OOM error. I could just move the declaration though.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Actually I probably don't want to move the declaration bc that will restrict the mem available for the data extraction.

Copy link
Member

Choose a reason for hiding this comment

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

Okay, well i dont love it but lets see how it goes haha

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This is really just to check if the data array that holds the fwp output is bigger than the total mem. If we are declaring an 900 GB array on a 800 GB machine itll fail no matter what magic python does

Copy link
Member

Choose a reason for hiding this comment

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

*Bigger than the available memory. psutil is not perfect and I'd always rather be able to try stuff with a warning instead of the code not letting me.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yeah I could change it to total mem instead of available?

Copy link
Member

Choose a reason for hiding this comment

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

I like that!

sup3r/postprocessing/file_handling.py Show resolved Hide resolved
sup3r/postprocessing/file_handling.py Outdated Show resolved Hide resolved
sup3r/postprocessing/file_handling.py Show resolved Hide resolved
sup3r/postprocessing/file_handling.py Outdated Show resolved Hide resolved
sup3r/preprocessing/feature_handling.py Show resolved Hide resolved
…um. changed output array mem assertition to warning.
'chunks': (2000, 500)},
'chunks': (2000, 500),
'min': 0,
'max': 100000},
Copy link
Member

@grantbuster grantbuster Jul 27, 2022

Choose a reason for hiding this comment

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

isnt this just 1 atm? If WRF is bar-absolute we should probably set an upper limit at like 1.5 * 1atm

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

yeah missed a 1. good catch

Copy link
Member

Choose a reason for hiding this comment

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

No what i'm saying is that WRF regularly produces pressures > 1atm so it shouldnt be 101325 Pa (1atm) it should be more like 1.5e5 Pa

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yeah I meant I missed a one to make it 1.1e5 but I'll increase it further

Copy link
Member

Choose a reason for hiding this comment

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

Oh gotcha, i saw 1.01e5 and thought you were setting the ceiling at exactly 1atm. sounds good!

@bnb32 bnb32 merged commit f53a07f into main Jul 28, 2022
@bnb32 bnb32 deleted the bnb/misc branch July 28, 2022 12:56
github-actions bot pushed a commit that referenced this pull request Jul 28, 2022
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