grain.cuda

CUDA wrapper module

Members

Aliases

CudaElementType
alias CudaElementType(M : CuPtr!T, T) = T
alias CudaElementType(M : CuArray!T, T) = T
alias CudaElementType(M : RefCounted!(CuPtr!T), T) = T
alias CudaElementType(M : RefCounted!(CuArray!T), T) = T

alias to element type of cuda storage

Classes

Global
class Global

global accessor for the cuda module in grain

Functions

axpy
void axpy(CuArray!T x, CuArray!T y, T alpha, int incx, int incy)

high-level axpy (y = alpha * x + y) wrapper for CuPtr

checkCUDNN
void checkCUDNN(cudnnStatus_t err)

cudnn error checker

checkCublasErrors
void checkCublasErrors(cublasStatus_t err)

cublas error checker

checkCudaErrors
void checkCudaErrors(CUresult err)

cuda error checker

copy
void copy(CuPtr!T src, CuPtr!T dst)

deep copy inter device memory without allocation

dup
auto dup(M m)

duplicate cuda memory (deep copy)

empty
bool empty(M m)

true if length == 0

fill_
ref fill_(S storage, V v, size_t N)

fill value for N elements from the first position TODO use cudnnSetTensor

fill_
ref fill_(S storage, V value)

fill value for all the element in device array

global
auto global()

global accessor for the cuda module in grain

sum
float sum(S a)

test sum

sumNaive
float sumNaive(S a)
Undocumented in source. Be warned that the author may not have intended to support it.
sum_thrust
float sum_thrust(float* , uint n)
Undocumented in source but is binding to C++. You might be able to learn more by searching the web for its name.
toHost
ref toHost(M m, T[] host)

copy device memory to host (maybe reallocate in host)

toHost
auto toHost(M m, T* host)

copy device memory to host (CAUTION: no reallocation here)

toHost
auto toHost(M m)

allocate host memory and copy device memory content

zero_
ref zero_(S storage)

fill zero for all the element in device array

zeros
auto zeros(size_t N)

create zero filled N elements array

Static variables

context
CUcontext context;
Undocumented in source.
cublasHandle
cublasHandle_t cublasHandle;
Undocumented in source.
cudnnHandle
cudnnHandle_t cudnnHandle;
Undocumented in source.

Structs

CuArray
struct CuArray(T)

sub-region on CuPtr!T

CuModule
struct CuModule

cuda module compiled from ptx string

CuPtr
struct CuPtr(T)

fat pointer in CUDA

Kernel
struct Kernel(alias F)

cuda function object called by mangled name of C++/D device function F

Launcher
struct Launcher(Args...)

cuda kernel function launcher with runtime numbers of blocks/threads

Variables

isDeviceMemory
enum bool isDeviceMemory(T);

trait to identify cuda storage

Meta