Skip to content

Commit

Permalink
Merge pull request #31 from JuliaGPU/ksh/fixup06
Browse files Browse the repository at this point in the history
Cleanup code for 0.5
  • Loading branch information
kshyatt authored May 25, 2017
2 parents a4fef4e + 3b56898 commit 66b699c
Show file tree
Hide file tree
Showing 28 changed files with 1,261 additions and 1,301 deletions.
1 change: 1 addition & 0 deletions REQUIRE
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
julia 0.5
CUDArt
Compat
3 changes: 2 additions & 1 deletion src/CUSPARSE.jl
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@ else
end

using CUDArt
using CUDArt.rt.cudaStream_t

typealias SparseChar Char
const SparseChar = Char
import Base.one
import Base.zero

Expand Down
54 changes: 28 additions & 26 deletions src/libcusparse_types.jl
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
using Compat

#enum cusparseStatus_t
#error messages from CUSPARSE

"""
Status messages from CUSPARSE's C API.
"""
typealias cusparseStatus_t UInt32
@compat const cusparseStatus_t = UInt32
const CUSPARSE_STATUS_SUCCESS = 0
const CUSPARSE_STATUS_NOT_INITIALIZED = 1
const CUSPARSE_STATUS_ALLOC_FAILED = 2
Expand All @@ -21,7 +23,7 @@ Perform operation on indices only (`CUSPARSE_ACTION_SYMBOLIC`) or
on both data and indices (`CUSPARSE_ACTION_NUMERIC`). Used in
conversion routines.
"""
typealias cusparseAction_t UInt32
@compat const cusparseAction_t = UInt32
const CUSPARSE_ACTION_SYMBOLIC = 0
const CUSPARSE_ACTION_NUMERIC = 1

Expand All @@ -30,7 +32,7 @@ const CUSPARSE_ACTION_NUMERIC = 1
Parse dense matrix by rows (`CUSPARSE_DIRECTION_ROW`) or columns
(`CUSPARSE_DIRECTION_COL`) to compute its number of non-zeros.
"""
typealias cusparseDirection_t UInt32
@compat const cusparseDirection_t = UInt32
const CUSPARSE_DIRECTION_ROW = 0
const CUSPARSE_DIRECTION_COL = 1

Expand All @@ -42,7 +44,7 @@ There are three choices:
* `CUSPARSE_HYB_PARTITION_USER` - set the partition manually in the conversion function.
* `CUSPARSE_HYB_PARTITION_MAX` - use the maximum partition, putting the matrix in ELL format.
"""
typealias cusparseHybPartition_t UInt32
@compat const cusparseHybPartition_t = UInt32
const CUSPARSE_HYB_PARTITION_AUTO = 0
const CUSPARSE_HYB_PARTITION_USER = 1
const CUSPARSE_HYB_PARTITION_MAX = 2
Expand All @@ -53,7 +55,7 @@ Determines if a symmetric/Hermitian/triangular matrix has its upper
(`CUSPARSE_FILL_MODE_UPPER`) or lower (`CUSPARSE_FILL_MODE_LOWER`)
triangle filled.
"""
typealias cusparseFillMode_t UInt32
@compat const cusparseFillMode_t = UInt32
const CUSPARSE_FILL_MODE_LOWER = 0
const CUSPARSE_FILL_MODE_UPPER = 1

Expand All @@ -62,7 +64,7 @@ const CUSPARSE_FILL_MODE_UPPER = 1
Determines if the diagonal of a matrix is all ones (`CUSPARSE_DIAG_TYPE_UNIT`)
or not all ones (`CUSPARSE_DIAG_TYPE_NON_UNIT`).
"""
typealias cusparseDiagType_t UInt32
@compat const cusparseDiagType_t = UInt32
const CUSPARSE_DIAG_TYPE_NON_UNIT = 0
const CUSPARSE_DIAG_TYPE_UNIT = 1

Expand All @@ -71,7 +73,7 @@ const CUSPARSE_DIAG_TYPE_UNIT = 1
Determines if scalar arguments to a function are present on the host CPU
(`CUSPARSE_POINTER_MODE_HOST`) or on the GPU (`CUSPARSE_POINTER_MODE_DEVICE`).
"""
typealias cusparsePointerMode_t UInt32
@compat const cusparsePointerMode_t = UInt32
const CUSPARSE_POINTER_MODE_HOST = 0
const CUSPARSE_POINTER_MODE_DEVICE = 1

Expand All @@ -82,7 +84,7 @@ or solve, on the matrix as-is (`CUSPARSE_OPERATION_NON_TRANSPOSE`), on the
matrix's transpose (`CUSPARSE_OPERATION_TRANSPOSE`), or on its conjugate
transpose (`CUSPARSE_OPERATION_CONJUGATE_TRANSPOSE`).
"""
typealias cusparseOperation_t UInt32
@compat const cusparseOperation_t = UInt32
const CUSPARSE_OPERATION_NON_TRANSPOSE = 0
const CUSPARSE_OPERATION_TRANSPOSE = 1
const CUSPARSE_OPERATION_CONJUGATE_TRANSPOSE = 2
Expand All @@ -96,7 +98,7 @@ symmetric (`CUSPARSE_MATRIX_TYPE_SYMMETRIC`), Hermitian
(those in [`CompressedSparse`](@ref)), this can be inferred for some function
calls.
"""
typealias cusparseMatrixType_t UInt32
@compat const cusparseMatrixType_t = UInt32
const CUSPARSE_MATRIX_TYPE_GENERAL = 0
const CUSPARSE_MATRIX_TYPE_SYMMETRIC = 1
const CUSPARSE_MATRIX_TYPE_HERMITIAN = 2
Expand All @@ -107,7 +109,7 @@ const CUSPARSE_MATRIX_TYPE_TRIANGULAR = 3
Indicates whether to keep level info in solvers (`CUSPARSE_SOLVE_POLICY_USE_LEVEL`)
or whether to not use it (`CUSPARSE_SOLVE_POLICY_NO_LEVEL`).
"""
typealias cusparseSolvePolicy_t UInt32
@compat const cusparseSolvePolicy_t = UInt32
const CUSPARSE_SOLVE_POLICY_NO_LEVEL = 0
const CUSPARSE_SOLVE_POLICY_USE_LEVEL = 1

Expand All @@ -118,7 +120,7 @@ or one-indexed (`CUSPARSE_INDEX_BASE_ONE`). CUSPARSE.jl supports both. Julia
sparse matrices are one-indexed, but you may wish to pass matrices from other
libraries which use zero-indexing (e.g. C language ODE solvers).
"""
typealias cusparseIndexBase_t UInt32
@compat const cusparseIndexBase_t = UInt32
const CUSPARSE_INDEX_BASE_ZERO = 0
const CUSPARSE_INDEX_BASE_ONE = 1

Expand Down Expand Up @@ -148,23 +150,23 @@ CUSPARSE will take. Generated by [`sv_analysis`](@ref) or
[`sm_analysis`](@ref) and passed to [`sv_solve!`](@ref), [`sm_solve`](@ref),
[`ic0!`](@ref), or [`ilu0!`](@ref).
"""
typealias cusparseSolveAnalysisInfo_t Ptr{Void}
typealias bsrsm2Info_t Ptr{Void}
typealias bsrsv2Info_t Ptr{Void}
typealias csrsv2Info_t Ptr{Void}
typealias csric02Info_t Ptr{Void}
typealias csrilu02Info_t Ptr{Void}
typealias bsric02Info_t Ptr{Void}
typealias bsrilu02Info_t Ptr{Void}
@compat const cusparseSolveAnalysisInfo_t = Ptr{Void}
@compat const bsrsm2Info_t = Ptr{Void}
@compat const bsrsv2Info_t = Ptr{Void}
@compat const csrsv2Info_t = Ptr{Void}
@compat const csric02Info_t = Ptr{Void}
@compat const csrilu02Info_t = Ptr{Void}
@compat const bsric02Info_t = Ptr{Void}
@compat const bsrilu02Info_t = Ptr{Void}

typealias cusparseContext Void
typealias cusparseHandle_t Ptr{cusparseContext}
@compat const cusparseContext = Void
@compat const cusparseHandle_t = Ptr{cusparseContext}

#complex numbers

typealias cuComplex Complex{Float32}
typealias cuDoubleComplex Complex{Float64}
@compat const cuComplex = Complex{Float32}
@compat const cuDoubleComplex = Complex{Float64}

typealias CusparseFloat Union{Float64,Float32,Complex128,Complex64}
typealias CusparseReal Union{Float64,Float32}
typealias CusparseComplex Union{Complex128,Complex64}
@compat const CusparseFloat = Union{Float64,Float32,Complex128,Complex64}
@compat const CusparseReal = Union{Float64,Float32}
@compat const CusparseComplex = Union{Complex128,Complex64}
Loading

0 comments on commit 66b699c

Please sign in to comment.