2004-11-22 00:37:56 +00:00
|
|
|
/*
|
2010-03-10 00:18:04 +00:00
|
|
|
* Copyright (c) 2004-2010 The Trustees of Indiana University and Indiana
|
2005-11-05 19:57:48 +00:00
|
|
|
* University Research and Technology
|
|
|
|
* Corporation. All rights reserved.
|
|
|
|
* Copyright (c) 2004-2005 The University of Tennessee and The University
|
|
|
|
* of Tennessee Research Foundation. All rights
|
|
|
|
* reserved.
|
2004-11-28 20:09:25 +00:00
|
|
|
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
|
|
|
|
* University of Stuttgart. All rights reserved.
|
2005-03-24 12:43:37 +00:00
|
|
|
* Copyright (c) 2004-2005 The Regents of the University of California.
|
|
|
|
* All rights reserved.
|
2007-03-07 13:28:06 +00:00
|
|
|
* Copyright (c) 2007 Sun Microsystems, Inc. All rights reserved.
|
2010-02-19 14:37:09 +00:00
|
|
|
* Copyright (c) 2008-2010 Cisco Systems, Inc. All rights reserved.
|
2010-06-09 16:58:52 +00:00
|
|
|
* Copyright (c) 2010 Los Alamos National Security, LLC.
|
|
|
|
* All rights reserved.
|
2004-11-22 01:38:40 +00:00
|
|
|
* $COPYRIGHT$
|
|
|
|
*
|
|
|
|
* Additional copyrights may follow
|
|
|
|
*
|
2004-11-22 00:37:56 +00:00
|
|
|
* $HEADER$
|
|
|
|
*/
|
|
|
|
|
2004-10-20 01:03:09 +00:00
|
|
|
#include "ompi_config.h"
|
2004-06-16 15:41:29 +00:00
|
|
|
#include <errno.h>
|
2004-10-22 16:06:05 +00:00
|
|
|
#ifdef HAVE_UNISTD_H
|
2004-06-16 15:41:29 +00:00
|
|
|
#include <unistd.h>
|
2004-10-22 16:06:05 +00:00
|
|
|
#endif
|
2005-12-12 20:24:07 +00:00
|
|
|
#ifdef HAVE_STRING_H
|
2004-06-16 15:41:29 +00:00
|
|
|
#include <string.h>
|
2005-12-12 20:24:07 +00:00
|
|
|
#endif /* HAVE_STRING_H */
|
|
|
|
#ifdef HAVE_FCNTL_H
|
2004-06-16 15:41:29 +00:00
|
|
|
#include <fcntl.h>
|
2005-12-12 20:24:07 +00:00
|
|
|
#endif /* HAVE_FCNTL_H */
|
|
|
|
#ifdef HAVE_TIME_H
|
2004-06-16 15:41:29 +00:00
|
|
|
#include <time.h>
|
2005-12-12 20:24:07 +00:00
|
|
|
#endif /* HAVE_TIME_H */
|
2004-10-22 16:06:05 +00:00
|
|
|
#ifdef HAVE_SYS_TYPES_H
|
2004-06-16 15:41:29 +00:00
|
|
|
#include <sys/types.h>
|
2004-10-22 16:06:05 +00:00
|
|
|
#endif
|
2005-12-12 20:24:07 +00:00
|
|
|
#ifdef HAVE_SYS_STAT_H
|
2004-06-16 15:41:29 +00:00
|
|
|
#include <sys/stat.h>
|
2005-12-12 20:24:07 +00:00
|
|
|
#endif /* HAVE_SYS_STAT_H */
|
2004-10-22 16:06:05 +00:00
|
|
|
#ifdef HAVE_SYS_MMAN_H
|
2004-06-16 15:41:29 +00:00
|
|
|
#include <sys/mman.h>
|
2004-10-22 16:06:05 +00:00
|
|
|
#endif
|
2004-06-16 15:41:29 +00:00
|
|
|
|
2009-02-14 02:26:12 +00:00
|
|
|
#include "opal/util/output.h"
|
2010-02-10 23:18:29 +00:00
|
|
|
#include "opal/util/path.h"
|
2008-03-30 13:41:47 +00:00
|
|
|
#include "opal/align.h"
|
Fixes trac:1988. The little bug that turned out to be huge. Yoinks.
* Various cosmetic/style updates in the btl sm
* Clean up concept of mpool module (I think that code was written way
back when the concept of "modules" was fuzzy)
* Bring over some old fixes from the /tmp/timattox-sm-coll/ tree to
fix potential segv's when mmap'ed regions were at different
addresses in different processes (thanks Tim!).
* Change sm coll to no longer use mpool as its main source of shmem;
rather, just mmap its own segment (because it's fixed size --
there was nothing to be gained by using mpool; shedding the use of
mpool saved a lot of complexity in the sm coll setup). This
effectively made Tim's fixes moot (because now everything is an
offset into the mmap that is computed locally; there are no global
pointers). :-)
* Slightly updated common/sm to allow making mmap's for a specific
set of procs (vs. ''all'' procs in the process). This potentially
allows for same-host-inter-proc mmaps -- yay!
* Fixed many, many things in the coll sm (particularly in reduce):
* Fixed handling of MPI_IN_PLACE in reduce and allreduce
* Fixed handling of non-contiguous datatypes in reduce
* Changed the order of reductions to go from process (n-1)'s data
to process 0's data, because that's how all other OMPI coll
components work
* Fixed lots of usage of ddt functions
* When using a non-contiguous datatype, if the root process is not
(n-1), now we used a 2nd convertor to copy from shmem to the rbuf
(saves a memory copy vs. what was done before)
* Lots and lots of little cleanups, clarifications, and minor
optimizations (although still more could be done -- e.g., I think
the use of write memory barriers is fairly sub-optimal; they
could be ganged together at the root, for example)
I'm marking this as "fixes trac:1988" and closing the ticket; if something
is still broken, we can re-open the ticket.
This commit was SVN r21967.
The following Trac tickets were found above:
Ticket 1988 --> https://svn.open-mpi.org/trac/ompi/ticket/1988
2009-09-15 00:25:21 +00:00
|
|
|
#include "opal/threads/mutex.h"
|
2010-05-17 23:08:56 +00:00
|
|
|
#include "opal/util/opal_sos.h"
|
Fixes trac:1988. The little bug that turned out to be huge. Yoinks.
* Various cosmetic/style updates in the btl sm
* Clean up concept of mpool module (I think that code was written way
back when the concept of "modules" was fuzzy)
* Bring over some old fixes from the /tmp/timattox-sm-coll/ tree to
fix potential segv's when mmap'ed regions were at different
addresses in different processes (thanks Tim!).
* Change sm coll to no longer use mpool as its main source of shmem;
rather, just mmap its own segment (because it's fixed size --
there was nothing to be gained by using mpool; shedding the use of
mpool saved a lot of complexity in the sm coll setup). This
effectively made Tim's fixes moot (because now everything is an
offset into the mmap that is computed locally; there are no global
pointers). :-)
* Slightly updated common/sm to allow making mmap's for a specific
set of procs (vs. ''all'' procs in the process). This potentially
allows for same-host-inter-proc mmaps -- yay!
* Fixed many, many things in the coll sm (particularly in reduce):
* Fixed handling of MPI_IN_PLACE in reduce and allreduce
* Fixed handling of non-contiguous datatypes in reduce
* Changed the order of reductions to go from process (n-1)'s data
to process 0's data, because that's how all other OMPI coll
components work
* Fixed lots of usage of ddt functions
* When using a non-contiguous datatype, if the root process is not
(n-1), now we used a 2nd convertor to copy from shmem to the rbuf
(saves a memory copy vs. what was done before)
* Lots and lots of little cleanups, clarifications, and minor
optimizations (although still more could be done -- e.g., I think
the use of write memory barriers is fairly sub-optimal; they
could be ganged together at the root, for example)
I'm marking this as "fixes trac:1988" and closing the ticket; if something
is still broken, we can re-open the ticket.
This commit was SVN r21967.
The following Trac tickets were found above:
Ticket 1988 --> https://svn.open-mpi.org/trac/ompi/ticket/1988
2009-09-15 00:25:21 +00:00
|
|
|
|
2009-03-12 17:58:39 +00:00
|
|
|
#include "orte/mca/rml/rml.h"
|
Fixes trac:1988. The little bug that turned out to be huge. Yoinks.
* Various cosmetic/style updates in the btl sm
* Clean up concept of mpool module (I think that code was written way
back when the concept of "modules" was fuzzy)
* Bring over some old fixes from the /tmp/timattox-sm-coll/ tree to
fix potential segv's when mmap'ed regions were at different
addresses in different processes (thanks Tim!).
* Change sm coll to no longer use mpool as its main source of shmem;
rather, just mmap its own segment (because it's fixed size --
there was nothing to be gained by using mpool; shedding the use of
mpool saved a lot of complexity in the sm coll setup). This
effectively made Tim's fixes moot (because now everything is an
offset into the mmap that is computed locally; there are no global
pointers). :-)
* Slightly updated common/sm to allow making mmap's for a specific
set of procs (vs. ''all'' procs in the process). This potentially
allows for same-host-inter-proc mmaps -- yay!
* Fixed many, many things in the coll sm (particularly in reduce):
* Fixed handling of MPI_IN_PLACE in reduce and allreduce
* Fixed handling of non-contiguous datatypes in reduce
* Changed the order of reductions to go from process (n-1)'s data
to process 0's data, because that's how all other OMPI coll
components work
* Fixed lots of usage of ddt functions
* When using a non-contiguous datatype, if the root process is not
(n-1), now we used a 2nd convertor to copy from shmem to the rbuf
(saves a memory copy vs. what was done before)
* Lots and lots of little cleanups, clarifications, and minor
optimizations (although still more could be done -- e.g., I think
the use of write memory barriers is fairly sub-optimal; they
could be ganged together at the root, for example)
I'm marking this as "fixes trac:1988" and closing the ticket; if something
is still broken, we can re-open the ticket.
This commit was SVN r21967.
The following Trac tickets were found above:
Ticket 1988 --> https://svn.open-mpi.org/trac/ompi/ticket/1988
2009-09-15 00:25:21 +00:00
|
|
|
#include "orte/util/name_fns.h"
|
2009-10-02 17:13:56 +00:00
|
|
|
#include "orte/util/show_help.h"
|
2009-09-22 21:19:38 +00:00
|
|
|
#include "orte/runtime/orte_globals.h"
|
2009-10-07 18:58:58 +00:00
|
|
|
#include "orte/mca/errmgr/errmgr.h"
|
2004-06-16 15:41:29 +00:00
|
|
|
|
Fixes trac:1988. The little bug that turned out to be huge. Yoinks.
* Various cosmetic/style updates in the btl sm
* Clean up concept of mpool module (I think that code was written way
back when the concept of "modules" was fuzzy)
* Bring over some old fixes from the /tmp/timattox-sm-coll/ tree to
fix potential segv's when mmap'ed regions were at different
addresses in different processes (thanks Tim!).
* Change sm coll to no longer use mpool as its main source of shmem;
rather, just mmap its own segment (because it's fixed size --
there was nothing to be gained by using mpool; shedding the use of
mpool saved a lot of complexity in the sm coll setup). This
effectively made Tim's fixes moot (because now everything is an
offset into the mmap that is computed locally; there are no global
pointers). :-)
* Slightly updated common/sm to allow making mmap's for a specific
set of procs (vs. ''all'' procs in the process). This potentially
allows for same-host-inter-proc mmaps -- yay!
* Fixed many, many things in the coll sm (particularly in reduce):
* Fixed handling of MPI_IN_PLACE in reduce and allreduce
* Fixed handling of non-contiguous datatypes in reduce
* Changed the order of reductions to go from process (n-1)'s data
to process 0's data, because that's how all other OMPI coll
components work
* Fixed lots of usage of ddt functions
* When using a non-contiguous datatype, if the root process is not
(n-1), now we used a 2nd convertor to copy from shmem to the rbuf
(saves a memory copy vs. what was done before)
* Lots and lots of little cleanups, clarifications, and minor
optimizations (although still more could be done -- e.g., I think
the use of write memory barriers is fairly sub-optimal; they
could be ganged together at the root, for example)
I'm marking this as "fixes trac:1988" and closing the ticket; if something
is still broken, we can re-open the ticket.
This commit was SVN r21967.
The following Trac tickets were found above:
Ticket 1988 --> https://svn.open-mpi.org/trac/ompi/ticket/1988
2009-09-15 00:25:21 +00:00
|
|
|
#include "ompi/constants.h"
|
|
|
|
#include "ompi/proc/proc.h"
|
2008-02-28 01:57:57 +00:00
|
|
|
#include "ompi/mca/dpm/dpm.h"
|
Fixes trac:1988. The little bug that turned out to be huge. Yoinks.
* Various cosmetic/style updates in the btl sm
* Clean up concept of mpool module (I think that code was written way
back when the concept of "modules" was fuzzy)
* Bring over some old fixes from the /tmp/timattox-sm-coll/ tree to
fix potential segv's when mmap'ed regions were at different
addresses in different processes (thanks Tim!).
* Change sm coll to no longer use mpool as its main source of shmem;
rather, just mmap its own segment (because it's fixed size --
there was nothing to be gained by using mpool; shedding the use of
mpool saved a lot of complexity in the sm coll setup). This
effectively made Tim's fixes moot (because now everything is an
offset into the mmap that is computed locally; there are no global
pointers). :-)
* Slightly updated common/sm to allow making mmap's for a specific
set of procs (vs. ''all'' procs in the process). This potentially
allows for same-host-inter-proc mmaps -- yay!
* Fixed many, many things in the coll sm (particularly in reduce):
* Fixed handling of MPI_IN_PLACE in reduce and allreduce
* Fixed handling of non-contiguous datatypes in reduce
* Changed the order of reductions to go from process (n-1)'s data
to process 0's data, because that's how all other OMPI coll
components work
* Fixed lots of usage of ddt functions
* When using a non-contiguous datatype, if the root process is not
(n-1), now we used a 2nd convertor to copy from shmem to the rbuf
(saves a memory copy vs. what was done before)
* Lots and lots of little cleanups, clarifications, and minor
optimizations (although still more could be done -- e.g., I think
the use of write memory barriers is fairly sub-optimal; they
could be ganged together at the root, for example)
I'm marking this as "fixes trac:1988" and closing the ticket; if something
is still broken, we can re-open the ticket.
This commit was SVN r21967.
The following Trac tickets were found above:
Ticket 1988 --> https://svn.open-mpi.org/trac/ompi/ticket/1988
2009-09-15 00:25:21 +00:00
|
|
|
#include "ompi/mca/mpool/sm/mpool_sm.h"
|
2010-08-23 16:04:13 +00:00
|
|
|
|
|
|
|
#include "common_sm_rml.h"
|
Fixes trac:1988. The little bug that turned out to be huge. Yoinks.
* Various cosmetic/style updates in the btl sm
* Clean up concept of mpool module (I think that code was written way
back when the concept of "modules" was fuzzy)
* Bring over some old fixes from the /tmp/timattox-sm-coll/ tree to
fix potential segv's when mmap'ed regions were at different
addresses in different processes (thanks Tim!).
* Change sm coll to no longer use mpool as its main source of shmem;
rather, just mmap its own segment (because it's fixed size --
there was nothing to be gained by using mpool; shedding the use of
mpool saved a lot of complexity in the sm coll setup). This
effectively made Tim's fixes moot (because now everything is an
offset into the mmap that is computed locally; there are no global
pointers). :-)
* Slightly updated common/sm to allow making mmap's for a specific
set of procs (vs. ''all'' procs in the process). This potentially
allows for same-host-inter-proc mmaps -- yay!
* Fixed many, many things in the coll sm (particularly in reduce):
* Fixed handling of MPI_IN_PLACE in reduce and allreduce
* Fixed handling of non-contiguous datatypes in reduce
* Changed the order of reductions to go from process (n-1)'s data
to process 0's data, because that's how all other OMPI coll
components work
* Fixed lots of usage of ddt functions
* When using a non-contiguous datatype, if the root process is not
(n-1), now we used a 2nd convertor to copy from shmem to the rbuf
(saves a memory copy vs. what was done before)
* Lots and lots of little cleanups, clarifications, and minor
optimizations (although still more could be done -- e.g., I think
the use of write memory barriers is fairly sub-optimal; they
could be ganged together at the root, for example)
I'm marking this as "fixes trac:1988" and closing the ticket; if something
is still broken, we can re-open the ticket.
This commit was SVN r21967.
The following Trac tickets were found above:
Ticket 1988 --> https://svn.open-mpi.org/trac/ompi/ticket/1988
2009-09-15 00:25:21 +00:00
|
|
|
#include "common_sm_mmap.h"
|
2008-02-28 01:57:57 +00:00
|
|
|
|
2004-06-16 15:41:29 +00:00
|
|
|
OBJ_CLASS_INSTANCE(
|
2010-06-09 16:58:52 +00:00
|
|
|
mca_common_sm_module_mmap_t,
|
2005-07-03 16:06:07 +00:00
|
|
|
opal_object_t,
|
2004-06-16 15:41:29 +00:00
|
|
|
NULL,
|
|
|
|
NULL
|
|
|
|
);
|
|
|
|
|
2010-08-23 16:04:13 +00:00
|
|
|
/**
|
|
|
|
* list of RML messages that have arrived that have not yet been
|
|
|
|
* consumed by the thread who is looking to complete its component
|
|
|
|
* initialization based on the contents of the RML message.
|
|
|
|
*/
|
|
|
|
static opal_list_t pending_rml_msgs;
|
|
|
|
static bool pending_rml_msgs_init = false;
|
Fixes trac:1988. The little bug that turned out to be huge. Yoinks.
* Various cosmetic/style updates in the btl sm
* Clean up concept of mpool module (I think that code was written way
back when the concept of "modules" was fuzzy)
* Bring over some old fixes from the /tmp/timattox-sm-coll/ tree to
fix potential segv's when mmap'ed regions were at different
addresses in different processes (thanks Tim!).
* Change sm coll to no longer use mpool as its main source of shmem;
rather, just mmap its own segment (because it's fixed size --
there was nothing to be gained by using mpool; shedding the use of
mpool saved a lot of complexity in the sm coll setup). This
effectively made Tim's fixes moot (because now everything is an
offset into the mmap that is computed locally; there are no global
pointers). :-)
* Slightly updated common/sm to allow making mmap's for a specific
set of procs (vs. ''all'' procs in the process). This potentially
allows for same-host-inter-proc mmaps -- yay!
* Fixed many, many things in the coll sm (particularly in reduce):
* Fixed handling of MPI_IN_PLACE in reduce and allreduce
* Fixed handling of non-contiguous datatypes in reduce
* Changed the order of reductions to go from process (n-1)'s data
to process 0's data, because that's how all other OMPI coll
components work
* Fixed lots of usage of ddt functions
* When using a non-contiguous datatype, if the root process is not
(n-1), now we used a 2nd convertor to copy from shmem to the rbuf
(saves a memory copy vs. what was done before)
* Lots and lots of little cleanups, clarifications, and minor
optimizations (although still more could be done -- e.g., I think
the use of write memory barriers is fairly sub-optimal; they
could be ganged together at the root, for example)
I'm marking this as "fixes trac:1988" and closing the ticket; if something
is still broken, we can re-open the ticket.
This commit was SVN r21967.
The following Trac tickets were found above:
Ticket 1988 --> https://svn.open-mpi.org/trac/ompi/ticket/1988
2009-09-15 00:25:21 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Lock to protect multiple instances of mmap_init() from being
|
|
|
|
* invoked simultaneously (because of RML usage).
|
|
|
|
*/
|
|
|
|
static opal_mutex_t mutex;
|
|
|
|
|
2010-08-23 16:04:13 +00:00
|
|
|
/**
|
|
|
|
* shared memory information used for initialization and setup.
|
Fixes trac:1988. The little bug that turned out to be huge. Yoinks.
* Various cosmetic/style updates in the btl sm
* Clean up concept of mpool module (I think that code was written way
back when the concept of "modules" was fuzzy)
* Bring over some old fixes from the /tmp/timattox-sm-coll/ tree to
fix potential segv's when mmap'ed regions were at different
addresses in different processes (thanks Tim!).
* Change sm coll to no longer use mpool as its main source of shmem;
rather, just mmap its own segment (because it's fixed size --
there was nothing to be gained by using mpool; shedding the use of
mpool saved a lot of complexity in the sm coll setup). This
effectively made Tim's fixes moot (because now everything is an
offset into the mmap that is computed locally; there are no global
pointers). :-)
* Slightly updated common/sm to allow making mmap's for a specific
set of procs (vs. ''all'' procs in the process). This potentially
allows for same-host-inter-proc mmaps -- yay!
* Fixed many, many things in the coll sm (particularly in reduce):
* Fixed handling of MPI_IN_PLACE in reduce and allreduce
* Fixed handling of non-contiguous datatypes in reduce
* Changed the order of reductions to go from process (n-1)'s data
to process 0's data, because that's how all other OMPI coll
components work
* Fixed lots of usage of ddt functions
* When using a non-contiguous datatype, if the root process is not
(n-1), now we used a 2nd convertor to copy from shmem to the rbuf
(saves a memory copy vs. what was done before)
* Lots and lots of little cleanups, clarifications, and minor
optimizations (although still more could be done -- e.g., I think
the use of write memory barriers is fairly sub-optimal; they
could be ganged together at the root, for example)
I'm marking this as "fixes trac:1988" and closing the ticket; if something
is still broken, we can re-open the ticket.
This commit was SVN r21967.
The following Trac tickets were found above:
Ticket 1988 --> https://svn.open-mpi.org/trac/ompi/ticket/1988
2009-09-15 00:25:21 +00:00
|
|
|
*/
|
2010-08-23 16:04:13 +00:00
|
|
|
static mca_common_sm_rml_sm_info_t sm_info;
|
2008-03-30 13:41:47 +00:00
|
|
|
|
2010-06-09 16:58:52 +00:00
|
|
|
static mca_common_sm_module_mmap_t *
|
|
|
|
create_map(int fd, size_t size,
|
|
|
|
char *file_name,
|
|
|
|
size_t size_ctl_structure,
|
|
|
|
size_t data_seg_alignment)
|
2008-03-30 13:41:47 +00:00
|
|
|
{
|
2010-06-09 16:58:52 +00:00
|
|
|
mca_common_sm_module_mmap_t *map;
|
|
|
|
mca_common_sm_seg_header_t *seg;
|
2005-08-15 16:48:43 +00:00
|
|
|
unsigned char *addr = NULL;
|
2004-08-04 17:22:16 +00:00
|
|
|
|
2008-03-30 13:41:47 +00:00
|
|
|
/* map the file and initialize segment state */
|
2010-06-09 16:58:52 +00:00
|
|
|
seg = (mca_common_sm_seg_header_t *)
|
|
|
|
mmap(NULL, size, PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0);
|
2009-10-07 18:43:37 +00:00
|
|
|
if (MAP_FAILED == seg) {
|
2010-04-15 15:51:57 +00:00
|
|
|
orte_show_help("help-mpi-common-sm.txt", "sys call fail", 1,
|
2009-10-02 17:13:56 +00:00
|
|
|
orte_process_info.nodename,
|
2010-03-10 00:18:04 +00:00
|
|
|
"mmap(2)", "", ORTE_NAME_PRINT(ORTE_PROC_MY_NAME),
|
2009-10-02 17:13:56 +00:00
|
|
|
strerror(errno), errno);
|
2008-03-30 13:41:47 +00:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* set up the map object */
|
2010-06-09 16:58:52 +00:00
|
|
|
map = OBJ_NEW(mca_common_sm_module_mmap_t);
|
|
|
|
strncpy(map->super.module_seg_path, file_name, OPAL_PATH_MAX);
|
2008-03-30 13:41:47 +00:00
|
|
|
/* the first entry in the file is the control structure. The first
|
2010-06-09 16:58:52 +00:00
|
|
|
entry in the control structure is an mca_common_sm_seg_header_t
|
2008-03-30 13:41:47 +00:00
|
|
|
element */
|
2010-06-09 16:58:52 +00:00
|
|
|
map->super.module_seg = seg;
|
2008-03-30 13:41:47 +00:00
|
|
|
|
|
|
|
addr = ((unsigned char *)seg) + size_ctl_structure;
|
|
|
|
/* If we have a data segment (i.e., if 0 != data_seg_alignment),
|
|
|
|
then make it the first aligned address after the control
|
2009-10-02 17:13:56 +00:00
|
|
|
structure. IF THIS HAPPENS, THIS IS A PROGRAMMING ERROR IN
|
|
|
|
OPEN MPI!*/
|
2008-03-30 13:41:47 +00:00
|
|
|
if (0 != data_seg_alignment) {
|
|
|
|
addr = OPAL_ALIGN_PTR(addr, data_seg_alignment, unsigned char*);
|
|
|
|
|
|
|
|
/* is addr past end of file ? */
|
|
|
|
if((unsigned char*)seg + size < addr) {
|
2010-04-15 15:51:57 +00:00
|
|
|
orte_show_help("help-mpi-common-sm.txt", "mmap too small", 1,
|
2009-10-02 17:13:56 +00:00
|
|
|
orte_process_info.nodename,
|
|
|
|
(unsigned long) size,
|
|
|
|
(unsigned long) size_ctl_structure,
|
|
|
|
(unsigned long) data_seg_alignment);
|
2008-03-30 13:41:47 +00:00
|
|
|
return NULL;
|
2007-01-03 00:06:02 +00:00
|
|
|
}
|
2004-06-16 15:41:29 +00:00
|
|
|
}
|
2010-06-09 16:58:52 +00:00
|
|
|
map->super.module_data_addr = addr;
|
|
|
|
map->super.module_seg_addr = (unsigned char *)seg;
|
|
|
|
map->super.module_size = size;
|
2008-03-30 13:41:47 +00:00
|
|
|
|
2010-08-23 16:04:13 +00:00
|
|
|
/* map object successful initialized - we can safely increment seg_att */
|
|
|
|
opal_atomic_wmb();
|
|
|
|
opal_atomic_add_32(&map->super.module_seg->seg_att, 1);
|
|
|
|
|
2008-03-30 13:41:47 +00:00
|
|
|
return map;
|
|
|
|
}
|
2004-06-16 15:41:29 +00:00
|
|
|
|
2010-06-09 16:58:52 +00:00
|
|
|
/******************************************************************************/
|
|
|
|
/**
|
|
|
|
* mca_common_sm_mmap_component_query
|
|
|
|
*/
|
|
|
|
int
|
|
|
|
mca_common_sm_mmap_component_query(void)
|
|
|
|
{
|
|
|
|
return OMPI_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
mca_common_sm_module_t *
|
2010-08-23 16:04:13 +00:00
|
|
|
mca_common_sm_mmap_init(ompi_proc_t **sorted_procs,
|
|
|
|
size_t num_loc_procs,
|
2010-06-09 16:58:52 +00:00
|
|
|
size_t size, char *file_name,
|
|
|
|
size_t size_ctl_structure,
|
|
|
|
size_t data_seg_alignment)
|
2008-03-30 13:41:47 +00:00
|
|
|
{
|
|
|
|
int fd = -1;
|
2010-08-23 16:04:13 +00:00
|
|
|
bool lowest;
|
2010-06-09 16:58:52 +00:00
|
|
|
mca_common_sm_module_mmap_t *map = NULL;
|
2010-08-23 16:04:13 +00:00
|
|
|
size_t mem_offset;
|
|
|
|
int num_local_procs;
|
|
|
|
|
|
|
|
lowest = (0 == orte_util_compare_name_fields(
|
|
|
|
ORTE_NS_CMP_ALL,
|
|
|
|
ORTE_PROC_MY_NAME,
|
|
|
|
&(sorted_procs[0]->proc_name)));
|
|
|
|
|
|
|
|
/* using sm_info.id as an initialization marker:
|
|
|
|
* o 0 -> not initialized; 1 -> initialized
|
|
|
|
*/
|
|
|
|
sm_info.id = 0;
|
|
|
|
memset(sm_info.posix_fname_buff, '\0', OMPI_COMMON_SM_POSIX_FILE_LEN_MAX);
|
|
|
|
/**
|
|
|
|
* remember that this function was passed
|
|
|
|
* a sorted procs array and a local proc count.
|
|
|
|
*/
|
|
|
|
num_local_procs = num_loc_procs;
|
Fixes trac:1988. The little bug that turned out to be huge. Yoinks.
* Various cosmetic/style updates in the btl sm
* Clean up concept of mpool module (I think that code was written way
back when the concept of "modules" was fuzzy)
* Bring over some old fixes from the /tmp/timattox-sm-coll/ tree to
fix potential segv's when mmap'ed regions were at different
addresses in different processes (thanks Tim!).
* Change sm coll to no longer use mpool as its main source of shmem;
rather, just mmap its own segment (because it's fixed size --
there was nothing to be gained by using mpool; shedding the use of
mpool saved a lot of complexity in the sm coll setup). This
effectively made Tim's fixes moot (because now everything is an
offset into the mmap that is computed locally; there are no global
pointers). :-)
* Slightly updated common/sm to allow making mmap's for a specific
set of procs (vs. ''all'' procs in the process). This potentially
allows for same-host-inter-proc mmaps -- yay!
* Fixed many, many things in the coll sm (particularly in reduce):
* Fixed handling of MPI_IN_PLACE in reduce and allreduce
* Fixed handling of non-contiguous datatypes in reduce
* Changed the order of reductions to go from process (n-1)'s data
to process 0's data, because that's how all other OMPI coll
components work
* Fixed lots of usage of ddt functions
* When using a non-contiguous datatype, if the root process is not
(n-1), now we used a 2nd convertor to copy from shmem to the rbuf
(saves a memory copy vs. what was done before)
* Lots and lots of little cleanups, clarifications, and minor
optimizations (although still more could be done -- e.g., I think
the use of write memory barriers is fairly sub-optimal; they
could be ganged together at the root, for example)
I'm marking this as "fixes trac:1988" and closing the ticket; if something
is still broken, we can re-open the ticket.
This commit was SVN r21967.
The following Trac tickets were found above:
Ticket 1988 --> https://svn.open-mpi.org/trac/ompi/ticket/1988
2009-09-15 00:25:21 +00:00
|
|
|
|
|
|
|
/* Lock here to prevent multiple threads from invoking this
|
|
|
|
function simultaneously. The critical section we're protecting
|
|
|
|
is usage of the RML in this block. */
|
|
|
|
opal_mutex_lock(&mutex);
|
|
|
|
|
2010-08-23 16:04:13 +00:00
|
|
|
if (!pending_rml_msgs_init)
|
|
|
|
{
|
Fixes trac:1988. The little bug that turned out to be huge. Yoinks.
* Various cosmetic/style updates in the btl sm
* Clean up concept of mpool module (I think that code was written way
back when the concept of "modules" was fuzzy)
* Bring over some old fixes from the /tmp/timattox-sm-coll/ tree to
fix potential segv's when mmap'ed regions were at different
addresses in different processes (thanks Tim!).
* Change sm coll to no longer use mpool as its main source of shmem;
rather, just mmap its own segment (because it's fixed size --
there was nothing to be gained by using mpool; shedding the use of
mpool saved a lot of complexity in the sm coll setup). This
effectively made Tim's fixes moot (because now everything is an
offset into the mmap that is computed locally; there are no global
pointers). :-)
* Slightly updated common/sm to allow making mmap's for a specific
set of procs (vs. ''all'' procs in the process). This potentially
allows for same-host-inter-proc mmaps -- yay!
* Fixed many, many things in the coll sm (particularly in reduce):
* Fixed handling of MPI_IN_PLACE in reduce and allreduce
* Fixed handling of non-contiguous datatypes in reduce
* Changed the order of reductions to go from process (n-1)'s data
to process 0's data, because that's how all other OMPI coll
components work
* Fixed lots of usage of ddt functions
* When using a non-contiguous datatype, if the root process is not
(n-1), now we used a 2nd convertor to copy from shmem to the rbuf
(saves a memory copy vs. what was done before)
* Lots and lots of little cleanups, clarifications, and minor
optimizations (although still more could be done -- e.g., I think
the use of write memory barriers is fairly sub-optimal; they
could be ganged together at the root, for example)
I'm marking this as "fixes trac:1988" and closing the ticket; if something
is still broken, we can re-open the ticket.
This commit was SVN r21967.
The following Trac tickets were found above:
Ticket 1988 --> https://svn.open-mpi.org/trac/ompi/ticket/1988
2009-09-15 00:25:21 +00:00
|
|
|
OBJ_CONSTRUCT(&(pending_rml_msgs), opal_list_t);
|
|
|
|
pending_rml_msgs_init = true;
|
|
|
|
}
|
2008-03-30 13:41:47 +00:00
|
|
|
|
Fixes trac:1988. The little bug that turned out to be huge. Yoinks.
* Various cosmetic/style updates in the btl sm
* Clean up concept of mpool module (I think that code was written way
back when the concept of "modules" was fuzzy)
* Bring over some old fixes from the /tmp/timattox-sm-coll/ tree to
fix potential segv's when mmap'ed regions were at different
addresses in different processes (thanks Tim!).
* Change sm coll to no longer use mpool as its main source of shmem;
rather, just mmap its own segment (because it's fixed size --
there was nothing to be gained by using mpool; shedding the use of
mpool saved a lot of complexity in the sm coll setup). This
effectively made Tim's fixes moot (because now everything is an
offset into the mmap that is computed locally; there are no global
pointers). :-)
* Slightly updated common/sm to allow making mmap's for a specific
set of procs (vs. ''all'' procs in the process). This potentially
allows for same-host-inter-proc mmaps -- yay!
* Fixed many, many things in the coll sm (particularly in reduce):
* Fixed handling of MPI_IN_PLACE in reduce and allreduce
* Fixed handling of non-contiguous datatypes in reduce
* Changed the order of reductions to go from process (n-1)'s data
to process 0's data, because that's how all other OMPI coll
components work
* Fixed lots of usage of ddt functions
* When using a non-contiguous datatype, if the root process is not
(n-1), now we used a 2nd convertor to copy from shmem to the rbuf
(saves a memory copy vs. what was done before)
* Lots and lots of little cleanups, clarifications, and minor
optimizations (although still more could be done -- e.g., I think
the use of write memory barriers is fairly sub-optimal; they
could be ganged together at the root, for example)
I'm marking this as "fixes trac:1988" and closing the ticket; if something
is still broken, we can re-open the ticket.
This commit was SVN r21967.
The following Trac tickets were found above:
Ticket 1988 --> https://svn.open-mpi.org/trac/ompi/ticket/1988
2009-09-15 00:25:21 +00:00
|
|
|
/* Figure out if I am the lowest rank in the group. If so, I will
|
|
|
|
create the shared file. */
|
2010-08-23 16:04:13 +00:00
|
|
|
if (lowest) {
|
2010-06-09 16:58:52 +00:00
|
|
|
/* check, whether the specified filename is on a network file system */
|
2010-02-10 23:18:29 +00:00
|
|
|
if (opal_path_nfs(file_name)) {
|
|
|
|
orte_show_help("help-mpi-common-sm.txt", "mmap on nfs", 1,
|
2010-02-19 14:37:09 +00:00
|
|
|
orte_process_info.nodename, file_name);
|
2010-02-10 23:18:29 +00:00
|
|
|
}
|
2007-01-01 02:39:02 +00:00
|
|
|
/* process initializing the file */
|
|
|
|
fd = open(file_name, O_CREAT|O_RDWR, 0600);
|
Fixes trac:1988. The little bug that turned out to be huge. Yoinks.
* Various cosmetic/style updates in the btl sm
* Clean up concept of mpool module (I think that code was written way
back when the concept of "modules" was fuzzy)
* Bring over some old fixes from the /tmp/timattox-sm-coll/ tree to
fix potential segv's when mmap'ed regions were at different
addresses in different processes (thanks Tim!).
* Change sm coll to no longer use mpool as its main source of shmem;
rather, just mmap its own segment (because it's fixed size --
there was nothing to be gained by using mpool; shedding the use of
mpool saved a lot of complexity in the sm coll setup). This
effectively made Tim's fixes moot (because now everything is an
offset into the mmap that is computed locally; there are no global
pointers). :-)
* Slightly updated common/sm to allow making mmap's for a specific
set of procs (vs. ''all'' procs in the process). This potentially
allows for same-host-inter-proc mmaps -- yay!
* Fixed many, many things in the coll sm (particularly in reduce):
* Fixed handling of MPI_IN_PLACE in reduce and allreduce
* Fixed handling of non-contiguous datatypes in reduce
* Changed the order of reductions to go from process (n-1)'s data
to process 0's data, because that's how all other OMPI coll
components work
* Fixed lots of usage of ddt functions
* When using a non-contiguous datatype, if the root process is not
(n-1), now we used a 2nd convertor to copy from shmem to the rbuf
(saves a memory copy vs. what was done before)
* Lots and lots of little cleanups, clarifications, and minor
optimizations (although still more could be done -- e.g., I think
the use of write memory barriers is fairly sub-optimal; they
could be ganged together at the root, for example)
I'm marking this as "fixes trac:1988" and closing the ticket; if something
is still broken, we can re-open the ticket.
This commit was SVN r21967.
The following Trac tickets were found above:
Ticket 1988 --> https://svn.open-mpi.org/trac/ompi/ticket/1988
2009-09-15 00:25:21 +00:00
|
|
|
if (fd < 0) {
|
2009-10-07 18:58:58 +00:00
|
|
|
int err = errno;
|
2009-10-02 17:13:56 +00:00
|
|
|
orte_show_help("help-mpi-common-sm.txt", "sys call fail", 1,
|
|
|
|
orte_process_info.nodename,
|
2010-03-10 00:18:04 +00:00
|
|
|
"open(2)", file_name, ORTE_NAME_PRINT(ORTE_PROC_MY_NAME),
|
2009-10-07 18:58:58 +00:00
|
|
|
strerror(err), err);
|
Fixes trac:1988. The little bug that turned out to be huge. Yoinks.
* Various cosmetic/style updates in the btl sm
* Clean up concept of mpool module (I think that code was written way
back when the concept of "modules" was fuzzy)
* Bring over some old fixes from the /tmp/timattox-sm-coll/ tree to
fix potential segv's when mmap'ed regions were at different
addresses in different processes (thanks Tim!).
* Change sm coll to no longer use mpool as its main source of shmem;
rather, just mmap its own segment (because it's fixed size --
there was nothing to be gained by using mpool; shedding the use of
mpool saved a lot of complexity in the sm coll setup). This
effectively made Tim's fixes moot (because now everything is an
offset into the mmap that is computed locally; there are no global
pointers). :-)
* Slightly updated common/sm to allow making mmap's for a specific
set of procs (vs. ''all'' procs in the process). This potentially
allows for same-host-inter-proc mmaps -- yay!
* Fixed many, many things in the coll sm (particularly in reduce):
* Fixed handling of MPI_IN_PLACE in reduce and allreduce
* Fixed handling of non-contiguous datatypes in reduce
* Changed the order of reductions to go from process (n-1)'s data
to process 0's data, because that's how all other OMPI coll
components work
* Fixed lots of usage of ddt functions
* When using a non-contiguous datatype, if the root process is not
(n-1), now we used a 2nd convertor to copy from shmem to the rbuf
(saves a memory copy vs. what was done before)
* Lots and lots of little cleanups, clarifications, and minor
optimizations (although still more could be done -- e.g., I think
the use of write memory barriers is fairly sub-optimal; they
could be ganged together at the root, for example)
I'm marking this as "fixes trac:1988" and closing the ticket; if something
is still broken, we can re-open the ticket.
This commit was SVN r21967.
The following Trac tickets were found above:
Ticket 1988 --> https://svn.open-mpi.org/trac/ompi/ticket/1988
2009-09-15 00:25:21 +00:00
|
|
|
} else if (ftruncate(fd, size) != 0) {
|
2009-10-07 18:58:58 +00:00
|
|
|
int err = errno;
|
2009-10-02 17:13:56 +00:00
|
|
|
orte_show_help("help-mpi-common-sm.txt", "sys call fail", 1,
|
|
|
|
orte_process_info.nodename,
|
2010-03-10 00:18:04 +00:00
|
|
|
"ftruncate(2)", "", ORTE_NAME_PRINT(ORTE_PROC_MY_NAME),
|
2009-10-07 18:58:58 +00:00
|
|
|
strerror(err), err);
|
2009-10-02 17:13:56 +00:00
|
|
|
close(fd);
|
|
|
|
unlink(file_name);
|
|
|
|
fd = -1;
|
2007-01-01 02:39:02 +00:00
|
|
|
} else {
|
2008-03-30 13:41:47 +00:00
|
|
|
map = create_map(fd, size, file_name, size_ctl_structure,
|
|
|
|
data_seg_alignment);
|
Fixes trac:1988. The little bug that turned out to be huge. Yoinks.
* Various cosmetic/style updates in the btl sm
* Clean up concept of mpool module (I think that code was written way
back when the concept of "modules" was fuzzy)
* Bring over some old fixes from the /tmp/timattox-sm-coll/ tree to
fix potential segv's when mmap'ed regions were at different
addresses in different processes (thanks Tim!).
* Change sm coll to no longer use mpool as its main source of shmem;
rather, just mmap its own segment (because it's fixed size --
there was nothing to be gained by using mpool; shedding the use of
mpool saved a lot of complexity in the sm coll setup). This
effectively made Tim's fixes moot (because now everything is an
offset into the mmap that is computed locally; there are no global
pointers). :-)
* Slightly updated common/sm to allow making mmap's for a specific
set of procs (vs. ''all'' procs in the process). This potentially
allows for same-host-inter-proc mmaps -- yay!
* Fixed many, many things in the coll sm (particularly in reduce):
* Fixed handling of MPI_IN_PLACE in reduce and allreduce
* Fixed handling of non-contiguous datatypes in reduce
* Changed the order of reductions to go from process (n-1)'s data
to process 0's data, because that's how all other OMPI coll
components work
* Fixed lots of usage of ddt functions
* When using a non-contiguous datatype, if the root process is not
(n-1), now we used a 2nd convertor to copy from shmem to the rbuf
(saves a memory copy vs. what was done before)
* Lots and lots of little cleanups, clarifications, and minor
optimizations (although still more could be done -- e.g., I think
the use of write memory barriers is fairly sub-optimal; they
could be ganged together at the root, for example)
I'm marking this as "fixes trac:1988" and closing the ticket; if something
is still broken, we can re-open the ticket.
This commit was SVN r21967.
The following Trac tickets were found above:
Ticket 1988 --> https://svn.open-mpi.org/trac/ompi/ticket/1988
2009-09-15 00:25:21 +00:00
|
|
|
if (map != NULL) {
|
2010-08-23 16:04:13 +00:00
|
|
|
sm_info.id = 1;
|
2008-03-30 13:41:47 +00:00
|
|
|
|
|
|
|
/* initialize the segment - only the first process
|
|
|
|
to open the file */
|
2010-06-09 16:58:52 +00:00
|
|
|
mem_offset =
|
|
|
|
map->super.module_data_addr -
|
|
|
|
(unsigned char *)map->super.module_seg;
|
|
|
|
map->super.module_seg->seg_offset = mem_offset;
|
|
|
|
map->super.module_seg->seg_size = size - mem_offset;
|
|
|
|
opal_atomic_unlock(&map->super.module_seg->seg_lock);
|
|
|
|
map->super.module_seg->seg_inited = 0;
|
2009-10-02 17:13:56 +00:00
|
|
|
} else {
|
|
|
|
close(fd);
|
|
|
|
unlink(file_name);
|
|
|
|
fd = -1;
|
2008-03-30 13:41:47 +00:00
|
|
|
}
|
|
|
|
}
|
2010-08-23 16:04:13 +00:00
|
|
|
}
|
2007-01-03 00:06:02 +00:00
|
|
|
|
2010-08-23 16:04:13 +00:00
|
|
|
/* Signal the rest of the local procs that the backing file
|
|
|
|
has been created. */
|
|
|
|
if (OMPI_SUCCESS != mca_common_sm_rml_info_bcast(
|
|
|
|
&sm_info,
|
|
|
|
sorted_procs,
|
|
|
|
num_local_procs,
|
|
|
|
OMPI_RML_TAG_SM_BACK_FILE_CREATED,
|
|
|
|
lowest,
|
|
|
|
file_name,
|
|
|
|
&(pending_rml_msgs))) {
|
|
|
|
goto out;
|
|
|
|
}
|
Fixes trac:1988. The little bug that turned out to be huge. Yoinks.
* Various cosmetic/style updates in the btl sm
* Clean up concept of mpool module (I think that code was written way
back when the concept of "modules" was fuzzy)
* Bring over some old fixes from the /tmp/timattox-sm-coll/ tree to
fix potential segv's when mmap'ed regions were at different
addresses in different processes (thanks Tim!).
* Change sm coll to no longer use mpool as its main source of shmem;
rather, just mmap its own segment (because it's fixed size --
there was nothing to be gained by using mpool; shedding the use of
mpool saved a lot of complexity in the sm coll setup). This
effectively made Tim's fixes moot (because now everything is an
offset into the mmap that is computed locally; there are no global
pointers). :-)
* Slightly updated common/sm to allow making mmap's for a specific
set of procs (vs. ''all'' procs in the process). This potentially
allows for same-host-inter-proc mmaps -- yay!
* Fixed many, many things in the coll sm (particularly in reduce):
* Fixed handling of MPI_IN_PLACE in reduce and allreduce
* Fixed handling of non-contiguous datatypes in reduce
* Changed the order of reductions to go from process (n-1)'s data
to process 0's data, because that's how all other OMPI coll
components work
* Fixed lots of usage of ddt functions
* When using a non-contiguous datatype, if the root process is not
(n-1), now we used a 2nd convertor to copy from shmem to the rbuf
(saves a memory copy vs. what was done before)
* Lots and lots of little cleanups, clarifications, and minor
optimizations (although still more could be done -- e.g., I think
the use of write memory barriers is fairly sub-optimal; they
could be ganged together at the root, for example)
I'm marking this as "fixes trac:1988" and closing the ticket; if something
is still broken, we can re-open the ticket.
This commit was SVN r21967.
The following Trac tickets were found above:
Ticket 1988 --> https://svn.open-mpi.org/trac/ompi/ticket/1988
2009-09-15 00:25:21 +00:00
|
|
|
|
2010-08-23 16:04:13 +00:00
|
|
|
if (lowest)
|
|
|
|
{
|
|
|
|
if (1 == sm_info.id)
|
|
|
|
{
|
|
|
|
/* wait until all other local procs have reported in */
|
|
|
|
while (num_local_procs > map->super.module_seg->seg_att);
|
|
|
|
{
|
|
|
|
opal_atomic_rmb();
|
Fixes trac:1988. The little bug that turned out to be huge. Yoinks.
* Various cosmetic/style updates in the btl sm
* Clean up concept of mpool module (I think that code was written way
back when the concept of "modules" was fuzzy)
* Bring over some old fixes from the /tmp/timattox-sm-coll/ tree to
fix potential segv's when mmap'ed regions were at different
addresses in different processes (thanks Tim!).
* Change sm coll to no longer use mpool as its main source of shmem;
rather, just mmap its own segment (because it's fixed size --
there was nothing to be gained by using mpool; shedding the use of
mpool saved a lot of complexity in the sm coll setup). This
effectively made Tim's fixes moot (because now everything is an
offset into the mmap that is computed locally; there are no global
pointers). :-)
* Slightly updated common/sm to allow making mmap's for a specific
set of procs (vs. ''all'' procs in the process). This potentially
allows for same-host-inter-proc mmaps -- yay!
* Fixed many, many things in the coll sm (particularly in reduce):
* Fixed handling of MPI_IN_PLACE in reduce and allreduce
* Fixed handling of non-contiguous datatypes in reduce
* Changed the order of reductions to go from process (n-1)'s data
to process 0's data, because that's how all other OMPI coll
components work
* Fixed lots of usage of ddt functions
* When using a non-contiguous datatype, if the root process is not
(n-1), now we used a 2nd convertor to copy from shmem to the rbuf
(saves a memory copy vs. what was done before)
* Lots and lots of little cleanups, clarifications, and minor
optimizations (although still more could be done -- e.g., I think
the use of write memory barriers is fairly sub-optimal; they
could be ganged together at the root, for example)
I'm marking this as "fixes trac:1988" and closing the ticket; if something
is still broken, we can re-open the ticket.
This commit was SVN r21967.
The following Trac tickets were found above:
Ticket 1988 --> https://svn.open-mpi.org/trac/ompi/ticket/1988
2009-09-15 00:25:21 +00:00
|
|
|
}
|
2010-08-23 16:04:13 +00:00
|
|
|
/**
|
|
|
|
* all other local procs reported in, so it's safe to unlink
|
|
|
|
*/
|
|
|
|
unlink(file_name);
|
2007-01-03 00:06:02 +00:00
|
|
|
}
|
2010-08-23 16:04:13 +00:00
|
|
|
} else {
|
|
|
|
/* check to see if file initialized correctly */
|
|
|
|
if (sm_info.id != 0) {
|
2008-03-30 13:41:47 +00:00
|
|
|
fd = open(file_name, O_RDWR, 0600);
|
2007-01-01 02:39:02 +00:00
|
|
|
|
Fixes trac:1988. The little bug that turned out to be huge. Yoinks.
* Various cosmetic/style updates in the btl sm
* Clean up concept of mpool module (I think that code was written way
back when the concept of "modules" was fuzzy)
* Bring over some old fixes from the /tmp/timattox-sm-coll/ tree to
fix potential segv's when mmap'ed regions were at different
addresses in different processes (thanks Tim!).
* Change sm coll to no longer use mpool as its main source of shmem;
rather, just mmap its own segment (because it's fixed size --
there was nothing to be gained by using mpool; shedding the use of
mpool saved a lot of complexity in the sm coll setup). This
effectively made Tim's fixes moot (because now everything is an
offset into the mmap that is computed locally; there are no global
pointers). :-)
* Slightly updated common/sm to allow making mmap's for a specific
set of procs (vs. ''all'' procs in the process). This potentially
allows for same-host-inter-proc mmaps -- yay!
* Fixed many, many things in the coll sm (particularly in reduce):
* Fixed handling of MPI_IN_PLACE in reduce and allreduce
* Fixed handling of non-contiguous datatypes in reduce
* Changed the order of reductions to go from process (n-1)'s data
to process 0's data, because that's how all other OMPI coll
components work
* Fixed lots of usage of ddt functions
* When using a non-contiguous datatype, if the root process is not
(n-1), now we used a 2nd convertor to copy from shmem to the rbuf
(saves a memory copy vs. what was done before)
* Lots and lots of little cleanups, clarifications, and minor
optimizations (although still more could be done -- e.g., I think
the use of write memory barriers is fairly sub-optimal; they
could be ganged together at the root, for example)
I'm marking this as "fixes trac:1988" and closing the ticket; if something
is still broken, we can re-open the ticket.
This commit was SVN r21967.
The following Trac tickets were found above:
Ticket 1988 --> https://svn.open-mpi.org/trac/ompi/ticket/1988
2009-09-15 00:25:21 +00:00
|
|
|
if (fd != -1) {
|
2008-03-30 13:41:47 +00:00
|
|
|
map = create_map(fd, size, file_name, size_ctl_structure,
|
|
|
|
data_seg_alignment);
|
Fixes trac:1988. The little bug that turned out to be huge. Yoinks.
* Various cosmetic/style updates in the btl sm
* Clean up concept of mpool module (I think that code was written way
back when the concept of "modules" was fuzzy)
* Bring over some old fixes from the /tmp/timattox-sm-coll/ tree to
fix potential segv's when mmap'ed regions were at different
addresses in different processes (thanks Tim!).
* Change sm coll to no longer use mpool as its main source of shmem;
rather, just mmap its own segment (because it's fixed size --
there was nothing to be gained by using mpool; shedding the use of
mpool saved a lot of complexity in the sm coll setup). This
effectively made Tim's fixes moot (because now everything is an
offset into the mmap that is computed locally; there are no global
pointers). :-)
* Slightly updated common/sm to allow making mmap's for a specific
set of procs (vs. ''all'' procs in the process). This potentially
allows for same-host-inter-proc mmaps -- yay!
* Fixed many, many things in the coll sm (particularly in reduce):
* Fixed handling of MPI_IN_PLACE in reduce and allreduce
* Fixed handling of non-contiguous datatypes in reduce
* Changed the order of reductions to go from process (n-1)'s data
to process 0's data, because that's how all other OMPI coll
components work
* Fixed lots of usage of ddt functions
* When using a non-contiguous datatype, if the root process is not
(n-1), now we used a 2nd convertor to copy from shmem to the rbuf
(saves a memory copy vs. what was done before)
* Lots and lots of little cleanups, clarifications, and minor
optimizations (although still more could be done -- e.g., I think
the use of write memory barriers is fairly sub-optimal; they
could be ganged together at the root, for example)
I'm marking this as "fixes trac:1988" and closing the ticket; if something
is still broken, we can re-open the ticket.
This commit was SVN r21967.
The following Trac tickets were found above:
Ticket 1988 --> https://svn.open-mpi.org/trac/ompi/ticket/1988
2009-09-15 00:25:21 +00:00
|
|
|
}
|
2007-01-01 02:39:02 +00:00
|
|
|
}
|
2004-06-16 15:41:29 +00:00
|
|
|
}
|
2007-01-01 02:39:02 +00:00
|
|
|
|
2008-03-30 13:41:47 +00:00
|
|
|
out:
|
Fixes trac:1988. The little bug that turned out to be huge. Yoinks.
* Various cosmetic/style updates in the btl sm
* Clean up concept of mpool module (I think that code was written way
back when the concept of "modules" was fuzzy)
* Bring over some old fixes from the /tmp/timattox-sm-coll/ tree to
fix potential segv's when mmap'ed regions were at different
addresses in different processes (thanks Tim!).
* Change sm coll to no longer use mpool as its main source of shmem;
rather, just mmap its own segment (because it's fixed size --
there was nothing to be gained by using mpool; shedding the use of
mpool saved a lot of complexity in the sm coll setup). This
effectively made Tim's fixes moot (because now everything is an
offset into the mmap that is computed locally; there are no global
pointers). :-)
* Slightly updated common/sm to allow making mmap's for a specific
set of procs (vs. ''all'' procs in the process). This potentially
allows for same-host-inter-proc mmaps -- yay!
* Fixed many, many things in the coll sm (particularly in reduce):
* Fixed handling of MPI_IN_PLACE in reduce and allreduce
* Fixed handling of non-contiguous datatypes in reduce
* Changed the order of reductions to go from process (n-1)'s data
to process 0's data, because that's how all other OMPI coll
components work
* Fixed lots of usage of ddt functions
* When using a non-contiguous datatype, if the root process is not
(n-1), now we used a 2nd convertor to copy from shmem to the rbuf
(saves a memory copy vs. what was done before)
* Lots and lots of little cleanups, clarifications, and minor
optimizations (although still more could be done -- e.g., I think
the use of write memory barriers is fairly sub-optimal; they
could be ganged together at the root, for example)
I'm marking this as "fixes trac:1988" and closing the ticket; if something
is still broken, we can re-open the ticket.
This commit was SVN r21967.
The following Trac tickets were found above:
Ticket 1988 --> https://svn.open-mpi.org/trac/ompi/ticket/1988
2009-09-15 00:25:21 +00:00
|
|
|
opal_mutex_unlock(&mutex);
|
|
|
|
|
|
|
|
if (fd != -1) {
|
|
|
|
close(fd);
|
|
|
|
}
|
2007-01-01 02:39:02 +00:00
|
|
|
|
2010-06-09 16:58:52 +00:00
|
|
|
return &(map->super);
|
2004-06-16 15:41:29 +00:00
|
|
|
}
|
|
|
|
|
2010-06-09 16:58:52 +00:00
|
|
|
int
|
|
|
|
mca_common_sm_mmap_fini(mca_common_sm_module_t *mca_common_sm_module)
|
2005-12-31 15:06:24 +00:00
|
|
|
{
|
2010-06-09 16:58:52 +00:00
|
|
|
mca_common_sm_module_mmap_t *mmap_module =
|
|
|
|
(mca_common_sm_module_mmap_t *)mca_common_sm_module;
|
2005-12-31 16:11:58 +00:00
|
|
|
int rc = OMPI_SUCCESS;
|
|
|
|
|
2010-06-09 16:58:52 +00:00
|
|
|
if( NULL != mmap_module->super.module_seg ) {
|
|
|
|
rc = munmap((void*) mmap_module->super.module_seg_addr,
|
|
|
|
mmap_module->super.module_size);
|
|
|
|
mmap_module->super.module_seg_addr = NULL;
|
|
|
|
mmap_module->super.module_size = 0;
|
2005-12-31 15:06:24 +00:00
|
|
|
}
|
2005-12-31 16:11:58 +00:00
|
|
|
return rc;
|
2005-12-31 15:06:24 +00:00
|
|
|
}
|
2004-06-16 15:41:29 +00:00
|
|
|
|
2004-08-11 16:06:14 +00:00
|
|
|
/**
|
|
|
|
* allocate memory from a previously allocated shared memory
|
|
|
|
* block.
|
|
|
|
*
|
|
|
|
* @param size size of request, in bytes (IN)
|
|
|
|
*
|
|
|
|
* @retval addr virtual address
|
|
|
|
*/
|
2005-06-21 17:10:28 +00:00
|
|
|
|
2010-06-09 16:58:52 +00:00
|
|
|
void *
|
|
|
|
mca_common_sm_mmap_seg_alloc(struct mca_mpool_base_module_t* mpool,
|
|
|
|
size_t* size,
|
|
|
|
mca_mpool_base_registration_t** registration)
|
2004-06-16 15:41:29 +00:00
|
|
|
{
|
Fixes trac:1988. The little bug that turned out to be huge. Yoinks.
* Various cosmetic/style updates in the btl sm
* Clean up concept of mpool module (I think that code was written way
back when the concept of "modules" was fuzzy)
* Bring over some old fixes from the /tmp/timattox-sm-coll/ tree to
fix potential segv's when mmap'ed regions were at different
addresses in different processes (thanks Tim!).
* Change sm coll to no longer use mpool as its main source of shmem;
rather, just mmap its own segment (because it's fixed size --
there was nothing to be gained by using mpool; shedding the use of
mpool saved a lot of complexity in the sm coll setup). This
effectively made Tim's fixes moot (because now everything is an
offset into the mmap that is computed locally; there are no global
pointers). :-)
* Slightly updated common/sm to allow making mmap's for a specific
set of procs (vs. ''all'' procs in the process). This potentially
allows for same-host-inter-proc mmaps -- yay!
* Fixed many, many things in the coll sm (particularly in reduce):
* Fixed handling of MPI_IN_PLACE in reduce and allreduce
* Fixed handling of non-contiguous datatypes in reduce
* Changed the order of reductions to go from process (n-1)'s data
to process 0's data, because that's how all other OMPI coll
components work
* Fixed lots of usage of ddt functions
* When using a non-contiguous datatype, if the root process is not
(n-1), now we used a 2nd convertor to copy from shmem to the rbuf
(saves a memory copy vs. what was done before)
* Lots and lots of little cleanups, clarifications, and minor
optimizations (although still more could be done -- e.g., I think
the use of write memory barriers is fairly sub-optimal; they
could be ganged together at the root, for example)
I'm marking this as "fixes trac:1988" and closing the ticket; if something
is still broken, we can re-open the ticket.
This commit was SVN r21967.
The following Trac tickets were found above:
Ticket 1988 --> https://svn.open-mpi.org/trac/ompi/ticket/1988
2009-09-15 00:25:21 +00:00
|
|
|
mca_mpool_sm_module_t *sm_module = (mca_mpool_sm_module_t*) mpool;
|
2010-06-09 16:58:52 +00:00
|
|
|
mca_common_sm_module_mmap_t *map =
|
|
|
|
(mca_common_sm_module_mmap_t *)sm_module->sm_common_module;
|
|
|
|
mca_common_sm_seg_header_t* seg = map->super.module_seg;
|
2004-06-16 15:41:29 +00:00
|
|
|
void* addr;
|
|
|
|
|
2005-07-03 21:38:51 +00:00
|
|
|
opal_atomic_lock(&seg->seg_lock);
|
2007-03-07 13:28:06 +00:00
|
|
|
if(seg->seg_offset + *size > seg->seg_size) {
|
2004-06-16 15:41:29 +00:00
|
|
|
addr = NULL;
|
|
|
|
} else {
|
2006-04-23 21:14:03 +00:00
|
|
|
size_t fixup;
|
|
|
|
|
2004-08-11 16:06:14 +00:00
|
|
|
/* add base address to segment offset */
|
2010-06-09 16:58:52 +00:00
|
|
|
addr = map->super.module_data_addr + seg->seg_offset;
|
2004-06-16 15:41:29 +00:00
|
|
|
seg->seg_offset += *size;
|
2006-04-23 21:14:03 +00:00
|
|
|
|
|
|
|
/* fix up seg_offset so next allocation is aligned on a
|
|
|
|
sizeof(long) boundry. Do it here so that we don't have to
|
|
|
|
check before checking remaining size in buffer */
|
|
|
|
if ((fixup = (seg->seg_offset & (sizeof(long) - 1))) > 0) {
|
|
|
|
seg->seg_offset += sizeof(long) - fixup;
|
|
|
|
}
|
2004-06-16 15:41:29 +00:00
|
|
|
}
|
2005-08-08 21:29:05 +00:00
|
|
|
if (NULL != registration) {
|
2005-07-14 19:10:46 +00:00
|
|
|
*registration = NULL;
|
2005-08-08 21:29:05 +00:00
|
|
|
}
|
2005-07-03 21:38:51 +00:00
|
|
|
opal_atomic_unlock(&seg->seg_lock);
|
2004-06-16 15:41:29 +00:00
|
|
|
return addr;
|
|
|
|
}
|
|
|
|
|