MCPcopy Create free account
hub / github.com/QuEST-Kit/QuEST / cpu_deallocNumaArray

Function cpu_deallocNumaArray

quest/src/cpu/cpu_config.cpp:264–291  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

262
263
264void cpu_deallocNumaArray(qcomp* arr, qindex length) {
265
266 // musn't pass nullptr to munmap() below
267 if (arr == nullptr)
268 return;
269
270#if ! NUMA_AWARE
271 cpu_deallocArray(arr);
272
273#elif defined(_WIN32)
274 error_numaAllocOrDeallocAttemptedOnWindows();
275
276#else
277 qindex arrSize = length * sizeof(qcomp);
278 long pageSize = cpu_getPageSize();
279
280 // sub-page arrays were allocated with calloc()
281 if (arrSize <= pageSize)
282 return cpu_deallocArray(arr);
283
284 qindex numPages = getNumPagesToContainArray(pageSize, arrSize);
285 qindex numBytes = numPages * pageSize; // gauranteed no overflow
286 int success = munmap(arr, numBytes);
287
288 if (success == -1)
289 error_numaUnmappingFailed();
290#endif
291}
292
293
294qcomp** cpu_allocAndInitMatrixWrapper(qcomp* arr, qindex dim) {

Callers 1

destroyQuregFunction · 0.85

Calls 5

cpu_deallocArrayFunction · 0.85
cpu_getPageSizeFunction · 0.85

Tested by

no test coverage detected