1 /* Copyright (c) 2007-2017. The SimGrid Team. All rights reserved. */
3 /* This program is free software; you can redistribute it and/or modify it
4 * under the terms of the license (GNU LGPL) which comes with this package. */
7 #include "smpi_coll.hpp"
8 #include "smpi_comm.hpp"
9 #include "smpi_datatype_derived.hpp"
10 #include "smpi_op.hpp"
11 #include "smpi_process.hpp"
12 #include "smpi_win.hpp"
14 XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(smpi_pmpi);
16 /* PMPI User level calls */
17 extern "C" { // Obviously, the C MPI interface should use the C linkage
19 int PMPI_Win_create( void *base, MPI_Aint size, int disp_unit, MPI_Info info, MPI_Comm comm, MPI_Win *win){
22 if (comm == MPI_COMM_NULL) {
24 }else if ((base == nullptr && size != 0) || disp_unit <= 0 || size < 0 ){
25 retval= MPI_ERR_OTHER;
27 *win = new simgrid::smpi::Win( base, size, disp_unit, info, comm);
34 int PMPI_Win_allocate( MPI_Aint size, int disp_unit, MPI_Info info, MPI_Comm comm, void *base, MPI_Win *win){
37 if (comm == MPI_COMM_NULL) {
39 }else if (disp_unit <= 0 || size < 0 ){
40 retval= MPI_ERR_OTHER;
42 void* ptr = xbt_malloc(size);
44 return MPI_ERR_NO_MEM;
45 *static_cast<void**>(base) = ptr;
46 *win = new simgrid::smpi::Win( ptr, size, disp_unit, info, comm,1);
53 int PMPI_Win_create_dynamic( MPI_Info info, MPI_Comm comm, MPI_Win *win){
56 if (comm == MPI_COMM_NULL) {
59 *win = new simgrid::smpi::Win(info, comm);
66 int PMPI_Win_attach(MPI_Win win, void *base, MPI_Aint size){
69 if(win == MPI_WIN_NULL){
71 } else if ((base == nullptr && size != 0) || size < 0 ){
72 retval= MPI_ERR_OTHER;
74 retval = win->attach(base, size);
80 int PMPI_Win_detach(MPI_Win win, void* base)
84 if(win == MPI_WIN_NULL){
86 } else if (base == nullptr){
87 retval= MPI_ERR_OTHER;
89 retval = win->detach(base);
96 int PMPI_Win_free( MPI_Win* win){
99 if (win == nullptr || *win == MPI_WIN_NULL) {
100 retval = MPI_ERR_WIN;
109 int PMPI_Win_set_name(MPI_Win win, char * name)
111 if (win == MPI_WIN_NULL) {
113 } else if (name == nullptr) {
121 int PMPI_Win_get_name(MPI_Win win, char * name, int* len)
123 if (win == MPI_WIN_NULL) {
125 } else if (name == nullptr) {
128 win->get_name(name, len);
133 int PMPI_Win_get_info(MPI_Win win, MPI_Info* info)
135 if (win == MPI_WIN_NULL) {
143 int PMPI_Win_set_info(MPI_Win win, MPI_Info info)
145 if (win == MPI_WIN_NULL) {
153 int PMPI_Win_get_group(MPI_Win win, MPI_Group * group){
154 if (win == MPI_WIN_NULL) {
157 win->get_group(group);
163 int PMPI_Win_fence( int assert, MPI_Win win){
166 if (win == MPI_WIN_NULL) {
167 retval = MPI_ERR_WIN;
169 int rank = smpi_process()->index();
170 TRACE_smpi_collective_in(rank, __FUNCTION__, nullptr);
171 retval = win->fence(assert);
172 TRACE_smpi_collective_out(rank);
178 int PMPI_Get( void *origin_addr, int origin_count, MPI_Datatype origin_datatype, int target_rank,
179 MPI_Aint target_disp, int target_count, MPI_Datatype target_datatype, MPI_Win win){
182 if (win == MPI_WIN_NULL) {
183 retval = MPI_ERR_WIN;
184 } else if (target_rank == MPI_PROC_NULL) {
185 retval = MPI_SUCCESS;
186 } else if (target_rank <0){
187 retval = MPI_ERR_RANK;
188 } else if (win->dynamic()==0 && target_disp <0){
189 //in case of dynamic window, target_disp can be mistakenly seen as negative, as it is an address
190 retval = MPI_ERR_ARG;
191 } else if ((origin_count < 0 || target_count < 0) ||
192 (origin_addr==nullptr && origin_count > 0)){
193 retval = MPI_ERR_COUNT;
194 } else if (((origin_datatype == MPI_DATATYPE_NULL) || (target_datatype == MPI_DATATYPE_NULL)) ||
195 ((not origin_datatype->is_valid()) || (not target_datatype->is_valid()))) {
196 retval = MPI_ERR_TYPE;
198 int rank = smpi_process()->index();
200 win->get_group(&group);
201 TRACE_smpi_ptp_in(rank, __FUNCTION__, nullptr);
203 retval = win->get( origin_addr, origin_count, origin_datatype, target_rank, target_disp, target_count,
206 TRACE_smpi_ptp_out(rank);
212 int PMPI_Rget( void *origin_addr, int origin_count, MPI_Datatype origin_datatype, int target_rank,
213 MPI_Aint target_disp, int target_count, MPI_Datatype target_datatype, MPI_Win win, MPI_Request* request){
216 if (win == MPI_WIN_NULL) {
217 retval = MPI_ERR_WIN;
218 } else if (target_rank == MPI_PROC_NULL) {
219 *request = MPI_REQUEST_NULL;
220 retval = MPI_SUCCESS;
221 } else if (target_rank <0){
222 retval = MPI_ERR_RANK;
223 } else if (win->dynamic()==0 && target_disp <0){
224 //in case of dynamic window, target_disp can be mistakenly seen as negative, as it is an address
225 retval = MPI_ERR_ARG;
226 } else if ((origin_count < 0 || target_count < 0) ||
227 (origin_addr==nullptr && origin_count > 0)){
228 retval = MPI_ERR_COUNT;
229 } else if (((origin_datatype == MPI_DATATYPE_NULL) || (target_datatype == MPI_DATATYPE_NULL)) ||
230 ((not origin_datatype->is_valid()) || (not target_datatype->is_valid()))) {
231 retval = MPI_ERR_TYPE;
232 } else if(request == nullptr){
233 retval = MPI_ERR_REQUEST;
235 int rank = smpi_process()->index();
237 win->get_group(&group);
238 TRACE_smpi_ptp_in(rank, __FUNCTION__, nullptr);
240 retval = win->get( origin_addr, origin_count, origin_datatype, target_rank, target_disp, target_count,
241 target_datatype, request);
243 TRACE_smpi_ptp_out(rank);
249 int PMPI_Put( void *origin_addr, int origin_count, MPI_Datatype origin_datatype, int target_rank,
250 MPI_Aint target_disp, int target_count, MPI_Datatype target_datatype, MPI_Win win){
253 if (win == MPI_WIN_NULL) {
254 retval = MPI_ERR_WIN;
255 } else if (target_rank == MPI_PROC_NULL) {
256 retval = MPI_SUCCESS;
257 } else if (target_rank <0){
258 retval = MPI_ERR_RANK;
259 } else if (win->dynamic()==0 && target_disp <0){
260 //in case of dynamic window, target_disp can be mistakenly seen as negative, as it is an address
261 retval = MPI_ERR_ARG;
262 } else if ((origin_count < 0 || target_count < 0) ||
263 (origin_addr==nullptr && origin_count > 0)){
264 retval = MPI_ERR_COUNT;
265 } else if (((origin_datatype == MPI_DATATYPE_NULL) || (target_datatype == MPI_DATATYPE_NULL)) ||
266 ((not origin_datatype->is_valid()) || (not target_datatype->is_valid()))) {
267 retval = MPI_ERR_TYPE;
269 int rank = smpi_process()->index();
271 win->get_group(&group);
272 int dst_traced = group->index(target_rank);
273 TRACE_smpi_ptp_in(rank, __FUNCTION__, nullptr);
274 TRACE_smpi_send(rank, rank, dst_traced, SMPI_RMA_TAG, origin_count*origin_datatype->size());
276 retval = win->put( origin_addr, origin_count, origin_datatype, target_rank, target_disp, target_count,
279 TRACE_smpi_ptp_out(rank);
285 int PMPI_Rput( void *origin_addr, int origin_count, MPI_Datatype origin_datatype, int target_rank,
286 MPI_Aint target_disp, int target_count, MPI_Datatype target_datatype, MPI_Win win, MPI_Request* request){
289 if (win == MPI_WIN_NULL) {
290 retval = MPI_ERR_WIN;
291 } else if (target_rank == MPI_PROC_NULL) {
292 *request = MPI_REQUEST_NULL;
293 retval = MPI_SUCCESS;
294 } else if (target_rank <0){
295 retval = MPI_ERR_RANK;
296 } else if (win->dynamic()==0 && target_disp <0){
297 //in case of dynamic window, target_disp can be mistakenly seen as negative, as it is an address
298 retval = MPI_ERR_ARG;
299 } else if ((origin_count < 0 || target_count < 0) ||
300 (origin_addr==nullptr && origin_count > 0)){
301 retval = MPI_ERR_COUNT;
302 } else if (((origin_datatype == MPI_DATATYPE_NULL) || (target_datatype == MPI_DATATYPE_NULL)) ||
303 ((not origin_datatype->is_valid()) || (not target_datatype->is_valid()))) {
304 retval = MPI_ERR_TYPE;
305 } else if(request == nullptr){
306 retval = MPI_ERR_REQUEST;
308 int rank = smpi_process()->index();
310 win->get_group(&group);
311 int dst_traced = group->index(target_rank);
312 TRACE_smpi_ptp_in(rank, __FUNCTION__, nullptr);
313 TRACE_smpi_send(rank, rank, dst_traced, SMPI_RMA_TAG, origin_count*origin_datatype->size());
315 retval = win->put( origin_addr, origin_count, origin_datatype, target_rank, target_disp, target_count,
316 target_datatype, request);
318 TRACE_smpi_ptp_out(rank);
324 int PMPI_Accumulate( void *origin_addr, int origin_count, MPI_Datatype origin_datatype, int target_rank,
325 MPI_Aint target_disp, int target_count, MPI_Datatype target_datatype, MPI_Op op, MPI_Win win){
328 if (win == MPI_WIN_NULL) {
329 retval = MPI_ERR_WIN;
330 } else if (target_rank == MPI_PROC_NULL) {
331 retval = MPI_SUCCESS;
332 } else if (target_rank <0){
333 retval = MPI_ERR_RANK;
334 } else if (win->dynamic()==0 && target_disp <0){
335 //in case of dynamic window, target_disp can be mistakenly seen as negative, as it is an address
336 retval = MPI_ERR_ARG;
337 } else if ((origin_count < 0 || target_count < 0) ||
338 (origin_addr==nullptr && origin_count > 0)){
339 retval = MPI_ERR_COUNT;
340 } else if (((origin_datatype == MPI_DATATYPE_NULL) || (target_datatype == MPI_DATATYPE_NULL)) ||
341 ((not origin_datatype->is_valid()) || (not target_datatype->is_valid()))) {
342 retval = MPI_ERR_TYPE;
343 } else if (op == MPI_OP_NULL) {
346 int rank = smpi_process()->index();
348 win->get_group(&group);
349 TRACE_smpi_ptp_in(rank, __FUNCTION__, nullptr);
350 retval = win->accumulate( origin_addr, origin_count, origin_datatype, target_rank, target_disp, target_count,
351 target_datatype, op);
353 TRACE_smpi_ptp_out(rank);
359 int PMPI_Raccumulate( void *origin_addr, int origin_count, MPI_Datatype origin_datatype, int target_rank,
360 MPI_Aint target_disp, int target_count, MPI_Datatype target_datatype, MPI_Op op, MPI_Win win, MPI_Request* request){
363 if (win == MPI_WIN_NULL) {
364 retval = MPI_ERR_WIN;
365 } else if (target_rank == MPI_PROC_NULL) {
366 *request = MPI_REQUEST_NULL;
367 retval = MPI_SUCCESS;
368 } else if (target_rank <0){
369 retval = MPI_ERR_RANK;
370 } else if (win->dynamic()==0 && target_disp <0){
371 //in case of dynamic window, target_disp can be mistakenly seen as negative, as it is an address
372 retval = MPI_ERR_ARG;
373 } else if ((origin_count < 0 || target_count < 0) ||
374 (origin_addr==nullptr && origin_count > 0)){
375 retval = MPI_ERR_COUNT;
376 } else if (((origin_datatype == MPI_DATATYPE_NULL) || (target_datatype == MPI_DATATYPE_NULL)) ||
377 ((not origin_datatype->is_valid()) || (not target_datatype->is_valid()))) {
378 retval = MPI_ERR_TYPE;
379 } else if (op == MPI_OP_NULL) {
381 } else if(request == nullptr){
382 retval = MPI_ERR_REQUEST;
384 int rank = smpi_process()->index();
386 win->get_group(&group);
387 TRACE_smpi_ptp_in(rank, __FUNCTION__, nullptr);
389 retval = win->accumulate( origin_addr, origin_count, origin_datatype, target_rank, target_disp, target_count,
390 target_datatype, op, request);
392 TRACE_smpi_ptp_out(rank);
398 int PMPI_Get_accumulate(void *origin_addr, int origin_count, MPI_Datatype origin_datatype, void *result_addr,
399 int result_count, MPI_Datatype result_datatype, int target_rank, MPI_Aint target_disp, int target_count,
400 MPI_Datatype target_datatype, MPI_Op op, MPI_Win win){
403 if (win == MPI_WIN_NULL) {
404 retval = MPI_ERR_WIN;
405 } else if (target_rank == MPI_PROC_NULL) {
406 retval = MPI_SUCCESS;
407 } else if (target_rank <0){
408 retval = MPI_ERR_RANK;
409 } else if (win->dynamic()==0 && target_disp <0){
410 //in case of dynamic window, target_disp can be mistakenly seen as negative, as it is an address
411 retval = MPI_ERR_ARG;
412 } else if ((origin_count < 0 || target_count < 0 || result_count <0) ||
413 (origin_addr==nullptr && origin_count > 0 && op != MPI_NO_OP) ||
414 (result_addr==nullptr && result_count > 0)){
415 retval = MPI_ERR_COUNT;
416 } else if (((target_datatype == MPI_DATATYPE_NULL) || (result_datatype == MPI_DATATYPE_NULL)) ||
417 (((origin_datatype != MPI_DATATYPE_NULL) && (not origin_datatype->is_valid())) || (not target_datatype->is_valid()) || (not result_datatype->is_valid()))) {
418 retval = MPI_ERR_TYPE;
419 } else if (op == MPI_OP_NULL) {
422 int rank = smpi_process()->index();
424 win->get_group(&group);
425 TRACE_smpi_ptp_in(rank, __FUNCTION__, nullptr);
427 retval = win->get_accumulate( origin_addr, origin_count, origin_datatype, result_addr,
428 result_count, result_datatype, target_rank, target_disp,
429 target_count, target_datatype, op);
431 TRACE_smpi_ptp_out(rank);
438 int PMPI_Rget_accumulate(void *origin_addr, int origin_count, MPI_Datatype origin_datatype, void *result_addr,
439 int result_count, MPI_Datatype result_datatype, int target_rank, MPI_Aint target_disp, int target_count,
440 MPI_Datatype target_datatype, MPI_Op op, MPI_Win win, MPI_Request* request){
443 if (win == MPI_WIN_NULL) {
444 retval = MPI_ERR_WIN;
445 } else if (target_rank == MPI_PROC_NULL) {
446 *request = MPI_REQUEST_NULL;
447 retval = MPI_SUCCESS;
448 } else if (target_rank <0){
449 retval = MPI_ERR_RANK;
450 } else if (win->dynamic()==0 && target_disp <0){
451 //in case of dynamic window, target_disp can be mistakenly seen as negative, as it is an address
452 retval = MPI_ERR_ARG;
453 } else if ((origin_count < 0 || target_count < 0 || result_count <0) ||
454 (origin_addr==nullptr && origin_count > 0 && op != MPI_NO_OP) ||
455 (result_addr==nullptr && result_count > 0)){
456 retval = MPI_ERR_COUNT;
457 } else if (((target_datatype == MPI_DATATYPE_NULL) || (result_datatype == MPI_DATATYPE_NULL)) ||
458 (((origin_datatype != MPI_DATATYPE_NULL) && (not origin_datatype->is_valid())) || (not target_datatype->is_valid()) || (not result_datatype->is_valid()))) {
459 retval = MPI_ERR_TYPE;
460 } else if (op == MPI_OP_NULL) {
462 } else if(request == nullptr){
463 retval = MPI_ERR_REQUEST;
465 int rank = smpi_process()->index();
467 win->get_group(&group);
468 TRACE_smpi_ptp_in(rank, __FUNCTION__, nullptr);
470 retval = win->get_accumulate( origin_addr, origin_count, origin_datatype, result_addr,
471 result_count, result_datatype, target_rank, target_disp,
472 target_count, target_datatype, op, request);
474 TRACE_smpi_ptp_out(rank);
480 int PMPI_Fetch_and_op(void *origin_addr, void *result_addr, MPI_Datatype dtype, int target_rank, MPI_Aint target_disp, MPI_Op op, MPI_Win win){
481 return PMPI_Get_accumulate(origin_addr, origin_addr==nullptr?0:1, dtype, result_addr, 1, dtype, target_rank, target_disp, 1, dtype, op, win);
484 int PMPI_Compare_and_swap(void* origin_addr, void* compare_addr, void* result_addr, MPI_Datatype datatype,
485 int target_rank, MPI_Aint target_disp, MPI_Win win)
489 if (win == MPI_WIN_NULL) {
490 retval = MPI_ERR_WIN;
491 } else if (target_rank == MPI_PROC_NULL) {
492 retval = MPI_SUCCESS;
493 } else if (target_rank <0){
494 retval = MPI_ERR_RANK;
495 } else if (win->dynamic()==0 && target_disp <0){
496 //in case of dynamic window, target_disp can be mistakenly seen as negative, as it is an address
497 retval = MPI_ERR_ARG;
498 } else if (origin_addr==nullptr || result_addr==nullptr || compare_addr==nullptr){
499 retval = MPI_ERR_COUNT;
500 } else if ((datatype == MPI_DATATYPE_NULL) || (not datatype->is_valid())) {
501 retval = MPI_ERR_TYPE;
503 int rank = smpi_process()->index();
505 win->get_group(&group);
506 TRACE_smpi_ptp_in(rank, __FUNCTION__, nullptr);
508 retval = win->compare_and_swap(origin_addr, compare_addr, result_addr, datatype, target_rank, target_disp);
510 TRACE_smpi_ptp_out(rank);
516 int PMPI_Win_post(MPI_Group group, int assert, MPI_Win win){
519 if (win == MPI_WIN_NULL) {
520 retval = MPI_ERR_WIN;
521 } else if (group==MPI_GROUP_NULL){
522 retval = MPI_ERR_GROUP;
524 int rank = smpi_process()->index();
525 TRACE_smpi_collective_in(rank, __FUNCTION__, nullptr);
526 retval = win->post(group,assert);
527 TRACE_smpi_collective_out(rank);
533 int PMPI_Win_start(MPI_Group group, int assert, MPI_Win win){
536 if (win == MPI_WIN_NULL) {
537 retval = MPI_ERR_WIN;
538 } else if (group==MPI_GROUP_NULL){
539 retval = MPI_ERR_GROUP;
541 int rank = smpi_process()->index();
542 TRACE_smpi_collective_in(rank, __FUNCTION__, nullptr);
543 retval = win->start(group,assert);
544 TRACE_smpi_collective_out(rank);
550 int PMPI_Win_complete(MPI_Win win){
553 if (win == MPI_WIN_NULL) {
554 retval = MPI_ERR_WIN;
556 int rank = smpi_process()->index();
557 TRACE_smpi_collective_in(rank, __FUNCTION__, nullptr);
559 retval = win->complete();
561 TRACE_smpi_collective_out(rank);
567 int PMPI_Win_wait(MPI_Win win){
570 if (win == MPI_WIN_NULL) {
571 retval = MPI_ERR_WIN;
573 int rank = smpi_process()->index();
574 TRACE_smpi_collective_in(rank, __FUNCTION__, nullptr);
576 retval = win->wait();
578 TRACE_smpi_collective_out(rank);
584 int PMPI_Win_lock(int lock_type, int rank, int assert, MPI_Win win){
587 if (win == MPI_WIN_NULL) {
588 retval = MPI_ERR_WIN;
589 } else if (lock_type != MPI_LOCK_EXCLUSIVE &&
590 lock_type != MPI_LOCK_SHARED) {
591 retval = MPI_ERR_LOCKTYPE;
592 } else if (rank == MPI_PROC_NULL){
593 retval = MPI_SUCCESS;
595 int myrank = smpi_process()->index();
596 TRACE_smpi_collective_in(myrank, __FUNCTION__, nullptr);
597 retval = win->lock(lock_type,rank,assert);
598 TRACE_smpi_collective_out(myrank);
604 int PMPI_Win_unlock(int rank, MPI_Win win){
607 if (win == MPI_WIN_NULL) {
608 retval = MPI_ERR_WIN;
609 } else if (rank == MPI_PROC_NULL){
610 retval = MPI_SUCCESS;
612 int myrank = smpi_process()->index();
613 TRACE_smpi_collective_in(myrank, __FUNCTION__, nullptr);
614 retval = win->unlock(rank);
615 TRACE_smpi_collective_out(myrank);
621 int PMPI_Win_lock_all(int assert, MPI_Win win){
624 if (win == MPI_WIN_NULL) {
625 retval = MPI_ERR_WIN;
627 int myrank = smpi_process()->index();
628 TRACE_smpi_collective_in(myrank, __FUNCTION__, nullptr);
629 retval = win->lock_all(assert);
630 TRACE_smpi_collective_out(myrank);
636 int PMPI_Win_unlock_all(MPI_Win win){
639 if (win == MPI_WIN_NULL) {
640 retval = MPI_ERR_WIN;
642 int myrank = smpi_process()->index();
643 TRACE_smpi_collective_in(myrank, __FUNCTION__, nullptr);
644 retval = win->unlock_all();
645 TRACE_smpi_collective_out(myrank);
651 int PMPI_Win_flush(int rank, MPI_Win win){
654 if (win == MPI_WIN_NULL) {
655 retval = MPI_ERR_WIN;
656 } else if (rank == MPI_PROC_NULL){
657 retval = MPI_SUCCESS;
659 int myrank = smpi_process()->index();
660 TRACE_smpi_collective_in(myrank, __FUNCTION__, nullptr);
661 retval = win->flush(rank);
662 TRACE_smpi_collective_out(myrank);
668 int PMPI_Win_flush_local(int rank, MPI_Win win){
671 if (win == MPI_WIN_NULL) {
672 retval = MPI_ERR_WIN;
673 } else if (rank == MPI_PROC_NULL){
674 retval = MPI_SUCCESS;
676 int myrank = smpi_process()->index();
677 TRACE_smpi_collective_in(myrank, __FUNCTION__, nullptr);
678 retval = win->flush_local(rank);
679 TRACE_smpi_collective_out(myrank);
685 int PMPI_Win_flush_all(MPI_Win win){
688 if (win == MPI_WIN_NULL) {
689 retval = MPI_ERR_WIN;
691 int myrank = smpi_process()->index();
692 TRACE_smpi_collective_in(myrank, __FUNCTION__, nullptr);
693 retval = win->flush_all();
694 TRACE_smpi_collective_out(myrank);
700 int PMPI_Win_flush_local_all(MPI_Win win){
703 if (win == MPI_WIN_NULL) {
704 retval = MPI_ERR_WIN;
706 int myrank = smpi_process()->index();
707 TRACE_smpi_collective_in(myrank, __FUNCTION__, nullptr);
708 retval = win->flush_local_all();
709 TRACE_smpi_collective_out(myrank);
716 int PMPI_Win_get_attr (MPI_Win win, int keyval, void *attribute_val, int* flag)
718 static MPI_Aint size;
719 static int disp_unit;
720 if (win==MPI_WIN_NULL)
725 *static_cast<void**>(attribute_val) = win->base();
730 *static_cast<MPI_Aint**>(attribute_val) = &size;
733 case MPI_WIN_DISP_UNIT :
734 disp_unit=win->disp_unit();
735 *static_cast<int**>(attribute_val) = &disp_unit;
739 return win->attr_get<simgrid::smpi::Win>(keyval, attribute_val, flag);
745 int PMPI_Win_set_attr (MPI_Win win, int type_keyval, void *attribute_val)
747 if (win==MPI_WIN_NULL)
750 return win->attr_put<simgrid::smpi::Win>(type_keyval, attribute_val);
753 int PMPI_Win_delete_attr (MPI_Win win, int type_keyval)
755 if (win==MPI_WIN_NULL)
758 return win->attr_delete<simgrid::smpi::Win>(type_keyval);
761 int PMPI_Win_create_keyval(MPI_Win_copy_attr_function* copy_fn, MPI_Win_delete_attr_function* delete_fn, int* keyval,
764 smpi_copy_fn _copy_fn={nullptr, nullptr, copy_fn};
765 smpi_delete_fn _delete_fn={nullptr, nullptr, delete_fn};
766 return simgrid::smpi::Keyval::keyval_create<simgrid::smpi::Win>(_copy_fn, _delete_fn, keyval, extra_state);
769 int PMPI_Win_free_keyval(int* keyval) {
770 return simgrid::smpi::Keyval::keyval_free<simgrid::smpi::Win>(keyval);
773 MPI_Win PMPI_Win_f2c(MPI_Fint win){
774 return static_cast<MPI_Win>(simgrid::smpi::Win::f2c(win));
777 MPI_Fint PMPI_Win_c2f(MPI_Win win){