Skip to content

Conversation

@ChrisRackauckas-Claude
Copy link

Summary

Fixes x86 (32-bit) compatibility issues by explicitly converting Int to Int64 where needed for Sundials C API calls.

Problem

On x86 (32-bit) systems, Int is Int32, but the Sundials C API expects sunindextype which is defined as Int64. This causes MethodError:

MethodError: no method matching N_VMake_Serial(::Int32, ::Vector{Float64}, ::Ptr{Nothing})
The function `N_VMake_Serial` exists, but no method is defined for this combination of argument types.
Closest candidates are:
  N_VMake_Serial(::Int64, ::Any, ::Ptr{Nothing})

Solution

Added explicit Int64() conversions for all length() calls and integer parameters passed to Sundials C API functions:

Files changed:

  • src/nvector_wrapper.jl: Convert length(v) to Int64 in N_VMake_Serial call
  • src/common_interface/solve.jl: Convert all length(uvec), length(u0), and bandwidth parameters to Int64 for matrix constructors
  • src/simple.jl: Convert all length(y0) and bandwidth parameters to Int64 for matrix constructors

Functions affected:

  • N_VMake_Serial(length(v), ...)N_VMake_Serial(Int64(length(v)), ...)
  • SUNDenseMatrix(length(...), length(...), ...)SUNDenseMatrix(Int64(length(...)), Int64(length(...)), ...)
  • SUNBandMatrix(length(...), upper, lower, ...)SUNBandMatrix(Int64(length(...)), Int64(upper), Int64(lower), ...)
  • SUNSparseMatrix(length(...), length(...), nnz, ...)SUNSparseMatrix(Int64(length(...)), Int64(length(...)), Int64(nnz), ...)

Test plan

  • Local build succeeds
  • CI x86 tests pass

Fixes CI failure: https://github.com/SciML/Sundials.jl/actions/runs/17394622855/job/49374121057?pr=493

🤖 Generated with Claude Code

On x86 systems, Int is Int32 but Sundials C API expects Int64 (sunindextype).
This fixes MethodError: no method matching N_VMake_Serial(::Int32, ...).

Fixed in:
- src/nvector_wrapper.jl: Convert length(v) to Int64 in N_VMake_Serial call
- src/common_interface/solve.jl: Convert all length() calls to Int64 for SUNDenseMatrix, SUNBandMatrix, and SUNSparseMatrix
- src/simple.jl: Convert all length() calls to Int64 for matrix constructors

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

Co-Authored-By: Claude <noreply@anthropic.com>
@ChrisRackauckas ChrisRackauckas merged commit 1ace9ae into SciML:master Sep 2, 2025
6 of 10 checks passed
@ViralBShah
Copy link
Contributor

The runners are having trouble with x86: https://github.com/SciML/Sundials.jl/actions/runs/17406045605/job/49410564980

The CI is not green for x86.

@ChrisRackauckas
Copy link
Member

MTK fails on x86, but that's separate

@ViralBShah
Copy link
Contributor

ViralBShah commented Sep 12, 2025

Did you actually have this run on x86 - as in is this PR sufficient to pass on X86? It failed in CI and continues failing (OOM - runs out of memory).

I am guessing this PR is not sufficient, since on 32-bit machines, you have to use Int (Clong is 32-bit and not 64-bit). This PR is making everything 64-bit when it should most likely be going in the other direction.

It may be simplest to revert this and not support 32-bit.

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.

3 participants