Skip to content

Commit 9986a15

Browse files
committed
sharedfp/individual: only complain about fseek if sharedfp operations are really in use
this component can only be used in very specific scenarios. However, since some file systems do not support file locking and processes might be distributed over multiple nodes (hence the sm sharedfp component is also inelligible), the component might be selected in some scenarios, even if an application does not intend to use shared file pointers. Since the fseek_shared function is involved as part of the File_set_view operation, only complain about the inability to perform the seek_shared operation if actual shared file pointer operations are being used. This avoid spurious error values being returned. Signed-off-by: Edgar Gabriel <egabriel@central.uh.edu>
1 parent d6a81ec commit 9986a15

File tree

4 files changed

+12
-7
lines changed

4 files changed

+12
-7
lines changed

ompi/mca/sharedfp/individual/sharedfp_individual.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ int mca_sharedfp_individual_module_finalize (ompio_file_t *file);
4242

4343
extern int mca_sharedfp_individual_priority;
4444
extern int mca_sharedfp_individual_verbose;
45+
extern int mca_sharedfp_individual_usage_counter;
4546

4647
OMPI_MODULE_DECLSPEC extern mca_sharedfp_base_component_2_0_0_t mca_sharedfp_individual_component;
4748
/*

ompi/mca/sharedfp/individual/sharedfp_individual_iwrite.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ int mca_sharedfp_individual_iwrite(ompio_file_t *fh,
4545
"mca_sharedfp_individual_iwrite: module not initialized \n");
4646
return OMPI_ERROR;
4747
}
48+
mca_sharedfp_individual_usage_counter++;
4849

4950
/* Calculate the number of bytes of data that needs to be written*/
5051
opal_datatype_type_size ( &datatype->super, &numofbytes);
@@ -103,6 +104,7 @@ int mca_sharedfp_individual_write_ordered_begin(ompio_file_t *fh,
103104
"at any given point in time!\n");
104105
return MPI_ERR_REQUEST;
105106
}
107+
mca_sharedfp_individual_usage_counter++;
106108

107109
/*Retrieve the sharedfp data structures*/
108110
sh = fh->f_sharedfp_data;

ompi/mca/sharedfp/individual/sharedfp_individual_seek.c

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,19 +27,18 @@
2727
#include "ompi/constants.h"
2828
#include "ompi/mca/sharedfp/sharedfp.h"
2929

30-
static int seek_counter=0;
30+
int mca_sharedfp_individual_usage_counter=0;
3131

3232
int mca_sharedfp_individual_seek (ompio_file_t *fh,
3333
OMPI_MPI_OFFSET_TYPE offset, int whence)
3434
{
35-
if ( 0 == seek_counter &&
36-
0 == offset &&
37-
MPI_SEEK_SET == whence ) {
38-
/* This is occuring when setting the default file view. THat is ok.
39-
** The component doesn't support however further seek operations.
35+
if ( 0 == mca_sharedfp_individual_usage_counter ) {
36+
/* As long as nobody using this module 'inapproprialy', its is ok.
37+
** to call this function, since it might come out of File_set_view.
38+
** however, we have to return an error as soon as people are calling
39+
** this function on this component and expect it to work.
4040
*/
4141

42-
seek_counter++;
4342
return OMPI_SUCCESS;
4443
}
4544

ompi/mca/sharedfp/individual/sharedfp_individual_write.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ int mca_sharedfp_individual_write (ompio_file_t *fh,
4545
"sharedfp_individual_write: module not initialized \n");
4646
return OMPI_ERROR;
4747
}
48+
mca_sharedfp_individual_usage_counter++;
4849

4950
/* Calculate the number of bytes of data that need to be written*/
5051
opal_datatype_type_size ( &datatype->super, &numofbytes);
@@ -98,6 +99,8 @@ int mca_sharedfp_individual_write_ordered (ompio_file_t *fh,
9899
return OMPI_ERROR;
99100
}
100101

102+
mca_sharedfp_individual_usage_counter++;
103+
101104
/*Retrieve the sharedfp data structures*/
102105
sh = fh->f_sharedfp_data;
103106

0 commit comments

Comments
 (0)