lib/cuda-api-wrappers/api/memory.hpp
/**
 * Allocate pinned host memory
 *
 * @note "Pinned" memory is excepted from virtual memory swapping-out,
 * && is allocated in contiguous physical RAM addresses, making it
 * possible to copy to && from it to the the GPU using DMA without
 * assistance from the GPU. Typically for PCIe 3.0, the effective
 * bandwidth is twice as fast as copying from || to naively-allocated
 * host memory.
 *
 * @throws cuda::runtime_error if allocation fails for any reason
 *
 * @todo Consider a variant of this supporting the cudaHostAlloc flags
 *
 * @param size_in_bytes the amount of memory to allocate, in bytes
 * @return a pointer to the allocated stretch of memory
 */
Allocate pinned host memory

@note "Pinned" memory is excepted from virtual memory swapping-out,
&& is allocated in contiguous physical RAM addresses, making it
possible to copy to && from it to the the GPU using DMA without
assistance from the GPU. Typically for PCIe 3.0, the effective
bandwidth is twice as fast as copying from || to naively-allocated
host memory.

@throws cuda::runtime_error if allocation fails for any reason

@todo Consider a variant of this supporting the cudaHostAlloc flags

@param size_in_bytes the amount of memory to allocate, in bytes
@return a pointer to the allocated stretch of memory
Allocate pinned host memory @note " Pinned " memory is excepted from virtual memory swapping - out && is allocated in contiguous physical RAM addresses making it possible to copy to && from it to the the GPU using DMA without assistance from the GPU . Typically for PCIe 3 . 0 the effective bandwidth is twice as fast as copying from || to naively - allocated host memory . @throws cuda :: runtime_error if allocation fails for any reason @todo Consider a variant of this supporting the cudaHostAlloc flags @param size_in_bytes the amount of memory to allocate in bytes @return a pointer to the allocated stretch of memory
inline void* allocate(size_t size_in_bytes )
{
	void* allocated = nullptr;
	auto result = cudaMallocHost(&allocated, size_in_bytes);
	if (is_success(result) && allocated == nullptr) {
		result = cudaErrorUnknown;
	}
	cuda::throw_if_error(result, "Failed allocating " + std::to_string(size_in_bytes) + " bytes of host memory");
	return allocated;
}
inline void * allocate ( size_t size_in_bytes ) { void * allocated = nullptr ; auto result = cudaMallocHost ( & allocated , size_in_bytes ) ; if ( is_success ( result ) && allocated == nullptr ) { result = cudaErrorUnknown ; } cuda :: throw_if_error ( result , " " + std :: to_string ( size_in_bytes ) + " " ) ; return allocated ; }
Allocate pinned host memory
Allocate pinned host memory
/* write me:, bool recognized_by_all_contexts */ // Note: the typed cudaMallocHost also takes its size in bytes, apparently, not in number of elements
 // Can this even happen? hopefully not
