1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525
|
/* $Source: bitbucket.org:berkeleylab/gasnet.git/tests/testtmpair.c $
* Copyright (c) 2020, The Regents of the University of California
*
* Description: Test of gex_TM_Pair() for communication initiation
*/
#include <gasnetex.h>
#include <gasnet_vis.h>
struct test_segment {
gex_Rank_t local[6]; // Local in-segment temporaries
gex_Rank_t get_src; // Source of various Gets
gex_Rank_t put_dst[6]; // Destinations of various Puts x6
gex_Rank_t fp_req_dst; // FPAM LongRequest dst
gex_Rank_t fp_rep_dst; // FPAM LongReply dst
gex_Rank_t np_req_dst; // NPAM LongRequest dst
gex_Rank_t np_rep_dst; // NPAM LongReply dst
gex_Rank_t vis_src; // VIS Gets
gex_Rank_t vis_dst[6]; // VIS Puts x6
};
#ifndef TEST_SEGSZ
#define TEST_SEGSZ_EXPR sizeof(struct test_segment)
#endif
#include <test.h>
#if 1
// To count failures, not reporting detail
#define CHECK(cond) failed += !(cond)
#else
// To stop at first failure
#define CHECK(cond) assert(cond)
#endif
// ------------------------------------------------------------------------------------
static gex_Client_t myclient;
static gex_Segment_t mysegment;
static gex_EP_t myep;
static gex_TM_t myteam;
static gex_Rank_t myrank, nranks;
static gex_Rank_t next, prev;
// ------------------------------------------------------------------------------------
static gex_Rank_t *fp_reply_dst;
static gex_Rank_t *np_reply_dst;
enum {
hidx_short_ping = GEX_AM_INDEX_BASE,
hidx_short_pong,
hidx_med_ping,
hidx_med_pong,
hidx_long_ping,
hidx_long_pong,
hidx_npmed_ping,
hidx_npmed_pong,
hidx_nplong_ping,
hidx_nplong_pong,
};
#define HANDLER_DECLS(hname) \
static gasnett_atomic_t hname##_cntr = gasnett_atomic_init(0); \
static gex_Rank_t hname##_from = GEX_RANK_INVALID;
#define HANDLER_COMMON(hname) do { \
gex_Token_Info_t info; \
gex_TI_t rc = gex_Token_Info(token, &info, GEX_TI_SRCRANK); \
hname##_from = info.gex_srcrank; \
gasnett_atomic_increment(&hname##_cntr, GASNETT_ATOMIC_REL); \
} while (0)
HANDLER_DECLS(short_ping)
static void short_ping_handler(gex_Token_t token) {
HANDLER_COMMON(short_ping);
gex_AM_ReplyShort0(token, hidx_short_pong, 0);
}
HANDLER_DECLS(short_pong)
static void short_pong_handler(gex_Token_t token) {
HANDLER_COMMON(short_pong);
}
HANDLER_DECLS(med_ping)
static void med_ping_handler(gex_Token_t token, void *buf, size_t nbytes) {
HANDLER_COMMON(med_ping);
gex_AM_ReplyMedium0(token, hidx_med_pong, buf, nbytes, GEX_EVENT_NOW, 0);
assert(myrank == *(gex_Rank_t*)buf);
}
HANDLER_DECLS(med_pong)
static void med_pong_handler(gex_Token_t token, void *buf, size_t nbytes) {
HANDLER_COMMON(med_pong);
assert(next == *(gex_Rank_t*)buf);
}
HANDLER_DECLS(long_ping)
static void long_ping_handler(gex_Token_t token, void *buf, size_t nbytes) {
HANDLER_COMMON(long_ping);
gex_AM_ReplyLong0(token, hidx_long_pong, buf, nbytes, fp_reply_dst, GEX_EVENT_NOW, 0);
assert(myrank == *(gex_Rank_t*)buf);
}
HANDLER_DECLS(long_pong)
static void long_pong_handler(gex_Token_t token, void *buf, size_t nbytes) {
HANDLER_COMMON(long_pong);
assert(next == *(gex_Rank_t*)buf);
}
HANDLER_DECLS(npmed_ping)
static void npmed_ping_handler(gex_Token_t token, void *buf, size_t nbytes) {
HANDLER_COMMON(npmed_ping);
// Not bothering w/ the complexity of NPAM here since token is indep of TM-Pair
gex_AM_ReplyMedium0(token, hidx_npmed_pong, buf, nbytes, GEX_EVENT_NOW, 0);
assert(myrank == *(gex_Rank_t*)buf);
}
HANDLER_DECLS(npmed_pong)
static void npmed_pong_handler(gex_Token_t token, void *buf, size_t nbytes) {
HANDLER_COMMON(npmed_pong);
assert(next == *(gex_Rank_t*)buf);
}
HANDLER_DECLS(nplong_ping)
static void nplong_ping_handler(gex_Token_t token, void *buf, size_t nbytes) {
HANDLER_COMMON(nplong_ping);
// Not bothering w/ the complexity of NPAM here since token is indep of TM-Pair
gex_AM_ReplyLong0(token, hidx_nplong_pong, buf, nbytes, np_reply_dst, GEX_EVENT_NOW, 0);
assert(myrank == *(gex_Rank_t*)buf);
}
HANDLER_DECLS(nplong_pong)
static void nplong_pong_handler(gex_Token_t token, void *buf, size_t nbytes) {
HANDLER_COMMON(nplong_pong);
assert(next == *(gex_Rank_t*)buf);
}
// handler table
gex_AM_Entry_t htable[] = {
{ hidx_short_ping, (gex_AM_Fn_t)short_ping_handler, GEX_FLAG_AM_REQUEST|GEX_FLAG_AM_SHORT, 0 },
{ hidx_short_pong, (gex_AM_Fn_t)short_pong_handler, GEX_FLAG_AM_REPLY |GEX_FLAG_AM_SHORT, 0 },
{ hidx_med_ping, (gex_AM_Fn_t)med_ping_handler, GEX_FLAG_AM_REQUEST|GEX_FLAG_AM_MEDIUM, 0 },
{ hidx_med_pong, (gex_AM_Fn_t)med_pong_handler, GEX_FLAG_AM_REPLY |GEX_FLAG_AM_MEDIUM, 0 },
{ hidx_long_ping, (gex_AM_Fn_t)long_ping_handler, GEX_FLAG_AM_REQUEST|GEX_FLAG_AM_LONG, 0 },
{ hidx_long_pong, (gex_AM_Fn_t)long_pong_handler, GEX_FLAG_AM_REPLY |GEX_FLAG_AM_LONG, 0 },
{ hidx_npmed_ping, (gex_AM_Fn_t)npmed_ping_handler, GEX_FLAG_AM_REQUEST|GEX_FLAG_AM_MEDIUM, 0 },
{ hidx_npmed_pong, (gex_AM_Fn_t)npmed_pong_handler, GEX_FLAG_AM_REPLY |GEX_FLAG_AM_MEDIUM, 0 },
{ hidx_nplong_ping, (gex_AM_Fn_t)nplong_ping_handler, GEX_FLAG_AM_REQUEST|GEX_FLAG_AM_LONG, 0 },
{ hidx_nplong_pong, (gex_AM_Fn_t)nplong_pong_handler, GEX_FLAG_AM_REPLY |GEX_FLAG_AM_LONG, 0 }
};
#define HANDLER_TABLE_SIZE (sizeof(htable)/sizeof(gex_AM_Entry_t))
// ------------------------------------------------------------------------------------
int main(int argc, char **argv)
{
GASNET_Safe(gex_Client_Init(&myclient, &myep, &myteam, "testtmpair", &argc, &argv, 0));
// TODO: control over how many EPs and how they are paired (loc,rem)
test_init("testpair", 0, "(test_sections)");
if (argc > 1) TEST_SECTION_PARSE(argv[1]);
if (argc > 2) test_usage();
myrank = gex_TM_QueryRank(myteam);
nranks = gex_TM_QuerySize(myteam);
GASNET_Safe(gex_Segment_Attach(&mysegment, myteam, TEST_SEGSZ));
GASNET_Safe(gex_EP_RegisterHandlers(myep, htable, HANDLER_TABLE_SIZE));
next = (myrank + 1) % nranks;
prev = (myrank + nranks - 1) % nranks;
const int num_eps = MIN(4, GASNET_MAXEPS); // TODO: command line arg to control this
gex_EP_t *eps = test_malloc(num_eps * sizeof(gex_EP_t));
gex_Segment_t *segs = test_malloc(num_eps * sizeof(gex_Segment_t));
gex_EP_Capabilities_t ep_caps = 0;
eps[0] = myep;
segs[0] = mysegment;
{
// Limit capabilities to those required by the enabled tests
for (gex_EP_Index_t idx = 0; idx < num_eps; ++idx) {
if (TEST_SECTION_BEGIN_ENABLED()) ep_caps |= GEX_EP_CAPABILITY_RMA; // Get
if (TEST_SECTION_BEGIN_ENABLED()) ep_caps |= GEX_EP_CAPABILITY_RMA; // Put
if (TEST_SECTION_BEGIN_ENABLED()) ep_caps |= GEX_EP_CAPABILITY_AM; // AM
if (TEST_SECTION_BEGIN_ENABLED()) ep_caps |= GEX_EP_CAPABILITY_VIS; // VIS
}
test_section = '\0';
// Limit capabilities to those currently implementd by the current conduit
#if GASNET_CONDUIT_IBV
ep_caps &= GEX_EP_CAPABILITY_RMA;
#elif GASNET_CONDUIT_UCX
ep_caps &= GEX_EP_CAPABILITY_RMA;
#elif GASNET_CONDUIT_OFI
ep_caps &= GEX_EP_CAPABILITY_RMA;
#elif GASNET_MAXEPS > 1
MSG0("Update required in testtmpair.c for conduit-specific capabilities.");
#endif
for (gex_EP_Index_t idx = 1; idx < num_eps; ++idx) {
GASNET_Safe(gex_EP_Create(eps+idx, myclient, ep_caps, 0));
}
for (gex_EP_Index_t idx = 1; idx < num_eps; ++idx) {
GASNET_Safe(gex_Segment_Create(segs+idx, myclient, NULL, TEST_SEGSZ_EXPR, GEX_MK_HOST, 0));
GASNET_Safe(gex_EP_BindSegment(eps[idx], segs[idx], 0));
}
gex_EP_PublishBoundSegment(myteam, eps+1, num_eps-1, 0);
}
// Paranoia to prevent accidental use:
myteam = GEX_TM_INVALID;
for (int iter = 0; iter < num_eps; ++iter) {
gex_EP_Index_t loc_idx, rem_idx;
// TODO: "mix it up", such that non-equal local and remote indices communicate.
// However, that requires addition thought to managing two local segments if we
// are to continue using in-segment local addresses.
loc_idx = rem_idx = iter;
gex_EP_Capabilities_t test_caps = (loc_idx || rem_idx) ? ep_caps : GEX_EP_CAPABILITY_ALL;
gex_TM_t pair = gex_TM_Pair(eps[loc_idx], rem_idx);
const size_t rank_sz = sizeof(gex_Rank_t);
struct test_segment *loc_seg;
if (!loc_idx) {
// Required for GASNET_SEGMENT_EVERYTHING, buy always correct
loc_seg = (struct test_segment *) TEST_MYSEG();
} else {
loc_seg = gex_Segment_QueryAddr(segs[loc_idx]);
}
struct test_segment *rem_seg;
struct test_segment *prev_seg;
if (!rem_idx) {
// Required for GASNET_SEGMENT_EVERYTHING, buy always correct
rem_seg = (struct test_segment *) TEST_SEG(next);
prev_seg = (struct test_segment *) TEST_SEG(prev);
} else {
gex_Event_Wait( gex_EP_QueryBoundSegmentNB(pair, next, (void**)&rem_seg, NULL, NULL, 0) );
gex_Event_Wait( gex_EP_QueryBoundSegmentNB(pair, prev, (void**)&prev_seg, NULL, NULL, 0) );
}
loc_seg->get_src = myrank;
for (int i = 0; i < 6; ++i) {
loc_seg->put_dst[i] = GEX_RANK_INVALID;
}
loc_seg->fp_req_dst = GEX_RANK_INVALID;
loc_seg->fp_req_dst = GEX_RANK_INVALID;
loc_seg->np_rep_dst = GEX_RANK_INVALID;
loc_seg->np_rep_dst = GEX_RANK_INVALID;
loc_seg->vis_src = prev;
for (int i = 0; i < 6; ++i) {
loc_seg->vis_dst[i] = GEX_RANK_INVALID;
}
// Cannot use QueryBound in handler context
fp_reply_dst = &prev_seg->fp_rep_dst;
np_reply_dst = &prev_seg->np_rep_dst;
BARRIER();
// RMA Get tests
if (!TEST_SECTION_BEGIN_ENABLED()) {
// Nothing to do
} else if (! (test_caps & GEX_EP_CAPABILITY_RMA)) {
MSG0("%c: Skipping RMA Get tests for pair (%d,%d) - RMA not yet supported for non-primordial EPs",
TEST_SECTION_NAME(), loc_idx, rem_idx);
} else {
MSG0("%c: Starting RMA Get tests for pair (%d,%d)",
TEST_SECTION_NAME(), loc_idx, rem_idx);
int rc;
gex_Event_t ev;
gex_Rank_t *dst_array = loc_seg->local;
gex_Rank_t *src_addr = &rem_seg->get_src;
for (int i = 0; i < 4; ++i) {
dst_array[i] = GEX_RANK_INVALID;
}
gex_Rank_t *dst = &dst_array[0];
ev = gex_RMA_GetNB(pair, dst++, next, src_addr, rank_sz, 0);
rc = gex_RMA_GetNBI(pair, dst++, next, src_addr, rank_sz, 0);
assert(!rc);
rc = gex_RMA_GetBlocking(pair, dst++, next, src_addr, rank_sz, 0);
assert(!rc);
*(dst++) = gex_RMA_GetBlockingVal(pair, next, src_addr, rank_sz, 0);
gex_Event_Wait(ev);
gex_NBI_Wait(GEX_EC_GET, 0);
int failed = 0;
for (int i = 0; i < 4; ++i) {
CHECK(dst_array[i] == next);
}
if (failed) {
ERR("Tests of Get APIs FAILED %d test(s).", failed);
}
}
// RMA Put tests
if (!TEST_SECTION_BEGIN_ENABLED()) {
// Nothing to do
} else if (! (test_caps & GEX_EP_CAPABILITY_RMA)) {
MSG0("%c: Skipping RMA Put tests for pair (%d,%d) - RMA not yet supported for non-primordial EPs",
TEST_SECTION_NAME(), loc_idx, rem_idx);
} else {
MSG0("%c: Starting RMA Put tests for pair (%d,%d)",
TEST_SECTION_NAME(), loc_idx, rem_idx);
int rc;
gex_Event_t ev[2];
gex_Rank_t *dst = &rem_seg->put_dst[0];
gex_Rank_t *src = &loc_seg->local[0];
*src = next;
ev[0] = gex_RMA_PutNB(pair, next, dst++, src, rank_sz, GEX_EVENT_NOW, 0);
ev[1] = gex_RMA_PutNBVal(pair, next, dst++, next, rank_sz, 0);
rc = gex_RMA_PutNBI(pair, next, dst++, src, rank_sz, GEX_EVENT_NOW, 0);
assert(!rc);
rc = gex_RMA_PutNBIVal(pair, next, dst++, next, rank_sz, 0);
assert(!rc);
rc = gex_RMA_PutBlocking(pair, next, dst++, src, rank_sz, 0);
assert(!rc);
rc = gex_RMA_PutBlockingVal(pair, next, dst++, next, rank_sz, 0);
assert(!rc);
gex_Event_WaitAll(ev, sizeof(ev)/sizeof(ev[0]), 0);
gex_NBI_Wait(GEX_EC_PUT, 0);
BARRIER();
int failed = 0;
for (int i = 0; i < 6; ++i) {
CHECK(loc_seg->put_dst[i] == myrank);
loc_seg->put_dst[i] = myrank; // prevent cascading failure, such as in VIS
}
if (failed) {
ERR("Tests of Put APIs FAILED %d test(s).", failed);
}
}
// TODO: Long tests probably don't use RMA on conduits w/ "packed long"
if (!TEST_SECTION_BEGIN_ENABLED()) { // AM Tests
// Nothing to do
} else if (! (test_caps & GEX_EP_CAPABILITY_AM)) {
MSG0("%c: Skipping AM Request tests for pair (%d,%d) - AMs not yet supported for non-primordial EPs",
TEST_SECTION_NAME(), loc_idx, rem_idx);
} else {
MSG0("%c: Starting AM Request tests for pair (%d,%d)",
TEST_SECTION_NAME(), loc_idx, rem_idx);
static gasnett_atomic_val_t cntr_target = 0;
// Payload limit queries
size_t maxmedreq = gex_AM_MaxRequestMedium(pair,next,GEX_EVENT_NOW,0,0);
assert_always(maxmedreq >= gex_AM_LUBRequestMedium());
size_t maxmedrep = gex_AM_MaxReplyMedium (pair,next,GEX_EVENT_NOW,0,0);
assert_always(maxmedrep >= gex_AM_LUBReplyMedium());
size_t maxlongreq = gex_AM_MaxRequestLong (pair,next,GEX_EVENT_NOW,0,0);
assert_always(maxlongreq >= gex_AM_LUBRequestLong());
size_t maxlongrep = gex_AM_MaxReplyLong (pair,next,GEX_EVENT_NOW,0,0);
assert_always(maxlongrep >= gex_AM_LUBReplyLong());
// FPAM injection
gex_Rank_t *fp_dst = &rem_seg->fp_req_dst;
gex_AM_RequestShort0 (pair, next, hidx_short_ping, 0);
gex_AM_RequestMedium0(pair, next, hidx_med_ping,
&next, sizeof(gex_Rank_t), GEX_EVENT_NOW, 0);
gex_AM_RequestLong0 (pair, next, hidx_long_ping,
&next, sizeof(gex_Rank_t), fp_dst, GEX_EVENT_NOW, 0);
// NPAM injection
gex_Rank_t *np_dst = &rem_seg->np_req_dst;
gex_AM_SrcDesc_t sd;
sd = gex_AM_PrepareRequestMedium(pair, next, &next, rank_sz, rank_sz, GEX_EVENT_NOW, 1, 0);
gex_AM_CommitRequestMedium0(sd, hidx_npmed_ping, rank_sz);
sd = gex_AM_PrepareRequestLong(pair, next, &next, rank_sz, rank_sz, NULL, GEX_EVENT_NOW, 0, 0);
gex_AM_CommitRequestLong0 (sd, hidx_nplong_ping, rank_sz, np_dst);
cntr_target += 1;
GASNET_BLOCKUNTIL((cntr_target <= gasnett_atomic_read(&short_ping_cntr, 0)) &&
(cntr_target <= gasnett_atomic_read(&short_pong_cntr, 0)) &&
(cntr_target <= gasnett_atomic_read(&med_ping_cntr, 0)) &&
(cntr_target <= gasnett_atomic_read(&med_pong_cntr, 0)) &&
(cntr_target <= gasnett_atomic_read(&long_ping_cntr, 0)) &&
(cntr_target <= gasnett_atomic_read(&long_pong_cntr, 0)) &&
(cntr_target <= gasnett_atomic_read(&npmed_ping_cntr, 0)) &&
(cntr_target <= gasnett_atomic_read(&npmed_pong_cntr, 0)) &&
(cntr_target <= gasnett_atomic_read(&nplong_ping_cntr, 0)) &&
(cntr_target <= gasnett_atomic_read(&nplong_pong_cntr, 0)));
// Note the ACQUIRE semantics of BLOCKUNTIL
int failed = 0;
CHECK(cntr_target == gasnett_atomic_read(&short_ping_cntr,0));
CHECK(short_ping_from == prev);
CHECK(cntr_target == gasnett_atomic_read(&short_pong_cntr,0));
CHECK(short_pong_from == next);
CHECK(cntr_target == gasnett_atomic_read(&med_ping_cntr,0));
CHECK(med_ping_from == prev);
CHECK(cntr_target == gasnett_atomic_read(&med_pong_cntr,0));
CHECK(med_pong_from == next);
CHECK(cntr_target == gasnett_atomic_read(&long_ping_cntr,0));
CHECK(long_ping_from == prev);
CHECK(loc_seg->fp_req_dst == myrank);
CHECK(cntr_target == gasnett_atomic_read(&long_pong_cntr,0));
CHECK(long_pong_from == next);
CHECK(loc_seg->fp_rep_dst == next);
CHECK(cntr_target == gasnett_atomic_read(&npmed_ping_cntr,0));
CHECK(npmed_ping_from == prev);
CHECK(cntr_target == gasnett_atomic_read(&npmed_pong_cntr,0));
CHECK(npmed_pong_from == next);
CHECK(cntr_target == gasnett_atomic_read(&nplong_ping_cntr,0));
CHECK(nplong_ping_from == prev);
CHECK(loc_seg->np_req_dst == myrank);
CHECK(cntr_target == gasnett_atomic_read(&nplong_pong_cntr,0));
CHECK(nplong_pong_from == next);
CHECK(loc_seg->np_rep_dst == next);
if (failed) {
ERR("Tests of AM APIs FAILED %d test(s).", failed);
}
}
if (!TEST_SECTION_BEGIN_ENABLED()) { // VIS Indexed Tests
// Nothing to do
} else if (! (test_caps & GEX_EP_CAPABILITY_VIS)) {
MSG0("%c: Skipping VIS Indxed tests for pair (%d,%d) - VIS not yet supported for non-primordial EPs",
TEST_SECTION_NAME(), loc_idx, rem_idx);
} else {
MSG0("%c: Starting VIS Indexed tests for pair (%d,%d)",
TEST_SECTION_NAME(), loc_idx, rem_idx);
// gex_VIS_{Vector,Indexed,Strided}{Put,Get}{NB,NBI,Blocking} == 18 entry points
// TODO: currently we cover only Indexed, which we *hope* is representative
gex_Rank_t S[2]; S[0] = myrank; S[1] = next;
gex_Rank_t D[6] = { GEX_RANK_INVALID, GEX_RANK_INVALID, GEX_RANK_INVALID,
GEX_RANK_INVALID, GEX_RANK_INVALID, GEX_RANK_INVALID};
void *loc_src_list[2];
loc_src_list[0] = S+0;
loc_src_list[1] = S+1;
void *rem_src_list[2];
rem_src_list[0] = &rem_seg->get_src;
rem_src_list[1] = &rem_seg->vis_src;
int dst_idx[] = {1,0,2,3,5,4};
void *loc_dst_list[6];
void *rem_dst_list[6];
for (int i = 0; i < 6; ++i) {
loc_dst_list[i] = dst_idx[i] + D;
rem_dst_list[i] = dst_idx[i] + rem_seg->vis_dst;
}
gex_Event_t puti_ev =
gex_VIS_IndexedPutNB(pair, next, 2, rem_dst_list+0, rank_sz,
2, loc_src_list, rank_sz, 0);
gex_VIS_IndexedPutNBI(pair, next, 2, rem_dst_list+2, rank_sz,
2, loc_src_list, rank_sz, 0);
gex_VIS_IndexedPutBlocking(pair, next, 2, rem_dst_list+4, rank_sz,
2, loc_src_list, rank_sz, 0);
gex_Event_t geti_ev =
gex_VIS_IndexedGetNB(pair, 2, loc_dst_list+0, rank_sz,
next, 2, rem_src_list, rank_sz, 0);
gex_VIS_IndexedGetNBI(pair, 2, loc_dst_list+2, rank_sz,
next, 2, rem_src_list, rank_sz, 0);
gex_VIS_IndexedGetBlocking(pair, 2, loc_dst_list+4, rank_sz,
next, 2, rem_src_list, rank_sz, 0);
gex_Event_Wait(puti_ev);
gex_Event_Wait(geti_ev);
gex_NBI_Wait(GEX_EC_GET | GEX_EC_PUT, 0);
BARRIER();
int failed = 0;
CHECK(loc_seg->vis_dst[0] == myrank);
CHECK(loc_seg->vis_dst[1] == prev);
CHECK(loc_seg->vis_dst[2] == prev);
CHECK(loc_seg->vis_dst[3] == myrank);
CHECK(loc_seg->vis_dst[4] == myrank);
CHECK(loc_seg->vis_dst[5] == prev);
CHECK(D[0] == myrank);
CHECK(D[1] == next);
CHECK(D[2] == next);
CHECK(D[3] == myrank);
CHECK(D[4] == myrank);
CHECK(D[5] == next);
if (failed) {
ERR("Tests of VIS APIs FAILED %d test(s).", failed);
}
}
}
BARRIER();
MSG("done.");
gasnet_exit(0);
return 0;
}
|