Matrix exponential of a `1×1` `JLSparseMatrixCSC` fails with scalar indexing both disabled and enabled
Los mantenedores suelen responder en 2 días
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Aptitud para principiantes
- 57/100
Línea de trabajo
The reported stack traces point to src/host/sparse.jl:216 and, with scalar indexing disabled, src/host/indexing.jl:50. Start by reading those paths and the sparse matrix exponential dispatch for JLSparseMatrixCSC; reproduce with the provided 1×1 Float32 example under both scalar-indexing settings. Done when exp(a) returns approximately 1.868246 with scalar indexing disabled.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Description
Calling exp(a) on a 1×1 Float32 sparse matrix fails on JLArrays under both scalar-indexing settings. With allowscalar(false), it raises a scalar-indexing error. With allowscalar(true), it reaches a missing constructor for JLSparseMatrixCSC{Float32, Int64}. CUDA returns the same matrix exponential in both runs.
Reproduction
Run the following script in a fresh Julia process with the packages listed below and a CUDA-capable GPU. The second iteration enables scalar indexing to expose the next failure.
using CUDA, JLArrays
using JLArrays: JLSparseMatrixCSC
using CUDA.cuSPARSE: CuSparseMatrixCSC
using SparseArrays: sparse
using GPUArrays: allowscalar
for enabled in (false, true)
println("allowscalar(", enabled, "):")
allowscalar(enabled)
for (backend, array) in (("JLArrays", JLSparseMatrixCSC), ("CUDA", CuSparseMatrixCSC))
try
a = array(sparse(Float32[0.625]))
result = exp(a)
println(backend, ": ", Array(result))
catch err
println(backend, ": ", first(eachsplit(sprint(showerror, err), '\n')))
end
end
end
Observed output
allowscalar(false):
JLArrays: Scalar indexing is disallowed.
CUDA: Float32[1.8682458;;]
allowscalar(true):
JLArrays: MethodError: no method matching JLSparseMatrixCSC{Float32, Int64}(::SparseArrays.SparseMatrixCSC{Float32, Int64})
CUDA: Float32[1.8682458;;]
Expected behavior
For this 1×1 matrix, the only entry in the matrix exponential should be approximately 1.868246, the exponential of 0.625. I would expect the JLArrays sparse implementation to compute this value with scalar indexing disabled.
Additional context
Both input constructors succeeded under both settings. The resulting matrices had types JLSparseMatrixCSC{Float32, Int64} and CuSparseMatrixCSC{Float32, Int32}, each with size (1, 1).
Both JLArrays exceptions arose inside exp(a), before the copy to the host. In GPUArrays.jl 12.3.0, both stack traces point to src/host/sparse.jl:216. With scalar indexing disabled, the stack also includes getindex at src/host/indexing.jl:50. With it enabled, the exception identifies a host SparseMatrixCSC{Float32, Int64} as the argument to the missing constructor.
Environment
- Julia 1.13.4 on Debian GNU/Linux 13 (x86_64, Docker)
- GPUArrays.jl 12.3.0, JLArrays.jl 0.5.0, CUDA.jl 6.5.1
- JLArrays CPU device: Intel Core i7-11700
- CUDA device: NVIDIA GeForce RTX 4090, CUDA runtime 12.9.0, NVIDIA driver 595.99.02
- Lenguaje dominante
- Julia
- Estrellas
- 462
- Forks
- 109
- Merge medio
- 4 d 11 h
- PR fusionados (30 d)
- 26
Preparar el entorno
Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de JuliaGPU/GPUArrays.jl
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 74/100
JuliaGPU/GPUArrays.jl#881 ·
Los mantenedores suelen responder en 2 días
-
arrays
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
JuliaGPU/GPUArrays.jl#697 · 1 reacción ·
Los mantenedores suelen responder en 2 días
-
Dificultad 3/5 1-2 días Aptitud para principiantes 58/100
JuliaGPU/GPUArrays.jl#880 ·
Los mantenedores suelen responder en 2 días
-
JLArrays 0.5: `erfcx`, `logerfc`, `logerfcx` fail (worked in 0.4)Posiblemente ocupada @timholy la tomó hace 2 días. Abierto
Dificultad 4/5 3-5 días Aptitud para principiantes 48/100
JuliaGPU/GPUArrays.jl#877 ·
Los mantenedores suelen responder en 2 días
-
Dificultad 4/5 3-5 días Aptitud para principiantes 48/100
JuliaGPU/GPUArrays.jl#866 ·
Los mantenedores suelen responder en 2 días
Todos los issues de JuliaGPU/GPUArrays.jl
Issues similares
-
Release CorleoneInverse as 0.1.1Posiblemente ocupada Un pull request vinculado a esta issue está abierto o ya se fusionó. Abierto
Dificultad 1/5 Menos de una hora Aptitud para principiantes 78/100
SciML/Corleone.jl#200 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
JuliaAI/MLJTransforms.jl#120 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 88/100
exercism/julia#1205 · 3 comentarios · 1 reacción ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
Los mantenedores suelen responder en 1 día
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 90/100
SciML/OrdinaryDiffEq.jl#5175 ·
Los mantenedores suelen responder en 1 día