1
1

Change the API slightly so that it is assumed that each process will

be called with a description of its memory segments to make local.  It
is a small enough API that changing to support a
one-process-does-all-assignment model is simple enough if we ever need
it.

This commit was SVN r7148.
Этот коммит содержится в:
Jeff Squyres 2005-09-02 12:57:02 +00:00
родитель 560f323048
Коммит a8f9df9951
6 изменённых файлов: 29 добавлений и 43 удалений

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

@ -103,7 +103,7 @@ extern "C" {
* opal_maffinity_base_select() was never invoked, OPAL_NOT_FOUND
* is returned.
*/
OMPI_DECLSPEC int opal_maffinity_base_set(opal_maffinity_base_segment_t *segments, size_t num_segments, bool am_allocator);
OMPI_DECLSPEC int opal_maffinity_base_set(opal_maffinity_base_segment_t *segments, size_t num_segments);
/**
* Shut down the maffinity MCA framework.

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

@ -24,11 +24,10 @@
int opal_maffinity_base_set(opal_maffinity_base_segment_t *segments,
size_t num_segments, bool am_allocator)
size_t num_segments)
{
if (!opal_maffinity_base_selected) {
return OPAL_ERR_NOT_FOUND;
}
return opal_maffinity_base_module->maff_module_set(segments, num_segments,
am_allocator);
return opal_maffinity_base_module->maff_module_set(segments, num_segments);
}

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

@ -16,8 +16,6 @@
#include "ompi_config.h"
#include <sys/types.h>
#include <unistd.h>
#include <string.h>
#include "opal/include/constants.h"
@ -31,7 +29,7 @@
*/
static int first_use_module_init(void);
static int first_use_module_set(opal_maffinity_base_segment_t *segments,
size_t num_segments, bool am_allocator);
size_t num_segments);
/*
* First_Use maffinity module
@ -69,10 +67,9 @@ static int first_use_module_init(void)
static int first_use_module_set(opal_maffinity_base_segment_t *segments,
size_t num_segments, bool am_allocator)
size_t num_segments)
{
size_t i;
pid_t mypid = getpid();
/* Crude: zero out all the segments that belong to me. We could
probably get away with touching a byte in each page (which
@ -81,9 +78,7 @@ static int first_use_module_set(opal_maffinity_base_segment_t *segments,
optimization... */
for (i = 0; i < num_segments; ++i) {
if (segments[i].mbs_owner_pid == mypid) {
memset(segments[i].mbs_start_addr, 0, segments[i].mbs_len);
}
memset(segments[i].mbs_start_addr, 0, segments[i].mbs_len);
}
return OPAL_SUCCESS;

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

@ -16,8 +16,6 @@
#include "ompi_config.h"
#include <sys/types.h>
#include <unistd.h>
#include <string.h>
#include <numa.h>
@ -32,7 +30,7 @@
*/
static int libnuma_module_init(void);
static int libnuma_module_set(opal_maffinity_base_segment_t *segments,
size_t num_segments, bool am_allocator);
size_t num_segments);
/*
* Libnuma maffinity module
@ -78,10 +76,9 @@ static int libnuma_module_init(void)
static int libnuma_module_set(opal_maffinity_base_segment_t *segments,
size_t num_segments, bool am_allocator)
size_t num_segments)
{
size_t i;
pid_t mypid = getpid();
/* Kinda crummy that we have to allocate each portion individually
rather than provide a top-level function call that does it all,
@ -90,10 +87,8 @@ static int libnuma_module_set(opal_maffinity_base_segment_t *segments,
placement of pages. */
for (i = 0; i < num_segments; ++i) {
if (segments[i].mbs_owner_pid == mypid) {
numa_setlocal_memory(segments[i].mbs_start_addr,
segments[i].mbs_len);
}
numa_setlocal_memory(segments[i].mbs_start_addr,
segments[i].mbs_len);
}
return OPAL_SUCCESS;

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

@ -37,23 +37,16 @@
* for a given process are physically local to the processor where
* that process is bound.
*
* One process will allocate a large shared memory block and one or
* more processors will need to participate to make pages local to
* specific processors.
* One process will allocate a large shared memory block and all will
* need to participate to make pages local to specific processors.
*
* Some systems have an API (e.g., SGI Altix) where a single function
* call by the allocating process can assign the page locality of the
* pages throughout the entire shared block. Other systems follow a
* "first use" rule, where pages in the shared block are assigned to
* memory local to the processor of the first process that uses it.
*
* This API can handle both models. There is one main module function
* There is one main module function
* (opal_maffinity_base_module_set_fn_t) that takes an array of
* segment descriptions within the block. This is enough information
* to describe each section in the shared block and what process owns
* it. Components can then do whatever is necessary to make pages
* local to their respective processes (i.e., the processors where the
* processes are running).
* segment descriptions within the block. Each process will get a
* different set of segment descriptions (i.e., the segments belonging
* to that process). Components then do whatever is necessary to make
* pages local to their respective processes (i.e., the processors
* where the processes are running).
*/
#ifndef OPAL_MAFFINITY_H
@ -97,8 +90,7 @@ typedef int (*opal_maffinity_base_module_init_1_0_0_fn_t)(void);
* "touch" the pages that are supposed to be local to them).
*/
typedef int (*opal_maffinity_base_module_set_fn_t)
(opal_maffinity_base_segment_t *segments, size_t num_segments,
bool am_allocator);
(opal_maffinity_base_segment_t *segments, size_t num_segments);
/**

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

@ -32,13 +32,18 @@ extern "C" {
/**
* Struct used with opal_maffinity_base_module_set_fn_t. It
* describes a section of memory (starting address and length) and
* what process owns it (by PID). PID is unique enough because
* all processes are guaranteed to be on the same machine.
* describes a section of memory (starting address and length).
* This is really the same thing as an iovec, but we include a
* separate type for it for at least 2 reasons:
*
* 1. Some OS's iovec definitions are exceedingly lame (e.g.,
* Solaris 9 has the length argument as an int, instead of a
* size_t).
*
* 2. We reserve the right to expand/change this struct in the
* future.
*/
struct opal_maffinity_base_segment_t {
/** Owning process */
pid_t mbs_owner_pid;
/** Starting address of segment */
void *mbs_start_addr;
/** Length of segment */