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

[merge after thesis] Facilitate switching babelstream to size_t when necessary #841

Draft
wants to merge 1 commit into
base: develop
Choose a base branch
from
Draft
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
18 changes: 9 additions & 9 deletions examples/alpaka/babelstream/AlpakaStream.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down Expand Up @@ -87,7 +87,7 @@ struct InitKernel
template<typename T>
void AlpakaStream<T>::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<Acc>(
queue,
Expand Down Expand Up @@ -123,7 +123,7 @@ struct CopyKernel
template<typename T>
void AlpakaStream<T>::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<std::byte*>(alpaka::getPtrNative(d_a))}, Accessor{}};
Expand All @@ -147,7 +147,7 @@ struct MulKernel
template<typename T>
void AlpakaStream<T>::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<std::byte*>(alpaka::getPtrNative(d_b))}, Accessor{}};
Expand All @@ -170,7 +170,7 @@ struct AddKernel
template<typename T>
void AlpakaStream<T>::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<std::byte*>(alpaka::getPtrNative(d_a))}, Accessor{}};
Expand All @@ -196,7 +196,7 @@ struct TriadKernel
template<typename T>
void AlpakaStream<T>::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<std::byte*>(alpaka::getPtrNative(d_a))}, Accessor{}};
Expand All @@ -222,7 +222,7 @@ struct NstreamKernel
template<typename T>
void AlpakaStream<T>::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<std::byte*>(alpaka::getPtrNative(d_a))}, Accessor{}};
Expand Down Expand Up @@ -270,7 +270,7 @@ struct DotKernel
template<typename T>
auto AlpakaStream<T>::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<std::byte*>(alpaka::getPtrNative(d_a))}, Accessor{}};
Expand Down
2 changes: 1 addition & 1 deletion examples/alpaka/babelstream/AlpakaStream.h
Original file line number Diff line number Diff line change
Expand Up @@ -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<Dim, Idx>;
using Acc = alpaka::ExampleDefaultAcc<Dim, Idx>;

Expand Down
Loading