Port sparse inequality constraint Jacobian to GPU#40
Merged
pelesh merged 8 commits intoolcf-hackathon-2026-devfrom Apr 20, 2026
Merged
Port sparse inequality constraint Jacobian to GPU#40pelesh merged 8 commits intoolcf-hackathon-2026-devfrom
pelesh merged 8 commits intoolcf-hackathon-2026-devfrom
Conversation
nkoukpaizan
reviewed
Apr 16, 2026
nkoukpaizan
reviewed
Apr 20, 2026
Collaborator
There was a problem hiding this comment.
Just a couple more minor suggestions. Looks good otherwise!
Benchmark results are promising. It would be good to see how the GPU kernel compares to a purely CPU evaluation (i.e., what portion of the PETSc path was compute versus data movement).
case_ACTIVSg200.m
=== Performance Benchmark (1000 iterations) ===
PETSc path (compute + MatGetRow + copy): 85.9155 us/iter
GPU path (RAJA kernels, no copies): 14.2352 us/iter
=== End Benchmark ===
case_ACTIVSg2000.m
=== Performance Benchmark (1000 iterations) ===
PETSc path (compute + MatGetRow + copy): 670.548 us/iter
GPU path (RAJA kernels, no copies): 15.0518 us/iter
=== End Benchmark ===
case_ACTIVSg10k.m
=== Performance Benchmark (1000 iterations) ===
PETSc path (compute + MatGetRow + copy): 1975.1 us/iter
GPU path (RAJA kernels, no copies): 15.803 us/iter
=== End Benchmark ===
Replace PETSc-based inequality Jacobian with GPU RAJA kernels Move the inequality constraint Jacobian computation for the HiOp sparse GPU solver entirely to the device, eliminating the per-iteration host back and forth (copy to host, PETSc compute, MatGetRow extraction, values copy back to device). Elimiate PETSc use from this part of the code. Three RAJA kernels now compute directly into device memory: - Generator set-point constraints (AGC) - Voltage-reactive-power bounds (FIXED_WITHIN_QBOUNDS) - Line flow limits (Sf^2/St^2 derivatives + slack variables) Supporting changes: - Analytical NNZ counting replaces PETSc MatGetInfo at solver setup - New device-side parameter fields (apf, vs, xpdevidx, xslackidx, bus-to-gen mapping) added to *ParamsRajaHiop structs - Sparse position indices assigned at model setup for all three contribution types Includes validation test (test_ineqjac_gpu) that solves with IPOPT, then compares PETSc and GPU Jacobian values at the converged solution. Optional -benchmark flag for performance comparison. Made-with: Cursor
62a86d9 to
580192c
Compare
20 tasks
nkoukpaizan
approved these changes
Apr 20, 2026
Collaborator
nkoukpaizan
left a comment
There was a problem hiding this comment.
Looks good to me! Tests are passing on the HIP and CUDA backends.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Merge request type
Relates to
This MR updates
Summary
Replace PETSc-based inequality Jacobian with GPU RAJA kernels
Move the inequality constraint Jacobian computation for the HiOp sparse
GPU solver entirely to the device, eliminating the per-iteration host
back and forth (copy to host, PETSc compute, MatGetRow extraction, values
copy back to device). Elimiate PETSc use from this part of the code.
Three RAJA kernels now compute directly into device memory:
Supporting changes:
bus-to-gen mapping) added to *ParamsRajaHiop structs
contribution types
Includes validation test (test_ineqjac_gpu) that solves with IPOPT,
then compares PETSc and GPU Jacobian values at the converged solution.
Optional -benchmark flag for performance comparison.
Made-with: Cursor