This source file includes following definitions.
- ADIOI_LUSTRE_SetInfo
1
2
3
4
5
6
7
8
9
10
11 #include "ad_lustre.h"
12 #include "adio_extern.h"
13 #include "hint_fns.h"
14 #ifdef HAVE_LIMITS_H
15 #include <limits.h>
16 #endif
17
18 void ADIOI_LUSTRE_SetInfo(ADIO_File fd, MPI_Info users_info, int *error_code)
19 {
20 char *value;
21 int flag;
22 ADIO_Offset stripe_val[3], str_factor = -1, str_unit=0, start_iodev=-1;
23 int myrank;
24 static char myname[] = "ADIOI_LUSTRE_SETINFO";
25
26 value = (char *) ADIOI_Malloc((MPI_MAX_INFO_VAL+1)*sizeof(char));
27 if ( (fd->info) == MPI_INFO_NULL) {
28
29
30 MPI_Info_create(&(fd->info));
31
32 ADIOI_Info_set(fd->info, "direct_read", "false");
33 ADIOI_Info_set(fd->info, "direct_write", "false");
34 fd->direct_read = fd->direct_write = 0;
35
36 ADIOI_Info_set(fd->info, "romio_lustre_co_ratio", "1");
37 fd->hints->fs_hints.lustre.co_ratio = 1;
38 ADIOI_Info_set(fd->info, "romio_lustre_coll_threshold", "0");
39 fd->hints->fs_hints.lustre.coll_threshold = 0;
40 ADIOI_Info_set(fd->info, "romio_lustre_ds_in_coll", "enable");
41 fd->hints->fs_hints.lustre.ds_in_coll = ADIOI_HINT_ENABLE;
42
43
44
45 if (users_info != MPI_INFO_NULL) {
46
47 ADIOI_Info_get(users_info, "striping_unit", MPI_MAX_INFO_VAL,
48 value, &flag);
49 if (flag) {
50 ADIOI_Info_set(fd->info, "striping_unit", value);
51 str_unit=atoll(value);
52 }
53
54 ADIOI_Info_get(users_info, "striping_factor", MPI_MAX_INFO_VAL,
55 value, &flag);
56 if (flag) {
57 ADIOI_Info_set(fd->info, "striping_factor", value);
58 str_factor=atoll(value);
59 }
60
61 ADIOI_Info_get(users_info, "romio_lustre_start_iodevice",
62 MPI_MAX_INFO_VAL, value, &flag);
63 if (flag) {
64 ADIOI_Info_set(fd->info, "romio_lustre_start_iodevice", value);
65 start_iodev=atoll(value);
66 }
67
68
69
70 ADIOI_Info_get(users_info, "direct_read", MPI_MAX_INFO_VAL,
71 value, &flag);
72 if (flag && (!strcmp(value, "true") || !strcmp(value, "TRUE"))) {
73 ADIOI_Info_set(fd->info, "direct_read", "true");
74 fd->direct_read = 1;
75 }
76 ADIOI_Info_get(users_info, "direct_write", MPI_MAX_INFO_VAL,
77 value, &flag);
78 if (flag && (!strcmp(value, "true") || !strcmp(value, "TRUE"))) {
79 ADIOI_Info_set(fd->info, "direct_write", "true");
80 fd->direct_write = 1;
81 }
82 }
83
84
85 MPI_Comm_rank(fd->comm, &myrank);
86 if (myrank == 0) {
87 stripe_val[0] = str_factor;
88 stripe_val[1] = str_unit;
89 stripe_val[2] = start_iodev;
90 }
91 MPI_Bcast(stripe_val, 3, MPI_OFFSET, 0, fd->comm);
92
93
94
95
96 if (stripe_val[0] != str_factor
97 || stripe_val[1] != str_unit
98 || stripe_val[2] != start_iodev) {
99 MPIO_ERR_CREATE_CODE_INFO_NOT_SAME("ADIOI_LUSTRE_SetInfo",
100 "str_factor or str_unit or start_iodev",
101 error_code);
102 ADIOI_Free(value);
103 return;
104 }
105 }
106
107
108 if (users_info != MPI_INFO_NULL) {
109
110
111 ADIOI_Info_check_and_install_int(fd, users_info, "romio_lustre_co_ratio",
112 &(fd->hints->fs_hints.lustre.co_ratio), myname, error_code );
113
114
115
116
117 ADIOI_Info_check_and_install_int(fd, users_info, "romio_lustre_coll_threshold",
118 &(fd->hints->fs_hints.lustre.coll_threshold), myname, error_code );
119
120
121 ADIOI_Info_check_and_install_enabled(fd, users_info, "romio_lustre_ds_in_coll",
122 &(fd->hints->fs_hints.lustre.ds_in_coll), myname, error_code );
123
124 }
125
126 ADIOI_GEN_SetInfo(fd, users_info, error_code);
127
128
129 if (users_info != MPI_INFO_NULL) {
130 ADIOI_Info_check_and_install_int(fd, users_info, "striping_unit",
131 NULL, myname, error_code);
132 }
133
134 if (ADIOI_Direct_read) fd->direct_read = 1;
135 if (ADIOI_Direct_write) fd->direct_write = 1;
136
137 ADIOI_Free(value);
138
139 *error_code = MPI_SUCCESS;
140 }