First cut of libnuma maffinity component; not yet complete
This commit was SVN r7052.
Этот коммит содержится в:
родитель
a771aeb1ab
Коммит
f7638f0884
0
opal/mca/maffinity/libnuma/.ompi_ignore
Обычный файл
0
opal/mca/maffinity/libnuma/.ompi_ignore
Обычный файл
1
opal/mca/maffinity/libnuma/.ompi_unignore
Обычный файл
1
opal/mca/maffinity/libnuma/.ompi_unignore
Обычный файл
@ -0,0 +1 @@
|
||||
jsquyres
|
45
opal/mca/maffinity/libnuma/Makefile.am
Обычный файл
45
opal/mca/maffinity/libnuma/Makefile.am
Обычный файл
@ -0,0 +1,45 @@
|
||||
#
|
||||
# Copyright (c) 2004-2005 The Trustees of Indiana University.
|
||||
# All rights reserved.
|
||||
# Copyright (c) 2004-2005 The Trustees of the University of Tennessee.
|
||||
# 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$
|
||||
#
|
||||
# Additional copyrights may follow
|
||||
#
|
||||
# $HEADER$
|
||||
#
|
||||
|
||||
AM_CPPFLAGS = $(maffinity_libnuma_CPPFLAGS)
|
||||
|
||||
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 OMPI_BUILD_maffinity_libnuma_DSO
|
||||
component_noinst =
|
||||
component_install = mca_maffinity_libnuma.la
|
||||
else
|
||||
component_noinst = libmca_maffinity_libnuma.la
|
||||
component_install =
|
||||
endif
|
||||
|
||||
mcacomponentdir = $(libdir)/openmpi
|
||||
mcacomponent_LTLIBRARIES = $(component_install)
|
||||
mca_maffinity_libnuma_la_SOURCES = $(sources)
|
||||
mca_maffinity_libnuma_la_LIBADD = $(maffinity_libnuma_LIBS)
|
||||
mca_maffinity_libnuma_la_LDFLAGS = -module -avoid-version $(maffinity_libnuma_LDFLAGS)
|
||||
|
||||
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)
|
61
opal/mca/maffinity/libnuma/configure.m4
Обычный файл
61
opal/mca/maffinity/libnuma/configure.m4
Обычный файл
@ -0,0 +1,61 @@
|
||||
# -*- shell-script -*-
|
||||
#
|
||||
# Copyright (c) 2004-2005 The Trustees of Indiana University.
|
||||
# All rights reserved.
|
||||
# Copyright (c) 2004-2005 The Trustees of the University of Tennessee.
|
||||
# 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$
|
||||
#
|
||||
# Additional copyrights may follow
|
||||
#
|
||||
# $HEADER$
|
||||
#
|
||||
|
||||
|
||||
# MCA_<framework>_<component>_CONFIG([action-if-can-compile],
|
||||
# [action-if-cant-compile])
|
||||
# ------------------------------------------------
|
||||
AC_DEFUN([MCA_maffinity_libnuma_CONFIG],[
|
||||
AC_ARG_WITH([libnuma],
|
||||
[AC_HELP_STRING([--with-libnuma],
|
||||
[Directory where the libnuma software is installed])])
|
||||
|
||||
ompi_check_maffinity_libnuma_save_CPPFLAGS="$CPPFLAGS"
|
||||
ompi_check_maffinity_libnuma_save_LDFLAGS="$LDFLAGS"
|
||||
ompi_check_maffinity_libnuma_save_LIBS="$LIBS"
|
||||
|
||||
# libnuma, by default, installs into lib64/. So we're going to
|
||||
# assume that's the common case. If this needs to be augmented
|
||||
# someday to look in lib/ as well, then so be it.
|
||||
AS_IF([test ! -z "$with_libnuma"],
|
||||
[CPPFLAGS="$CPPFLAGS -I$with_libnuma/include"
|
||||
LDFLAGS="$LDFLAGS -L$with_libnuma/lib64"])
|
||||
AC_CHECK_HEADERS([numa.h],
|
||||
[AC_CHECK_LIB([numa],
|
||||
[numa_available],
|
||||
[ompi_check_maffinity_libnuma_happy="yes"],
|
||||
[ompi_check_maffinity_libnuma_happy="no"])],
|
||||
[ompi_check_maffinity_libnuma_happy="no"])
|
||||
|
||||
CPPFLAGS="$ompi_check_maffinity_libnuma_save_CPPFLAGS"
|
||||
LDFLAGS="$ompi_check_maffinity_libnuma_save_LDFLAGS"
|
||||
LIBS="$ompi_check_maffinity_libnuma_save_LIBS"
|
||||
|
||||
AS_IF([test "$ompi_check_maffinity_libnuma_happy" = "yes"],
|
||||
[AS_IF([test ! -z "$with_libnuma"],
|
||||
[maffinity_libnuma_CPPFLAGS="$maffinity_libnuma_CPPFLAGS -I$with_libnuma/include"
|
||||
maffinity_libnuma_LDFLAGS="$maffinity_libnuma_LDFLAGS -L$with_libnuma/lib64"
|
||||
maffinity_libnuma_LIBS="$maffinity_libnuma_LIBS -lnuma"])
|
||||
$1],
|
||||
[$2])
|
||||
|
||||
# substitute in the things needed to build gm
|
||||
AC_SUBST([maffinity_libnuma_CFLAGS])
|
||||
AC_SUBST([maffinity_libnuma_CPPFLAGS])
|
||||
AC_SUBST([maffinity_libnuma_LDFLAGS])
|
||||
AC_SUBST([maffinity_libnuma_LIBS])
|
||||
])dnl
|
19
opal/mca/maffinity/libnuma/configure.params
Обычный файл
19
opal/mca/maffinity/libnuma/configure.params
Обычный файл
@ -0,0 +1,19 @@
|
||||
# -*- shell-script -*-
|
||||
#
|
||||
# Copyright (c) 2004-2005 The Trustees of Indiana University.
|
||||
# All rights reserved.
|
||||
# Copyright (c) 2004-2005 The Trustees of the University of Tennessee.
|
||||
# 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$
|
||||
#
|
||||
# Additional copyrights may follow
|
||||
#
|
||||
# $HEADER$
|
||||
#
|
||||
|
||||
PARAM_INIT_FILE=maffinity_libnuma_component.c
|
||||
PARAM_CONFIG_FILES="Makefile"
|
53
opal/mca/maffinity/libnuma/maffinity_libnuma.h
Обычный файл
53
opal/mca/maffinity/libnuma/maffinity_libnuma.h
Обычный файл
@ -0,0 +1,53 @@
|
||||
/*
|
||||
* Copyright (c) 2004-2005 The Trustees of Indiana University.
|
||||
* All rights reserved.
|
||||
* Copyright (c) 2004-2005 The Trustees of the University of Tennessee.
|
||||
* 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$
|
||||
*
|
||||
* Additional copyrights may follow
|
||||
*
|
||||
* $HEADER$
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file
|
||||
*
|
||||
* Processor affinity for libnuma.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef MCA_MAFFINITY_LIBNUMA_EXPORT_H
|
||||
#define MCA_MAFFINITY_LIBNUMA_EXPORT_H
|
||||
|
||||
#include "ompi_config.h"
|
||||
|
||||
#include "opal/mca/mca.h"
|
||||
#include "opal/mca/maffinity/maffinity.h"
|
||||
|
||||
|
||||
#if defined(c_plusplus) || defined(__cplusplus)
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Globally exported variable
|
||||
*/
|
||||
OMPI_COMP_EXPORT extern const opal_maffinity_base_component_1_0_0_t
|
||||
mca_maffinity_libnuma_component;
|
||||
|
||||
|
||||
/**
|
||||
* maffinity query API function
|
||||
*/
|
||||
const opal_maffinity_base_module_1_0_0_t *
|
||||
opal_maffinity_libnuma_component_query(int *query);
|
||||
|
||||
#if defined(c_plusplus) || defined(__cplusplus)
|
||||
}
|
||||
#endif
|
||||
#endif /* MCA_MAFFINITY_LIBNUMA_EXPORT_H */
|
85
opal/mca/maffinity/libnuma/maffinity_libnuma_component.c
Обычный файл
85
opal/mca/maffinity/libnuma/maffinity_libnuma_component.c
Обычный файл
@ -0,0 +1,85 @@
|
||||
/*
|
||||
* Copyright (c) 2004-2005 The Trustees of Indiana University.
|
||||
* All rights reserved.
|
||||
* Copyright (c) 2004-2005 The Trustees of the University of Tennessee.
|
||||
* 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$
|
||||
*
|
||||
* Additional copyrights may follow
|
||||
*
|
||||
* $HEADER$
|
||||
*/
|
||||
|
||||
#include "ompi_config.h"
|
||||
|
||||
#include "opal/include/constants.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 " OMPI_VERSION;
|
||||
|
||||
/*
|
||||
* Local function
|
||||
*/
|
||||
static int libnuma_open(void);
|
||||
|
||||
/*
|
||||
* Instantiate the public struct with all of our public information
|
||||
* and pointers to our public functions in it
|
||||
*/
|
||||
|
||||
const opal_maffinity_base_component_1_0_0_t mca_maffinity_libnuma_component = {
|
||||
|
||||
/* First, the mca_component_t struct containing meta information
|
||||
about the component itself */
|
||||
|
||||
{
|
||||
/* Indicate that we are a maffinity v1.0.0 component (which also
|
||||
implies a specific MCA version) */
|
||||
|
||||
OPAL_MAFFINITY_BASE_VERSION_1_0_0,
|
||||
|
||||
/* Component name and version */
|
||||
|
||||
"libnuma",
|
||||
OMPI_MAJOR_VERSION,
|
||||
OMPI_MINOR_VERSION,
|
||||
OMPI_RELEASE_VERSION,
|
||||
|
||||
/* Component open and close functions */
|
||||
|
||||
libnuma_open,
|
||||
NULL
|
||||
},
|
||||
|
||||
/* Next the MCA v1.0.0 component meta data */
|
||||
|
||||
{
|
||||
/* Whether the component is checkpointable or not */
|
||||
|
||||
true
|
||||
},
|
||||
|
||||
/* Query function */
|
||||
|
||||
opal_maffinity_libnuma_component_query
|
||||
};
|
||||
|
||||
|
||||
static int libnuma_open(void)
|
||||
{
|
||||
mca_base_param_reg_int(&mca_maffinity_libnuma_component.maffinityc_version,
|
||||
"priority",
|
||||
"Priority of the libnuma maffinity component",
|
||||
false, false, 25, NULL);
|
||||
|
||||
return OPAL_SUCCESS;
|
||||
}
|
93
opal/mca/maffinity/libnuma/maffinity_libnuma_module.c
Обычный файл
93
opal/mca/maffinity/libnuma/maffinity_libnuma_module.c
Обычный файл
@ -0,0 +1,93 @@
|
||||
/*
|
||||
* Copyright (c) 2004-2005 The Trustees of Indiana University.
|
||||
* All rights reserved.
|
||||
* Copyright (c) 2004-2005 The Trustees of the University of Tennessee.
|
||||
* 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$
|
||||
*
|
||||
* Additional copyrights may follow
|
||||
*
|
||||
* $HEADER$
|
||||
*/
|
||||
|
||||
#include "ompi_config.h"
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
#include <numa.h>
|
||||
|
||||
#include "opal/include/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, bool am_allocator);
|
||||
|
||||
/*
|
||||
* Libnuma maffinity module
|
||||
*/
|
||||
static const opal_maffinity_base_module_1_0_0_t module = {
|
||||
|
||||
/* Initialization function */
|
||||
|
||||
libnuma_module_init,
|
||||
|
||||
/* Module function pointers */
|
||||
|
||||
libnuma_module_set
|
||||
};
|
||||
|
||||
|
||||
const opal_maffinity_base_module_1_0_0_t *
|
||||
opal_maffinity_libnuma_component_query(int *query)
|
||||
{
|
||||
int param;
|
||||
|
||||
if (-1 == numa_available()) {
|
||||
return NULL;
|
||||
}
|
||||
param = mca_base_param_find("maffinity", "libnuma", "priority");
|
||||
mca_base_param_lookup_int(param, query);
|
||||
|
||||
return &module;
|
||||
}
|
||||
|
||||
|
||||
static int libnuma_module_init(void)
|
||||
{
|
||||
/* Tell libnuma that we want all memory affinity to be local. */
|
||||
|
||||
numa_set_localalloc();
|
||||
|
||||
return OPAL_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
static int libnuma_module_set(opal_maffinity_base_segment_t *segments,
|
||||
size_t num_segments, bool am_allocator)
|
||||
{
|
||||
size_t i;
|
||||
|
||||
/* Only the allocator does anything */
|
||||
|
||||
if (!am_allocator) {
|
||||
return OPAL_SUCCESS;
|
||||
}
|
||||
|
||||
for (i = 0; i < num_segments; ++i) {
|
||||
/* JMS do something */
|
||||
}
|
||||
|
||||
return OPAL_SUCCESS;
|
||||
}
|
Загрузка…
x
Ссылка в новой задаче
Block a user