|
2 | 2 | * Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana |
3 | 3 | * University Research and Technology |
4 | 4 | * Corporation. All rights reserved. |
5 | | - * Copyright (c) 2004-2005 The University of Tennessee and The University |
| 5 | + * Copyright (c) 2004-2016 The University of Tennessee and The University |
6 | 6 | * of Tennessee Research Foundation. All rights |
7 | 7 | * reserved. |
8 | 8 | * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, |
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) 2008-2015 University of Houston. All rights reserved. |
| 12 | + * Copyright (c) 2008-2016 University of Houston. All rights reserved. |
13 | 13 | * Copyright (c) 2015 Research Organization for Information Science |
14 | 14 | * and Technology (RIST). All rights reserved. |
15 | 15 | * $COPYRIGHT$ |
|
39 | 39 | #include "io_ompio.h" |
40 | 40 |
|
41 | 41 | static OMPI_MPI_OFFSET_TYPE get_contiguous_chunk_size (mca_io_ompio_file_t *); |
| 42 | +static int datatype_duplicate (ompi_datatype_t *oldtype, ompi_datatype_t **newtype ); |
| 43 | +static int datatype_duplicate (ompi_datatype_t *oldtype, ompi_datatype_t **newtype ) |
| 44 | +{ |
| 45 | + ompi_datatype_t *type; |
| 46 | + if( ompi_datatype_is_predefined(oldtype) ) { |
| 47 | + *newtype = oldtype; |
| 48 | + return OMPI_SUCCESS; |
| 49 | + } |
| 50 | + |
| 51 | + if ( OMPI_SUCCESS != ompi_datatype_duplicate (oldtype, &type)){ |
| 52 | + ompi_datatype_destroy (&type); |
| 53 | + return MPI_ERR_INTERN; |
| 54 | + } |
| 55 | + |
| 56 | + ompi_datatype_set_args( type, 0, NULL, 0, NULL, 1, &oldtype, MPI_COMBINER_DUP ); |
| 57 | + |
| 58 | + *newtype = type; |
| 59 | + return OMPI_SUCCESS; |
| 60 | +} |
42 | 61 |
|
43 | 62 |
|
44 | 63 | int mca_io_ompio_set_view_internal(mca_io_ompio_file_t *fh, |
@@ -82,7 +101,7 @@ int mca_io_ompio_set_view_internal(mca_io_ompio_file_t *fh, |
82 | 101 |
|
83 | 102 | fh->f_flags |= OMPIO_FILE_VIEW_IS_SET; |
84 | 103 | fh->f_datarep = strdup (datarep); |
85 | | - ompi_datatype_duplicate (filetype, &fh->f_orig_filetype ); |
| 104 | + datatype_duplicate (filetype, &fh->f_orig_filetype ); |
86 | 105 |
|
87 | 106 | opal_datatype_get_extent(&filetype->super, &lb, &ftype_extent); |
88 | 107 | opal_datatype_type_size (&filetype->super, &ftype_size); |
@@ -119,7 +138,9 @@ int mca_io_ompio_set_view_internal(mca_io_ompio_file_t *fh, |
119 | 138 | opal_datatype_type_ub (&newfiletype->super, &ub); |
120 | 139 | opal_datatype_type_size (&etype->super, &fh->f_etype_size); |
121 | 140 | opal_datatype_type_size (&newfiletype->super, &fh->f_view_size); |
122 | | - ompi_datatype_duplicate (etype, &fh->f_etype); |
| 141 | + datatype_duplicate (etype, &fh->f_etype); |
| 142 | + // This file type is our own representation. The original is stored |
| 143 | + // in orig_file type, No need to set args on this one. |
123 | 144 | ompi_datatype_duplicate (newfiletype, &fh->f_filetype); |
124 | 145 |
|
125 | 146 | fh->f_cc_size = get_contiguous_chunk_size (fh); |
@@ -233,8 +254,8 @@ int mca_io_ompio_file_get_view (struct ompi_file_t *fp, |
233 | 254 | fh = &data->ompio_fh; |
234 | 255 |
|
235 | 256 | *disp = fh->f_disp; |
236 | | - ompi_datatype_duplicate (fh->f_etype, etype); |
237 | | - ompi_datatype_duplicate (fh->f_orig_filetype, filetype); |
| 257 | + datatype_duplicate (fh->f_etype, etype); |
| 258 | + datatype_duplicate (fh->f_orig_filetype, filetype); |
238 | 259 | strcpy (datarep, fh->f_datarep); |
239 | 260 |
|
240 | 261 | return OMPI_SUCCESS; |
|
0 commit comments