diff --git a/examples/mallocMC_example01.cpp b/examples/mallocMC_example01.cpp index e544072a..f64c99b0 100644 --- a/examples/mallocMC_example01.cpp +++ b/examples/mallocMC_example01.cpp @@ -103,11 +103,12 @@ auto main() -> int // create arrays of arrays on the device { auto createArrayPointers - = [] ALPAKA_FN_ACC(const Acc& acc, int x, int y, ScatterAllocator::AllocatorHandle allocHandle) { - arA = (int**) allocHandle.malloc(acc, sizeof(int*) * x * y); - arB = (int**) allocHandle.malloc(acc, sizeof(int*) * x * y); - arC = (int**) allocHandle.malloc(acc, sizeof(int*) * x * y); - }; + = [] ALPAKA_FN_ACC(const Acc& acc, int x, int y, ScatterAllocator::AllocatorHandle allocHandle) + { + arA = (int**) allocHandle.malloc(acc, sizeof(int*) * x * y); + arB = (int**) allocHandle.malloc(acc, sizeof(int*) * x * y); + arC = (int**) allocHandle.malloc(acc, sizeof(int*) * x * y); + }; const auto workDiv = alpaka::WorkDivMembers{Idx{1}, Idx{1}, Idx{1}}; alpaka::enqueue( queue, @@ -121,7 +122,8 @@ auto main() -> int // fill 2 of them all with ascending values { - auto fillArrays = [] ALPAKA_FN_ACC(const Acc& acc, int length, ScatterAllocator::AllocatorHandle allocHandle) { + auto fillArrays = [] ALPAKA_FN_ACC(const Acc& acc, int length, ScatterAllocator::AllocatorHandle allocHandle) + { const auto id = alpaka::getIdx(acc)[0]; arA[id] = (int*) allocHandle.malloc(acc, length * sizeof(int)); @@ -145,7 +147,8 @@ auto main() -> int { auto sumsBufferAcc = alpaka::allocBuf(dev, Idx{block * grid}); - auto addArrays = [] ALPAKA_FN_ACC(const Acc& acc, int length, int* sums) { + auto addArrays = [] ALPAKA_FN_ACC(const Acc& acc, int length, int* sums) + { const auto id = alpaka::getIdx(acc)[0]; sums[id] = 0; @@ -184,7 +187,8 @@ auto main() -> int } { - auto freeArrays = [] ALPAKA_FN_ACC(const Acc& acc, ScatterAllocator::AllocatorHandle allocHandle) { + auto freeArrays = [] ALPAKA_FN_ACC(const Acc& acc, ScatterAllocator::AllocatorHandle allocHandle) + { const auto id = alpaka::getIdx(acc)[0]; allocHandle.free(acc, arA[id]); allocHandle.free(acc, arB[id]); @@ -195,7 +199,8 @@ auto main() -> int } { - auto freeArrayPointers = [] ALPAKA_FN_ACC(const Acc& acc, ScatterAllocator::AllocatorHandle allocHandle) { + auto freeArrayPointers = [] ALPAKA_FN_ACC(const Acc& acc, ScatterAllocator::AllocatorHandle allocHandle) + { allocHandle.free(acc, arA); allocHandle.free(acc, arB); allocHandle.free(acc, arC); diff --git a/src/include/mallocMC/creationPolicies/Scatter.hpp b/src/include/mallocMC/creationPolicies/Scatter.hpp index d1b362a4..feeb4d3e 100644 --- a/src/include/mallocMC/creationPolicies/Scatter.hpp +++ b/src/include/mallocMC/creationPolicies/Scatter.hpp @@ -600,9 +600,8 @@ namespace mallocMC 0u, minAllocation); // Check if the chunk size can be used even if the size is not an exact match. - auto const isChunkSizeInRange = [&](uint32_t currentChunkSize) { - return currentChunkSize >= bytes && currentChunkSize <= maxchunksize; - }; + auto const isChunkSizeInRange = [&](uint32_t currentChunkSize) + { return currentChunkSize >= bytes && currentChunkSize <= maxchunksize; }; uint32_t useChunkSize = 0u; if(beforeChunkSize == 0u) { @@ -1112,7 +1111,8 @@ namespace mallocMC const AlpakaAcc& m_acc, T_DeviceAllocator* m_heap, void* m_heapmem, - size_t m_memsize) { + size_t m_memsize) + { m_heap->pool = m_heapmem; m_heap->initDeviceFunction(m_acc, m_heapmem, m_memsize); }; @@ -1285,7 +1285,8 @@ namespace mallocMC const AlpakaAcc& acc, T_DeviceAllocator* heapPtr, size_t numBytes, - unsigned* slots) -> void { + unsigned* slots) -> void + { const auto gid = alpaka::getIdx(acc).sum(); const auto nWorker = alpaka::getWorkDiv(acc).prod(); diff --git a/src/include/mallocMC/oOMPolicies/BadAllocException.hpp b/src/include/mallocMC/oOMPolicies/BadAllocException.hpp index 9c28b84e..f3a3bb75 100644 --- a/src/include/mallocMC/oOMPolicies/BadAllocException.hpp +++ b/src/include/mallocMC/oOMPolicies/BadAllocException.hpp @@ -53,9 +53,9 @@ namespace mallocMC static auto handleOOM(void* mem) -> void* { #if BOOST_LANG_CUDA || BOOST_COMP_HIP -//#if __CUDA_ARCH__ < 350 +// #if __CUDA_ARCH__ < 350 # define PM_EXCEPTIONS_NOT_SUPPORTED_HERE -//#endif +// #endif #endif #ifdef PM_EXCEPTIONS_NOT_SUPPORTED_HERE diff --git a/tests/dimensions.cpp b/tests/dimensions.cpp index b8b02399..bd7e3343 100644 --- a/tests/dimensions.cpp +++ b/tests/dimensions.cpp @@ -90,9 +90,8 @@ void test1D() queue, alpaka::createTaskKernel( alpaka::WorkDivMembers{Idx{1}, Idx{1}, Idx{1}}, - [] ALPAKA_FN_ACC(const Acc& acc, int dim, typename ScatterAllocator::AllocatorHandle allocHandle) { - deviceArray = (int**) allocHandle.malloc(acc, sizeof(int*) * dim * dim); - }, + [] ALPAKA_FN_ACC(const Acc& acc, int dim, typename ScatterAllocator::AllocatorHandle allocHandle) + { deviceArray = (int**) allocHandle.malloc(acc, sizeof(int*) * dim * dim); }, N, scatterAlloc.getAllocatorHandle())); @@ -101,7 +100,8 @@ void test1D() queue, alpaka::createTaskKernel( alpaka::WorkDivMembers{Idx{N}, Idx{N}, Idx{1}}, - [] ALPAKA_FN_ACC(const Acc& acc, typename ScatterAllocator::AllocatorHandle allocHandle) { + [] ALPAKA_FN_ACC(const Acc& acc, typename ScatterAllocator::AllocatorHandle allocHandle) + { const auto i = alpaka::getIdx(acc)[0]; deviceArray[i] = (int*) allocHandle.malloc(acc, sizeof(int)); }, @@ -117,7 +117,8 @@ void test1D() queue, alpaka::createTaskKernel( alpaka::WorkDivMembers{Idx{N}, Idx{N}, Idx{1}}, - [] ALPAKA_FN_ACC(const Acc& acc, typename ScatterAllocator::AllocatorHandle allocHandle) { + [] ALPAKA_FN_ACC(const Acc& acc, typename ScatterAllocator::AllocatorHandle allocHandle) + { const auto i = alpaka::getIdx(acc)[0]; allocHandle.free(acc, deviceArray[i]); }, @@ -128,9 +129,8 @@ void test1D() queue, alpaka::createTaskKernel( alpaka::WorkDivMembers{Idx{1}, Idx{1}, Idx{1}}, - [] ALPAKA_FN_ACC(const Acc& acc, typename ScatterAllocator::AllocatorHandle allocHandle) { - allocHandle.free(acc, deviceArray); - }, + [] ALPAKA_FN_ACC(const Acc& acc, typename ScatterAllocator::AllocatorHandle allocHandle) + { allocHandle.free(acc, deviceArray); }, scatterAlloc.getAllocatorHandle())); } @@ -165,9 +165,8 @@ void test2D() alpaka::Vec::all(1), alpaka::Vec::all(1), alpaka::Vec::all(1)}, - [] ALPAKA_FN_ACC(const Acc& acc, int dim, typename ScatterAllocator::AllocatorHandle allocHandle) { - deviceArray = (int**) allocHandle.malloc(acc, sizeof(int*) * dim * dim * dim * dim); - }, + [] ALPAKA_FN_ACC(const Acc& acc, int dim, typename ScatterAllocator::AllocatorHandle allocHandle) + { deviceArray = (int**) allocHandle.malloc(acc, sizeof(int*) * dim * dim * dim * dim); }, N, scatterAlloc.getAllocatorHandle())); @@ -179,7 +178,8 @@ void test2D() alpaka::Vec::all(N), alpaka::Vec::all(N), alpaka::Vec::all(1)}, - [] ALPAKA_FN_ACC(const Acc& acc, int dim, typename ScatterAllocator::AllocatorHandle allocHandle) { + [] ALPAKA_FN_ACC(const Acc& acc, int dim, typename ScatterAllocator::AllocatorHandle allocHandle) + { const auto idx = alpaka::getIdx(acc); deviceArray[idx[0] * dim * dim + idx[1]] = (int*) allocHandle.malloc(acc, sizeof(int)); }, @@ -199,7 +199,8 @@ void test2D() alpaka::Vec::all(N), alpaka::Vec::all(N), alpaka::Vec::all(1)}, - [] ALPAKA_FN_ACC(const Acc& acc, int dim, typename ScatterAllocator::AllocatorHandle allocHandle) { + [] ALPAKA_FN_ACC(const Acc& acc, int dim, typename ScatterAllocator::AllocatorHandle allocHandle) + { const auto idx = alpaka::getIdx(acc); allocHandle.free(acc, deviceArray[idx[0] * dim * dim + idx[1]]); }, @@ -214,9 +215,8 @@ void test2D() alpaka::Vec::all(1), alpaka::Vec::all(1), alpaka::Vec::all(1)}, - [] ALPAKA_FN_ACC(const Acc& acc, typename ScatterAllocator::AllocatorHandle allocHandle) { - allocHandle.free(acc, deviceArray); - }, + [] ALPAKA_FN_ACC(const Acc& acc, typename ScatterAllocator::AllocatorHandle allocHandle) + { allocHandle.free(acc, deviceArray); }, scatterAlloc.getAllocatorHandle())); } @@ -251,9 +251,8 @@ void test3D() alpaka::Vec::all(1), alpaka::Vec::all(1), alpaka::Vec::all(1)}, - [] ALPAKA_FN_ACC(const Acc& acc, int dim, typename ScatterAllocator::AllocatorHandle allocHandle) { - deviceArray = (int**) allocHandle.malloc(acc, sizeof(int*) * dim * dim * dim * dim * dim * dim); - }, + [] ALPAKA_FN_ACC(const Acc& acc, int dim, typename ScatterAllocator::AllocatorHandle allocHandle) + { deviceArray = (int**) allocHandle.malloc(acc, sizeof(int*) * dim * dim * dim * dim * dim * dim); }, N, scatterAlloc.getAllocatorHandle())); @@ -266,7 +265,8 @@ void test3D() alpaka::Vec::all(N), alpaka::Vec::all(N), alpaka::Vec::all(1)}, - [] ALPAKA_FN_ACC(const Acc& acc, int dim, typename ScatterAllocator::AllocatorHandle allocHandle) { + [] ALPAKA_FN_ACC(const Acc& acc, int dim, typename ScatterAllocator::AllocatorHandle allocHandle) + { const auto idx = alpaka::getIdx(acc); deviceArray[idx[0] * dim * dim * dim * dim + idx[1] * dim * dim + idx[0]] = (int*) allocHandle.malloc(acc, sizeof(int)); @@ -288,7 +288,8 @@ void test3D() alpaka::Vec::all(N), alpaka::Vec::all(N), alpaka::Vec::all(1)}, - [] ALPAKA_FN_ACC(const Acc& acc, int dim, typename ScatterAllocator::AllocatorHandle allocHandle) { + [] ALPAKA_FN_ACC(const Acc& acc, int dim, typename ScatterAllocator::AllocatorHandle allocHandle) + { const auto idx = alpaka::getIdx(acc); allocHandle.free(acc, deviceArray[idx[0] * dim * dim * dim * dim + idx[1] * dim * dim + idx[0]]); }, @@ -303,9 +304,8 @@ void test3D() alpaka::Vec::all(1), alpaka::Vec::all(1), alpaka::Vec::all(1)}, - [] ALPAKA_FN_ACC(const Acc& acc, typename ScatterAllocator::AllocatorHandle allocHandle) { - allocHandle.free(acc, deviceArray); - }, + [] ALPAKA_FN_ACC(const Acc& acc, typename ScatterAllocator::AllocatorHandle allocHandle) + { allocHandle.free(acc, deviceArray); }, scatterAlloc.getAllocatorHandle())); } diff --git a/tests/policies.cpp b/tests/policies.cpp index b80abb17..cbb6f453 100644 --- a/tests/policies.cpp +++ b/tests/policies.cpp @@ -73,7 +73,8 @@ void run() queue, alpaka::createTaskKernel( alpaka::WorkDivMembers{Idx{1}, Idx{1}, Idx{1}}, - [] ALPAKA_FN_ACC(const Acc& acc, typename ScatterAllocator::AllocatorHandle allocHandle) { + [] ALPAKA_FN_ACC(const Acc& acc, typename ScatterAllocator::AllocatorHandle allocHandle) + { auto* ptr = allocHandle.malloc(acc, sizeof(int) * 1000); allocHandle.free(acc, ptr); },