Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump version of clang-format, its action and checkout #265

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ jobs:
clang-format:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: DoozyX/clang-format-lint-action@v0.11
with:
exclude: './thirdParty ./alpaka'
clangFormatVersion: 11
- uses: actions/checkout@v4
- uses: DoozyX/clang-format-lint-action@v0.18.2
with:
exclude: "./thirdParty ./alpaka"
clangFormatVersion: 18
23 changes: 14 additions & 9 deletions examples/mallocMC_example01.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<Dim, Idx>{Idx{1}, Idx{1}, Idx{1}};
alpaka::enqueue(
queue,
Expand All @@ -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<alpaka::Grid, alpaka::Threads>(acc)[0];

arA[id] = (int*) allocHandle.malloc(acc, length * sizeof(int));
Expand All @@ -145,7 +147,8 @@ auto main() -> int
{
auto sumsBufferAcc = alpaka::allocBuf<int, Idx>(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<alpaka::Grid, alpaka::Threads>(acc)[0];

sums[id] = 0;
Expand Down Expand Up @@ -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<alpaka::Grid, alpaka::Threads>(acc)[0];
allocHandle.free(acc, arA[id]);
allocHandle.free(acc, arB[id]);
Expand All @@ -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);
Expand Down
11 changes: 6 additions & 5 deletions src/include/mallocMC/creationPolicies/Scatter.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down Expand Up @@ -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);
};
Expand Down Expand Up @@ -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<alpaka::Grid, alpaka::Threads>(acc).sum();

const auto nWorker = alpaka::getWorkDiv<alpaka::Grid, alpaka::Threads>(acc).prod();
Expand Down
4 changes: 2 additions & 2 deletions src/include/mallocMC/oOMPolicies/BadAllocException.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
48 changes: 24 additions & 24 deletions tests/dimensions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,8 @@ void test1D()
queue,
alpaka::createTaskKernel<Acc>(
alpaka::WorkDivMembers<Dim, Idx>{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()));

Expand All @@ -101,7 +100,8 @@ void test1D()
queue,
alpaka::createTaskKernel<Acc>(
alpaka::WorkDivMembers<Dim, Idx>{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<alpaka::Grid, alpaka::Threads>(acc)[0];
deviceArray[i] = (int*) allocHandle.malloc(acc, sizeof(int));
},
Expand All @@ -117,7 +117,8 @@ void test1D()
queue,
alpaka::createTaskKernel<Acc>(
alpaka::WorkDivMembers<Dim, Idx>{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<alpaka::Grid, alpaka::Threads>(acc)[0];
allocHandle.free(acc, deviceArray[i]);
},
Expand All @@ -128,9 +129,8 @@ void test1D()
queue,
alpaka::createTaskKernel<Acc>(
alpaka::WorkDivMembers<Dim, Idx>{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()));
}

Expand Down Expand Up @@ -165,9 +165,8 @@ void test2D()
alpaka::Vec<Dim, Idx>::all(1),
alpaka::Vec<Dim, Idx>::all(1),
alpaka::Vec<Dim, Idx>::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()));

Expand All @@ -179,7 +178,8 @@ void test2D()
alpaka::Vec<Dim, Idx>::all(N),
alpaka::Vec<Dim, Idx>::all(N),
alpaka::Vec<Dim, Idx>::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<alpaka::Grid, alpaka::Threads>(acc);
deviceArray[idx[0] * dim * dim + idx[1]] = (int*) allocHandle.malloc(acc, sizeof(int));
},
Expand All @@ -199,7 +199,8 @@ void test2D()
alpaka::Vec<Dim, Idx>::all(N),
alpaka::Vec<Dim, Idx>::all(N),
alpaka::Vec<Dim, Idx>::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<alpaka::Grid, alpaka::Threads>(acc);
allocHandle.free(acc, deviceArray[idx[0] * dim * dim + idx[1]]);
},
Expand All @@ -214,9 +215,8 @@ void test2D()
alpaka::Vec<Dim, Idx>::all(1),
alpaka::Vec<Dim, Idx>::all(1),
alpaka::Vec<Dim, Idx>::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()));
}

Expand Down Expand Up @@ -251,9 +251,8 @@ void test3D()
alpaka::Vec<Dim, Idx>::all(1),
alpaka::Vec<Dim, Idx>::all(1),
alpaka::Vec<Dim, Idx>::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()));

Expand All @@ -266,7 +265,8 @@ void test3D()
alpaka::Vec<Dim, Idx>::all(N),
alpaka::Vec<Dim, Idx>::all(N),
alpaka::Vec<Dim, Idx>::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<alpaka::Grid, alpaka::Threads>(acc);
deviceArray[idx[0] * dim * dim * dim * dim + idx[1] * dim * dim + idx[0]]
= (int*) allocHandle.malloc(acc, sizeof(int));
Expand All @@ -288,7 +288,8 @@ void test3D()
alpaka::Vec<Dim, Idx>::all(N),
alpaka::Vec<Dim, Idx>::all(N),
alpaka::Vec<Dim, Idx>::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<alpaka::Grid, alpaka::Threads>(acc);
allocHandle.free(acc, deviceArray[idx[0] * dim * dim * dim * dim + idx[1] * dim * dim + idx[0]]);
},
Expand All @@ -303,9 +304,8 @@ void test3D()
alpaka::Vec<Dim, Idx>::all(1),
alpaka::Vec<Dim, Idx>::all(1),
alpaka::Vec<Dim, Idx>::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()));
}

Expand Down
3 changes: 2 additions & 1 deletion tests/policies.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,8 @@ void run()
queue,
alpaka::createTaskKernel<Acc>(
alpaka::WorkDivMembers<Dim, Idx>{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);
},
Expand Down