thirdparty/cuda/api/memory.hpp
inline void* allocate(size_t size_in_bytes /* write me:, bool recognized_by_all_contexts */)
{
	void* allocated = nullptr;
	// Note: the typed cudaMallocHost also takes its size in bytes, apparently, not in number of elements
	auto result = cudaMallocHost(&allocated, size_in_bytes);
	if (is_success(result) && allocated == nullptr) {
		// Can this even happen? hopefully not
		result = cudaErrorUnknown;
	}
	cuda::throw_if_error(result, "Failed allocating " + std::to_string(size_in_bytes) + " bytes of host memory");
	return allocated;
}
/**
 * Allocate pinned host memory
 *
 * @note "Pinned" memory is excepted from virtual memory swapping-out,
 * and is allocated in contiguous physical RAM addresses, making it
 * possible to copy to and 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 or 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,
and is allocated in contiguous physical RAM addresses, making it
possible to copy to and 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 or 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 and is allocated in contiguous physical RAM addresses making it possible to copy to and 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 or 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
 @note "Pinned" memory is excepted from virtual memory swapping-out,
 and is allocated in contiguous physical RAM addresses, making it
 possible to copy to and from it to the the GPU using DMA without
 assistance from the GPU.
Allocate pinned host memory @note " Pinned " memory is excepted from virtual memory swapping - out and is allocated in contiguous physical RAM addresses making it possible to copy to and from it to the the GPU using DMA without assistance from the GPU .
/* 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