Skip to content

Commit 14e3d7b

Browse files
committed
romio info: letting romio keep its internal setup
I'm restoring the info function pointers to the IO module but allowing the function pointers to be NULL (eg in ompio). And letting romio321 set its function pointers for those routines. This means the info system uses the new OMPI-level info system for most things, but skips it and uses the pre-existing romio info system just for the romio module. It's possible to convert romio, but I went a ways down that path and found it kind of convoluted. Having pointers from the lower level ADIO_File back to the higher level ompi_file_t wasn't too bad, but I got stuck trying to figure out where/how to register the infosubscribe_subscribe callbacks vs the way initial k/v values are scattered around the romio code currently. Signed-off-by: Mark Allen <[email protected]>
1 parent f1a065f commit 14e3d7b

File tree

7 files changed

+59
-32
lines changed

7 files changed

+59
-32
lines changed

ompi/mca/io/io.h

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
* Copyright (c) 2015 University of Houston. All rights reserved.
1717
* Copyright (c) 2015 Research Organization for Information Science
1818
* and Technology (RIST). All rights reserved.
19-
* Copyright (c) 2016-2017 IBM Corporation. All rights reserved.
19+
* Copyright (c) 2016-2019 IBM Corporation. All rights reserved.
2020
* $COPYRIGHT$
2121
*
2222
* Additional copyrights may follow
@@ -153,6 +153,10 @@ typedef int (*mca_io_base_module_file_get_size_fn_t)
153153
(struct ompi_file_t *fh, MPI_Offset *size);
154154
typedef int (*mca_io_base_module_file_get_amode_fn_t)
155155
(struct ompi_file_t *fh, int *amode);
156+
typedef int (*mca_io_base_module_file_set_info_fn_t)
157+
(struct ompi_file_t *fh, struct ompi_info_t *info);
158+
typedef int (*mca_io_base_module_file_get_info_fn_t)
159+
(struct ompi_file_t *fh, struct ompi_info_t **info_used);
156160

157161
typedef int (*mca_io_base_module_file_set_view_fn_t)
158162
(struct ompi_file_t *fh, MPI_Offset disp, struct ompi_datatype_t *etype,
@@ -307,6 +311,8 @@ struct mca_io_base_module_2_0_0_t {
307311
mca_io_base_module_file_preallocate_fn_t io_module_file_preallocate;
308312
mca_io_base_module_file_get_size_fn_t io_module_file_get_size;
309313
mca_io_base_module_file_get_amode_fn_t io_module_file_get_amode;
314+
mca_io_base_module_file_set_info_fn_t io_module_file_set_info;
315+
mca_io_base_module_file_get_info_fn_t io_module_file_get_info;
310316

311317
mca_io_base_module_file_set_view_fn_t io_module_file_set_view;
312318
mca_io_base_module_file_get_view_fn_t io_module_file_get_view;

ompi/mca/io/ompio/io_ompio_module.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
* Copyright (c) 2004-2005 The Regents of the University of California.
1111
* All rights reserved.
1212
* Copyright (c) 2008-2011 University of Houston. All rights reserved.
13-
* Copyright (c) 2016-2017 IBM Corporation. All rights reserved.
13+
* Copyright (c) 2016-2019 IBM Corporation. All rights reserved.
1414
* $COPYRIGHT$
1515
*
1616
* Additional copyrights may follow
@@ -36,6 +36,8 @@ mca_io_base_module_2_0_0_t mca_io_ompio_module = {
3636
mca_io_ompio_file_preallocate,
3737
mca_io_ompio_file_get_size,
3838
mca_io_ompio_file_get_amode,
39+
NULL,
40+
NULL,
3941

4042
mca_io_ompio_file_set_view,
4143
mca_io_ompio_file_get_view,

ompi/mca/io/romio321/src/io_romio321.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
* Copyright (c) 2008 Sun Microsystems, Inc. All rights reserved.
1313
* Copyright (c) 2015-2017 Research Organization for Information Science
1414
* and Technology (RIST). All rights reserved.
15-
* Copyright (c) 2016-2017 IBM Corporation. All rights reserved.
15+
* Copyright (c) 2016-2019 IBM Corporation. All rights reserved.
1616
* $COPYRIGHT$
1717
*
1818
* Additional copyrights may follow
@@ -81,9 +81,9 @@ int mca_io_romio321_file_get_size (struct ompi_file_t *fh,
8181
int mca_io_romio321_file_get_amode (struct ompi_file_t *fh,
8282
int *amode);
8383
int mca_io_romio321_file_set_info (struct ompi_file_t *fh,
84-
struct opal_info_t *info);
84+
struct ompi_info_t *info);
8585
int mca_io_romio321_file_get_info (struct ompi_file_t *fh,
86-
struct opal_info_t ** info_used);
86+
struct ompi_info_t ** info_used);
8787

8888
/* Section 9.3 */
8989
int mca_io_romio321_file_set_view (struct ompi_file_t *fh,

ompi/mca/io/romio321/src/io_romio321_file_open.c

Lines changed: 5 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
* All rights reserved.
1212
* Copyright (c) 2015-2017 Research Organization for Information Science
1313
* and Technology (RIST). All rights reserved.
14-
* Copyright (c) 2016-2017 IBM Corporation. All rights reserved.
14+
* Copyright (c) 2016-2019 IBM Corporation. All rights reserved.
1515
* $COPYRIGHT$
1616
*
1717
* Additional copyrights may follow
@@ -162,51 +162,32 @@ mca_io_romio321_file_get_amode (ompi_file_t *fh,
162162

163163
int
164164
mca_io_romio321_file_set_info (ompi_file_t *fh,
165-
opal_info_t *info)
165+
ompi_info_t *info)
166166
{
167167
int ret;
168168
mca_io_romio321_data_t *data;
169169

170-
// An opal_info_t isn't a full ompi_info_t. so if we're using an MPI call
171-
// below with an MPI_Info, we need to create an equivalent MPI_Info. This
172-
// isn't ideal but it only happens a few places.
173-
ompi_info_t *ompi_info;
174-
ompi_info = OBJ_NEW(ompi_info_t);
175-
if (!ompi_info) { return(MPI_ERR_NO_MEM); }
176-
opal_info_t *opal_info = &(ompi_info->super);
177-
opal_info_dup (info, &opal_info);
178-
179170
data = (mca_io_romio321_data_t *) fh->f_io_selected_data;
180171
OPAL_THREAD_LOCK (&mca_io_romio321_mutex);
181-
ret = ROMIO_PREFIX(MPI_File_set_info) (data->romio_fh, ompi_info);
172+
ret = ROMIO_PREFIX(MPI_File_set_info) (data->romio_fh, info);
182173
OPAL_THREAD_UNLOCK (&mca_io_romio321_mutex);
183174

184-
ompi_info_free(&ompi_info);
185175
return ret;
186176
}
187177

188178

189179
int
190180
mca_io_romio321_file_get_info (ompi_file_t *fh,
191-
opal_info_t ** info_used)
181+
ompi_info_t ** info_used)
192182
{
193183
int ret;
194184
mca_io_romio321_data_t *data;
195185

196-
// An opal_info_t isn't a full ompi_info_t. so if we're using an MPI call
197-
// below with an MPI_Info, we need to create an equivalent MPI_Info. This
198-
// isn't ideal but it only happens a few places.
199-
ompi_info_t *ompi_info;
200-
ompi_info = OBJ_NEW(ompi_info_t);
201-
if (!ompi_info) { return(MPI_ERR_NO_MEM); }
202-
203186
data = (mca_io_romio321_data_t *) fh->f_io_selected_data;
204187
OPAL_THREAD_LOCK (&mca_io_romio321_mutex);
205-
ret = ROMIO_PREFIX(MPI_File_get_info) (data->romio_fh, &ompi_info);
188+
ret = ROMIO_PREFIX(MPI_File_get_info) (data->romio_fh, info_used);
206189
OPAL_THREAD_UNLOCK (&mca_io_romio321_mutex);
207190

208-
opal_info_dup (&(ompi_info->super), info_used);
209-
ompi_info_free(&ompi_info);
210191
return ret;
211192
}
212193

ompi/mca/io/romio321/src/io_romio321_module.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
* All rights reserved.
1212
* Copyright (c) 2008 Sun Microsystems, Inc. All rights reserved.
1313
* Copyright (c) 2008 Cisco Systems, Inc. All rights reserved.
14-
* Copyright (c) 2017 IBM Corporation. All rights reserved.
14+
* Copyright (c) 2017-2019 IBM Corporation. All rights reserved.
1515
* Copyright (c) 2017 Research Organization for Information Science
1616
* and Technology (RIST). All rights reserved.
1717
* $COPYRIGHT$
@@ -50,6 +50,8 @@ mca_io_base_module_2_0_0_t mca_io_romio321_module = {
5050
mca_io_romio321_file_preallocate,
5151
mca_io_romio321_file_get_size,
5252
mca_io_romio321_file_get_amode,
53+
mca_io_romio321_file_set_info,
54+
mca_io_romio321_file_get_info,
5355
mca_io_romio321_file_set_view,
5456
mca_io_romio321_file_get_view,
5557

ompi/mpi/c/file_get_info.c

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
* Copyright (c) 2008 Sun Microsystems, Inc. All rights reserved.
1313
* Copyright (c) 2015 Research Organization for Information Science
1414
* and Technology (RIST). All rights reserved.
15-
* Copyright (c) 2016-2017 IBM Corporation. All rights reserved.
15+
* Copyright (c) 2016-2019 IBM Corporation. All rights reserved.
1616
* $COPYRIGHT$
1717
*
1818
* Additional copyrights may follow
@@ -53,6 +53,24 @@ int MPI_File_get_info(MPI_File fh, MPI_Info *info_used)
5353
}
5454
}
5555

56+
// Some components we're still letting handle info internally, eg romio321.
57+
// Components that want to handle it themselves will fill in the get/set
58+
// info function pointers, components that don't will use NULL.
59+
if (fh->f_io_selected_module.v2_0_0.io_module_file_get_info != NULL) {
60+
int rc;
61+
switch (fh->f_io_version) {
62+
case MCA_IO_BASE_V_2_0_0:
63+
rc = fh->f_io_selected_module.v2_0_0.
64+
io_module_file_get_info(fh, info_used);
65+
break;
66+
67+
default:
68+
rc = MPI_ERR_INTERN;
69+
break;
70+
}
71+
OMPI_ERRHANDLER_RETURN(rc, fh, rc, FUNC_NAME);
72+
}
73+
5674
if (NULL == fh->super.s_info) {
5775
/*
5876
* Setup any defaults if MPI_Win_set_info was never called

ompi/mpi/c/file_set_info.c

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
* Copyright (c) 2008 Sun Microsystems, Inc. All rights reserved.
1313
* Copyright (c) 2015 Research Organization for Information Science
1414
* and Technology (RIST). All rights reserved.
15-
* Copyright (c) 2016-2017 IBM Corporation. All rights reserved.
15+
* Copyright (c) 2016-2019 IBM Corporation. All rights reserved.
1616
* $COPYRIGHT$
1717
*
1818
* Additional copyrights may follow
@@ -62,6 +62,24 @@ int MPI_File_set_info(MPI_File fh, MPI_Info info)
6262

6363
OPAL_CR_ENTER_LIBRARY();
6464

65+
// Some components we're still letting handle info internally, eg romio321.
66+
// Components that want to handle it themselves will fill in the get/set
67+
// info function pointers, components that don't will use NULL.
68+
if (fh->f_io_selected_module.v2_0_0.io_module_file_set_info != NULL) {
69+
int rc;
70+
switch (fh->f_io_version) {
71+
case MCA_IO_BASE_V_2_0_0:
72+
rc = fh->f_io_selected_module.v2_0_0.
73+
io_module_file_set_info(fh, info);
74+
break;
75+
76+
default:
77+
rc = MPI_ERR_INTERN;
78+
break;
79+
}
80+
OMPI_ERRHANDLER_RETURN(rc, fh, rc, FUNC_NAME);
81+
}
82+
6583
ret = opal_infosubscribe_change_info(&fh->super, &info->super);
6684

6785
OMPI_ERRHANDLER_RETURN(ret, fh, ret, FUNC_NAME);

0 commit comments

Comments
 (0)