* \brief Allocates size-number of bytes on the host system. * This memory must be freed with freeHost(void*). * * Note that allocate zero bytes is perfectly fine. * That is also the only case in which this function might * return NULL. * Otherwise, always a valid pointer must be returned * or an exception is thrown. * * \param size the number of bytes to allocate * \return t
| 243 | * \return the adress of the new host memory |
| 244 | */ |
| 245 | void* mallocHost(size_t size) |
| 246 | { |
| 247 | CUMAT_PROFILING_INC(HostMemAlloc); |
| 248 | //TODO: add a plugin-mechanism for custom allocators |
| 249 | if (size == 0) return nullptr; |
| 250 | #if CUMAT_CONTEXT_DEBUG_MEMORY==1 |
| 251 | allocationsHost_++; |
| 252 | #endif |
| 253 | void* memory; |
| 254 | CUMAT_SAFE_CALL(cudaMallocHost(&memory, size)); |
| 255 | return memory; |
| 256 | } |
| 257 | |
| 258 | /** |
| 259 | * \brief Allocates size-number of bytes on the device system. |
nothing calls this directly
no outgoing calls
no test coverage detected