Skip to content

Commit d520c24

Browse files
jsquyresbosilca
authored andcommitted
predefined MPI object padding: set to fixed number of bytes (#3634)
Convert the predefined MPI object padding to a fixed number of bytes (vs. a multiple of sizeof(void*)) so that the padding is the same size between 32 and 64 bit builds. I.e., we won't have a situation where we've run out of padding in 32 bit builds but still have more space available in 64 bit builds. Fixes #3610 Signed-off-by: Jeff Squyres <[email protected]>
1 parent 5e9be76 commit d520c24

File tree

9 files changed

+27
-18
lines changed

9 files changed

+27
-18
lines changed

ompi/communicator/communicator.h

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
* University of Stuttgart. All rights reserved.
1111
* Copyright (c) 2004-2005 The Regents of the University of California.
1212
* All rights reserved.
13-
* Copyright (c) 2006-2012 Cisco Systems, Inc. All rights reserved.
13+
* Copyright (c) 2006-2017 Cisco Systems, Inc. All rights reserved
1414
* Copyright (c) 2006-2010 University of Houston. All rights reserved.
1515
* Copyright (c) 2009 Sun Microsystems, Inc. All rights reserved.
1616
* Copyright (c) 2011-2013 Inria. All rights reserved.
@@ -242,6 +242,15 @@ typedef struct ompi_communicator_t ompi_communicator_t;
242242
* the ompi_communicator_t without impacting the size of the
243243
* ompi_predefined_communicator_t structure for some number of additions.
244244
*
245+
* Note: we used to define the PAD as a multiple of sizeof(void*).
246+
* However, this makes a different size PAD, depending on
247+
* sizeof(void*). In some cases
248+
* (https://github.com/open-mpi/ompi/issues/3610), 32 bit builds can
249+
* run out of space when 64 bit builds are still ok. So we changed to
250+
* use just a naked byte size. As a rule of thumb, however, the size
251+
* should probably still be a multiple of 8 so that it has the
252+
* possibility of being nicely aligned.
253+
*
245254
* As an example:
246255
* If the size of ompi_communicator_t is less than the size of the _PAD then
247256
* the _PAD ensures that the size of the ompi_predefined_communicator_t is
@@ -258,7 +267,7 @@ typedef struct ompi_communicator_t ompi_communicator_t;
258267
* the PREDEFINED_COMMUNICATOR_PAD macro?
259268
* A: Most likely not, but it would be good to check.
260269
*/
261-
#define PREDEFINED_COMMUNICATOR_PAD (sizeof(void*) * 64)
270+
#define PREDEFINED_COMMUNICATOR_PAD 512
262271

263272
struct ompi_predefined_communicator_t {
264273
struct ompi_communicator_t comm;

ompi/datatype/ompi_datatype.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* of Tennessee Research Foundation. All rights
55
* reserved.
66
* Copyright (c) 2009 Oak Ridge National Labs. All rights reserved.
7-
* Copyright (c) 2010 Cisco Systems, Inc. All rights reserved.
7+
* Copyright (c) 2010-2017 Cisco Systems, Inc. All rights reserved
88
* Copyright (c) 2013 Los Alamos National Security, LLC. All rights
99
* reserved.
1010
* Copyright (c) 2015-2017 Research Organization for Information Science
@@ -95,7 +95,7 @@ OMPI_DECLSPEC OBJ_CLASS_DECLARATION(ompi_datatype_t);
9595
/* Using set constant for padding of the DATATYPE handles because the size of
9696
* base structure is very close to being the same no matter the bitness.
9797
*/
98-
#define PREDEFINED_DATATYPE_PAD (512)
98+
#define PREDEFINED_DATATYPE_PAD 512
9999

100100
struct ompi_predefined_datatype_t {
101101
struct ompi_datatype_t dt;

ompi/file/file.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
* Copyright (c) 2004-2005 The Regents of the University of California.
1212
* All rights reserved.
1313
* Copyright (c) 2009 Sun Microsystems, Inc. All rights reserved.
14-
* Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved.
14+
* Copyright (c) 2009-2017 Cisco Systems, Inc. All rights reserved
1515
* Copyright (c) 2015 Research Organization for Information Science
1616
* and Technology (RIST). All rights reserved.
1717
* Copyright (c) 2016 University of Houston. All rights reserved.
@@ -103,7 +103,7 @@ typedef struct ompi_file_t ompi_file_t;
103103
* See ompi/communicator/communicator.h comments with struct ompi_communicator_t
104104
* for full explanation why we chose the following padding construct for predefines.
105105
*/
106-
#define PREDEFINED_FILE_PAD (sizeof(void*) * 192)
106+
#define PREDEFINED_FILE_PAD 1536
107107

108108
struct ompi_predefined_file_t {
109109
struct ompi_file_t file;

ompi/group/group.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
* Copyright (c) 2004-2005 The Regents of the University of California.
1212
* All rights reserved.
1313
* Copyright (c) 2006-2007 University of Houston. All rights reserved.
14-
* Copyright (c) 2007-2012 Cisco Systems, Inc. All rights reserved.
14+
* Copyright (c) 2007-2017 Cisco Systems, Inc. All rights reserved
1515
* Copyright (c) 2009 Sun Microsystems, Inc. All rights reserved.
1616
* Copyright (c) 2012 Oak Ridge National Labs. All rights reserved.
1717
* Copyright (c) 2013-2015 Los Alamos National Security, LLC. All rights
@@ -107,7 +107,7 @@ OMPI_DECLSPEC OBJ_CLASS_DECLARATION(ompi_group_t);
107107
* See ompi/communicator/communicator.h comments with struct ompi_communicator_t
108108
* for full explanation why we chose the following padding construct for predefines.
109109
*/
110-
#define PREDEFINED_GROUP_PAD (sizeof(void*) * 32)
110+
#define PREDEFINED_GROUP_PAD 256
111111

112112
struct ompi_predefined_group_t {
113113
struct ompi_group_t group;

ompi/info/info.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
* University of Stuttgart. All rights reserved.
1111
* Copyright (c) 2004-2005 The Regents of the University of California.
1212
* All rights reserved.
13-
* Copyright (c) 2007-2012 Cisco Systems, Inc. All rights reserved.
13+
* Copyright (c) 2007-2017 Cisco Systems, Inc. All rights reserved
1414
* Copyright (c) 2009 Sun Microsystems, Inc. All rights reserved.
1515
* Copyright (c) 2012-2015 Los Alamos National Security, LLC. All rights
1616
* reserved.
@@ -55,7 +55,7 @@ typedef struct ompi_info_t ompi_info_t;
5555
* See ompi/communicator/communicator.h comments with struct ompi_communicator_t
5656
* for full explanation why we chose the following padding construct for predefines.
5757
*/
58-
#define PREDEFINED_INFO_PAD (sizeof(void*) * 32)
58+
#define PREDEFINED_INFO_PAD 256
5959

6060
struct ompi_predefined_info_t {
6161
struct ompi_info_t info;

ompi/message/message.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
22
/*
33
* Copyright (c) 2011-2012 Sandia National Laboratories. All rights reserved.
4-
* Copyright (c) 2012 Cisco Systems, Inc. All rights reserved.
4+
* Copyright (c) 2012-2017 Cisco Systems, Inc. All rights reserved
55
* Copyright (c) 2015 Los Alamos National Security, LLC. All rights
66
* reserved.
77
* $COPYRIGHT$
@@ -38,7 +38,7 @@ OMPI_DECLSPEC OBJ_CLASS_DECLARATION(ompi_message_t);
3838
* See ompi/communicator/communicator.h comments with struct ompi_communicator_t
3939
* for full explanation why we chose the following padding construct for predefines.
4040
*/
41-
#define PREDEFINED_MESSAGE_PAD (sizeof(void*) * 32)
41+
#define PREDEFINED_MESSAGE_PAD 256
4242

4343
struct ompi_predefined_message_t {
4444
struct ompi_message_t message;

ompi/op/op.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
* Copyright (c) 2004-2005 The Regents of the University of California.
1212
* All rights reserved.
1313
* Copyright (c) 2008 UT-Battelle, LLC
14-
* Copyright (c) 2008-2012 Cisco Systems, Inc. All rights reserved.
14+
* Copyright (c) 2008-2017 Cisco Systems, Inc. All rights reserved
1515
* Copyright (c) 2009 Sun Microsystems, Inc. All rights reserved.
1616
* Copyright (c) 2015 Los Alamos National Security, LLC. All rights
1717
* reserved.
@@ -199,7 +199,7 @@ OMPI_DECLSPEC OBJ_CLASS_DECLARATION(ompi_op_t);
199199
* See ompi/communicator/communicator.h comments with struct ompi_communicator_t
200200
* for full explanation why we chose the following padding construct for predefines.
201201
*/
202-
#define PREDEFINED_OP_PAD (sizeof(void*) * 256)
202+
#define PREDEFINED_OP_PAD 2048
203203

204204
struct ompi_predefined_op_t {
205205
struct ompi_op_t op;

ompi/request/request.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
* University of Stuttgart. All rights reserved.
1111
* Copyright (c) 2004-2005 The Regents of the University of California.
1212
* All rights reserved.
13-
* Copyright (c) 2006-2012 Cisco Systems, Inc. All rights reserved.
13+
* Copyright (c) 2006-2017 Cisco Systems, Inc. All rights reserved
1414
* Copyright (c) 2009-2012 Oracle and/or its affiliates. All rights reserved.
1515
* Copyright (c) 2012 Oak Ridge National Labs. All rights reserved.
1616
* Copyright (c) 2015-2016 Los Alamos National Security, LLC. All rights
@@ -127,7 +127,7 @@ typedef struct ompi_request_t ompi_request_t;
127127
* See ompi/communicator/communicator.h comments with struct ompi_communicator_t
128128
* for full explanation why we chose the following padding construct for predefines.
129129
*/
130-
#define PREDEFINED_REQUEST_PAD (sizeof(void*) * 32)
130+
#define PREDEFINED_REQUEST_PAD 256
131131

132132
struct ompi_predefined_request_t {
133133
struct ompi_request_t request;

ompi/win/win.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
* University of Stuttgart. All rights reserved.
1111
* Copyright (c) 2004-2005 The Regents of the University of California.
1212
* All rights reserved.
13-
* Copyright (c) 2006-2012 Cisco Systems, Inc. All rights reserved.
13+
* Copyright (c) 2006-2017 Cisco Systems, Inc. All rights reserved
1414
* Copyright (c) 2009 Sun Microsystems, Inc. All rights reserved.
1515
* Copyright (c) 2013-2015 Los Alamos National Security, LLC. All rights
1616
* reserved.
@@ -119,7 +119,7 @@ OMPI_DECLSPEC OBJ_CLASS_DECLARATION(ompi_win_t);
119119
* See ompi/communicator/communicator.h comments with struct ompi_communicator_t
120120
* for full explanation why we chose the following padding construct for predefines.
121121
*/
122-
#define PREDEFINED_WIN_PAD (sizeof(void*) * 64)
122+
#define PREDEFINED_WIN_PAD 512
123123

124124
struct ompi_predefined_win_t {
125125
struct ompi_win_t win;

0 commit comments

Comments
 (0)