1 /*
2  * Copyright (C) by Argonne National Laboratory
3  *     See COPYRIGHT in top-level directory
4  */
5 
6 #include <stdlib.h>
7 #include "ad_pvfs2.h"
8 
9 #include "hint_fns.h"
10 
ADIOI_PVFS2_SetInfo(ADIO_File fd,MPI_Info users_info,int * error_code)11 void ADIOI_PVFS2_SetInfo(ADIO_File fd, MPI_Info users_info, int *error_code)
12 {
13     char *value;
14     int flag, tmp_value;
15     static char myname[] = "ADIOI_PVFS_SETINFO";
16 
17     if ((fd->info) == MPI_INFO_NULL) {
18         /* part of the open call */
19         MPI_Info_create(&(fd->info));
20         ADIOI_Info_set(fd->info, "romio_pvfs2_debugmask", "0");
21         fd->hints->fs_hints.pvfs2.debugmask = 0;
22 
23         ADIOI_Info_set(fd->info, "striping_factor", "0");
24         fd->hints->striping_factor = 0;
25 
26         ADIOI_Info_set(fd->info, "striping_unit", "0");
27         fd->hints->striping_unit = 0;
28 
29         /* disable the aggressive strided optimizations by default */
30         ADIOI_Info_set(fd->info, "romio_pvfs2_posix_read", "disable");
31         ADIOI_Info_set(fd->info, "romio_pvfs2_posix_write", "disable");
32         fd->hints->fs_hints.pvfs2.posix_read = ADIOI_HINT_DISABLE;
33         fd->hints->fs_hints.pvfs2.posix_write = ADIOI_HINT_DISABLE;
34 
35         ADIOI_Info_set(fd->info, "romio_pvfs2_dtype_read", "disable");
36         ADIOI_Info_set(fd->info, "romio_pvfs2_dtype_write", "disable");
37         fd->hints->fs_hints.pvfs2.dtype_read = ADIOI_HINT_DISABLE;
38         fd->hints->fs_hints.pvfs2.dtype_write = ADIOI_HINT_DISABLE;
39 
40         ADIOI_Info_set(fd->info, "romio_pvfs2_listio_read", "disable");
41         ADIOI_Info_set(fd->info, "romio_pvfs2_listio_write", "disable");
42         fd->hints->fs_hints.pvfs2.listio_read = ADIOI_HINT_DISABLE;
43         fd->hints->fs_hints.pvfs2.listio_write = ADIOI_HINT_DISABLE;
44 
45 
46         /* any user-provided hints? */
47         if (users_info != MPI_INFO_NULL) {
48             value = (char *) ADIOI_Malloc((MPI_MAX_INFO_VAL + 1) * sizeof(char));
49             /* pvfs2 debugging */
50             ADIOI_Info_get(users_info, "romio_pvfs2_debugmask", MPI_MAX_INFO_VAL, value, &flag);
51             if (flag) {
52                 tmp_value = fd->hints->fs_hints.pvfs2.debugmask =
53                     PVFS_debug_eventlog_to_mask(value);
54 
55                 MPI_Bcast(&tmp_value, 1, MPI_INT, 0, fd->comm);
56                 /* --BEGIN ERROR HANDLING-- */
57                 if (tmp_value != fd->hints->fs_hints.pvfs2.debugmask) {
58                     MPIO_ERR_CREATE_CODE_INFO_NOT_SAME(myname, "romio_pvfs2_debugmask", error_code);
59                     return;
60                 }
61                 /* --END ERROR HANDLING-- */
62 
63                 ADIOI_Info_set(fd->info, "romio_pvfs2_debugmask", value);
64             }
65 
66             /* the striping factor */
67             ADIOI_Info_check_and_install_int(fd, users_info, "striping_factor",
68                                              &(fd->hints->striping_factor), myname, error_code);
69 
70 
71             /* the striping unit */
72             ADIOI_Info_check_and_install_int(fd, users_info, "striping_unit",
73                                              &(fd->hints->striping_unit), myname, error_code);
74 
75             /* distribution name */
76             ADIOI_Info_get(users_info, "romio_pvfs2_distribution_name",
77                            MPI_MAX_INFO_VAL, value, &flag);
78             if (flag) {
79             }
80 
81             /* POSIX read */
82             ADIOI_Info_check_and_install_enabled(fd, users_info, "romio_pvfs2_posix_read",
83                                                  &(fd->hints->fs_hints.pvfs2.posix_read), myname,
84                                                  error_code);
85 
86             /* POSIX write */
87             ADIOI_Info_check_and_install_enabled(fd, users_info, "romio_pvfs2_posix_write",
88                                                  &(fd->hints->fs_hints.pvfs2.posix_write), myname,
89                                                  error_code);
90 
91             /* Datatype read */
92             ADIOI_Info_check_and_install_enabled(fd, users_info, "romio_pvfs2_dtype_read",
93                                                  &(fd->hints->fs_hints.pvfs2.dtype_read), myname,
94                                                  error_code);
95 
96             /* Datatype write */
97             ADIOI_Info_check_and_install_enabled(fd, users_info, "romio_pvfs2_dtype_write",
98                                                  &(fd->hints->fs_hints.pvfs2.dtype_write), myname,
99                                                  error_code);
100 
101             /* Listio read */
102             ADIOI_Info_check_and_install_enabled(fd, users_info, "romio_pvfs2_listio_read",
103                                                  &(fd->hints->fs_hints.pvfs2.listio_read), myname,
104                                                  error_code);
105 
106             /* Datatype write */
107             ADIOI_Info_check_and_install_enabled(fd, users_info, "romio_pvfs2_listio_write",
108                                                  &(fd->hints->fs_hints.pvfs2.listio_write), myname,
109                                                  error_code);
110             ADIOI_Free(value);
111         }
112     }
113     /* set the values for collective I/O and data sieving parameters */
114     ADIOI_GEN_SetInfo(fd, users_info, error_code);
115 
116     *error_code = MPI_SUCCESS;
117 }
118