5#ifndef MUTUAL_INFORMATION_SHARED_MEMORY_CUARRAY_H
6#define MUTUAL_INFORMATION_SHARED_MEMORY_CUARRAY_H
11typedef int CuArrayError;
299 int NUMPY_ARRAY_DIM1,
334 int **NUMPY_ARRAY_DIM1,
335 int **NUMPY_ARRAY_DIM2
351 int **NUMPY_ARRAY_DIM1
399 CuArrayError
load(
const std::string &fname);
410 void save(
const std::string &fname);
467 int allocatedDevice_{};
468 int allocatedHost_{};
480 T &operator[](
int i)
const;
Manages CUDA-supported arrays, offering initialization, memory management, and data manipulation....
Definition cuarray.h:24
int m() const
Returns the number of rows in the CuArray.
void toNumpy(T **NUMPY_ARRAY, int **NUMPY_ARRAY_DIM1, int **NUMPY_ARRAY_DIM2)
Copies data from the CuArray to a NumPy array.
CuArrayError allocatedHost() const
Checks if memory is allocated for the host data.
CuArrayError toHost()
Copies data from the device to the host.
T get(int i, int j) const
Returns the value at a specified position in the CuArray.
CuArrayError init(T *host, int m, int n)
Initializes CuArray with specified host data and dimensions, performing a shallow copy....
CuArrayError allocateHost()
Allocates memory for the host data.
CuArrayError toDevice()
Copies data from the host to the device.
CuArrayError allocatedDevice() const
Checks if memory is allocated for the device data.
CuArrayError fromNumpy(T *NUMPY_ARRAY, int NUMPY_ARRAY_DIM1, int NUMPY_ARRAY_DIM2)
Copies data from a NumPy array to the CuArray.
int n() const
Returns the number of columns in the CuArray.
CuArrayError deallocateDevice()
Deallocates memory for the device data.
CuArrayError set(T value, int i, int j)
Sets a value at a specified position in the CuArray.
void save(const std::string &fname)
Saves CuArray data to a specified file.
CuArrayError allocateDevice()
Allocates memory for the device data.
T *& device()
Returns a reference to the device data.
CuArrayError fromCuArrayShallowCopy(CuArray< T > *cuArray, int start, int end, int m, int n)
Performs a shallow copy of data from another CuArray within a specified row range....
T *& host()
Returns a reference to the host data.
int owner() const
Returns the owner status of the CuArray. Indicates whether the CuArray is responsible for memory deal...
CuArrayError init(int m, int n)
Initializes CuArray with specified dimensions and allocates memory on host and device.
CuArrayError fromCuArrayDeepCopy(CuArray< T > *cuArray, int start, int end, int m, int n)
Performs a deep copy of data from another CuArray within a specified row range. Copies the host data ...
void toNumpy(T **NUMPY_ARRAY, int **NUMPY_ARRAY_DIM1)
Copies data from the CuArray to a NumPy array.
CuArrayError fromNumpy(T *NUMPY_ARRAY, int NUMPY_ARRAY_DIM1)
Copies data from a NumPy array to the CuArray.
CuArrayError load(const std::string &fname)
Loads CuArray data from a specified file.
~CuArray()
Destructor for CuArray. Deallocates memory on both the host and the device.
CuArray< T > * sort(int i)
Sorts CuArray based on the values in a specified row.
CuArrayError deallocateHost()
Deallocates memory for the host data.
int size() const
Returns the total number of elements in the CuArray.
CuArray< int > * argsort(int i)
Performs an argsort on a specified row of the CuArray. Returns a new CuArray containing sorted indice...
T & operator[](int i) const
Returns a reference to the element at a specified index in the CuArray.
CuArray()
Constructs an empty CuArray object.
size_t bytes() const
Returns the total size in bytes of the CuArray data.