LinearOperators.jl icon indicating copy to clipboard operation
LinearOperators.jl copied to clipboard

Add JLArrays, Metal and AMDGPU extensions and S kwarg tests

Open nHackel opened this issue 1 year ago • 7 comments

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.

  • [x] JLArrays + Tests
  • [x] Metal + Tests
  • [x] AMDGPU

nHackel avatar May 28 '24 10:05 nHackel

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

nHackel avatar May 29 '24 09:05 nHackel

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

github-actions[bot] avatar Jun 05 '24 13:06 github-actions[bot]

@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 avatar Jun 09 '24 09:06 tknopp

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?

tknopp avatar Jun 09 '24 12:06 tknopp

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

maleadt avatar Jun 10 '24 07:06 maleadt

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

nHackel avatar Jul 02 '24 16:07 nHackel

@nHackel I had to rebase your branch and did so in #351.

dpo avatar Oct 16 '24 22:10 dpo