9
9
* University of Stuttgart. All rights reserved.
10
10
* Copyright (c) 2004-2005 The Regents of the University of California.
11
11
* All rights reserved.
12
- * Copyright (c) 2013-2018 University of Houston. All rights reserved.
12
+ * Copyright (c) 2013-2019 University of Houston. All rights reserved.
13
13
* Copyright (c) 2015-2018 Research Organization for Information Science
14
14
* and Technology (RIST). All rights reserved.
15
15
* Copyright (c) 2016-2017 IBM Corporation. All rights reserved.
@@ -92,11 +92,18 @@ int mca_sharedfp_individual_file_open (struct ompi_communicator_t *comm,
92
92
MPI_MODE_RDWR | MPI_MODE_CREATE | MPI_MODE_DELETE_ON_CLOSE ,
93
93
& (MPI_INFO_NULL -> super ), datafilehandle , false);
94
94
if ( OMPI_SUCCESS != err ) {
95
- opal_output (0 , "mca_sharedfp_individual_file_open: Error during datafile file open\n" );
95
+ opal_output (ompi_sharedfp_base_framework .framework_output ,
96
+ "mca_sharedfp_individual_file_open: Error during datafile file open. Continuing anyway. \n" );
96
97
free (sh );
97
98
free (datafilename );
98
99
free (datafilehandle );
99
- return err ;
100
+
101
+ // We reset the error code here to OMPI_SUCCESS since the individual component can act as
102
+ // a dummy component, in case no sharedfp operations are used by the code. Invoking any write/read
103
+ // operations will however lead to an error, since the sharedfp_data pointer will be NULL.
104
+ sh = NULL ;
105
+ err = OMPI_SUCCESS ;
106
+ goto exit ;
100
107
}
101
108
102
109
/*----------------------------------------------------------*/
@@ -113,32 +120,48 @@ int mca_sharedfp_individual_file_open (struct ompi_communicator_t *comm,
113
120
if ( NULL == metadatafilename ) {
114
121
free (sh );
115
122
free (datafilename );
123
+ mca_common_ompio_file_close ( datafilehandle );
116
124
free (datafilehandle );
117
125
opal_output (0 , "mca_sharedfp_individual_file_open: Error during memory allocation\n" );
118
- return OMPI_ERR_OUT_OF_RESOURCE ;
126
+
127
+ sh = NULL ;
128
+ err = OMPI_ERR_OUT_OF_RESOURCE ;
129
+ goto exit ;
119
130
}
120
131
snprintf ( metadatafilename , len , "%s%s%d" , filename , ".metadata." ,fh -> f_rank );
121
132
122
133
metadatafilehandle = (ompio_file_t * )malloc (sizeof (ompio_file_t ));
123
134
if ( NULL == metadatafilehandle ) {
124
135
free (sh );
125
136
free (datafilename );
137
+ mca_common_ompio_file_close ( datafilehandle );
126
138
free (datafilehandle );
127
139
free (metadatafilename );
128
140
opal_output (0 , "mca_sharedfp_individual_file_open: Error during memory allocation\n" );
129
- return OMPI_ERR_OUT_OF_RESOURCE ;
141
+
142
+ sh = NULL ;
143
+ err = OMPI_ERR_OUT_OF_RESOURCE ;
144
+ goto exit ;
130
145
}
131
146
err = mca_common_ompio_file_open ( MPI_COMM_SELF ,metadatafilename ,
132
147
MPI_MODE_RDWR | MPI_MODE_CREATE | MPI_MODE_DELETE_ON_CLOSE ,
133
148
& (MPI_INFO_NULL -> super ), metadatafilehandle , false);
134
149
if ( OMPI_SUCCESS != err ) {
135
- opal_output (0 , "mca_sharedfp_individual_file_open: Error during metadatafile file open\n" );
150
+ opal_output (ompi_sharedfp_base_framework .framework_output ,
151
+ "mca_sharedfp_individual_file_open: Error during metadatafile file open. Continuing anyway. \n" );
136
152
free (sh );
137
153
free (datafilename );
154
+ mca_common_ompio_file_close ( datafilehandle );
138
155
free (datafilehandle );
139
156
free (metadatafilename );
140
157
free (metadatafilehandle );
141
- return err ;
158
+
159
+ // We reset the error code here to OMPI_SUCCESS since the individual component can act as
160
+ // a dummy component, in case no sharedfp operations are used by the code. Invoking any write/read
161
+ // operations will however lead to an error, since the sharedfp_data pointer will be NULL.
162
+ sh = NULL ;
163
+ err = OMPI_SUCCESS ;
164
+ goto exit ;
142
165
}
143
166
144
167
/*save the datafilehandle and metadatahandle in the sharedfp individual module data structure*/
@@ -150,6 +173,8 @@ int mca_sharedfp_individual_file_open (struct ompi_communicator_t *comm,
150
173
headnode -> metadatafilename = metadatafilename ;
151
174
}
152
175
176
+
177
+ exit :
153
178
/*save the sharedfp individual module data structure in the ompio filehandle structure*/
154
179
fh -> f_sharedfp_data = sh ;
155
180
0 commit comments