I have the following code that I can run on Julia v.1.1:
using LinearAlgebra
L=Symmetric(rand(Float32,10000,10000))
C=zeros(Float32,size(L,1),size(L,2))
D=zeros(Float32,size(L,1),size(L,2))
D[1,1]=1
k=750
function Lapprox!(C::Array{Float32,2},D::Array{Float32,2},i)
m=min((i-1),k)
N=Int32.(partialsortperm(L[i,1:(i-1)],1:m,rev=true))
C[i,N]=L[N,N]\L[N,i]
D[i,i]=L[i,i] - transpose(L[i,N])*C[i,N]
end
for i=2:size(C,1) Lapprox!(C,D,i) end
I want to take advantage of GPU programming, but I am starting with this type of programming… So far, I tried the following code:
using LinearAlgebra
using CuArrays
using CUDAnative
L=cu(Symmetric(rand(10000,10000)))
C=CuArray{Float32}(undef, size(L,1),size(L,2))
D=CuArray{Float32}(undef, size(L,1),size(L,2))
D[1,1]=1
k=750
function Lapprox!(C,D,i)
m=min((i-1),k)
N=Int32.(partialsortperm(L[i,1:(i-1)],1:m,rev=true))
C[i,N]=L[N,N]\L[N,i]
D[i,i]=L[i,i] - transpose(L[i,N])*C[i,N]
end
@cuda for i=2:size(C,1) Lapprox!(C,D,i) end
but it doesn’t work… Can anyone give me some insights for the function Lapprox!
and @cuda
macro line, please? Thank you!