Ginkgo.jl API

Ginkgo.GkoCsrType
GkoCsr{Tv, Ti} <: AbstractMatrix{Tv, Ti}

A type for representing sparse matrix and vectors in CSR format. Alias for gko_matrix_csr_eltype_indextype_st in C API. where eltype is one of the DataType[Float32] and indextype is one of the DataType[Int32]. For constructing a matrix, it is necessary to provide an GkoExecutor.

Examples

# Read matrix and vector from a mtx file
A = GkoCsr{Tv, Ti}("data/A.mtx", exec)

External links

  • gko::matrix::Csr<ValueType, IndexType> man page Ginkgo
source
Ginkgo.GkoDenseType
GkoDense{T} <: AbstractMatrix{T}

A type for representing dense matrix and vectors. Alias for gko_matrix_dense_eltype_st in C API. where eltype is one of the DataType[Float32, Float64]. For constructing a matrix, it is necessary to provide an GkoExecutor.

Examples

# Creating uninitialized vector of length 2, represented as a 2x1 dense matrix
julia> dim = (2,1); vec1 = GkoDense{Float32}(dim, exec)

# Passing a tuple
julia> vec2 = GkoDense{Float32}((2, 1), exec)

# Passing numbers
julia> vec3 = GkoDense{Float32}(2, 1, exec)

# Creating initialized dense vector or matrix via reading from a `.mtx` file
julia> b = GkoDense{Float32}("b.mtx", exec)

External links

  • gko::matrix::Dense<T> man page Ginkgo
source
Ginkgo.GkoExecutorType
GkoExecutor

Executors are used to specify the location for the data of linear algebra objects, and to determine where the operations will be executed. In Ginkgo.jl you can select one of the types out of - [:omp, :reference, :cuda]

Alternatively, you can also create an executor using the create method.

Examples

# Creating an OpenMP executor
julia> exec = GkoExecutor(:omp)

# Creating a reference (OpenMP) executor
julia> exec = GkoExecutor(:reference)

# Creating an CUDA executor to run on Nvidia GPUs
julia> exec = GkoExecutor(:cuda)

External links

source
Base.fill!Method
Base.fill!(mat::GkoDense{T}, val::G) where {T, G}

Fill the given matrix for all matrix elements with the provided value val

source
Base.getindexMethod
Base.getindex(mat::GkoDense{T}, m::Int, n::Int) where T

Obtain an element of the matrix, using Julia indexing

source
Base.sizeMethod
Base.size(mat::GkoCsr{Tv,Ti}) where {Tv,Ti}

Returns the size of the sparse matrix/vector as a tuple

source
Base.sizeMethod
Base.size(mat::GkoDense{T}) where T

Returns the size of the dense matrix/vector as a tuple

source
Ginkgo.createMethod
create(executor_type::Symbol)

Creation of the executor of a specified executor type.

Parameters

  • executor_type::Symbol: One of the executor types to create out of supported executor types [:omp, :reference, :cuda]
source
Ginkgo.elementsMethod
elements(mat::GkoDense{T}) where T

Get number of stored elements of the matrix

source
Ginkgo.mtx_buffer_strMethod
mtx_buffer_str(mat::GkoDense{T}) where T

Intermediate step that calls gko::write within C level wrapper. Allocates memory temporarily and returns a string pointer in C, then we utilize an IOBuffer to obtain a copy of the allocated cstring in Julia. In the end we deallocate the C string and return the buffered copy.

source
Ginkgo.nnzMethod
nnz(mat::GkoCsr{Tv,Ti}) where {Tv,Ti}

Get number of stored elements of the matrix

source
Ginkgo.norm1!Method
norm1!(from::GkoDense{T}, to::GkoDense{T})

Computes the column-wise Euclidian (L¹) norm of this matrix.

External links

  • void gko::matrix::Dense< ValueType >::compute_norm1 man page Ginkgo
source
Ginkgo.norm2!Method
norm2!(from::GkoDense{T}, to::GkoDense{T})

Computes the column-wise Euclidian (L²) norm of this matrix.

External links

  • void gko::matrix::Dense< ValueType >::compute_norm2 man page Ginkgo
source
Ginkgo.numberFunction
number(val::Number, exec::GkoExecutor = EXECUTOR[])

Initialize a 1x1 matrix representing a number with the provided value val

source
Ginkgo.spmm!Method
spmm!(A::GkoCsr{Tv, Ti}, α::Dense{Tv}, x::Dense{Tv}, β::Dense{Tv}, y::Dense{Tv}) where {Tv, Ti}

Applying to Dense matrices, computes an SpMM product. x = αAb + β*x.

source
Ginkgo.srowsMethod
srows(mat::GkoCsr{Tv,Ti}) where {Tv,Ti}

Returns the number of the srow stored elements (involved warps)

source
Ginkgo.versionMethod
version()

Obtain the version information and the supported modules of the underlying Ginkgo library.

External links

  • gko::version_info::get() man page Ginkgo
source