From ab7824087b1f8e8257edd89daeafda62b34eb409 Mon Sep 17 00:00:00 2001 From: Bernhard Manfred Gruber Date: Fri, 2 Feb 2024 01:17:16 +0100 Subject: [PATCH] Facilitate switching babelstream to size_t when necessary --- examples/alpaka/babelstream/AlpakaStream.cpp | 18 +++++++++--------- examples/alpaka/babelstream/AlpakaStream.h | 2 +- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/examples/alpaka/babelstream/AlpakaStream.cpp b/examples/alpaka/babelstream/AlpakaStream.cpp index 2452c2a502..cb7046ffaa 100644 --- a/examples/alpaka/babelstream/AlpakaStream.cpp +++ b/examples/alpaka/babelstream/AlpakaStream.cpp @@ -13,8 +13,8 @@ namespace { - constexpr auto blockSize = 1024; - constexpr auto dotBlockSize = 256; + constexpr auto blockSize = Idx{1024}; + constexpr auto dotBlockSize = Idx{256}; struct StreamingAccessor { @@ -87,7 +87,7 @@ struct InitKernel template void AlpakaStream::init_arrays(T initA, T initB, T initC) { - auto const workdiv = WorkDiv{arraySize / blockSize, blockSize, 1}; + auto const workdiv = WorkDiv{arraySize / blockSize, blockSize, Idx{1}}; // auto const workdiv = alpaka::getValidWorkDiv(devAcc, arraySize); alpaka::exec( queue, @@ -123,7 +123,7 @@ struct CopyKernel template void AlpakaStream::copy() { - auto const workdiv = WorkDiv{arraySize / blockSize, blockSize, 1}; + auto const workdiv = WorkDiv{arraySize / blockSize, blockSize, Idx{1}}; // auto const workdiv = alpaka::getValidWorkDiv(devAcc, arraySize); auto viewA = llama::View{mapping, llama::Array{reinterpret_cast(alpaka::getPtrNative(d_a))}, Accessor{}}; @@ -147,7 +147,7 @@ struct MulKernel template void AlpakaStream::mul() { - auto const workdiv = WorkDiv{arraySize / blockSize, blockSize, 1}; + auto const workdiv = WorkDiv{arraySize / blockSize, blockSize, Idx{1}}; // auto const workdiv = alpaka::getValidWorkDiv(devAcc, arraySize); auto viewB = llama::View{mapping, llama::Array{reinterpret_cast(alpaka::getPtrNative(d_b))}, Accessor{}}; @@ -170,7 +170,7 @@ struct AddKernel template void AlpakaStream::add() { - auto const workdiv = WorkDiv{arraySize / blockSize, blockSize, 1}; + auto const workdiv = WorkDiv{arraySize / blockSize, blockSize, Idx{1}}; // auto const workdiv = alpaka::getValidWorkDiv(devAcc, arraySize); auto viewA = llama::View{mapping, llama::Array{reinterpret_cast(alpaka::getPtrNative(d_a))}, Accessor{}}; @@ -196,7 +196,7 @@ struct TriadKernel template void AlpakaStream::triad() { - auto const workdiv = WorkDiv{arraySize / blockSize, blockSize, 1}; + auto const workdiv = WorkDiv{arraySize / blockSize, blockSize, Idx{1}}; // auto const workdiv = alpaka::getValidWorkDiv(devAcc, arraySize); auto viewA = llama::View{mapping, llama::Array{reinterpret_cast(alpaka::getPtrNative(d_a))}, Accessor{}}; @@ -222,7 +222,7 @@ struct NstreamKernel template void AlpakaStream::nstream() { - auto const workdiv = WorkDiv{arraySize / blockSize, blockSize, 1}; + auto const workdiv = WorkDiv{arraySize / blockSize, blockSize, Idx{1}}; // auto const workdiv = alpaka::getValidWorkDiv(devAcc, arraySize); auto viewA = llama::View{mapping, llama::Array{reinterpret_cast(alpaka::getPtrNative(d_a))}, Accessor{}}; @@ -270,7 +270,7 @@ struct DotKernel template auto AlpakaStream::dot() -> T { - auto const workdiv = WorkDiv{dotBlockSize, blockSize, 1}; + auto const workdiv = WorkDiv{dotBlockSize, blockSize, Idx{1}}; // auto const workdiv = alpaka::getValidWorkDiv(devAcc, dotBlockSize * blockSize); auto viewA = llama::View{mapping, llama::Array{reinterpret_cast(alpaka::getPtrNative(d_a))}, Accessor{}}; diff --git a/examples/alpaka/babelstream/AlpakaStream.h b/examples/alpaka/babelstream/AlpakaStream.h index d07ac6541b..0c35894961 100644 --- a/examples/alpaka/babelstream/AlpakaStream.h +++ b/examples/alpaka/babelstream/AlpakaStream.h @@ -20,7 +20,7 @@ inline constexpr auto IMPLEMENTATION_STRING = "alpaka/LLAMA"; using Dim = alpaka::DimInt<1>; -using Idx = int; +using Idx = int; // use size_t for large problem sizes using Vec = alpaka::Vec; using Acc = alpaka::ExampleDefaultAcc;