1
1

Remove the libnuma component; the hwloc maffinity component does everything that this compnent used to do. Good riddance!

This commit was SVN r25749.
Этот коммит содержится в:
Jeff Squyres 2012-01-19 23:53:05 +00:00
родитель 45636b0558
Коммит 1d15d39fb8
6 изменённых файлов: 0 добавлений и 446 удалений

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

@ -1,50 +0,0 @@
#
# Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
# 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.
# Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
# University of Stuttgart. All rights reserved.
# Copyright (c) 2004-2005 The Regents of the University of California.
# All rights reserved.
# Copyright (c) 2010-2011 Cisco Systems, Inc. All rights reserved.
# $COPYRIGHT$
#
# Additional copyrights may follow
#
# $HEADER$
#
AM_CPPFLAGS = $(maffinity_libnuma_CPPFLAGS)
dist_pkgdata_DATA = help-opal-maffinity-libnuma.txt
sources = \
maffinity_libnuma.h \
maffinity_libnuma_component.c \
maffinity_libnuma_module.c
# Make the output library in this directory, and name it either
# mca_<type>_<name>.la (for DSO builds) or libmca_<type>_<name>.la
# (for static builds).
if MCA_BUILD_opal_maffinity_libnuma_DSO
component_noinst =
component_install = mca_maffinity_libnuma.la
else
component_noinst = libmca_maffinity_libnuma.la
component_install =
endif
mcacomponentdir = $(pkglibdir)
mcacomponent_LTLIBRARIES = $(component_install)
mca_maffinity_libnuma_la_SOURCES = $(sources)
mca_maffinity_libnuma_la_LDFLAGS = -module -avoid-version $(maffinity_libnuma_LDFLAGS)
mca_maffinity_libnuma_la_LIBADD = $(maffinity_libnuma_LIBS)
noinst_LTLIBRARIES = $(component_noinst)
libmca_maffinity_libnuma_la_SOURCES =$(sources)
libmca_maffinity_libnuma_la_LIBADD = $(maffinity_libnuma_LIBS)
libmca_maffinity_libnuma_la_LDFLAGS = -module -avoid-version $(maffinity_libnuma_LDFLAGS)

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

@ -1,39 +0,0 @@
# -*- shell-script -*-
#
# Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
# 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.
# Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
# University of Stuttgart. All rights reserved.
# Copyright (c) 2004-2005 The Regents of the University of California.
# All rights reserved.
# Copyright (c) 2008-2010 Cisco Systems, Inc. All rights reserved.
# $COPYRIGHT$
#
# Additional copyrights may follow
#
# $HEADER$
#
# MCA_<framework>_<component>_CONFIG([action-if-can-compile],
# [action-if-cant-compile])
# ------------------------------------------------
AC_DEFUN([MCA_opal_maffinity_libnuma_CONFIG],[
AC_CONFIG_FILES([opal/mca/maffinity/libnuma/Makefile])
OPAL_SETUP_COMPONENT_PACKAGE([maffinity],
[libnuma],
[libnuma],
[include/numa.h],
[libnuma*],
[numa.h],
[numa],
[numa_available],
[],
[AC_CHECK_DECLS([MPOL_MF_MOVE])
$1],
[$2])
])

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

@ -1,27 +0,0 @@
# -*- text -*-
#
# Copyright (c) 2011 Cisco Systems, Inc. All rights reserved.
# $COPYRIGHT$
#
# Additional copyrights may follow
#
# $HEADER$
#
# This is the US/English help file for Open MPI's libnuma support
#
[invalid policy]
WARNING: An invalid value was given for the maffinity_libnuma_policy
MCA parameter. The policy determines what happens when Open MPI tries
to allocate local memory, but no local memory is available. The value
provided was:
Value: %s
PID: %d
Valid values are:
strict: the memory allocation will fail
loose: the memory allocation will spill over to remote memory
Your job will now abort.
#

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

@ -1,66 +0,0 @@
/*
* Copyright (c) 2004-2008 The Trustees of Indiana University and Indiana
* 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.
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
* University of Stuttgart. All rights reserved.
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
* Copyright (c) 2011 Cisco Systems, Inc. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
/**
* @file
*
* Processor affinity for libnuma.
*/
#ifndef MCA_MAFFINITY_LIBNUMA_EXPORT_H
#define MCA_MAFFINITY_LIBNUMA_EXPORT_H
#include "opal_config.h"
#include "opal/mca/mca.h"
#include "opal/mca/maffinity/maffinity.h"
BEGIN_C_DECLS
/* Component struct to wrap the base maffinity component and then include
some data private to this component. */
typedef struct {
/* Base component */
opal_maffinity_base_component_2_0_0_t base;
/* What libnuma memory binding policy we're using */
int libnuma_policy;
} opal_maffinity_libnuma_component_2_0_0_t;
/**
* Globally exported variable
*/
OPAL_DECLSPEC extern opal_maffinity_libnuma_component_2_0_0_t
mca_maffinity_libnuma_component;
/**
* maffinity query API function
*
* Query function for maffinity components. Simply returns a priority
* to rank it against other available maffinity components (assumedly,
* only one component will be available per platform, but it's
* possible that there could be more than one available).
*/
int opal_maffinity_libnuma_component_query(mca_base_module_t **module, int *priority);
END_C_DECLS
#endif /* MCA_MAFFINITY_LIBNUMA_EXPORT_H */

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

@ -1,112 +0,0 @@
/*
* Copyright (c) 2004-2008 The Trustees of Indiana University and Indiana
* 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.
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
* University of Stuttgart. All rights reserved.
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
* Copyright (c) 2011 Cisco Systems, Inc. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
#include "opal_config.h"
#include <numa.h>
#include <numaif.h>
#include <unistd.h>
#include "opal/constants.h"
#include "opal/util/show_help.h"
#include "opal/mca/maffinity/maffinity.h"
#include "maffinity_libnuma.h"
/*
* Public string showing the maffinity ompi_libnuma component version number
*/
const char *opal_maffinity_libnuma_component_version_string =
"OPAL libnuma maffinity MCA component version " OPAL_VERSION;
/*
* Local functions
*/
static int libnuma_register(void);
/*
* Local variable
*/
static char *mca_policy = NULL;
/*
* Instantiate the public struct with all of our public information
* and pointers to our public functions in it
*/
opal_maffinity_libnuma_component_2_0_0_t mca_maffinity_libnuma_component = {
{
/* First, the mca_component_t struct containing meta information
about the component itself */
{
OPAL_MAFFINITY_BASE_VERSION_2_0_0,
/* Component name and version */
"libnuma",
OPAL_MAJOR_VERSION,
OPAL_MINOR_VERSION,
OPAL_RELEASE_VERSION,
/* Component open and close functions */
NULL,
NULL,
opal_maffinity_libnuma_component_query,
libnuma_register,
},
{
/* The component is checkpoint ready */
MCA_BASE_METADATA_PARAM_CHECKPOINT
}
},
/* Default libnuma memory binding policy */
MPOL_PREFERRED,
};
static int libnuma_register(void)
{
char *val;
mca_base_param_reg_int(&mca_maffinity_libnuma_component.base.base_version,
"priority",
"Priority of the libnuma maffinity component",
false, false, 25, NULL);
val = (MPOL_PREFERRED == mca_maffinity_libnuma_component.libnuma_policy ?
"loose" : "strict");
mca_base_param_reg_string(&mca_maffinity_libnuma_component.base.base_version,
"policy",
"Binding policy that determines what happens if memory is unavailable on the local NUMA node. A value of \"strict\" means that the memory allocation will fail; a value of \"loose\" means that the memory allocation will spill over to another NUMA node.",
false, false, val, &mca_policy);
if (strcasecmp(mca_policy, "loose") == 0) {
mca_maffinity_libnuma_component.libnuma_policy = MPOL_PREFERRED;
} else if (strcasecmp(mca_policy, "strict") == 0) {
mca_maffinity_libnuma_component.libnuma_policy = MPOL_BIND;
} else {
opal_show_help("help-opal-maffinity-libnuma.txt", "invalid policy",
true, mca_policy, getpid());
mca_maffinity_libnuma_component.libnuma_policy = MPOL_PREFERRED;
return OPAL_ERR_BAD_PARAM;
}
return OPAL_SUCCESS;
}

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

@ -1,152 +0,0 @@
/*
* Copyright (c) 2004-2008 The Trustees of Indiana University and Indiana
* 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.
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
* University of Stuttgart. All rights reserved.
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
* Copyright (c) 2008-2011 Cisco Systems, Inc. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
#include "opal_config.h"
#include <string.h>
#include <numa.h>
#include <numaif.h>
#include "opal/constants.h"
#include "opal/mca/maffinity/maffinity.h"
#include "opal/mca/maffinity/base/base.h"
#include "maffinity_libnuma.h"
/*
* Local functions
*/
static int libnuma_module_init(void);
static int libnuma_module_set(opal_maffinity_base_segment_t *segments,
size_t num_segments);
static int libnuma_module_node_name_to_id(char *, int *);
static int libnuma_modules_bind(opal_maffinity_base_segment_t *, size_t, int);
/*
* Libnuma maffinity module
*/
static const opal_maffinity_base_module_1_0_0_t loc_module = {
/* Initialization function */
libnuma_module_init,
/* Module function pointers */
libnuma_module_set,
libnuma_module_node_name_to_id,
libnuma_modules_bind
};
int opal_maffinity_libnuma_component_query(mca_base_module_t **module, int *priority)
{
int param;
if (-1 == numa_available()) {
return OPAL_ERROR;
}
param = mca_base_param_find("maffinity", "libnuma", "priority");
mca_base_param_lookup_int(param, priority);
*module = (mca_base_module_t *)&loc_module;
return OPAL_SUCCESS;
}
static int libnuma_module_init(void)
{
/* Libnuma didn't start defining an API version until version 2.
Sigh. For convenience, ensure it's always defined. */
#if !defined(LIBNUMA_API_VERSION)
#define LIBNUMA_API_VERSION 1
#endif
#if LIBNUMA_API_VERSION >= 2
struct bitmask *mask;
#else
nodemask_t mask;
#endif
/* If we have a strict policy set, then bind all memory to this
numa node. Note that maffinity won't be invoked unless the
process is already bound to a specific processor, so we're
guaranteed to get a good value back from
numa_get_run_node_mask(). */
if (MPOL_BIND == mca_maffinity_libnuma_component.libnuma_policy) {
mask = numa_get_run_node_mask();
#if LIBNUMA_API_VERSION >= 2
numa_set_membind(mask);
#else
numa_set_membind(&mask);
#endif
}
/* We want libnuma to fail to alloc if it can't allocate on the
specified node */
numa_set_strict(1);
return OPAL_SUCCESS;
}
static int libnuma_module_set(opal_maffinity_base_segment_t *segments,
size_t num_segments)
{
size_t i;
/* Explicitly set the memory binding policy for a set of
segments */
for (i = 0; i < num_segments; ++i) {
numa_setlocal_memory(segments[i].mbs_start_addr,
segments[i].mbs_len);
}
return OPAL_SUCCESS;
}
static int libnuma_module_node_name_to_id(char *node_name, int *id)
{
/* GLB: fix me */
*id = atoi(node_name + 3);
return OPAL_SUCCESS;
}
static int libnuma_modules_bind(opal_maffinity_base_segment_t *segs,
size_t count, int node_id)
{
size_t i;
int rc;
unsigned long node_mask = (1 << node_id);
for(i = 0; i < count; i++) {
rc = mbind(segs[i].mbs_start_addr, segs[i].mbs_len,
mca_maffinity_libnuma_component.libnuma_policy,
&node_mask, sizeof(node_mask) * 8,
#ifdef HAVE_MPOL_MF_MOVE
MPOL_MF_MOVE
#else
MPOL_MF_STRICT
#endif
);
if (0 != rc) {
return OPAL_ERROR;
}
}
return OPAL_SUCCESS;
}