Ginkgo.jl API
Ginkgo.GkoCsr Type
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
Ginkgo.GkoDense Type
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
Ginkgo.GkoExecutor Type
GkoExecutorExecutors 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
gko::Executorman page Ginkgo
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
Base.getindex Method
Base.getindex(mat::GkoDense{T}, m::Int, n::Int) where TObtain an element of the matrix, using Julia indexing
sourceBase.size Method
Base.size(mat::GkoCsr{Tv,Ti}) where {Tv,Ti}Returns the size of the sparse matrix/vector as a tuple
sourceBase.size Method
Base.size(mat::GkoDense{T}) where TReturns the size of the dense matrix/vector as a tuple
sourceGinkgo.create Method
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]
Ginkgo.elements Method
elements(mat::GkoDense{T}) where TGet number of stored elements of the matrix
sourceGinkgo.mtx_buffer_str Method
mtx_buffer_str(mat::GkoDense{T}) where TIntermediate 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.
Ginkgo.nnz Method
nnz(mat::GkoCsr{Tv,Ti}) where {Tv,Ti}Get number of stored elements of the matrix
sourceGinkgo.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_norm1man page Ginkgo
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_norm2man page Ginkgo
Ginkgo.number Function
number(val::Number, exec::GkoExecutor = EXECUTOR[])Initialize a 1x1 matrix representing a number with the provided value val
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 = α_A_b + β*x.
sourceGinkgo.srows Method
srows(mat::GkoCsr{Tv,Ti}) where {Tv,Ti}Returns the number of the srow stored elements (involved warps)
sourceGinkgo.version Method
version()Obtain the version information and the supported modules of the underlying Ginkgo library.
External links
gko::version_info::get()man page Ginkgo