Skip to content

Conversation

@ChrisRackauckas-Claude
Copy link

Summary

Fixes CI test failures on Julia v1 (1.12+) by conditionally disabling Enzyme, which currently has compatibility issues with Julia 1.12+.

Changes

  • test/runtests.jl: Added global const ENZYME_ENABLED = VERSION < v"1.12" and updated package installation logic
  • test/adjoint_tests.jl: Conditionally import and test Enzyme only when enabled

Re-enabling Enzyme

To re-enable Enzyme in the future (once compatibility is fixed), simply change the condition in both files:

const ENZYME_ENABLED = true  # or VERSION < v"1.13"`

This centralizes the Enzyme compatibility check in one easy-to-modify location.

Test plan

  • CI should pass on Julia 1.12+ without Enzyme
  • CI should still pass on Julia 1.11 and earlier with Enzyme enabled
  • Tests can be manually verified by checking the CI logs

🤖 Generated with Claude Code

ChrisRackauckas and others added 2 commits November 13, 2025 10:41
- Added global const ENZYME_ENABLED = VERSION < v"1.12" in one central location
- Modified test/runtests.jl to conditionally install Enzyme based on ENZYME_ENABLED
- Modified test/adjoint_tests.jl to conditionally run Enzyme tests
- Easy to re-enable by changing the condition in the const definition
- Resolves CI failures on Julia v1.12+ where Enzyme has compatibility issues

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
- Skip entire adjoint test on Julia 1.12+ since SciMLSensitivity/Mooncake aren't installed
- Add Julia 1.11 to all CI workflows (top-level and all sublibs)
- This ensures we test on both v1.11 (with Enzyme) and v1.12+ (without Enzyme)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
@ChrisRackauckas-Claude
Copy link
Author

Additional fixes

Updated to skip the entire adjoint test on Julia 1.12+ rather than just conditionally importing Enzyme, since SciMLSensitivity and Mooncake also aren't installed on v1.12+.

Also added Julia 1.11 to all CI workflows:

  • Top-level CI_NonlinearSolve.yml
  • All sublib CI workflows (BracketingNonlinearSolve, NonlinearSolveBase, NonlinearSolveFirstOrder, NonlinearSolveQuasiNewton, NonlinearSolveSpectralMethods, SimpleNonlinearSolve, SciMLJacobianOperators, NonlinearSolveHomotopyContinuation, SCCNonlinearSolve, NonlinearSolveSciPy)

This ensures we test on both:

  • Julia 1.11 (with Enzyme enabled)
  • Julia 1.12+ (with Enzyme disabled)

The previous approach using `return` didn't work because @testitem isn't a
function scope. Using @static if prevents the package imports from being
attempted at all on Julia 1.12+.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
@ChrisRackauckas-Claude
Copy link
Author

Fixed: Use @static if instead of return

Fixed the adjoint test to use @static if VERSION < v"1.12" instead of a runtime if with return. The previous approach didn't work because @testitem isn't a function scope, so the packages were still being loaded before the return statement could execute.

Now the entire test body is conditionally compiled based on the Julia version, preventing the package imports from being attempted on Julia 1.12+.

Added VERSION < v"1.12" check to all conditional Enzyme imports across all
subpackage tests:
- lib/NonlinearSolveBase/ext/NonlinearSolveBaseEnzymeExt.jl
- lib/NonlinearSolveFirstOrder/test/rootfind_tests.jl
- lib/NonlinearSolveHomotopyContinuation/test/allroots.jl
- lib/NonlinearSolveHomotopyContinuation/test/single_root.jl
- lib/NonlinearSolveQuasiNewton/test/core_tests.jl
- lib/SciMLJacobianOperators/test/core_tests.jl
- lib/SimpleNonlinearSolve/test/core/rootfind_tests.jl

Changed from: if isempty(VERSION.prerelease)
Changed to: if isempty(VERSION.prerelease) && VERSION < v"1.12"

This ensures Enzyme is not loaded on Julia 1.12+ where it has compatibility issues.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
@ChrisRackauckas-Claude
Copy link
Author

Updated all sublib Enzyme version checks

Extended the Enzyme version check to all subpackage tests to prevent Enzyme from being loaded on Julia 1.12+.

Files Updated:

  • lib/NonlinearSolveBase/ext/NonlinearSolveBaseEnzymeExt.jl
  • lib/NonlinearSolveFirstOrder/test/rootfind_tests.jl
  • lib/NonlinearSolveHomotopyContinuation/test/allroots.jl
  • lib/NonlinearSolveHomotopyContinuation/test/single_root.jl
  • lib/NonlinearSolveQuasiNewton/test/core_tests.jl
  • lib/SciMLJacobianOperators/test/core_tests.jl
  • lib/SimpleNonlinearSolve/test/core/rootfind_tests.jl

Change:

# Before
if isempty(VERSION.prerelease)

# After
if isempty(VERSION.prerelease) && VERSION < v"1.12"

This ensures that all Enzyme imports and usage are properly skipped on Julia 1.12+ across the entire codebase, not just in the top-level tests.

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