1#ifndef PSCF_HOST_SEND_ARRAY_CU_H
2#define PSCF_HOST_SEND_ARRAY_CU_H
11#include <util/containers/DArray.h>
12#include <pscf/backend/cuda/CUT.h>
92 template <
typename Data>
111 HostSendArray() =
default;
121 HostSendArray(HostSendArray<Data,CUT>
const & other) =
delete;
124 ~HostSendArray() =
default;
127 HostSendArray<Data,CUT>&
128 operator = (HostSendArray<Data,CUT>
const & other) =
delete;
188 using Array<Data>::operator [];
189 using Array<Data>::cArray;
190 using Array<Data>::isAllocated;
191 using Array<Data>::capacity;
192 using DArray<Data>::allocate;
193 using DArray<Data>::deallocate;
198 extern template class HostSendArray<cudaReal,CUT>;
199 extern template class HostSendArray<cudaComplex,CUT>;
203#include <pscf/backend/cuda/BackendArray.h>
204#include <pscf/backend/cuda/cudaErrorCheck.h>
206#include <cuda_runtime.h>
213 template <
typename Data>
214 HostSendArray<Data,CUT>::HostSendArray(
int capacity)
221 template <
typename Data>
242 cudaMemcpyDeviceToHost)
251 template <
typename Data>
264 other.cArray() + beginId,
266 cudaMemcpyDeviceToHost)
273 template <
typename Data>
274 void HostSendArray<Data,CUT>::associate(
278 const int n = deviceArray.capacity();
Backend identifier class for the GPU-enabled CUDA backend.
void copySlice(BackendArray< Data, CUT > const &other, int beginId)
Copy a slice of the data from a larger BackendArray into this array.
void associate(BackendArray< Data, CUT > &deviceArray)
Allocate if not allocated previously.
Data ValueType
Data type of each element.
void dissociate()
Release host array.
CUT BackendIdClass
Backend identifier class type.
Array container class template.
Data * data_
Pointer to an array of Data elements.
int capacity() const
Return allocated size.
bool isAllocated() const
Does this array have associated data?
Dynamically allocatable contiguous array template.
void allocate(int capacity)
Allocate the underlying C array.
DArray()
Default constructor.
File containing preprocessor macros for error handling.
#define UTIL_CHECK(condition)
Assertion macro suitable for serial or parallel production code.
PSCF package top-level namespace.