Skip to content

Recognize ROCm host OpenBLAS libraries - #311

Open
cccat6 wants to merge 3 commits into
joblib:masterfrom
cccat6:codex/fix-rocm-openblas-prefix
Open

cccat6 wants to merge 3 commits into
joblib:masterfrom
cccat6:codex/fix-rocm-openblas-prefix

Conversation

@cccat6

@cccat6 cccat6 commented Nov 30, 2026

Copy link
Copy Markdown

I found that threadpoolctl was missing the host OpenBLAS library loaded by
PyTorch in my ROCm environment. threadpool_info() did not list it, and
threadpool_limits() could not control its thread count. I need it to be
recognized so I can manage its threads alongside the other BLAS libraries.

ROCm names these libraries librocm-openblas.so.0 and librocm-openblas64.so.0.
Those filenames do not match the prefixes currently recognized by
OpenBLASController, even though the existing controller can handle them.

Add "librocm-openblas" to OpenBLASController.filename_prefixes and reuse the
existing detection and thread-limit handling.

@ogrisel

ogrisel commented Dec 2, 2026

Copy link
Copy Markdown
Contributor

The change look reasonable but I am worried we might break support silently in the future if our CI does not test it. I am not very familiar with ROCm. Do you think it would be possible to update one of the CI configs to test this? Are there easily installable conda-forge or pypi packages? Would testing this require specific hardware not available in standard github actions runners?

Also we need a changelog entry for this.

@cccat6

cccat6 commented Dec 3, 2026

Copy link
Copy Markdown
Author

Thanks for the suggestion. I found the host libraries in AMD's ROCm SDK wheel, and a smaller Ubuntu package, amdrocm-math-common, that contains the same libraries.

I updated the existing Ubuntu 24.04 CI job to extract that package and run the two existing by-prefix tests against the real OpenBLAS library. Both passed in my local test without PyTorch, a GPU driver install, or a GPU requirement. I also added the changelog entry and removed the two temporary skip allowances.

@ogrisel ogrisel left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks @cccat6. Here is a follow-up suggestion:

with:
name: test_result_${{ github.run_id }}_ubuntu-24.04_rocm_openblas
path: rocm-test-result/test_result.xml
retention-days: 1

@ogrisel ogrisel Dec 4, 2026 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I would rather not have overspecialized logic in the CI config itself because it makes it hard to interactively debug failures with such complex setups locally.

Instead we could just decompress the the .so file in a test folder (e.g. "extra_dynamic_libraries_for_tests") and then add a pytest fixture in conftest.py that globs all the files under that folder and call ctypes.CDLL() on all of them.

The configure .gitignore to ignore anything under "extra_dynamic_libraries_for_tests" to avoid commiting binaries by mistake.

Then we could run the regular test suite.

This will make it easier to run the same test setup locally for debugging purpose.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actually cursor suggested this instead: #318. I think I like it better.

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.

Thanks for putting #318 together. I took a look, and it fixes the issue I ran into. I’m not very familiar with how best to set up CI for this project, so my approach may not have been the best fit. I appreciate the fix!

This branch has not been deployed

No deployments
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