Skip to content

Allow CUDA build with bazel#2554

Merged
galabovaa merged 4 commits into
ERGO-Code:latestfrom
TendTo:feat/cuda
Oct 17, 2025
Merged

Allow CUDA build with bazel#2554
galabovaa merged 4 commits into
ERGO-Code:latestfrom
TendTo:feat/cuda

Conversation

@TendTo
Copy link
Copy Markdown
Contributor

@TendTo TendTo commented Oct 2, 2025

Add the option to build Highs (more precisely cupdlp) with CUDA using Bazel as the build system.
For the CUDA build to be selected, the following 3 must be true:

  • a CUDA toolchain is detected on the system
  • the flag @rules_cuda//cuda:enable=False is NOT used (true by default)
  • the flag --//:cupdlp_gpu is used

I hadn't the chance to test it on many systems with different configurations, but the little testing I did seem to confirm that this small change works as expected.
Let me know if there are any issues with it.

@codecov
Copy link
Copy Markdown

codecov Bot commented Oct 2, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 79.70%. Comparing base (71e327a) to head (44f5b6c).
⚠️ Report is 65 commits behind head on latest.

Additional details and impacted files
@@            Coverage Diff             @@
##           latest    #2554      +/-   ##
==========================================
+ Coverage   79.66%   79.70%   +0.04%     
==========================================
  Files         346      346              
  Lines       86430    86417      -13     
==========================================
+ Hits        68854    68882      +28     
+ Misses      17576    17535      -41     

☔ 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.

@galabovaa
Copy link
Copy Markdown
Contributor

My local tests passed as well! Thank you, @TendTo, for this small but important update!

@galabovaa galabovaa merged commit 86de861 into ERGO-Code:latest Oct 17, 2025
195 of 196 checks passed
@galabovaa
Copy link
Copy Markdown
Contributor

@TendTo this code breaks the highs update in bazel-central-registry. I will have to modify it somehow, so

bazel_dep(
    name = "rules_cuda",
    version = "0.2.5",
)

is only optional in MODULE.bazel or moved to a separate file.

Could you tell me a little bit more about how you are using HiGHS with bazel in your project?

@TendTo
Copy link
Copy Markdown
Contributor Author

TendTo commented Oct 27, 2025

Interesting, could you share some more details on how the dependency breaks the update? I would assume that the dependency (rules_cuda) is only pulled if you actually need it, and it should not impact anything else, but there is clearly some flaws in my assumption.

I was planning on using Highs mostly as a configurable LP solver, since it supports Simplex, IPM and pdlp. Moreover, being open source, it would not require the user to have a licence and I was also considering statically linking it if needed.

@galabovaa
Copy link
Copy Markdown
Contributor

Actually, I think it's fine. The failure was my mistake, I needed to update one more file in bcr. I will test this a bit more locally with and without NVvidia, but I think it will go OK.

I was curious if you are just using bazel to build the highs library or binary or if your parent project is also bazel-based. So far, the bazel build has been used mostly for OR-Tools, at least as far as we know. It is great to hear that you have decided to try HiGHS and thank you again for your contribution!

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