1
1

Remove RML code from common/sm

The only user of this code was coll/sm. I implemented a basic replacement
for the removed code. This gets the trunk compiling again with
--disable-dlopen.

This commit was SVN r32333.
Этот коммит содержится в:
Nathan Hjelm 2014-07-28 22:00:12 +00:00
родитель 0f15afa4d9
Коммит 1407c1f501
4 изменённых файлов: 19 добавлений и 203 удалений

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

@ -59,6 +59,8 @@
#include "ompi/proc/proc.h"
#include "coll_sm.h"
#include "ompi/mca/coll/base/coll_tags.h"
#include "ompi/mca/pml/pml.h"
/*
* Global variables
@ -576,15 +578,23 @@ static int bootstrap_comm(ompi_communicator_t *comm,
opal_output_verbose(10, ompi_coll_base_framework.framework_output,
"coll:sm:enable:bootstrap comm (%d/%s): attaching to %" PRIsize_t " byte mmap: %s",
comm->c_contextid, comm->c_name, size, fullpath);
data->sm_bootstrap_meta =
mca_common_sm_init_group(comm->c_local_group, size, fullpath,
sizeof(mca_common_sm_seg_header_t),
getpagesize());
if (NULL == data->sm_bootstrap_meta) {
opal_output_verbose(10, ompi_coll_base_framework.framework_output,
"coll:sm:enable:bootstrap comm (%d/%s): mca_common_sm_init_group failed",
comm->c_contextid, comm->c_name);
return OMPI_ERR_OUT_OF_RESOURCE;
if (0 == ompi_comm_rank (comm)) {
data->sm_bootstrap_meta = mca_common_sm_module_create_and_attach (size, fullpath, sizeof(mca_common_sm_seg_header_t), 8);
if (NULL == data->sm_bootstrap_meta) {
opal_output_verbose(10, ompi_coll_base_framework.framework_output,
"coll:sm:enable:bootstrap comm (%d/%s): mca_common_sm_init_group failed",
comm->c_contextid, comm->c_name);
return OMPI_ERR_OUT_OF_RESOURCE;
}
for (int i = 0 ; i < ompi_comm_size (comm) ; ++i) {
MCA_PML_CALL(send(&data->sm_bootstrap_meta->shmem_ds, sizeof (data->sm_bootstrap_meta->shmem_ds), MPI_BYTE,
i, MCA_COLL_BASE_TAG_BCAST, MCA_PML_BASE_SEND_STANDARD, comm));
}
} else {
opal_shmem_ds_t shmem_ds;
MCA_PML_CALL(recv(&shmem_ds, sizeof (shmem_ds), MPI_BYTE, 0, MCA_COLL_BASE_TAG_BCAST, comm, MPI_STATUS_IGNORE));
data->sm_bootstrap_meta = mca_common_sm_module_attach (&shmem_ds, sizeof(mca_common_sm_seg_header_t), 8);
}
/* All done */

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

@ -44,13 +44,11 @@
# Header files
headers = \
common_sm_rml.h \
common_sm.h
# Source files
sources = \
common_sm_rml.c \
common_sm.c
# Help file

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

@ -259,140 +259,6 @@ mca_common_sm_local_proc_reorder(opal_proc_t **procs,
return OPAL_SUCCESS;
}
/* ////////////////////////////////////////////////////////////////////////// */
mca_common_sm_module_t *
mca_common_sm_init(opal_proc_t **procs,
size_t num_procs,
size_t size,
char *file_name,
size_t size_ctl_structure,
size_t data_seg_alignment)
{
/* indicates whether or not i'm the lowest named process */
bool lowest_local_proc = false;
mca_common_sm_module_t *map = NULL;
size_t num_local_procs = 0;
opal_shmem_ds_t *seg_meta = NULL;
if (OPAL_SUCCESS != mca_common_sm_local_proc_reorder(procs,
num_procs,
&num_local_procs)) {
return NULL;
}
/* if there is less than 2 local processes, there's nothing to do. */
if (num_local_procs < 2) {
return NULL;
}
if (NULL == (seg_meta = (opal_shmem_ds_t *) malloc(sizeof(*seg_meta)))) {
/* out of resources - just bail */
return NULL;
}
/* determine whether or not i am the lowest local process */
lowest_local_proc = (-1 == opal_compare_proc(OPAL_PROC_MY_NAME, procs[0]->proc_name));
/* figure out if i am the lowest rank in the group.
* if so, i will create the shared memory backing store
*/
if (lowest_local_proc) {
if (OPAL_SUCCESS == opal_shmem_segment_create(seg_meta, file_name,
size)) {
map = attach_and_init(seg_meta, size, size_ctl_structure,
data_seg_alignment, true);
if (NULL == map) {
/* fail!
* only invalidate the shmem_ds. doing so will let the rest
* of the local processes know that the lowest local rank
* failed to properly initialize the shared memory segment, so
* they should try to carry on without shared memory support
*/
OPAL_SHMEM_DS_INVALIDATE(seg_meta);
}
}
}
/* send shmem info to the rest of the local procs. */
if (OPAL_SUCCESS !=
mca_common_sm_rml_info_bcast(seg_meta, procs, num_local_procs,
OMPI_RML_TAG_SM_BACK_FILE_CREATED,
lowest_local_proc, file_name)) {
goto out;
}
/* are we dealing with a valid shmem_ds? that is, did the lowest process
* successfully initialize the shared memory segment? */
if (OPAL_SHMEM_DS_IS_VALID(seg_meta)) {
if (!lowest_local_proc) {
/* why is size zero? see comment in mca_common_sm_module_attach */
map = attach_and_init(seg_meta, 0, size_ctl_structure,
data_seg_alignment, false);
}
else {
/* wait until every other participating process has attached to the
* shared memory segment.
*/
while (num_local_procs > map->module_seg->seg_num_procs_inited) {
opal_atomic_rmb();
}
opal_shmem_unlink(seg_meta);
}
}
out:
if (NULL != seg_meta) {
free(seg_meta);
}
return map;
}
/* ////////////////////////////////////////////////////////////////////////// */
/**
* this routine is the same as mca_common_sm_mmap_init() except that
* it takes an (ompi_group_t *) parameter to specify the peers rather
* than an array of procs. unlike mca_common_sm_mmap_init(), the
* group must contain *only* local peers, or this function will return
* NULL and not create any shared memory segment.
*/
mca_common_sm_module_t *
mca_common_sm_init_group(ompi_group_t *group,
size_t size,
char *file_name,
size_t size_ctl_structure,
size_t data_seg_alignment)
{
mca_common_sm_module_t *ret = NULL;
opal_proc_t **procs = NULL, *proc;
size_t i, group_size;
/* if there is less than 2 procs, there's nothing to do */
if ((group_size = ompi_group_size(group)) < 2) {
goto out;
}
else if (NULL == (procs = (opal_proc_t **)
malloc(sizeof(opal_proc_t *) * group_size))) {
OPAL_ERROR_LOG(OPAL_ERR_OUT_OF_RESOURCE);
goto out;
}
/* make sure that all the procs in the group are local */
for (i = 0; i < group_size; ++i) {
proc = (opal_proc_t*)ompi_group_peer_lookup(group, i);
if (!OPAL_PROC_ON_LOCAL_NODE(proc->proc_flags)) {
goto out;
}
procs[i] = proc;
}
/* let mca_common_sm_init take care of the rest ... */
ret = mca_common_sm_init(procs, group_size, size, file_name,
size_ctl_structure, data_seg_alignment);
out:
if (NULL != procs) {
free(procs);
}
return ret;
}
/* ////////////////////////////////////////////////////////////////////////// */
/**
* allocate memory from a previously allocated shared memory

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

@ -125,64 +125,6 @@ mca_common_sm_module_attach(opal_shmem_ds_t *seg_meta,
OPAL_DECLSPEC extern int
mca_common_sm_module_unlink(mca_common_sm_module_t *modp);
/**
* This routine is used to set up a shared memory segment (whether
* it's an mmaped file or a SYSV IPC segment). It is assumed that
* the shared memory segment does not exist before any of the current
* set of processes try and open it.
*
* @param procs - array of (opal_proc_t *)'s to create this shared
* memory segment for. This array must be writable; it may be edited
* (in undefined ways) if the array contains procs that are not on
* this host. It is assumed that the caller will simply free this
* array upon return. (INOUT)
*
* @param num_procs - length of the procs array (IN)
*
* @param size - size of the segment, in bytes (IN)
*
* @param name - unique string identifier of this segment (IN)
*
* @param size_ctl_structure size of the control structure at
* the head of the segment. The control structure
* is assumed to have mca_common_sm_seg_header_t
* as its first segment (IN)
*
* @param data_set_alignment alignment of the data segment. this
* follows the control structure. If this
* value if 0, then assume that there will
* be no data segment following the control
* structure. (IN)
*
* @returnvalue pointer to control structure at head of shared memory segment.
*/
OPAL_DECLSPEC extern mca_common_sm_module_t *
mca_common_sm_init(opal_proc_t **procs,
size_t num_procs,
size_t size,
char *file_name,
size_t size_ctl_structure,
size_t data_seg_alignment);
/**
* This routine is used to set up a shared memory segment (whether
* it's an mmaped file or a SYSV IPC segment). It is assumed that
* the shared memory segment does not exist before any of the current
* set of processes try and open it.
*
* This routine is the same as mca_common_sm_mmap_init() except that
* it takes an (ompi_group_t *) parameter to specify the peers rather
* than an array of procs. Unlike mca_common_sm_mmap_init(), the
* group must contain *only* local peers, or this function will return
* NULL and not create any shared memory segment.
*/
OPAL_DECLSPEC extern mca_common_sm_module_t *
mca_common_sm_init_group(ompi_group_t *group,
size_t size,
char *file_name,
size_t size_ctl_structure,
size_t data_seg_alignment);
/**
* callback from the sm mpool
*/