Ginkgo.jl API
Ginkgo.GkoCsr
— TypeGkoCsr{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
— TypeGkoDense{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
— TypeGkoExecutor
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
gko::Executor
man page Ginkgo
Base.fill!
— MethodBase.fill!(mat::GkoDense{T}, val::G) where {T, G}
Fill the given matrix for all matrix elements with the provided value val
Base.getindex
— MethodBase.getindex(mat::GkoDense{T}, m::Int, n::Int) where T
Obtain an element of the matrix, using Julia indexing
Base.size
— MethodBase.size(mat::GkoCsr{Tv,Ti}) where {Tv,Ti}
Returns the size of the sparse matrix/vector as a tuple
Base.size
— MethodBase.size(mat::GkoDense{T}) where T
Returns the size of the dense matrix/vector as a tuple
Ginkgo.create
— Methodcreate(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
— Methodelements(mat::GkoDense{T}) where T
Get number of stored elements of the matrix
Ginkgo.mtx_buffer_str
— Methodmtx_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.
Ginkgo.nnz
— Methodnnz(mat::GkoCsr{Tv,Ti}) where {Tv,Ti}
Get number of stored elements of the matrix
Ginkgo.norm1!
— Methodnorm1!(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
Ginkgo.norm2!
— Methodnorm2!(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
Ginkgo.number
— Functionnumber(val::Number, exec::GkoExecutor = EXECUTOR[])
Initialize a 1x1 matrix representing a number with the provided value val
Ginkgo.spmm!
— Methodspmm!(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.
Ginkgo.srows
— Methodsrows(mat::GkoCsr{Tv,Ti}) where {Tv,Ti}
Returns the number of the srow stored elements (involved warps)
Ginkgo.version
— Methodversion()
Obtain the version information and the supported modules of the underlying Ginkgo library.
External links
gko::version_info::get()
man page Ginkgo