Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 38 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: CI
on:
push:
branches:
- master
pull_request:
jobs:
test:
name: Julia ${{ matrix.version }} - ${{ matrix.os }} - ${{ matrix.arch }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
version:
- '1'
os:
- ubuntu-latest
- macos-latest
arch:
- x64
exclude:
- os: macos-latest
arch: x64
include:
- os: macos-latest
arch: aarch64
version: '1'
- os: ubuntu-latest
arch: x64
version: 'pre'
steps:
- uses: actions/checkout@v4
- uses: julia-actions/setup-julia@v2
with:
version: ${{ matrix.version }}
- uses: julia-actions/cache@v2
- uses: julia-actions/julia-buildpkg@v1
- uses: julia-actions/julia-runtest@v1
13 changes: 0 additions & 13 deletions .travis.yml

This file was deleted.

21 changes: 7 additions & 14 deletions src/core/distmultivec.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
mutable struct DistMultiVec{T} <: ElementalMatrix{T}
obj::Ptr{Cvoid}
grid::Grid # keep the grid around to avoid that it's freed before the matrix
end

for (elty, ext) in ((:ElInt, :i),
Expand All @@ -16,24 +17,16 @@ for (elty, ext) in ((:ElInt, :i),
return nothing
end

function DistMultiVec(::Type{$elty}, cm::ElComm = MPI.CommWorld[])
function DistMultiVec(::Type{$elty}, grid::Grid = DefaultGrid[])
obj = Ref{Ptr{Cvoid}}(C_NULL)
ElError(ccall(($(string("ElDistMultiVecCreate_", ext)), libEl), Cuint,
(Ref{Ptr{Cvoid}}, ElComm),
obj, cm))
A = DistMultiVec{$elty}(obj[])
(Ref{Ptr{Cvoid}}, Ptr{Cvoid}),
obj, grid.obj))
A = DistMultiVec{$elty}(obj[], grid)
finalizer(destroy, A)
return A
end

function comm(A::DistMultiVec{$elty})
cm = Ref{ElComm}()
ElError(ccall(($(string("ElDistMultiVecComm_", ext)), libEl), Cuint,
(Ptr{Cvoid}, Ref{ElComm}),
A.obj, cm))
return cm[]
end

function get(x::DistMultiVec{$elty}, i::Integer = size(x, 1), j::Integer = 1)
v = Ref{$elty}()
ElError(ccall(($(string("ElDistMultiVecGet_", ext)), libEl), Cuint,
Expand Down Expand Up @@ -117,8 +110,8 @@ end

getindex(x::DistMultiVec, i, j) = get(x, i, j)

function similar(::DistMultiVec, ::Type{T}, sz::Dims, cm::ElComm = MPI.CommWorld[]) where {T}
A = DistMultiVec(T, cm)
function similar(::DistMultiVec, ::Type{T}, sz::Dims, grid::Grid = DefaultGrid[]) where {T}
A = DistMultiVec(T, grid)
resize!(A, sz...)
return A
end
Expand Down
21 changes: 7 additions & 14 deletions src/core/distsparsematrix.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
mutable struct DistSparseMatrix{T} <: ElementalMatrix{T}
obj::Ptr{Cvoid}
grid::Grid # keep the grid around to avoid that it's freed before the matrix
end

for (elty, ext) in ((:ElInt, :i),
Expand All @@ -16,24 +17,16 @@ for (elty, ext) in ((:ElInt, :i),
return nothing
end

function DistSparseMatrix(::Type{$elty}, comm::ElComm = MPI.CommWorld[])
function DistSparseMatrix(::Type{$elty}, grid::Grid = DefaultGrid[])
obj = Ref{Ptr{Cvoid}}(C_NULL)
ElError(ccall(($(string("ElDistSparseMatrixCreate_", ext)), libEl), Cuint,
(Ref{Ptr{Cvoid}}, ElComm),
obj, comm))
A = DistSparseMatrix{$elty}(obj[])
(Ref{Ptr{Cvoid}}, Ptr{Cvoid}),
obj, grid.obj))
A = DistSparseMatrix{$elty}(obj[], grid)
finalizer(destroy, A)
return A
end

function comm(A::DistSparseMatrix{$elty})
cm = Ref{ElComm}()
ElError(ccall(($(string("ElDistSparseMatrixComm_", ext)), libEl), Cuint,
(Ptr{Cvoid}, Ref{ElComm}),
A.obj, cm))
return cm[]
end

function globalRow(A::DistSparseMatrix{$elty}, iLoc::Integer)
i = Ref{ElInt}(0)
ElError(ccall(($(string("ElDistSparseMatrixGlobalRow_", ext)), libEl), Cuint,
Expand Down Expand Up @@ -112,8 +105,8 @@ for (elty, ext) in ((:ElInt, :i),
end

# The other constructors don't have a version with dimensions. Should they, or should this one go?
function DistSparseMatrix(::Type{T}, m::Integer, n::Integer, comm::ElComm = MPI.CommWorld[]) where {T}
A = DistSparseMatrix(T, comm)
function DistSparseMatrix(::Type{T}, m::Integer, n::Integer, grid::Grid = DefaultGrid[]) where {T}
A = DistSparseMatrix(T, grid)
resize!(A, m, n)
return A
end
Expand Down
6 changes: 3 additions & 3 deletions src/lapack_like/euclidean_min.jl
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ function leastSquares(A::DistMatrix{T}, B::DistMatrix{T};
end
function leastSquares(A::DistSparseMatrix{T}, B::DistMultiVec{T};
orientation::Orientation = NORMAL) where {T}
X = DistMultiVec(T, comm(A))
X = DistMultiVec(T, A.grid)
return leastSquares!(A, B, X, orientation = orientation)
end

Expand All @@ -49,7 +49,7 @@ function bpdn(A::DistMatrix{T}, B::DistMatrix{T}, lambda::T) where {T}
return bpdn!(A, B, lambda, X)
end
function bpdn(A::DistSparseMatrix{T}, B::DistMultiVec{T}, lambda) where {T}
X = DistMultiVec(T, comm(A))
X = DistMultiVec(T, A.grid)
return bpdn!(A, B, lambda, X)
end

Expand Down Expand Up @@ -78,6 +78,6 @@ function ridge(A::DistMatrix{T}, B::DistMatrix{T}, gamma::T; ka...) where {T}
return ridge!(A, B, gamma, X; ka...)
end
function ridge(A::DistSparseMatrix{T}, B::DistMultiVec{T}, gamma::T; ka...) where {T}
X = DistMultiVec(T, comm(A))
X = DistMultiVec(T, A.grid)
return ridge!(A, B, gamma, X; ka...)
end
4 changes: 2 additions & 2 deletions src/optimization/models.jl
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,11 @@ function lav(A::DistMatrix{T}, b::DistMatrix{T}) where {T<:Union{Float32,Float64
return lav!(A, b, x)
end
function lav(A::DistSparseMatrix{T}, b::DistMultiVec{T}) where {T<:Union{Float32,Float64}}
x = DistMultiVec(T, comm(A))
x = DistMultiVec(T, A.grid)
return lav!(A, b, x)
end

function lav(A::DistSparseMatrix{T}, b::DistMultiVec{T}, ctrl::LPAffineCtrl{T}) where {T<:Union{Float32,Float64}}
x = DistMultiVec(T, comm(A))
x = DistMultiVec(T, A.grid)
return lav!(A, b, x, ctrl)
end
Loading