Skip to content
This repository was archived by the owner on Sep 30, 2022. It is now read-only.

Commit 0bbceef

Browse files
committed
Merge pull request #1146 from edgargabriel/pr/getview-preallocate-fixes
Pr/getview preallocate fixes
2 parents a88f007 + 422c987 commit 0bbceef

File tree

2 files changed

+30
-7
lines changed

2 files changed

+30
-7
lines changed

ompi/mca/io/ompio/io_ompio_file_open.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
* University of Stuttgart. All rights reserved.
1010
* Copyright (c) 2004-2005 The Regents of the University of California.
1111
* 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.
1313
* Copyright (c) 2015 Research Organization for Information Science
1414
* and Technology (RIST). All rights reserved.
1515
* Copyright (c) 2016 Cisco Systems, Inc. All rights reserved.
@@ -504,6 +504,8 @@ mca_io_ompio_file_preallocate (ompi_file_t *fh,
504504
buf = NULL;
505505
}
506506
}
507+
ret = data->ompio_fh.f_fs->fs_file_set_size (&data->ompio_fh, diskspace);
508+
507509
fh->f_comm->c_coll.coll_barrier (fh->f_comm,
508510
fh->f_comm->c_coll.coll_barrier_module);
509511
return ret;

ompi/mca/io/ompio/io_ompio_file_set_view.c

Lines changed: 27 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@
22
* Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
33
* University Research and Technology
44
* 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
66
* of Tennessee Research Foundation. All rights
77
* reserved.
88
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
99
* University of Stuttgart. All rights reserved.
1010
* Copyright (c) 2004-2005 The Regents of the University of California.
1111
* 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.
1313
* Copyright (c) 2015 Research Organization for Information Science
1414
* and Technology (RIST). All rights reserved.
1515
* $COPYRIGHT$
@@ -39,6 +39,25 @@
3939
#include "io_ompio.h"
4040

4141
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+
}
4261

4362

4463
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,
82101

83102
fh->f_flags |= OMPIO_FILE_VIEW_IS_SET;
84103
fh->f_datarep = strdup (datarep);
85-
ompi_datatype_duplicate (filetype, &fh->f_orig_filetype );
104+
datatype_duplicate (filetype, &fh->f_orig_filetype );
86105

87106
opal_datatype_get_extent(&filetype->super, &lb, &ftype_extent);
88107
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,
119138
opal_datatype_type_ub (&newfiletype->super, &ub);
120139
opal_datatype_type_size (&etype->super, &fh->f_etype_size);
121140
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.
123144
ompi_datatype_duplicate (newfiletype, &fh->f_filetype);
124145

125146
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,
233254
fh = &data->ompio_fh;
234255

235256
*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);
238259
strcpy (datarep, fh->f_datarep);
239260

240261
return OMPI_SUCCESS;

0 commit comments

Comments
 (0)