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

Add error message to MemoryError #2304

Merged
merged 2 commits into from
Jan 24, 2024
Merged

Conversation

Ericgig
Copy link
Member

@Ericgig Ericgig commented Jan 23, 2024

Description
When we can't allocate enough memory for a matrix, there was no error message.
For sparse array, were the users expect the it not to take that much space, this can be confusing.
I added error message which tell the shape of the matrix and number of elements.

It won't help much, but may show that the matrix is not as sparse as expected.

Related issues or PRs
#2299

Copy link
Contributor

@hodgestar hodgestar left a comment

Choose a reason for hiding this comment

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

The code changes seem fine, but it looks like some tests are failing.

Could we also write some tests for these? It might be a little bit tricky in some cases, but hopefully we can at least cover the easier ones (e.g. directly creating big dense or big sparse data objects).

@Ericgig
Copy link
Member Author

Ericgig commented Jan 24, 2024

The failing test are related to #2301 not being merged in yet.

I am not sure we want tests for this.
We have no control on the memory of the runner, which could change at any time.
There could be strange thing with virtual memory, swap, etc.

@coveralls
Copy link

Coverage Status

coverage: 84.172% (-0.02%) from 84.195%
when pulling 696bbb4 on Ericgig:misc.memory_error_msg
into f84db23 on qutip:master.

@hodgestar
Copy link
Contributor

Agreed that it is tricky to test. I mostly wanted the tests because the nice error messages might contain bugs. Happy to let this slide for now though.

@Ericgig Ericgig merged commit 997db0c into qutip:master Jan 24, 2024
11 of 12 checks passed
@Ericgig Ericgig deleted the misc.memory_error_msg branch January 24, 2024 21:24
@Ericgig Ericgig mentioned this pull request Feb 7, 2024
5 tasks
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.

None yet

3 participants