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 Warning if array is above 2GB #238

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

tqml
Copy link
Collaborator

@tqml tqml commented Feb 21, 2025

This PR adds a warning if arrays larger than 2GB are used in MATLAB.jl since those are not supported by the MATLAB engine api.

I think, we can close #154 since there is not much we can do about this.

MATLAB docs:
https://de.mathworks.com/help/matlab/apiref/engputvariable.html

@tqml tqml requested a review from musm February 21, 2025 10:16
@musm
Copy link
Collaborator

musm commented Feb 24, 2025

Ideally we could just capture the error/warning in matlab (whatever they are) and return that vs manually handling the various exceptions that could be thrown.

@musm
Copy link
Collaborator

musm commented Feb 24, 2025

I see that is what you have in your other PR. Does that negate the need for this error msg?

@tqml
Copy link
Collaborator Author

tqml commented Feb 24, 2025

No the other PR is unrelated. There I check the exceptions that are thrown in MATLAB. Here, the engine gives us a non zero error code, without any information why it failed. (I havent actually checked the matlab exception variable so maybe it has some information why?)

I wanted to add a test with large arrays but on my system (Mac, R2024) it somehow blocks Julia from working and I have to kill the process and restart the REPL 😕

add warnings for large arrays
@tqml
Copy link
Collaborator Author

tqml commented Feb 26, 2025

Following problem happens on my machine (interestingly 2GB is not a hard limit).

MATLAB seems to block stdin (or something similiar) and the Julia REPL stops working (with the need to restart the repl forcefully).

Because of this, checking exceptions did not work for me.

Short example:

> M = 60_000
> N = 5_000 * 2
> X = rand(M,N)

> mat"x = $X" # raises error but julia REPL continuous to work

# One more matlab command, and the REPL is blocked and julia needs to be restarted
> mat"1+1"
Error using load
Cannot read file stdio.

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.

Fails to put large variables to the Matlab engine
2 participants