Skip to content

Conversation

@ZedongPeng
Copy link
Collaborator

@ZedongPeng ZedongPeng commented Nov 2, 2025

Desciption

This PR adds the Julia interface for cuPDLPx, a GPU-accelerated first-order LP solver.

Below is an example output from the current code generation workflow.
Any feedback or suggestions from the Julia or JuMP community would be greatly appreciated. @odow @blegat

julia> include("gen/generate.jl")
[ Info: Found dependent header: /home/zdpeng/.julia/artifacts/e94ada842831fcd275cc7c74e440e576dd0a9723/include/cupdlpx_types.h
[ Info: Parsing headers...
[ Info: Processing header: /home/zdpeng/.julia/artifacts/e94ada842831fcd275cc7c74e440e576dd0a9723/include/cupdlpx.h
[ Info: Building the DAG...
[ Info: Emit Julia expressions...
[ Info: [ProloguePrinter]: print to ./src/LibcuPDLPx.jl
[ Info: [GeneralPrinter]: print to ./src/LibcuPDLPx.jl
[ Info: [EpiloguePrinter]: print to ./src/LibcuPDLPx.jl
[ Info: Done!
✅ Successfully generated LibcuPDLPx.jl at /orcd/home/002/zdpeng/github/cuPDLPx.jl/gen/src/LibcuPDLPx.jl

julia> Pkg.precompile()
Precompiling project...
  1 dependency successfully precompiled in 4 seconds. 74 already precompiled.

@ZedongPeng ZedongPeng requested a review from blegat November 2, 2025 00:21
@ZedongPeng ZedongPeng marked this pull request as draft November 2, 2025 02:11
@odow
Copy link

odow commented Nov 2, 2025

There's a lot of stuff there. You should wrap only the public C API.

What functions is the user expected to call?

end

function read_mps_file(filename)
ccall((:read_mps_file, libcupdlpx), Ptr{lp_problem_t}, (Ptr{Cchar},), filename)
Copy link

Choose a reason for hiding this comment

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

But stuff like this should be

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I’m a bit confused here. Since the goal of this API is to interact with JuMP, do we still need this functionality, given that JuMP already provides the read_from_file function?

Copy link

Choose a reason for hiding this comment

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

This falls into the question of "what is your public API?"

People might want to interact with cuPDLPx directly, from Julia, and without JuMP.

Something like:

using cuPDLPx
model = cuPDLPx.read_mps_file(filename)
cuPDLPx.optimize(model)
x = cuPDLPx.get_solution(model)

(Or whatever, I don't know the C API functions)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Thanks for the input, @odow. That’s a good point — we may need to reorganize the C API functions in cuPDLPx.

@ZedongPeng
Copy link
Collaborator Author

Thank you so much for the suggestion, @odow. I wasn’t very familiar with Clang.jl before — I’ll make sure to wrap only the public C API.

There's a lot of stuff there. You should wrap only the public C API.

What functions is the user expected to call?

@ZedongPeng ZedongPeng changed the title [WIP] Add Julia interface for cuPDLPx Add Julia interface for cuPDLPx Nov 17, 2025
@ZedongPeng ZedongPeng requested a review from odow November 17, 2025 21:38
@ZedongPeng
Copy link
Collaborator Author

Hi @odow and @blegat, I’ve updated the code, and it looks much more reasonable now. This is my first time using Clang.jl, so there may still be issues. Any comments or suggestions would be greatly appreciated.

@@ -0,0 +1,2 @@
# This file will be inserted automatically at the top of LibcuPDLPx.jl
Copy link
Collaborator

Choose a reason for hiding this comment

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

It doesn't seem to be the case

Copy link
Collaborator

Choose a reason for hiding this comment

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

The line doesn't seem to be included in the file

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I will remove this.

@ZedongPeng
Copy link
Collaborator Author

I'm seeing generated names like ##Ctag#273 in my bindings. Is this normal, or is there a way to map these to meaningful names using the generator options?

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.

4 participants