Skip to content

Dynamic mkl link - #29

Merged
jcapriot merged 4 commits into
simpeg:mainfrom
jcapriot:dynamic_mkl_link
Sep 26, 2026
Merged

jcapriot merged 4 commits into
simpeg:mainfrom
jcapriot:dynamic_mkl_link

Conversation

@jcapriot

Copy link
Copy Markdown
Member

Static linking the MKL was proving a little problematic for distribution purposes mostly due to the continued openmp runtime library dependency, but also due to the requirements of including the necessary license information. For now the best route is still to just dynamically link to the MKL through the mkl python package for pypi distributions.

We can still provide pre-built wheels however, they just continue to keep the listed mkl dependency. Also, the most recent pkgconfig version has a fix to now work with the PKG_CONFIG_PATH environment variable set, so we can return to that.

Statically linked MKL wheels bundle third-party binaries (MKL, OpenMP runtime), which have specific redistribution terms. This commit addresses these by:

*   **Replacing Intel's OpenMP runtime with LLVM's:** `install_llvm_openmp.py` swaps out Intel's `libiomp5` for LLVM's Apache-2.0 licensed equivalent during the build, providing a more permissive license.
*   **Accurately declaring and bundling licenses:** `finalize_static_wheel.py` strips the `mkl` dependency (now fully static) and injects a combined `License-Expression` (`MIT AND LicenseRef-Intel-ISSL AND Apache-2.0 WITH LLVM-exception`). It also copies relevant license texts and third-party notices into the wheel's `.dist-info/licenses/` directory, as required by their terms.
*   **Updating documentation:** `README.md` now explicitly details the licensing for prebuilt wheels.

This ensures legal compliance for PyPI wheels while maintaining functionality.
@codecov

codecov Bot commented Sep 25, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 85.83%. Comparing base (c782c13) to head (b097c76).

Files with missing lines Patch % Lines
pydiso/_init_helper.py 0.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #29      +/-   ##
==========================================
+ Coverage   85.46%   85.83%   +0.37%     
==========================================
  Files           4        4              
  Lines         619      614       -5     
  Branches       78       78              
==========================================
- Hits          529      527       -2     
+ Misses         62       59       -3     
  Partials       28       28              

☔ View full report in Codecov by Harness.
📢 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.

Meson's lookup for PyPI's `mkl-devel` can be obstructed when `PKG_CONFIG_PATH` is
pre-set (e.g., by `actions/setup-python`). This commit ensures dynamic MKL
linking succeeds by:

*   Explicitly unsetting `PKG_CONFIG_PATH` in the CI workflow during package
    installation.
*   Modifying `meson.build` to detect MKL absence more gracefully and provide
    a clearer error message, guiding users to unset `PKG_CONFIG_PATH` or add
    the correct path to it.
*   Updating a comment in the CI workflow for clarity regarding the macOS MKL
    issue.
@jcapriot
jcapriot merged commit 93c3ebf into simpeg:main Sep 26, 2026
29 of 30 checks passed
@jcapriot
jcapriot deleted the dynamic_mkl_link branch September 26, 2026 18:45
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.

1 participant