/
typerep_yaksa_pack.c
574 lines (477 loc) · 19.1 KB
/
typerep_yaksa_pack.c
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
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
/*
* Copyright (C) by Argonne National Laboratory
* See COPYRIGHT in top-level directory
*/
#include "mpiimpl.h"
#include "yaksa.h"
#include "typerep_internal.h"
/*
=== BEGIN_MPI_T_CVAR_INFO_BLOCK ===
cvars:
- name : MPIR_CVAR_YAKSA_COMPLEX_SUPPORT
category : COLLECTIVE
type : int
default : 0
class : none
verbosity : MPI_T_VERBOSITY_USER_BASIC
scope : MPI_T_SCOPE_ALL_EQ
description : >-
This CVAR indicates that complex type reduction is not supported in yaksa.
- name : MPIR_CVAR_GPU_DOUBLE_SUPPORT
category : COLLECTIVE
type : int
default : 0
class : none
verbosity : MPI_T_VERBOSITY_USER_BASIC
scope : MPI_T_SCOPE_ALL_EQ
description : >-
This CVAR indicates that double type is not supported on the GPU.
- name : MPIR_CVAR_GPU_LONG_DOUBLE_SUPPORT
category : COLLECTIVE
type : int
default : 0
class : none
verbosity : MPI_T_VERBOSITY_USER_BASIC
scope : MPI_T_SCOPE_ALL_EQ
description : >-
This CVAR indicates that double type is not supported on the GPU.
- name : MPIR_CVAR_ENABLE_YAKSA_REDUCTION
category : COLLECTIVE
type : int
default : 1
class : none
verbosity : MPI_T_VERBOSITY_USER_BASIC
scope : MPI_T_SCOPE_ALL_EQ
description : >-
This cvar enables yaksa based reduction for local reduce.
=== END_MPI_T_CVAR_INFO_BLOCK ===
*/
#define IS_HOST(attr) \
((attr).type == MPL_GPU_POINTER_UNREGISTERED_HOST || \
(attr).type == MPL_GPU_POINTER_REGISTERED_HOST)
/* When a returned typerep_req is expected, using the nonblocking yaksa routine and
* return the request; otherwise use the blocking yaksa routine. */
static int typerep_do_copy(void *outbuf, const void *inbuf, MPI_Aint num_bytes,
MPIR_Typerep_req * typerep_req)
{
MPIR_FUNC_ENTER;
int mpi_errno = MPI_SUCCESS;
int rc;
if (typerep_req) {
*typerep_req = MPIR_TYPEREP_REQ_NULL;
}
if (num_bytes == 0) {
goto fn_exit;
}
MPL_pointer_attr_t inattr, outattr;
MPIR_GPU_query_pointer_attr(inbuf, &inattr);
MPIR_GPU_query_pointer_attr(outbuf, &outattr);
if (IS_HOST(inattr) && IS_HOST(outattr)) {
MPIR_Memcpy(outbuf, inbuf, num_bytes);
} else {
uintptr_t actual_pack_bytes;
yaksa_info_t info = MPII_yaksa_get_info(&inattr, &outattr);
if (typerep_req) {
rc = yaksa_ipack(inbuf, num_bytes, YAKSA_TYPE__BYTE, 0, outbuf, num_bytes,
&actual_pack_bytes, info, YAKSA_OP__REPLACE,
(yaksa_request_t *) typerep_req);
} else {
rc = yaksa_pack(inbuf, num_bytes, YAKSA_TYPE__BYTE, 0, outbuf, num_bytes,
&actual_pack_bytes, info, YAKSA_OP__REPLACE);
}
MPIR_ERR_CHKANDJUMP(rc, mpi_errno, MPI_ERR_INTERN, "**yaksa");
MPIR_Assert(actual_pack_bytes == num_bytes);
rc = MPII_yaksa_free_info(info);
MPIR_ERR_CHKANDJUMP(rc, mpi_errno, MPI_ERR_INTERN, "**yaksa");
}
fn_exit:
MPIR_FUNC_EXIT;
return mpi_errno;
fn_fail:
goto fn_exit;
}
/* When a returned typerep_req is expected, using the nonblocking yaksa routine and
* return the request; otherwise use the blocking yaksa routine. */
static int typerep_do_pack(const void *inbuf, MPI_Aint incount, MPI_Datatype datatype,
MPI_Aint inoffset, void *outbuf, MPI_Aint max_pack_bytes,
MPI_Aint * actual_pack_bytes, MPIR_Typerep_req * typerep_req)
{
MPIR_FUNC_ENTER;
int mpi_errno = MPI_SUCCESS;
int rc;
if (typerep_req) {
*typerep_req = MPIR_TYPEREP_REQ_NULL;
}
if (incount == 0) {
*actual_pack_bytes = 0;
goto fn_exit;
}
MPIR_Assert(datatype != MPI_DATATYPE_NULL);
int is_contig = 0;
int element_size = -1;
const void *inbuf_ptr; /* adjusted by true_lb */
MPI_Aint total_size = 0;
if (HANDLE_IS_BUILTIN(datatype)) {
is_contig = 1;
element_size = MPIR_Datatype_get_basic_size(datatype);
inbuf_ptr = inbuf;
total_size = incount * element_size;
} else {
MPIR_Datatype *dtp;
MPIR_Datatype_get_ptr(datatype, dtp);
is_contig = dtp->is_contig;
/* NOTE: dtp->element_size may not be set if dtp is from a flattened type */
if (dtp->basic_type != MPI_DATATYPE_NULL) {
element_size = MPIR_Datatype_get_basic_size(datatype);
}
inbuf_ptr = MPIR_get_contig_ptr(inbuf, dtp->true_lb);
total_size = incount * dtp->size;
}
MPL_pointer_attr_t inattr, outattr;
MPIR_GPU_query_pointer_attr(inbuf_ptr, &inattr);
MPIR_GPU_query_pointer_attr(outbuf, &outattr);
if (is_contig && element_size > 0 && IS_HOST(inattr) && IS_HOST(outattr)) {
MPI_Aint real_bytes = MPL_MIN(total_size - inoffset, max_pack_bytes);
/* Make sure we never pack partial element */
real_bytes -= real_bytes % element_size;
MPIR_Memcpy(outbuf, MPIR_get_contig_ptr(inbuf_ptr, inoffset), real_bytes);
*actual_pack_bytes = real_bytes;
goto fn_exit;
}
yaksa_type_t type = MPII_Typerep_get_yaksa_type(datatype);
yaksa_info_t info = MPII_yaksa_get_info(&inattr, &outattr);
uintptr_t real_pack_bytes;
if (typerep_req) {
rc = yaksa_ipack(inbuf, incount, type, inoffset, outbuf, max_pack_bytes,
&real_pack_bytes, info, YAKSA_OP__REPLACE,
(yaksa_request_t *) typerep_req);
} else {
rc = yaksa_pack(inbuf, incount, type, inoffset, outbuf, max_pack_bytes,
&real_pack_bytes, info, YAKSA_OP__REPLACE);
}
MPIR_ERR_CHKANDJUMP(rc, mpi_errno, MPI_ERR_INTERN, "**yaksa");
rc = MPII_yaksa_free_info(info);
MPIR_ERR_CHKANDJUMP(rc, mpi_errno, MPI_ERR_INTERN, "**yaksa");
*actual_pack_bytes = (MPI_Aint) real_pack_bytes;
fn_exit:
MPIR_FUNC_EXIT;
return mpi_errno;
fn_fail:
goto fn_exit;
}
/* This function checks whether the operation is supported in yaksa for the
* provided datatype */
int MPIR_Typerep_reduce_is_supported(MPI_Op op, MPI_Datatype datatype)
{
yaksa_op_t yaksa_op;
if (!MPIR_CVAR_ENABLE_YAKSA_REDUCTION)
return 0;
if ((datatype == MPI_DOUBLE || datatype == MPI_C_DOUBLE_COMPLEX) &&
(!MPIR_CVAR_GPU_DOUBLE_SUPPORT))
return 0;
if ((datatype == MPI_LONG_DOUBLE || datatype == MPI_C_LONG_DOUBLE_COMPLEX) &&
(!MPIR_CVAR_GPU_LONG_DOUBLE_SUPPORT))
return 0;
if ((datatype == MPI_C_COMPLEX || datatype == MPI_C_DOUBLE_COMPLEX ||
datatype == MPI_C_LONG_DOUBLE_COMPLEX) && (!MPIR_CVAR_YAKSA_COMPLEX_SUPPORT))
return 0;
#ifdef HAVE_FORTRAN_BINDING
if ((datatype == MPI_COMPLEX || datatype == MPI_DOUBLE_COMPLEX || datatype == MPI_COMPLEX8 ||
datatype == MPI_COMPLEX16) && (!MPIR_CVAR_YAKSA_COMPLEX_SUPPORT))
return 0;
if (datatype == MPI_DOUBLE_COMPLEX && (!MPIR_CVAR_GPU_DOUBLE_SUPPORT))
return 0;
#endif
#ifdef HAVE_CXX_BINDING
if ((datatype == MPI_CXX_FLOAT_COMPLEX || datatype == MPI_CXX_DOUBLE_COMPLEX ||
datatype == MPI_CXX_LONG_DOUBLE_COMPLEX) && (!MPIR_CVAR_YAKSA_COMPLEX_SUPPORT))
return 0;
if (datatype == MPI_CXX_DOUBLE_COMPLEX && (!MPIR_CVAR_GPU_DOUBLE_SUPPORT))
return 0;
if (datatype == MPI_CXX_LONG_DOUBLE_COMPLEX && (!MPIR_CVAR_GPU_LONG_DOUBLE_SUPPORT))
return 0;
#endif
if ((datatype == MPI_FLOAT || datatype == MPI_DOUBLE || datatype == MPI_LONG_DOUBLE) &&
(op == MPI_LXOR || op == MPI_LAND || op == MPI_LOR))
return 0;
yaksa_op = MPII_Typerep_get_yaksa_op(op);
if (yaksa_op == YAKSA_OP__LAST)
return 0;
return 1;
}
/* When a returned typerep_req is expected, using the nonblocking yaksa routine and
* return the request; otherwise use the blocking yaksa routine. */
static int typerep_do_unpack(const void *inbuf, MPI_Aint insize, void *outbuf, MPI_Aint outcount,
MPI_Datatype datatype, MPI_Aint outoffset,
MPI_Aint * actual_unpack_bytes, MPIR_Typerep_req * typerep_req)
{
MPIR_FUNC_ENTER;
int mpi_errno = MPI_SUCCESS;
int rc;
if (typerep_req) {
*typerep_req = MPIR_TYPEREP_REQ_NULL;
}
if (insize == 0) {
*actual_unpack_bytes = 0;
goto fn_exit;
}
MPIR_Assert(datatype != MPI_DATATYPE_NULL);
int is_contig = 0;
int element_size = -1;
const void *outbuf_ptr; /* adjusted by true_lb */
MPI_Aint total_size = 0;
if (HANDLE_IS_BUILTIN(datatype)) {
is_contig = 1;
element_size = MPIR_Datatype_get_basic_size(datatype);
outbuf_ptr = outbuf;
total_size = outcount * element_size;
} else {
MPIR_Datatype *dtp;
MPIR_Datatype_get_ptr(datatype, dtp);
is_contig = dtp->is_contig;
element_size = dtp->builtin_element_size;
outbuf_ptr = MPIR_get_contig_ptr(outbuf, dtp->true_lb);
total_size = outcount * dtp->size;
}
MPL_pointer_attr_t inattr, outattr;
MPIR_GPU_query_pointer_attr(inbuf, &inattr);
MPIR_GPU_query_pointer_attr(outbuf_ptr, &outattr);
if (is_contig && IS_HOST(inattr) && IS_HOST(outattr)) {
*actual_unpack_bytes = MPL_MIN(total_size - outoffset, insize);
/* We assume the amount we unpack is multiple of element_size */
MPIR_Assert(element_size < 0 || *actual_unpack_bytes % element_size == 0);
MPIR_Memcpy(MPIR_get_contig_ptr(outbuf_ptr, outoffset), inbuf, *actual_unpack_bytes);
goto fn_exit;
}
yaksa_type_t type = MPII_Typerep_get_yaksa_type(datatype);
yaksa_info_t info = MPII_yaksa_get_info(&inattr, &outattr);
uintptr_t real_insize = MPL_MIN(total_size - outoffset, insize);
uintptr_t real_unpack_bytes;
if (typerep_req) {
rc = yaksa_iunpack(inbuf, real_insize, outbuf, outcount, type, outoffset,
&real_unpack_bytes, info, YAKSA_OP__REPLACE,
(yaksa_request_t *) typerep_req);
} else {
rc = yaksa_unpack(inbuf, real_insize, outbuf, outcount, type, outoffset, &real_unpack_bytes,
info, YAKSA_OP__REPLACE);
}
MPIR_ERR_CHKANDJUMP(rc, mpi_errno, MPI_ERR_INTERN, "**yaksa");
rc = MPII_yaksa_free_info(info);
MPIR_ERR_CHKANDJUMP(rc, mpi_errno, MPI_ERR_INTERN, "**yaksa");
*actual_unpack_bytes = (MPI_Aint) real_unpack_bytes;
fn_exit:
MPIR_FUNC_EXIT;
return mpi_errno;
fn_fail:
goto fn_exit;
}
int MPIR_Typerep_icopy(void *outbuf, const void *inbuf, MPI_Aint num_bytes,
MPIR_Typerep_req * typerep_req)
{
MPIR_FUNC_ENTER;
int mpi_errno = MPI_SUCCESS;
mpi_errno = typerep_do_copy(outbuf, inbuf, num_bytes, typerep_req);
MPIR_FUNC_EXIT;
return mpi_errno;
}
int MPIR_Typerep_copy(void *outbuf, const void *inbuf, MPI_Aint num_bytes)
{
MPIR_FUNC_ENTER;
int mpi_errno = MPI_SUCCESS;
mpi_errno = typerep_do_copy(outbuf, inbuf, num_bytes, NULL);
MPIR_FUNC_EXIT;
return mpi_errno;
}
int MPIR_Typerep_ipack(const void *inbuf, MPI_Aint incount, MPI_Datatype datatype,
MPI_Aint inoffset, void *outbuf, MPI_Aint max_pack_bytes,
MPI_Aint * actual_pack_bytes, MPIR_Typerep_req * typerep_req)
{
MPIR_FUNC_ENTER;
int mpi_errno = MPI_SUCCESS;
mpi_errno = typerep_do_pack(inbuf, incount, datatype, inoffset, outbuf, max_pack_bytes,
actual_pack_bytes, typerep_req);
MPIR_FUNC_EXIT;
return mpi_errno;
}
int MPIR_Typerep_pack(const void *inbuf, MPI_Aint incount, MPI_Datatype datatype,
MPI_Aint inoffset, void *outbuf, MPI_Aint max_pack_bytes,
MPI_Aint * actual_pack_bytes)
{
MPIR_FUNC_ENTER;
int mpi_errno = MPI_SUCCESS;
mpi_errno = typerep_do_pack(inbuf, incount, datatype, inoffset, outbuf, max_pack_bytes,
actual_pack_bytes, NULL);
MPIR_FUNC_EXIT;
return mpi_errno;
}
int MPIR_Typerep_iunpack(const void *inbuf, MPI_Aint insize, void *outbuf, MPI_Aint outcount,
MPI_Datatype datatype, MPI_Aint outoffset, MPI_Aint * actual_unpack_bytes,
MPIR_Typerep_req * typerep_req)
{
MPIR_FUNC_ENTER;
int mpi_errno = MPI_SUCCESS;
mpi_errno = typerep_do_unpack(inbuf, insize, outbuf, outcount, datatype, outoffset,
actual_unpack_bytes, typerep_req);
MPIR_FUNC_EXIT;
return mpi_errno;
}
int MPIR_Typerep_unpack(const void *inbuf, MPI_Aint insize, void *outbuf, MPI_Aint outcount,
MPI_Datatype datatype, MPI_Aint outoffset, MPI_Aint * actual_unpack_bytes)
{
MPIR_FUNC_ENTER;
int mpi_errno = MPI_SUCCESS;
mpi_errno = typerep_do_unpack(inbuf, insize, outbuf, outcount, datatype, outoffset,
actual_unpack_bytes, NULL);
MPIR_FUNC_EXIT;
return mpi_errno;
}
int MPIR_Typerep_wait(MPIR_Typerep_req typerep_req)
{
MPIR_FUNC_ENTER;
int mpi_errno = MPI_SUCCESS;
int rc;
if (typerep_req == MPIR_TYPEREP_REQ_NULL)
goto fn_exit;
rc = yaksa_request_wait((yaksa_request_t) typerep_req);
MPIR_ERR_CHKANDJUMP(rc, mpi_errno, MPI_ERR_INTERN, "**yaksa");
fn_exit:
MPIR_FUNC_EXIT;
return mpi_errno;
fn_fail:
goto fn_exit;
}
/* MPIR_Typerep_op - accumulate source_buf onto target_buf with op.
* Assume (we may relax and extend in the future)
* - source datatype is predefined (basic or pairtype)
* - target datatype may be derived with the same basic type as source
* - op is builtin op
*/
static int typerep_op_unpack(void *source_buf, void *target_buf, MPI_Aint count,
MPI_Datatype datatype, MPI_Op op, int mapped_device);
static int typerep_op_pack(void *source_buf, void *target_buf, MPI_Aint count,
MPI_Datatype datatype, MPI_Op op, int mapped_device);
int MPIR_Typerep_reduce(const void *in_buf, void *out_buf, MPI_Aint count, MPI_Datatype datatype,
MPI_Op op)
{
int mpi_errno = MPI_SUCCESS;
MPIR_FUNC_ENTER;
mpi_errno = typerep_op_pack((void *) in_buf, out_buf, count, datatype, op, -1);
MPIR_ERR_CHECK(mpi_errno);
fn_exit:
MPIR_FUNC_EXIT;
return mpi_errno;
fn_fail:
goto fn_exit;
}
int MPIR_Typerep_op(void *source_buf, MPI_Aint source_count, MPI_Datatype source_dtp,
void *target_buf, MPI_Aint target_count, MPI_Datatype target_dtp, MPI_Op op,
bool source_is_packed, int mapped_device)
{
int mpi_errno = MPI_SUCCESS;
MPIR_FUNC_ENTER;
/* trivial cases */
if (op == MPI_NO_OP) {
goto fn_exit;
}
/* error checking */
MPIR_Assert(HANDLE_IS_BUILTIN(op));
MPIR_Assert(MPIR_DATATYPE_IS_PREDEFINED(source_dtp));
bool use_yaksa = MPIR_Typerep_reduce_is_supported(op, source_dtp);
if (use_yaksa) {
int source_is_contig, target_is_contig;
MPIR_Datatype_is_contig(source_dtp, &source_is_contig);
MPIR_Datatype_is_contig(target_dtp, &target_is_contig);
MPI_Aint true_extent, true_lb;
if (source_is_packed) {
mpi_errno = typerep_op_unpack(source_buf, target_buf, target_count, target_dtp,
op, mapped_device);
} else if (source_is_contig) {
MPIR_Type_get_true_extent_impl(source_dtp, &true_lb, &true_extent);
void *addr = MPIR_get_contig_ptr(source_buf, true_lb);
mpi_errno = typerep_op_unpack(addr, target_buf, target_count, target_dtp,
op, mapped_device);
} else if (target_is_contig) {
MPIR_Type_get_true_extent_impl(target_dtp, &true_lb, &true_extent);
void *addr = MPIR_get_contig_ptr(target_buf, true_lb);
mpi_errno = typerep_op_pack(source_buf, addr, source_count, source_dtp,
op, mapped_device);
} else {
MPI_Aint data_sz;
MPIR_Pack_size(source_count, source_dtp, &data_sz);
void *src_ptr = MPL_malloc(data_sz, MPL_MEM_OTHER);
MPI_Aint pack_size;
MPIR_Typerep_pack(source_buf, source_count, source_dtp, 0, src_ptr, data_sz,
&pack_size);
MPIR_Assert(pack_size == data_sz);
mpi_errno = typerep_op_unpack(src_ptr, target_buf, target_count, target_dtp,
op, mapped_device);
MPL_free(src_ptr);
}
} else {
mpi_errno = MPII_Typerep_op_fallback(source_buf, source_count, source_dtp,
target_buf, target_count, target_dtp,
op, source_is_packed);
}
MPIR_ERR_CHECK(mpi_errno);
fn_exit:
MPIR_FUNC_EXIT;
return mpi_errno;
fn_fail:
goto fn_exit;
}
static int typerep_op_unpack(void *source_buf, void *target_buf, MPI_Aint count,
MPI_Datatype datatype, MPI_Op op, int mapped_device)
{
int mpi_errno = MPI_SUCCESS;
int rc;
yaksa_type_t yaksa_type = MPII_Typerep_get_yaksa_type(datatype);
yaksa_op_t yaksa_op = MPII_Typerep_get_yaksa_op(op);
MPI_Aint data_sz;
MPIR_Pack_size(count, datatype, &data_sz);
yaksa_info_t info = NULL;
if (mapped_device >= 0) {
yaksa_info_create(&info);
rc = yaksa_info_keyval_append(info, "yaksa_mapped_device", &mapped_device, sizeof(int));
MPIR_Assert(rc == 0);
}
uintptr_t actual_bytes;
yaksa_request_t request;
rc = yaksa_iunpack(source_buf, data_sz, target_buf, count, yaksa_type, 0, &actual_bytes,
info, yaksa_op, &request);
MPIR_ERR_CHKANDJUMP(rc, mpi_errno, MPI_ERR_INTERN, "**yaksa");
rc = yaksa_request_wait(request);
MPIR_ERR_CHKANDJUMP(rc, mpi_errno, MPI_ERR_INTERN, "**yaksa");
MPIR_Assert(actual_bytes == data_sz);
fn_exit:
return mpi_errno;
fn_fail:
goto fn_exit;
}
static int typerep_op_pack(void *source_buf, void *target_buf, MPI_Aint count,
MPI_Datatype datatype, MPI_Op op, int mapped_device)
{
int mpi_errno = MPI_SUCCESS;
int rc;
yaksa_type_t yaksa_type = MPII_Typerep_get_yaksa_type(datatype);
yaksa_op_t yaksa_op = MPII_Typerep_get_yaksa_op(op);
MPI_Aint data_sz;
MPIR_Pack_size(count, datatype, &data_sz);
yaksa_info_t info = NULL;
if (mapped_device >= 0) {
yaksa_info_create(&info);
rc = yaksa_info_keyval_append(info, "yaksa_mapped_device", &mapped_device, sizeof(int));
MPIR_Assert(rc == 0);
}
uintptr_t actual_pack_bytes;
yaksa_request_t request;
rc = yaksa_ipack(source_buf, count, yaksa_type, 0, target_buf, data_sz, &actual_pack_bytes,
info, yaksa_op, &request);
MPIR_ERR_CHKANDJUMP(rc, mpi_errno, MPI_ERR_INTERN, "**yaksa");
rc = yaksa_request_wait(request);
MPIR_ERR_CHKANDJUMP(rc, mpi_errno, MPI_ERR_INTERN, "**yaksa");
MPIR_Assert(actual_pack_bytes == data_sz);
fn_exit:
return mpi_errno;
fn_fail:
goto fn_exit;
}