26 #define TableSize (1ULL<<N) 27 #define NUPDATE (4ULL * TableSize) 29 #define POLY 0x0000000000000007ULL 30 #define PERIOD 1317624576693539401LL 36 typedef dash::CSRPattern<1, dash::ROW_MAJOR, index_t>
38 typedef typename pattern_t::size_type
61 std::cout << el <<
" ";
63 std::cout << std::endl;
66 uint64_t starts(int64_t n)
72 while (n < 0) n += PERIOD;
73 while (n > PERIOD) n -= PERIOD;
79 for (i=0; i<64; i++) {
81 temp = (temp << 1) ^ ((int64_t) temp < 0 ? POLY : 0);
82 temp = (temp << 1) ^ ((int64_t) temp < 0 ? POLY : 0);
85 for (i=62; i>=0; i--)
if ((n >> i) & 1)
break;
90 for (
int j=0; j<64; j++) if ((ran >> j) & 1) temp ^= m2[j];
93 if ((n >> i) & 1) ran = (ran << 1) ^ ((int64_t) ran < 0 ? POLY : 0);
103 auto table_size = params.size_base;
106 ran = (ran << 1) ^ (((int64_t) ran < 0) ? POLY : 0);
107 int64_t g_idx =
static_cast<int64_t
>(ran & (table_size-1));
114 uint64_t i, localerrors, errors;
115 auto table_size = params.size_base;
122 errors = localerrors;
135 int main(
int argc,
char **argv)
137 DASH_LOG_DEBUG(
"bench.gups",
"main()");
140 #ifdef DASH_ENABLE_IPM 141 MPI_Pcontrol(0,
"off");
148 bench_cfg.set_output_width(72);
149 bench_cfg.print_header();
150 bench_cfg.print_pinning();
153 print_params(bench_cfg, params);
155 perform_test(params);
164 Timer::timestamp_t ts_start;
166 auto array_size = params.size_base;
167 auto num_updates = params.num_updates;
168 auto ts_init_start = Timer::Now();
170 DASH_LOG_DEBUG(
"bench.gups",
"Table.allocate()");
171 Table.
allocate(params.size_base, dash::BLOCKED);
175 double bytes_total = (double)(array_size *
sizeof(value_t));
176 double mb_total = bytes_total / 1024 / 1024;
177 double mb_unit = mb_total / nunits;
178 double updates_m = (double)(num_updates * 1.0e-9);
179 #ifdef DASH_MPI_IMPL_ID 180 std::string mpi_impl = dash__toxstr(DASH_MPI_IMPL_ID);
182 std::string mpi_impl =
"-";
184 cout << setw(6) <<
"units" <<
"," 185 << setw(12) <<
"size" <<
"," 186 << setw(9) <<
"mpi.impl" <<
"," 187 << setw(12) <<
"mb.total" <<
"," 188 << setw(12) <<
"mb.unit" <<
"," 189 << setw(12) <<
"updates.m" <<
"," 190 << setw(9) <<
"init.s" <<
"," 191 << setw(9) <<
"time.s" <<
"," 192 << setw(9) <<
"lat.us" <<
"," 193 << setw(9) <<
"gups" <<
"," 194 << setw(9) <<
"verified" <<
"," 195 << setw(9) <<
"errors" 197 cout << setw(6) << nunits <<
"," 198 << setw(12) << params.size_base <<
"," 199 << setw(9) << mpi_impl <<
"," 200 << setw(12) << std::fixed << std::setprecision(2) << mb_total <<
"," 201 << setw(12) << std::fixed << std::setprecision(2) << mb_unit <<
"," 202 << setw(12) << std::fixed << std::setprecision(2) << updates_m <<
"," 209 for (uint64_t i =
dash::myid(); i < TableSize; ++i) {
215 auto l_begin_glob_offset = Table.
pattern().global(0);
216 for (uint64_t i = 0; i < Table.
local.size(); ++i) {
217 Table.
local[i] = l_begin_glob_offset + i;
223 double time_init_s = Timer::ElapsedSince(ts_init_start) * 1.0e-6;
225 cout << setw(9) << std::fixed << std::setprecision(4) << time_init_s <<
"," 230 #ifdef DASH_ENABLE_IPM 231 MPI_Pcontrol(0,
"on");
232 MPI_Pcontrol(0,
"clear");
234 ts_start = Timer::Now();
235 RandomAccessUpdate(params);
237 duration_us = Timer::ElapsedSince(ts_start);
238 #ifdef DASH_ENABLE_IPM 239 MPI_Pcontrol(0,
"off");
243 double gups = (
static_cast<double>(params.num_updates) / 1000.0f)
245 double latency = duration_us *
dash::size() / num_updates;
246 double duration_s = (duration_us * 1.0e-6);
247 cout << setw(9) << std::fixed << std::setprecision(4) << duration_s <<
"," 248 << setw(9) << std::fixed << std::setprecision(4) << latency <<
"," 249 << setw(9) << std::fixed << std::setprecision(5) << gups <<
"," 256 RandomAccessUpdate(params);
258 uint64_t errors = RandomAccessVerify(params);
260 if ((
double)errors/num_updates < 0.01) {
261 cout << setw(9) <<
"passed" <<
"," 265 cout << setw(9) <<
"failed" <<
"," 272 cout << setw(9) <<
"no" <<
"," 282 params.size_base = TableSize;
283 params.num_updates = NUPDATE;
285 params.verify =
false;
287 for (
auto i = 1; i < argc; i += 2) {
288 std::string flag = argv[i];
290 params.size_base = atoi(argv[i+1]);
291 }
else if (flag ==
"-rb") {
292 params.rep_base = atoi(argv[i+1]);
293 }
else if (flag ==
"-verify") {
294 params.verify =
true;
309 bench_cfg.print_section_start(
"Runtime arguments");
310 bench_cfg.print_param(
"-sb",
"size base", params.size_base);
311 bench_cfg.print_param(
"-rb",
"rep. base", params.rep_base);
312 bench_cfg.print_param(
"-verify",
"verification", params.verify);
313 bench_cfg.print_section_end();
global_unit_t myid()
Shortcut to query the global unit ID of the calling unit.
size_t size()
Return the number of units in the global team.
void finalize()
Finalize the DASH library and the underlying runtime system.
constexpr const PatternType & pattern() const noexcept
The pattern used to distribute array elements to units.
void barrier()
A global barrier involving all units.
void init(int *argc, char ***argv)
Initialize the DASH library and the underlying runtime system.
bool allocate(size_type nelem, dash::DistributionSpec< 1 > distribution, dash::Team &team=dash::Team::All())
Delayed allocation of global memory using a one-dimensional distribution spec.
local_type local
Local proxy object, allows use in range-based for loops.