1
1

common/ompio: abstraction for different convertor types

introduce separate convertors for memory vs. file representation. Adjust the interfaces for decode_datatype to provide the convertor to be used for that.

Signed-off-by: Edgar Gabriel <egabriel@central.uh.edu>
Этот коммит содержится в:
Edgar Gabriel 2019-05-20 13:35:38 -05:00
родитель 35be18b266
Коммит d955753cb8
15 изменённых файлов: 60 добавлений и 14 удалений

Просмотреть файл

@ -10,7 +10,7 @@
* University of Stuttgart. All rights reserved.
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
* Copyright (c) 2008-2016 University of Houston. All rights reserved.
* Copyright (c) 2008-2019 University of Houston. All rights reserved.
* Copyright (c) 2018 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
* Copyright (c) 2018 DataDirect Networks. All rights reserved.
@ -157,7 +157,8 @@ struct ompio_file_t {
ompi_communicator_t *f_comm;
const char *f_filename;
char *f_datarep;
opal_convertor_t *f_convertor;
opal_convertor_t *f_mem_convertor;
opal_convertor_t *f_file_convertor;
opal_info_t *f_info;
int32_t f_flags;
void *f_fs_ptr;
@ -330,6 +331,7 @@ OMPI_DECLSPEC int mca_common_ompio_decode_datatype (struct ompio_file_t *fh,
int count,
const void *buf,
size_t *max_data,
opal_convertor_t *convertor,
struct iovec **iov,
uint32_t *iov_count);

Просмотреть файл

@ -23,7 +23,7 @@
#define OMPIO_PREPARE_BUF(_fh,_buf,_count,_datatype,_tbuf,_convertor,_max_data,_decoded_iov,_iov_count){ \
opal_convertor_clone ( _fh->f_convertor, _convertor, 0); \
opal_convertor_clone ( _fh->f_file_convertor, _convertor, 0); \
opal_convertor_prepare_for_send ( _convertor, &(_datatype->super), _count, _buf );\
opal_convertor_get_packed_size( _convertor, &_max_data ); \
_tbuf = mca_common_ompio_alloc_buf (_fh, _max_data); \

Просмотреть файл

@ -9,7 +9,7 @@
* University of Stuttgart. All rights reserved.
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
* Copyright (c) 2008-2018 University of Houston. All rights reserved.
* Copyright (c) 2008-2019 University of Houston. All rights reserved.
* Copyright (c) 2015-2018 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
* Copyright (c) 2016 Cisco Systems, Inc. All rights reserved.
@ -75,7 +75,8 @@ int mca_common_ompio_file_open (ompi_communicator_t *comm,
ompio_fh->f_rank = ompi_comm_rank (comm);
ompio_fh->f_size = ompi_comm_size (comm);
remote_arch = opal_local_arch;
ompio_fh->f_convertor = opal_convertor_create (remote_arch, 0);
ompio_fh->f_mem_convertor = opal_convertor_create (remote_arch, 0);
ompio_fh->f_file_convertor = opal_convertor_create (remote_arch, 0);
if ( true == use_sharedfp ) {
ret = ompi_comm_dup (comm, &ompio_fh->f_comm);
@ -323,17 +324,23 @@ int mca_common_ompio_file_close (ompio_file_t *ompio_fh)
ompio_fh->f_decoded_iov = NULL;
}
if (NULL != ompio_fh->f_convertor) {
free (ompio_fh->f_convertor);
ompio_fh->f_convertor = NULL;
if (NULL != ompio_fh->f_mem_convertor) {
opal_convertor_cleanup (ompio_fh->f_mem_convertor);
//free (ompio_fh->f_mem_convertor);
ompio_fh->f_mem_convertor = NULL;
}
if (NULL != ompio_fh->f_file_convertor) {
opal_convertor_cleanup (ompio_fh->f_file_convertor);
//free (ompio_fh->f_file_convertor);
ompio_fh->f_file_convertor = NULL;
}
if (NULL != ompio_fh->f_datarep) {
free (ompio_fh->f_datarep);
ompio_fh->f_datarep = NULL;
}
if ( NULL != ompio_fh->f_coll_write_time ) {
free ( ompio_fh->f_coll_write_time );
ompio_fh->f_coll_write_time = NULL;
@ -557,6 +564,7 @@ int mca_common_ompio_decode_datatype (struct ompio_file_t *fh,
int count,
const void *buf,
size_t *max_data,
opal_convertor_t *conv,
struct iovec **iov,
uint32_t *iovec_count)
{
@ -571,7 +579,7 @@ int mca_common_ompio_decode_datatype (struct ompio_file_t *fh,
size_t temp_data;
opal_convertor_clone (fh->f_convertor, &convertor, 0);
opal_convertor_clone (conv, &convertor, 0);
if (OMPI_SUCCESS != opal_convertor_prepare_for_send (&convertor,
&(datatype->super),
@ -667,7 +675,8 @@ int mca_common_ompio_decode_datatype (struct ompio_file_t *fh,
}
free (temp_iov);
opal_convertor_cleanup (&convertor);
return OMPI_SUCCESS;
}

Просмотреть файл

@ -105,6 +105,7 @@ int mca_common_ompio_file_read (ompio_file_t *fh,
count,
buf,
&max_data,
fh->f_mem_convertor,
&decoded_iov,
&iov_count);
}
@ -114,6 +115,7 @@ int mca_common_ompio_file_read (ompio_file_t *fh,
count,
buf,
&max_data,
fh->f_mem_convertor,
&decoded_iov,
&iov_count);
#endif
@ -272,6 +274,7 @@ int mca_common_ompio_file_iread (ompio_file_t *fh,
count,
buf,
&max_data,
fh->f_mem_convertor,
&decoded_iov,
&iov_count);
}
@ -281,6 +284,7 @@ int mca_common_ompio_file_iread (ompio_file_t *fh,
count,
buf,
&max_data,
fh->f_mem_convertor,
&decoded_iov,
&iov_count);
#endif

Просмотреть файл

@ -9,7 +9,7 @@
* University of Stuttgart. All rights reserved.
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
* Copyright (c) 2008-2018 University of Houston. All rights reserved.
* Copyright (c) 2008-2019 University of Houston. All rights reserved.
* Copyright (c) 2017-2018 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
* Copyright (c) 2017 IBM Corporation. All rights reserved.
@ -91,6 +91,12 @@ int mca_common_ompio_set_view (ompio_file_t *fh,
fh->f_datarep = NULL;
}
if (NULL != fh->f_file_convertor) {
opal_convertor_cleanup (fh->f_file_convertor);
//free (fh->f_file_convertor);
fh->f_file_convertor = NULL;
}
/* Reset the flags first */
if ( fh->f_flags & OMPIO_CONTIGUOUS_FVIEW ) {
fh->f_flags &= ~OMPIO_CONTIGUOUS_FVIEW;
@ -99,8 +105,19 @@ int mca_common_ompio_set_view (ompio_file_t *fh,
fh->f_flags &= ~OMPIO_UNIFORM_FVIEW;
}
fh->f_datarep = strdup (datarep);
datatype_duplicate (filetype, &fh->f_orig_filetype );
if ( !(strcmp(datarep, "external32") && strcmp(datarep, "EXTERNAL32"))) {
fh->f_file_convertor = malloc (sizeof(opal_convertor_t));
if ( NULL == fh->f_file_convertor ) {
return OMPI_ERR_OUT_OF_RESOURCE;
}
opal_convertor_clone (ompi_mpi_external32_convertor, fh->f_file_convertor, 0);
}
else {
fh->f_file_convertor = opal_convertor_create (opal_local_arch, 0);
}
datatype_duplicate (filetype, &fh->f_orig_filetype );
opal_datatype_get_extent(&filetype->super, &lb, &ftype_extent);
opal_datatype_type_size (&filetype->super, &ftype_size);
@ -129,6 +146,7 @@ int mca_common_ompio_set_view (ompio_file_t *fh,
1,
NULL,
&max_data,
fh->f_file_convertor,
&fh->f_decoded_iov,
&fh->f_iov_count);

Просмотреть файл

@ -89,6 +89,7 @@ int mca_common_ompio_file_write (ompio_file_t *fh,
count,
buf,
&max_data,
fh->f_mem_convertor,
&decoded_iov,
&iov_count);
}
@ -98,6 +99,7 @@ int mca_common_ompio_file_write (ompio_file_t *fh,
count,
buf,
&max_data,
fh->f_mem_convertor,
&decoded_iov,
&iov_count);
#endif
@ -250,6 +252,7 @@ int mca_common_ompio_file_iwrite (ompio_file_t *fh,
count,
buf,
&max_data,
fh->f_mem_convertor,
&decoded_iov,
&iov_count);
}
@ -259,6 +262,7 @@ int mca_common_ompio_file_iwrite (ompio_file_t *fh,
count,
buf,
&max_data,
fh->f_mem_convertor,
&decoded_iov,
&iov_count);
#endif

Просмотреть файл

@ -130,6 +130,7 @@ mca_fcoll_dynamic_file_read_all (ompio_file_t *fh,
count,
buf,
&max_data,
fh->f_mem_convertor,
&decoded_iov,
&iov_count);
if (OMPI_SUCCESS != ret){

Просмотреть файл

@ -132,6 +132,7 @@ mca_fcoll_dynamic_file_write_all (ompio_file_t *fh,
count,
buf,
&max_data,
fh->f_mem_convertor,
&decoded_iov,
&iov_count);
if (OMPI_SUCCESS != ret ){

Просмотреть файл

@ -130,6 +130,7 @@ mca_fcoll_dynamic_gen2_file_read_all (ompio_file_t *fh,
count,
buf,
&max_data,
fh->f_mem_convertor,
&decoded_iov,
&iov_count);
if (OMPI_SUCCESS != ret){

Просмотреть файл

@ -170,6 +170,7 @@ int mca_fcoll_dynamic_gen2_file_write_all (ompio_file_t *fh,
count,
buf,
&max_data,
fh->f_mem_convertor,
&decoded_iov,
&iov_count);
if (OMPI_SUCCESS != ret ){

Просмотреть файл

@ -155,6 +155,7 @@ mca_fcoll_two_phase_file_read_all (ompio_file_t *fh,
count,
buf,
&max_data,
fh->f_mem_convertor,
&temp_iov,
&iov_count);
if (OMPI_SUCCESS != ret ){

Просмотреть файл

@ -185,6 +185,7 @@ mca_fcoll_two_phase_file_write_all (ompio_file_t *fh,
count,
buf,
&max_data,
fh->f_mem_convertor,
&temp_iov,
&iov_count);
if (OMPI_SUCCESS != ret ){

Просмотреть файл

@ -129,6 +129,7 @@ mca_fcoll_vulcan_file_read_all (ompio_file_t *fh,
count,
buf,
&max_data,
fh->f_mem_convertor,
&decoded_iov,
&iov_count);
if (OMPI_SUCCESS != ret){

Просмотреть файл

@ -185,6 +185,7 @@ int mca_fcoll_vulcan_file_write_all (ompio_file_t *fh,
count,
buf,
&max_data,
fh->f_mem_convertor,
&decoded_iov,
&iov_count);
if (OMPI_SUCCESS != ret ){

Просмотреть файл

@ -66,7 +66,8 @@ int mca_io_ompio_file_set_view (ompi_file_t *fp,
mca_common_ompio_data_t *data;
ompio_file_t *fh;
if ( (strcmp(datarep, "native") && strcmp(datarep, "NATIVE"))) {
if ( (strcmp(datarep, "native") && strcmp(datarep, "NATIVE") &&
strcmp(datarep, "external32") && strcmp(datarep, "EXTERNAL32"))) {
return MPI_ERR_UNSUPPORTED_DATAREP;
}