-
Notifications
You must be signed in to change notification settings - Fork 29
/
CUDArt.jl
64 lines (54 loc) · 1.67 KB
/
CUDArt.jl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
isdefined(Base, :__precompile__) && __precompile__()
module CUDArt
export
# pointer symbols
CudaPtr, rawpointer, CUDA_NULL,
# array symbols
AbstractCudaArray, AbstractCudaVector, AbstractCudaMatrix,
CudaArray, CudaVector, CudaMatrix, CudaVecOrMat,
CudaPitchedArray, HostArray, to_host,
# other symbols
device, devices, device_reset, attribute, capability,
driver_version, runtime_version,
CuModule, CuFunction, unload,
pitchel, pitchbytes,
launch, device_synchronize, synchronize,
Stream, null_stream, cudasleep,
destroy, free, cudafinalizer, wait_free
import Base: ==, -, +, getindex, setindex!
import Base: length, size, ndims, eltype, similar, pointer, stride,
copy, convert, reinterpret, show, summary,
copy!, get!, fill!, wait, unsafe_convert, vec
# Prepare the CUDA runtime API bindings
include("libcudart-6.5.jl")
import .CUDArt_gen
const rt = CUDArt_gen
# To load PTX code, we also need access to the driver API module utilities
@windows? (
begin
const libcuda = Libdl.find_library(["nvcuda"], [""])
end
: # linux or mac
begin
const libcuda = Libdl.find_library(["libcuda"], ["/usr/lib/", "/usr/local/cuda/lib"])
end)
if isempty(libcuda)
error("CUDA driver API library cannot be found")
end
include("version.jl")
include("types.jl")
include("module.jl")
include("device.jl")
include("stream.jl")
#include("event.jl")
include("pointer.jl")
include("arrays.jl")
include("execute.jl")
if isdefined(Base, :__precompile__)
include("precompile.jl")
_precompile_()
end
function __init__()
c_async_send_cudastream[] = cfunction(async_send_cudastream, Void, (rt.cudaStream_t, rt.cudaError_t, Ptr{Void}))
end
end