JuliaSmoothOptimizers / LinearOperators.jl

Linear Operators for Julia
Other
149 stars 31 forks source link

Add JLArrays, Metal and AMDGPU extensions and S kwarg tests #332

Open nHackel opened 1 month ago

nHackel commented 1 month ago

This PR adds a weak extension for JLArrays. These arrays are a CPU-reference-implementation of GPUArrays and allow for easier testing of GPU handling. The weak extension is structured similar to the CUDA extension

We will also add extensions for Metal.jl and AMDGPU.jl. Metal.jl and JLArrays can be tested, AMDGPU.jl would require buildkite with an AMD card.

nHackel commented 1 month ago

I've also added some initial tests that check if the S keyword is correctly handled for the basic constructors and the special operators. I've also found a small bug where the S keyword was discarded for the opEye operator.

Per default the tests run on JLArrays, in theory it would also be possible to let the test run on CUDA with the buildkite setup

github-actions[bot] commented 1 month ago
Package name latest stable
CaNNOLeS.jl
DCISolver.jl
FletcherPenaltySolver.jl
JSOSolvers.jl
Krylov.jl
NLPModels.jl
NLPModelsModifiers.jl
PROPACK.jl
Percival.jl
QuadraticModels.jl
SolverTools.jl
tknopp commented 1 month ago

@nHackel: I added Metal support and the Metal tests should only run on the platform arm64. I have not tested though.

I needed to disable the Float64 tests and the SymTridiagonal(Symmetric(mat)) test. The former seems to be simply not supported by Metal. The later I have not investigated. It says: "Compilation to native code failed". Maybe something to be reported at Metal.jl but this can be done later.

tknopp commented 1 month ago

This is an MWE for the Metal issue:

using Metal, LinearAlgebra

mat = Metal.rand(Float32, 32, 32)
S = Symmetric(mat)
SymTridiagonal(S) # this fails.

@maleadt: Is this a potential Metal issue/limitation and should I file am an issue in Metal.jl?

maleadt commented 1 month ago

Is this a potential Metal issue/limitation and should I file am an issue in Metal.jl?

That looks like https://github.com/JuliaGPU/Metal.jl/issues/332

nHackel commented 3 weeks ago

Hello @dpo, I've restructured the GPU related tests into the GPU folder. The normal CI still executes an S keyword test with JLArrays. The metal test is still only run on the appropriate system.

I've also added a test for AMDGPUs as well as a buildkite step. Both AMD and Nvidia test now also run the S keyword test