cuda.Vector

Module Contents

class cuda.Vector.Vector(shape=1, source=None, dtype='float64', **kwds)

cuda vector (a python wrapper for c/c++ cuda_vector) typedef struct {

size_t size; // length char *data; // pointer to gpu memory size_t nbytes; // total bytes int dtype; // use numpy type_num

} cuda_vector;

data
copy_to_host(self, target=None, type='gsl')

copy cuda vector to host (gsl or numpy)vector gsl.vector is double precison only numpy.ndarray can be any type

copy_from_host(self, source)

copy from a host (gsl or numpy) vector

copy(self, other)

copy data from another vector

clone(self)

clone to a new vector

zero(self)

initialize all elements to 0

fill(self, value)

set all elements to a given value

print(self)

print elements by converting to numpy ndarray

sum(self)

summation

amin(self)

minimum value

amax(self)

maximum value

mean(self)

mean value

std(self, mean=None, ddof=1)

standard deviation :param mean: mean value :param ddof: delta degrees of freedom, or the dividing factor(n-ddof)

free(self)

force releasing gpu memory :return:

bcast(self, communicator=None, source=0)

Broadcast the given {vector} from {source} to all tasks in {communicator}

__len__(self)
__iadd__(self, other)

In-place addition with the elements of {other}

__isub__(self, other)

In-place subtraction with the elements of {other}

__imul__(self, other)

In-place scale with a factor {other}

__getitem__(self, index)

Get the value of v[index] :param index: index of the vector :return: float value (in cpu)