forked from JuliaGPU/CuArrays.jl
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
choose method using is_strided_cu(A)
- Loading branch information
Michael Abbott
committed
Apr 1, 2020
1 parent
20851f2
commit 9348904
Showing
4 changed files
with
274 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
module CuArrays | ||
|
||
using CUDAapi, CUDAdrv, CUDAnative | ||
|
||
using GPUArrays | ||
|
||
export CuArray, CuVector, CuMatrix, CuVecOrMat, cu | ||
export CUBLAS, CUSPARSE, CUSOLVER, CUFFT, CURAND, CUDNN, CUTENSOR | ||
|
||
import LinearAlgebra | ||
|
||
using Adapt | ||
|
||
using Libdl | ||
|
||
using Requires | ||
|
||
|
||
## source code includes | ||
|
||
include("bindeps.jl") | ||
|
||
# core array functionality | ||
include("memory.jl") | ||
include("array.jl") | ||
include("gpuarrays.jl") | ||
include("subarray.jl") | ||
include("utils.jl") | ||
|
||
# integrations and specialized functionality | ||
include("indexing.jl") | ||
include("broadcast.jl") | ||
include("mapreduce.jl") | ||
include("accumulate.jl") | ||
include("linalg.jl") | ||
|
||
# vendor libraries | ||
include("blas/CUBLAS.jl") | ||
include("sparse/CUSPARSE.jl") | ||
include("solver/CUSOLVER.jl") | ||
include("fft/CUFFT.jl") | ||
include("rand/CURAND.jl") | ||
include("dnn/CUDNN.jl") | ||
include("tensor/CUTENSOR.jl") | ||
|
||
include("deprecated.jl") | ||
|
||
include("nnlib.jl") | ||
|
||
## initialization | ||
|
||
const __initialized__ = Ref(false) | ||
functional() = __initialized__[] | ||
|
||
export has_cudnn, has_cutensor | ||
has_cudnn() = Libdl.dlopen_e(CUDNN.libcudnn[]) !== C_NULL | ||
has_cutensor() = Libdl.dlopen_e(CUTENSOR.libcutensor[]) !== C_NULL | ||
|
||
function __init__() | ||
precompiling = ccall(:jl_generating_output, Cint, ()) != 0 | ||
silent = parse(Bool, get(ENV, "JULIA_CUDA_SILENT", "false")) || precompiling | ||
verbose = parse(Bool, get(ENV, "JULIA_CUDA_VERBOSE", "false")) | ||
|
||
# if any dependent GPU package failed, expect it to have logged an error and bail out | ||
if !CUDAdrv.functional() || !CUDAnative.functional() | ||
verbose && @warn "CuArrays.jl did not initialize because CUDAdrv.jl or CUDAnative.jl failed to" | ||
return | ||
end | ||
|
||
try | ||
__init_bindeps__(silent=silent, verbose=verbose) | ||
|
||
# package integrations | ||
@require ForwardDiff="f6369f11-7733-5829-9624-2563aa707210" include("forwarddiff.jl") | ||
|
||
__init_memory__() | ||
|
||
__initialized__[] = true | ||
catch ex | ||
# don't actually fail to keep the package loadable | ||
if !silent | ||
if verbose | ||
@error "CuArrays.jl failed to initialize" exception=(ex, catch_backtrace()) | ||
else | ||
@info "CuArrays.jl failed to initialize and will be unavailable (set JULIA_CUDA_SILENT or JULIA_CUDA_VERBOSE to silence or expand this message)" | ||
end | ||
end | ||
end | ||
end | ||
|
||
end # module |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
module CuArrays | ||
|
||
using CUDAapi, CUDAdrv, CUDAnative | ||
|
||
using GPUArrays | ||
|
||
export CuArray, CuVector, CuMatrix, CuVecOrMat, cu | ||
export CUBLAS, CUSPARSE, CUSOLVER, CUFFT, CURAND, CUDNN, CUTENSOR | ||
|
||
import LinearAlgebra | ||
|
||
using Adapt | ||
|
||
using Libdl | ||
|
||
using Requires | ||
|
||
|
||
## source code includes | ||
|
||
include("bindeps.jl") | ||
|
||
# core array functionality | ||
include("memory.jl") | ||
include("array.jl") | ||
include("gpuarrays.jl") | ||
include("subarray.jl") | ||
include("utils.jl") | ||
|
||
# integrations and specialized functionality | ||
include("indexing.jl") | ||
include("broadcast.jl") | ||
include("mapreduce.jl") | ||
include("accumulate.jl") | ||
include("linalg.jl") | ||
|
||
# vendor libraries | ||
include("blas/CUBLAS.jl") | ||
include("sparse/CUSPARSE.jl") | ||
include("solver/CUSOLVER.jl") | ||
include("fft/CUFFT.jl") | ||
include("rand/CURAND.jl") | ||
include("dnn/CUDNN.jl") | ||
include("tensor/CUTENSOR.jl") | ||
|
||
include("deprecated.jl") | ||
|
||
include("nnlib.jl") | ||
|
||
## initialization | ||
|
||
const __initialized__ = Ref(false) | ||
functional() = __initialized__[] | ||
|
||
export has_cudnn, has_cutensor | ||
has_cudnn() = Libdl.dlopen_e(CUDNN.libcudnn[]) !== C_NULL | ||
has_cutensor() = Libdl.dlopen_e(CUTENSOR.libcutensor[]) !== C_NULL | ||
|
||
function __init__() | ||
precompiling = ccall(:jl_generating_output, Cint, ()) != 0 | ||
silent = parse(Bool, get(ENV, "JULIA_CUDA_SILENT", "false")) || precompiling | ||
verbose = parse(Bool, get(ENV, "JULIA_CUDA_VERBOSE", "false")) | ||
|
||
# if any dependent GPU package failed, expect it to have logged an error and bail out | ||
if !CUDAdrv.functional() || !CUDAnative.functional() | ||
verbose && @warn "CuArrays.jl did not initialize because CUDAdrv.jl or CUDAnative.jl failed to" | ||
return | ||
end | ||
|
||
try | ||
__init_bindeps__(silent=silent, verbose=verbose) | ||
|
||
# package integrations | ||
@require ForwardDiff="f6369f11-7733-5829-9624-2563aa707210" include("forwarddiff.jl") | ||
|
||
__init_memory__() | ||
|
||
__initialized__[] = true | ||
catch ex | ||
# don't actually fail to keep the package loadable | ||
if !silent | ||
if verbose | ||
@error "CuArrays.jl failed to initialize" exception=(ex, catch_backtrace()) | ||
else | ||
@info "CuArrays.jl failed to initialize and will be unavailable (set JULIA_CUDA_SILENT or JULIA_CUDA_VERBOSE to silence or expand this message)" | ||
end | ||
end | ||
end | ||
end | ||
|
||
end # module |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters