ci: rebuild the MATLAB toolbox workflow on the proven CUDA toolchain - #11
ci: rebuild the MATLAB toolbox workflow on the proven CUDA toolchain#11ericwait wants to merge 6 commits into
Conversation
The workflow's only run (v4.0.0 merge) failed on both platforms at the Jimver CUDA install step - the same breakage ci.yml already moved away from. Port the four ci.yml lessons: CUDA from conda-forge, conda base env, Ninja generator, CUDA 13.x (nvcc 12.x rejects VS 2026 MSVC). Other fixes while rebuilding it: - Pass Matlab_ROOT_DIR explicitly; FindMatlab cannot discover the hosted-toolcache install on its own. - Pin MATLAB R2024b (the release the .prj was authored with) so the MEX binaries match the toolbox's recorded minimum release. - Replace the inline .prj regex patch with packageToolboxCI.m, which packages programmatically via ToolboxOptions - no machine-specific absolute paths, version single-sourced from pyproject.toml (the old .prj still said 3.1.2). - Package with the freshly generated .m wrappers from the Windows build instead of the checked-in copies, and guard against Git LFS pointer files sneaking into the toolbox. - Run path-filtered on PRs (single CUDA arch for speed), all-major on main, and attach the .mltbx to published GitHub Releases. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Reviewer's GuideRebuilds the MATLAB toolbox GitHub Actions workflow to use the same conda-forge CUDA toolchain as ci.yml, adds explicit MATLAB discovery and version pinning, refactors toolbox packaging into a scripted MATLAB entry point with single-sourced versioning, and tightens triggers, artifacts, and release attachment behavior. File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Hey - I've left some high level feedback:
- The toolbox version extraction in
package-toolboxrelies on a simplegrep/sedpattern; consider making this more robust to pyproject formatting changes (e.g., multiline or commented version fields) to avoid silent misparsing. - Both the workflow and
packageToolboxCI.mencode the MATLAB release (viaMATLAB_RELEASEenv andMinimumMatlabRelease); centralizing this value or asserting they match at runtime would reduce the risk of them drifting apart.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- The toolbox version extraction in `package-toolbox` relies on a simple `grep`/`sed` pattern; consider making this more robust to pyproject formatting changes (e.g., multiline or commented version fields) to avoid silent misparsing.
- Both the workflow and `packageToolboxCI.m` encode the MATLAB release (via `MATLAB_RELEASE` env and `MinimumMatlabRelease`); centralizing this value or asserting they match at runtime would reduce the risk of them drifting apart.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
…ld hook Both platforms compiled and linked HydraMex, then failed with License Manager Error -1: the matlab-actions self-licensing on hosted runners only covers MATLAB launched through their actions, not a matlab -batch spawned by the CMake POST_BUILD step. Gate that step behind a new HYDRA_MEX_AUTOINSTALL option (default ON, so local builds keep the old behavior) and have the workflow run autoInstallMex via matlab-actions/run-command after the build. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The plain set(HYDRA_MODULE_NAME Hydra) silently shadowed the cache variable, so -DHYDRA_MODULE_NAME=HIP (documented, and used by the MATLAB CI to build HIP.mex*) has been a no-op since the v4.0 build rework - the MEX always linked as Hydra.mex*. Declare it as a CACHE STRING so the command line wins and the default stays Hydra. Caught by the rebuilt MATLAB workflow: autoInstallMex could not find build/src/c/Mex/HIP.mexa64 because the file was Hydra.mexa64. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
MATLAB resolves a MEX file's libstdc++ from its own bundled copy, and R2024b's rejects binaries built with GCC 14 (CXXABI_1.3.15 not found) - conda-forge's current default cxx-compiler. Build with GCC 12 so the MEX loads on R2024b and newer for end users as well, not just in CI. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The toolbox image is LFS-tracked, so the lfs:false checkout leaves a pointer file and ToolboxOptions rejects it as an unrecognized image format. Fetch just that file - the remaining LFS assets are large test images the packaging job does not need. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
- Remove the LFS-tracked pre-4.0 MEX binaries (HIP.mexw64, HIP.mexa64, Hydra.mexw64) and gitignore locally built ones plus the packaged .mltbx - users get binaries from the CI-built toolbox, not git. - Add Test.SmokeTest (matlab.unittest, no GPU): the MEX must load, Info() must return the command table, DeviceCount must return 0 gracefully, and the generated wrappers must agree with the command table. matlab-multibuild.yml now runs it on both platforms after regenerating the wrappers. - Fix AccuracyTest GPU detection: it called Hydra.DeviceCount(), which does not exist (DeviceCount has no package-level wrapper), so devCount was always 0 and the whole suite silently skipped as Incomplete even on a GPU box. Use HIP.Cuda.DeviceCount(). - Document the MATLAB steps in TESTING.md (build with -DHYDRA_MODULE_NAME=HIP since the wrappers hard-code HIP.Cuda; watch for Incomplete results) and CLAUDE.md. - Simplify the Windows artifact upload: with no checked-in mexa64 pointer to dodge, upload the whole +HIP directory. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Why
The MATLAB toolbox workflow's only run (triggered by the v4.0.0 merge to
main) failed on both platforms at theJimver/cuda-toolkitinstall step — the exact breakageci.ymlalready moved away from during the v4.0.0 CI rework. Nothing had compiled the MEX frontend since the 4.0 rework, so this repairs the workflow, re-proves the MATLAB build, and adds MATLAB testing.What changed
Toolchain (ported from ci.yml): CUDA from conda-forge (compiler only; runners have no GPU), build in the conda
baseenv, Ninja generator, CUDA 13.x (nvcc 12.x rejects the VS 2026 MSVC onwindows-latest).MATLAB integration:
Matlab_ROOT_DIRis passed explicitly —FindMatlabcannot discover the hosted-toolcache install location on its own.HYDRA_MEX_AUTOINSTALL(default ON — local builds unchanged) and CI runsautoInstallMexviamatlab-actions/run-command.CXXABI_1.3.15not found). This matters for end users, not just CI.Bug fixes found by the new CI:
-DHYDRA_MODULE_NAME=HIPhad been a silent no-op since the v4.0 build rework (a plainset()shadowed the cache variable), so the MEX always linked asHydra.mex*. NowCACHE STRING.AccuracyTest.mcalledHydra.DeviceCount(), which does not exist (DeviceCount has no package-level wrapper) — GPU detection always failed and the whole accuracy suite silently skipped as Incomplete, even on a GPU box. Fixed toHIP.Cuda.DeviceCount().Testing:
Test.SmokeTest(matlab.unittest, no GPU): MEX loads,Info()returns the command table,DeviceCount()returns 0 gracefully, and the regenerated wrappers agree with the command table. CI runs it on both platforms.-DHYDRA_MODULE_NAME=HIPsince the wrappers hard-codeHIP.Cuda; watch forIncompleteresults) and a matlab-multibuild.yml checklist item.Repo cleanup:
HIP.mexw64,HIP.mexa64,Hydra.mexw64) are removed; locally built MEX binaries and the packaged.mltbxare now gitignored. Users get binaries from the CI-built toolbox.Packaging: the inline Python regex patch of the
.prjis replaced bysrc/MATLAB/build-scripts/packageToolboxCI.m(programmaticToolboxOptions, same GUID as the.prjso installs upgrade in place, version single-sourced frompyproject.toml— the.prjstill said 3.1.2). The toolbox is packaged from the freshly generated wrappers,logo.pngis pulled from LFS explicitly, and a guard fails the job if an LFS pointer ever lands where a MEX binary should be.Triggers: PR (path-filtered, single CUDA arch for speed), push to
main+workflow_dispatch(all-major), andrelease: publishedattaches the.mltbxto the GitHub Release.🤖 Generated with Claude Code