Skip to content

Commit 4709f42

Browse files
authored
Merge pull request #1929 from edgargabriel/pr/ompio-code-reorg
io/ompio: next step in code-reorganization
2 parents 31cf46a + aa7e852 commit 4709f42

17 files changed

+531
-595
lines changed

ompi/mca/common/ompio/Makefile.am

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,16 @@
1818
# $HEADER$
1919
#
2020

21+
if OMPI_PROVIDE_MPI_FILE_INTERFACE
22+
2123
headers = \
2224
common_ompio_print_queue.h \
2325
common_ompio.h
2426

2527
sources = \
2628
common_ompio_print_queue.c \
2729
common_ompio_file_open.c \
30+
common_ompio_file_view.c \
2831
common_ompio_file_read.c \
2932
common_ompio_file_write.c
3033

@@ -84,3 +87,14 @@ clean-local:
8487
if test -z "$(lib_LTLIBRARIES)"; then \
8588
rm -f "$(comp_inst)"; \
8689
fi
90+
91+
else
92+
93+
# Need to have empty targets because AM can't handle having an
94+
# AM_CONDITIONAL was targets in the "if" statement but not in the
95+
# "else". :-(
96+
97+
all-local:
98+
clean-local:
99+
100+
endif

ompi/mca/common/ompio/common_ompio.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,10 @@ OMPI_DECLSPEC int mca_common_ompio_file_close (mca_io_ompio_file_t *ompio_fh);
8282
OMPI_DECLSPEC int mca_common_ompio_file_get_size (mca_io_ompio_file_t *ompio_fh, OMPI_MPI_OFFSET_TYPE *size);
8383
OMPI_DECLSPEC int mca_common_ompio_file_get_position (mca_io_ompio_file_t *fh,OMPI_MPI_OFFSET_TYPE *offset);
8484
OMPI_DECLSPEC int mca_common_ompio_set_explicit_offset (mca_io_ompio_file_t *fh, OMPI_MPI_OFFSET_TYPE offset);
85-
85+
OMPI_DECLSPEC int mca_common_ompio_set_file_defaults (mca_io_ompio_file_t *fh);
86+
OMPI_DECLSPEC int mca_common_ompio_set_view (mca_io_ompio_file_t *fh, OMPI_MPI_OFFSET_TYPE disp,
87+
ompi_datatype_t *etype, ompi_datatype_t *filetype, const char *datarep,
88+
ompi_info_t *info);
8689

8790

8891
#endif /* MCA_COMMON_OMPIO_H */

ompi/mca/common/ompio/common_ompio_file_open.c

Lines changed: 75 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ int mca_common_ompio_file_open (ompi_communicator_t *comm,
9191
ompio_fh->f_info = info;
9292
ompio_fh->f_atomicity = 0;
9393

94-
ompi_io_ompio_set_file_defaults (ompio_fh);
94+
mca_common_ompio_set_file_defaults (ompio_fh);
9595
ompio_fh->f_filename = filename;
9696

9797
ompio_fh->f_split_coll_req = NULL;
@@ -105,9 +105,6 @@ int mca_common_ompio_file_open (ompi_communicator_t *comm,
105105
ompio_fh->f_decode_datatype=ompi_io_ompio_decode_datatype;
106106
ompio_fh->f_generate_current_file_view=ompi_io_ompio_generate_current_file_view;
107107

108-
ompio_fh->f_sort=ompi_io_ompio_sort;
109-
ompio_fh->f_sort_iovec=ompi_io_ompio_sort_iovec;
110-
111108
ompio_fh->f_get_num_aggregators=mca_io_ompio_get_num_aggregators;
112109
ompio_fh->f_get_bytes_per_agg=mca_io_ompio_get_bytes_per_agg;
113110
ompio_fh->f_set_aggregator_props=mca_io_ompio_set_aggregator_props;
@@ -377,4 +374,78 @@ int mca_common_ompio_file_get_position (mca_io_ompio_file_t *fh,
377374
return OMPI_SUCCESS;
378375
}
379376

377+
int mca_common_ompio_set_file_defaults (mca_io_ompio_file_t *fh)
378+
{
379+
380+
if (NULL != fh) {
381+
ompi_datatype_t *types[2];
382+
int blocklen[2] = {1, 1};
383+
OPAL_PTRDIFF_TYPE d[2], base;
384+
int i;
385+
386+
fh->f_io_array = NULL;
387+
fh->f_perm = OMPIO_PERM_NULL;
388+
fh->f_flags = 0;
389+
fh->f_bytes_per_agg = mca_io_ompio_bytes_per_agg;
390+
fh->f_datarep = strdup ("native");
391+
392+
fh->f_offset = 0;
393+
fh->f_disp = 0;
394+
fh->f_position_in_file_view = 0;
395+
fh->f_index_in_file_view = 0;
396+
fh->f_total_bytes = 0;
397+
398+
fh->f_init_procs_per_group = -1;
399+
fh->f_init_procs_in_group = NULL;
400+
401+
fh->f_procs_per_group = -1;
402+
fh->f_procs_in_group = NULL;
403+
404+
fh->f_init_num_aggrs = -1;
405+
fh->f_init_aggr_list = NULL;
406+
407+
408+
/* Default file View */
409+
fh->f_iov_type = MPI_DATATYPE_NULL;
410+
fh->f_stripe_size = mca_io_ompio_bytes_per_agg;
411+
/*Decoded iovec of the file-view*/
412+
fh->f_decoded_iov = NULL;
413+
fh->f_etype = NULL;
414+
fh->f_filetype = NULL;
415+
fh->f_orig_filetype = NULL;
416+
417+
mca_common_ompio_set_view(fh,
418+
0,
419+
&ompi_mpi_byte.dt,
420+
&ompi_mpi_byte.dt,
421+
"native",
422+
fh->f_info);
423+
424+
425+
/*Create a derived datatype for the created iovec */
426+
types[0] = &ompi_mpi_long.dt;
427+
types[1] = &ompi_mpi_long.dt;
428+
429+
d[0] = (OPAL_PTRDIFF_TYPE) fh->f_decoded_iov;
430+
d[1] = (OPAL_PTRDIFF_TYPE) &fh->f_decoded_iov[0].iov_len;
431+
432+
base = d[0];
433+
for (i=0 ; i<2 ; i++) {
434+
d[i] -= base;
435+
}
436+
437+
ompi_datatype_create_struct (2,
438+
blocklen,
439+
d,
440+
types,
441+
&fh->f_iov_type);
442+
ompi_datatype_commit (&fh->f_iov_type);
443+
444+
return OMPI_SUCCESS;
445+
}
446+
else {
447+
return OMPI_ERROR;
448+
}
449+
}
450+
380451

0 commit comments

Comments
 (0)