Skip to content

[MATLAB] Create MLTBX toolbox file that can be published on File Exchange #1882

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

Draft
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

ssun30
Copy link
Contributor

@ssun30 ssun30 commented May 7, 2025

Changes proposed in this pull request

  • Added a script to build the MLTBX toolbox file that can be published on File Exchange

If applicable, fill in the issue number this pull request is fixing

This addresses Task 6 from this enhancement proposal: Cantera/enhancements#226

If applicable, provide an example illustrating new features this pull request is introducing

  • The script will automatically package the relevant files, including data, interfaces/matlab_experimental, test\matlab_experimental, samples\matlab_experimental into the toolbox file.
  • Added a step in the CI to build the toolbox.
  • (WIP) The script should also be able to automatically download platform-specific Cantera binaries and header files (packaged in zip files) once we can automatically generate these files in our CI workflow.
  • (WIP) Add a step in the CI to test the toolbox.
  • (WIP) Add steps to upload the toolbox and host it somewhere.

Checklist

  • The pull request includes a clear description of this code change
  • Commit messages have short titles and reference relevant issues
  • Build passes (scons build & scons test) and unit tests address code coverage
  • Style & formatting of contributed code follows contributing guidelines
  • The pull request is ready for review

@ssun30 ssun30 force-pushed the matlab_mltbx branch 2 times, most recently from 6768386 to 529e0e5 Compare May 7, 2025 23:52
@ssun30 ssun30 force-pushed the matlab_mltbx branch 2 times, most recently from 82f5f45 to f9ff4b1 Compare May 8, 2025 00:48
Copy link

codecov bot commented May 8, 2025

Codecov Report

Attention: Patch coverage is 0% with 141 lines in your changes missing coverage. Please review.

Project coverage is 72.56%. Comparing base (284a989) to head (d227c5b).

Files with missing lines Patch % Lines
...nterfaces/matlab_experimental/Setup/buildToolbox.m 0.00% 60 Missing ⚠️
interfaces/matlab_experimental/Utility/ctPaths.m 0.00% 40 Missing ⚠️
...s/matlab_experimental/Setup/downloadDependencies.m 0.00% 21 Missing ⚠️
interfaces/matlab_experimental/Utility/ctLoad.m 0.00% 20 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1882      +/-   ##
==========================================
- Coverage   74.28%   72.56%   -1.72%     
==========================================
  Files         448      451       +3     
  Lines       55744    55869     +125     
  Branches     9190     9190              
==========================================
- Hits        41411    40544     -867     
- Misses      11232    12233    +1001     
+ Partials     3101     3092       -9     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Member

@bryanwweber bryanwweber left a comment

Choose a reason for hiding this comment

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

Given the note in the downloadDependencies.m file, I think this should probably wait until the setup is integrated into SCons and we figure out a release process.

opts.OutputFile = outputFile;
opts.SupportedPlatforms.Win64 = true;
opts.SupportedPlatforms.Glnxa64 = true;
opts.SupportedPlatforms.Maci64 = true;
Copy link
Member

Choose a reason for hiding this comment

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

Does this support Apple Silicon?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

MATLAB will run through Rosetta 2 on Apple Silicon for releases after R2020b so even though the option is called Maci64 it should support Apple Silicon.

Earlier releases will only support Mac with Intel processors.

@ssun30 ssun30 force-pushed the matlab_mltbx branch 2 times, most recently from 907bc96 to 6513c20 Compare June 12, 2025 01:58
@@ -66,10 +66,34 @@
echo "LD_PRELOAD=$LIB_STDCXX:$LIB_OPENBLAS:$LIB_LAPACK" >> $GITHUB_ENV
- name: Set up MATLAB
uses: matlab-actions/setup-matlab@718d4320188c73c86eb94ce76b553cbf89778487 # v2.5.0
- name: Set MATLAB search paths for tests and build MLTBX toolbox
uses: matlab-actions/run-command@v2

Check failure

Code scanning / zizmor

action is not pinned to a hash (required by blanket policy) Error

action is not pinned to a hash (required by blanket policy)
Copy link
Member

Choose a reason for hiding this comment

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

Please address this CI error by using a hash.

@ssun30 ssun30 force-pushed the matlab_mltbx branch 2 times, most recently from 190fe92 to 32f8f53 Compare June 14, 2025 00:01
@ssun30
Copy link
Contributor Author

ssun30 commented Jun 14, 2025

Hi @bryanwweber @ischoegl , I have been testing my MLTBX toolbox with local copies of cantera binaries and headers. Could we build those and host them somewhere similar to the PyPI package?

@bryanwweber
Copy link
Member

Yes, we can do that, but I'd prefer to wait until this package is ready to be built. What's the status here? You have some failing checks still

@ischoegl
Copy link
Member

Yes, we can do that, but I'd prefer to wait until this package is ready to be built. What's the status here? You have some failing checks still

I second @bryanwweber’s opinion. I’d prefer to have a fully implemented test suite - there is a significant regression in the 1D code (#1722) that to my knowledge has not been addressed.

Copy link
Member

@ischoegl ischoegl left a comment

Choose a reason for hiding this comment

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

Thank you, @ssun30 - I only have minor comments. Other than that, I believe this is mostly ready to be merged - uploading to MATLAB File Exchange is an extra step and can be addressed at a later point.

Comment on lines +89 to +93
# MLTBX test is disabled until we can download packaged binaries and header files
# - name: Test the MLTBX toolbox
# uses: matlab-actions/run-tests@v2
# with:
# select-by-folder: /home/runner/work/cantera/cantera/test/matlab_experimental
Copy link
Member

@ischoegl ischoegl Jun 21, 2025

Choose a reason for hiding this comment

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

Wouldn't it be possible to use saved artifacts? (or what is already available anyway, as this CI job has compiled the binaries already)

Fwiw, you could make all of this dependent on previously compiled Cantera versions, similar to the .NET runners, which would allow you to test on all platforms (Windows/macOS/Linux). Caveat: you're still on the legacy CLib

@@ -66,10 +66,34 @@
echo "LD_PRELOAD=$LIB_STDCXX:$LIB_OPENBLAS:$LIB_LAPACK" >> $GITHUB_ENV
- name: Set up MATLAB
uses: matlab-actions/setup-matlab@718d4320188c73c86eb94ce76b553cbf89778487 # v2.5.0
- name: Set MATLAB search paths for tests and build MLTBX toolbox
uses: matlab-actions/run-command@v2
Copy link
Member

Choose a reason for hiding this comment

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

Please address this CI error by using a hash.

@bryanwweber
Copy link
Member

Aside from Ingmar's comments, I'm very confused about how all of the open PRs interact. For example, this PR changes test files but there's also the separate testing PR. Can you clarify the order we should review these?

ssun30 added 7 commits July 1, 2025 14:37
and upload the artifact
Replaced ctRoot with ctPaths, this will allow the
user to set paths to the shared libraries, header
files, and toolboxes more freely, instead of
relying on relative paths to a fixed path for
a certain conda environment.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants