Returns a host pointer to the data. More...

template<typename T >
T * host () const
 Returns the data to device pointer of type T. More...
 
void host (void *ptr) const
 Copy device data to host-side pointer. More...
 

Detailed Description

Returns a host pointer to the data.

Host-side pointer to matrix data. Data stored in column-major (Fortran) order. Call array::free() when done to allow garbage collection. Modification of this data has no effect on device copy.

Function Documentation

T* host ( ) const

Returns the data to device pointer of type T.

Host-side pointer to matrix data. Data stored in column-major (Fortran) order. Call array::free() when done to allow garbage collection. Modification of this data has no effect on device copy.

array A = randu(5);
float *h_A = A.host<float>();
float firstval = h_A[1]; // grab second value
array::free(h_A); // finished
Returns
A pointer to the data on the host
See Also
scalar(), device()
Examples:
examples/helloworld/helloworld.cpp, and examples/multi_device/gemv.cpp.
void host ( void *  ptr) const

Copy device data to host-side pointer.

Data stored in column-major (Fortran) order. Assumes allocation is sufficient.

array A = randu(5);
float *h_A = malloc(5*sizeof(*h_A));
A.host(h_A);
See Also
scalar(), device()