forked from jeffhammond/foMPI
-
Notifications
You must be signed in to change notification settings - Fork 1
/
fompi_win_attr.c
77 lines (60 loc) · 2.12 KB
/
fompi_win_attr.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
// Copyright (c) 2012 The Trustees of University of Illinois. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include <stdio.h>
#include "fompi.h"
int foMPI_Win_create_keyval(MPI_Win_copy_attr_function *win_copy_attr_fn, MPI_Win_delete_attr_function *win_delete_attr_fn, int *win_keyval, void *extra_state) {
printf("foMPI doesn't support MPI_Win_create_keyval at the moment.\n");
return MPI_ERR_KEYVAL; /* TODO: Not consistent with the MPI-3.0 standard. */
}
int foMPI_Win_free_keyval(int *win_keyval) {
printf("foMPI doesn't support MPI_Win_free_keyval at the moment.\n");
return MPI_ERR_KEYVAL;
}
int foMPI_Win_set_attr(foMPI_Win win, int win_keyval, void *attribute_val) {
printf("foMPI doesn't support MPI_Win_set_attr at the moment.\n");
return MPI_ERR_KEYVAL;
}
int foMPI_Win_get_attr(foMPI_Win win, int win_keyval, void *attribute_val, int *flag) {
switch (win_keyval) {
case foMPI_WIN_BASE:
if( win->create_flavor == foMPI_WIN_FLAVOR_DYNAMIC) {
*(void**)attribute_val = MPI_BOTTOM;
} else {
*(void**)attribute_val = win->win_array[win->commrank].base;
}
*flag = 1;
break;
case foMPI_WIN_SIZE:
if( win->create_flavor == foMPI_WIN_FLAVOR_DYNAMIC) {
*(MPI_Aint*)attribute_val = 0;
} else {
*(MPI_Aint*)attribute_val = win->win_array[win->commrank].size;
}
*flag = 1;
break;
case foMPI_WIN_DISP_UNIT:
if( win->create_flavor == foMPI_WIN_FLAVOR_DYNAMIC) {
*(int*)attribute_val = 1;
} else {
*(int*)attribute_val = win->win_array[win->commrank].disp_unit;
}
*flag = 1;
break;
case foMPI_WIN_CREATE_FLAVOR:
*(int*) attribute_val = win->create_flavor;
*flag = 1;
break;
case foMPI_WIN_MODEL:
*(int*)attribute_val = foMPI_WIN_UNIFIED;
*flag = 1;
break;
default:
*flag = 0;
}
return MPI_SUCCESS;
}
int foMPI_Win_delete_attr(foMPI_Win win, int win_keyval) {
printf("foMPI doesn't support MPI_Win_delete_attr at the moment.\n");
return MPI_ERR_KEYVAL;
}