Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 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
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
#include <iostream>

#include "RAJA/RAJA.hpp"
#include "umpire/Umpire.hpp"
#include "umpire/strategy/QuickPool.hpp"

int main()
{
#if defined (COMPILE)
constexpr int N{10000};
constexpr int M{7000};
double* a{nullptr};
double* a_t{nullptr};

auto& rm = umpire::ResourceManager::getInstance();

auto allocator = rm.getAllocator("UM");
auto pool = rm.makeAllocator<umpire::strategy::QuickPool>("POOL", allocator);

a = static_cast<double *>(pool.allocate(N*M*sizeof(double)));
a_t = static_cast<double *>(pool.allocate(N*M*sizeof(double)));

constexpr int DIM = 2;

RAJA::View<double, RAJA::Layout<DIM>> A(a, N, M);
RAJA::View<double, RAJA::Layout<DIM>> A_t(a_t, M, N);

using EXEC_POL =
RAJA::cuda_launch_t<false>;
using teams_x = /*what policy do we need here?*/
using threads_x = /*what loop policy do we need here?*/

RAJA::launch<EXEC_POL>(RAJA::ExecPlace::DEVICE,
/*What type of parameters do we need to specify bounds*/,
[=] RAJA_HOST_DEVICE(RAJA::LaunchContext ctx) {
RAJA::loop<teams_x>(ctx, col_range, [&] (int col) {
RAJA::loop<threads_x>(ctx, row_range, [&] (int row) {
A_t(col, row) = A(row, col);
});
});
});

pool.deallocate(a);
pool.deallocate(a_t);
#endif
return 0;
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,10 @@ if (ENABLE_CUDA)
SOURCES 12_raja_device_kernel_complete.cpp
DEPENDS_ON RAJA umpire cuda)
endif()

if (ENABLE_CUDA)
blt_add_executable(
NAME 12_raja_launch_transpose
SOURCES 12_raja_launch_transpose.cpp
DEPENDS_ON RAJA umpire cuda)
endif()
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
#include <iostream>

#include "RAJA/RAJA.hpp"
#include "umpire/Umpire.hpp"
#include "umpire/strategy/QuickPool.hpp"

int main()
{
constexpr int N{10000};
constexpr int M{7000};
double* a{nullptr};
double* a_t{nullptr};

auto& rm = umpire::ResourceManager::getInstance();

auto allocator = rm.getAllocator("UM");
auto pool = rm.makeAllocator<umpire::strategy::QuickPool>("POOL", allocator);

a = static_cast<double *>(pool.allocate(N*M*sizeof(double)));
a_t = static_cast<double *>(pool.allocate(N*M*sizeof(double)));

constexpr int DIM = 2;

RAJA::View<double, RAJA::Layout<DIM>> A(a, N, M);
RAJA::View<double, RAJA::Layout<DIM>> A_t(a_t, M, N);

using EXEC_POL =
RAJA::cuda_launch_t<false>;
using teams_x = RAJA::cuda_block_x_direct;
using threads_x = RAJA::cuda_thread_x_loop;

RAJA::launch<EXEC_POL>(RAJA::ExecPlace::DEVICE,
RAJA::LaunchParams(RAJA::Teams(N), RAJA::Threads(M)),
[=] RAJA_HOST_DEVICE(RAJA::LaunchContext ctx) {
RAJA::loop<teams_x>(ctx, col_range, [&] (int col) {
RAJA::loop<threads_x>(ctx, row_range, [&] (int row) {
A_t(col, row) = A(row, col);
});
});
});

pool.deallocate(a);
pool.deallocate(a_t);

return 0;
}