Skip to content

Update ir_mex_build to build penalty_mex file - #32

Open
kristinazvolanek wants to merge 11 commits into
JeffFessler:jf/penalty_mexfrom
kristinazvolanek:mex_build
Open

Update ir_mex_build to build penalty_mex file#32
kristinazvolanek wants to merge 11 commits into
JeffFessler:jf/penalty_mexfrom
kristinazvolanek:mex_build

Conversation

@kristinazvolanek

Copy link
Copy Markdown

Description of changes:

  1. Added mex/ to MATLAB path in setup.m to ensure mex source files are available
  2. Added irt_mex_make to ir_mex_build.m so it is run as part of standard build
  3. Updated directory handling in irt_mex_make so the script runs when called from ir_mex_build
    Note: this means there would be an error when running irt_mex_make from the mex/src directory, so there might be a more elegant solution
  4. Edited mex build command for penalty_mex to reflect current directory structure. Note that it no longer saves to the mex/v7 folder.

@JeffFessler JeffFessler left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

thanks for the PR!
see what you think of my suggestions in your environment?
you might need to tweak further.

Comment thread mex/src/irt_mex_make.m Outdated
Comment thread mex/src/irt_mex_make.m Outdated
Comment thread setup.m Outdated
Comment thread setup.m Outdated
kristinazvolanek and others added 5 commits April 17, 2026 10:42
Co-authored-by: Jeff Fessler <JeffFessler@users.noreply.github.com>
Co-authored-by: Jeff Fessler <JeffFessler@users.noreply.github.com>
Co-authored-by: Jeff Fessler <JeffFessler@users.noreply.github.com>
Co-authored-by: Jeff Fessler <JeffFessler@users.noreply.github.com>
Comment thread setup.m Outdated
addpath([irtdir 'mex/local']) % must precede "mex/v7"
addpath([irtdir 'mex/v7']);

disp('NOTE: Previous irt versions expected MEX files in "mex/v7".')

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Added a comment about the mex/v7 directory. Let me know if you prefer a different message!

Comment thread setup.m
disp(sprintf('The directory "%s" does not exist. Creating it now.', [irtdir 'mex/local']))
mkdir([irtdir 'mex/local']);
end

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Automatically create the mex/local directory if it doesn't exist

@kristinazvolanek

Copy link
Copy Markdown
Author

Thanks for the review!
I edited the setup file to create the mex/local directory automatically and tested in my environment. ir_mex_build runs and creates a compiled penalty_mex file in mex/local.

Comment thread setup.m Outdated
Comment thread setup.m Outdated
@JeffFessler

Copy link
Copy Markdown
Owner

Thanks for the updates and I appreciate you testing them.
So you could compile penalty_mex but I assume the memory issue you reported at the outset is still an open problem on apple cpu?

I've made a couple (hopefully final) suggestions based on #33.
I could just commit them but I wanted to give you the chance to counter if you think I'm overlooking something.

kristinazvolanek and others added 3 commits April 21, 2026 19:36
Co-authored-by: Jeff Fessler <JeffFessler@users.noreply.github.com>
Co-authored-by: Jeff Fessler <JeffFessler@users.noreply.github.com>
@kristinazvolanek

Copy link
Copy Markdown
Author

Thanks for the additional suggestions. I re-tested in my environment and they look good on my end.

I can successfully compile penalty_mex, but I still see the same error ("array exceeds the maximum possible variable size"). I haven't confirmed if this is specific to Apple, but I am seeing it on an M4 Pro with MATLAB 2025b and 2024b.

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