Skip to content

Commit 8f1181d

Browse files
committed
Add N-Body and Stencil to soa_refl
1 parent cb7b1dc commit 8f1181d

File tree

1 file changed

+25
-1
lines changed

1 file changed

+25
-1
lines changed

refl/soa_refl.cpp

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,14 @@ struct S64 {
2929
Eigen::Matrix3d &x51, &x52, &x53, &x54, &x55, &x56, &x57, &x58, &x59, &x60, &x61, &x62, &x63;
3030
};
3131

32+
struct Snbody {
33+
float &x, &y, &z, &vx, &vy, &vz;
34+
};
35+
36+
struct Sstencil {
37+
double &src, &dst, &rhs;
38+
};
39+
3240
int main(int argc, char **argv)
3341
{
3442
// Seperate loops to sort the output by benchmark.
@@ -57,14 +65,30 @@ int main(int argc, char **argv)
5765
benchmark::RegisterBenchmark("BM_CPURealRW", BM_CPURealRW<SoA>, t)->Arg(n)->Unit(benchmark::kMillisecond);
5866
}
5967

60-
for (auto n : N) {
68+
for (auto n : N) {
6169
using SoA = rmpp::AoS2SoA<S64, 64>;
6270
auto byte_size = SoA::ComputeSize(n);
6371
auto buffer = reinterpret_cast<std::byte *>(aligned_alloc(64, byte_size));
6472
SoA t(buffer, byte_size, n);
6573
benchmark::RegisterBenchmark("BM_CPUHardRW", BM_CPUHardRW<SoA>, t)->Arg(n)->Unit(benchmark::kMillisecond);
6674
}
6775

76+
for (auto n : N) {
77+
using SoA = rmpp::AoS2SoA<Snbody, 64>;
78+
auto byte_size = SoA::ComputeSize(n);
79+
auto buffer = reinterpret_cast<std::byte *>(aligned_alloc(64, byte_size));
80+
SoA t(buffer, byte_size, n);
81+
benchmark::RegisterBenchmark("BM_nbody", BM_nbody<SoA>, t)->Arg(n)->Unit(benchmark::kMillisecond);
82+
}
83+
84+
for (auto n : N) {
85+
using SoA = rmpp::AoS2SoA<Sstencil, 64>;
86+
auto byte_size = SoA::ComputeSize(n);
87+
auto buffer = reinterpret_cast<std::byte *>(aligned_alloc(64, byte_size));
88+
SoA t(buffer, byte_size, n);
89+
benchmark::RegisterBenchmark("BM_stencil", BM_stencil<SoA>, t)->Arg(n)->Unit(benchmark::kMillisecond);
90+
}
91+
6892
benchmark::Initialize(&argc, argv);
6993
benchmark::RunSpecifiedBenchmarks();
7094
benchmark::Shutdown();

0 commit comments

Comments
 (0)