1
1

The memcpy framework. The base component is here, but right now no

implementations. I dont want to overload the memcpy functions,
therefore people interested in using the high performance memcpy
should use directly opal_memcpy instead. Notice, that there are 2
other versions of memcpy available, which use a destination or a source
described as iovecs.

This commit was SVN r9532.
Этот коммит содержится в:
George Bosilca 2006-04-05 05:56:08 +00:00
родитель 87269ba0aa
Коммит d311d8acf1
8 изменённых файлов: 334 добавлений и 0 удалений

37
opal/mca/memcpy/Makefile.am Обычный файл
Просмотреть файл

@ -0,0 +1,37 @@
#
# Copyright (c) 2004-2006 The University of Tennessee and The University
# of Tennessee Research Foundation. All rights
# reserved.
# $COPYRIGHT$
#
# Additional copyrights may follow
#
# $HEADER$
#
# main library setup
noinst_LTLIBRARIES = libmca_memcpy.la
libmca_memcpy_la_SOURCES =
# header setup
nobase_opal_HEADERS =
nobase_nodist_opal_HEADERS =
# local files
headers = memcpy.h
nodist_headers =
libmca_memcpy_la_SOURCES += $(headers)
# Conditionally install the header files
if WANT_INSTALL_HEADERS
nobase_opal_HEADERS += $(headers)
nobase_nodist_opal_HEADERS += $(nodist_headers)
opaldir = $(includedir)/openmpi/opal/mca/memcpy
else
opaldir = $(includedir)
endif
include base/Makefile.am
distclean-local:
rm -f base/static-components.h

19
opal/mca/memcpy/base/Makefile.am Обычный файл
Просмотреть файл

@ -0,0 +1,19 @@
#
# Copyright (c) 2004-2005 The University of Tennessee and The University
# of Tennessee Research Foundation. All rights
# reserved.
# $COPYRIGHT$
#
# Additional copyrights may follow
#
# $HEADER$
#
headers += \
base/base.h
libmca_memcpy_la_SOURCES += \
base/memcpy_base_close.c \
base/memcpy_base_open.c
nodist_headers += base/base_impl.h

74
opal/mca/memcpy/base/base.h Обычный файл
Просмотреть файл

@ -0,0 +1,74 @@
/*
* Copyright (c) 2004-2005 The University of Tennessee and The University
* of Tennessee Research Foundation. All rights
* reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*
*/
#ifndef OPAL_MEMCPY_BASE_H
#define OPAL_MEMCPY_BASE_H
#include "opal_config.h"
#include "opal/mca/memcpy/memcpy.h"
/*
* Global functions for MCA overall memcpy open and close
*/
#if defined(c_plusplus) || defined(__cplusplus)
extern "C" {
#endif
/**
* Initialize the memcpy MCA framework
*
* @retval OPAL_SUCCESS Upon success
* @retval OPAL_ERROR Upon failure
*
* This must be the first function invoked in the memcpy MCA
* framework. It initializes the memcpy MCA framework, finds
* and opens memcpy components, etc.
*
* This function is invoked during opal_init() and during the
* initialization of the special case of the laminfo command.
*
* This function fills in the internal global variable
* opal_memcpy_base_components_opened, which is a list of all
* memcpy components that were successfully opened. This
* variable should \em only be used by other memcpy base
* functions -- it is not considered a public interface member --
* and is only mentioned here for completeness.
*/
OMPI_DECLSPEC int opal_memcpy_base_open(void);
/**
* Shut down the memcpy MCA framework.
*
* @retval OPAL_SUCCESS Always
*
* This function shuts down everything in the memcpy MCA
* framework, and is called during opal_finalize() and the
* special case of the laminfo command.
*
* It must be the last function invoked on the memcpy MCA framework.
*/
OMPI_DECLSPEC int opal_memcpy_base_close(void);
extern opal_list_t opal_memcpy_base_components_opened;
#if defined(c_plusplus) || defined(__cplusplus)
}
#endif
/* include implementation to call */
#include "opal/mca/memcpy/base/base_impl.h"
#endif /* OPAL_BASE_MEMCPY_H */

30
opal/mca/memcpy/base/memcpy_base_close.c Обычный файл
Просмотреть файл

@ -0,0 +1,30 @@
/*
* Copyright (c) 2004-2005 The University of Tennessee and The University
* of Tennessee Research Foundation. All rights
* reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
#include "opal_config.h"
#include "opal/constants.h"
#include "opal/mca/mca.h"
#include "opal/mca/base/base.h"
#include "opal/mca/memcpy/memcpy.h"
#include "opal/mca/memcpy/base/base.h"
int opal_memcpy_base_close(void)
{
/* Close all components that are still open (this should only
happen during laminfo). */
mca_base_components_close(0, &opal_memcpy_base_components_opened, NULL);
OBJ_DESTRUCT(&opal_memcpy_base_components_opened);
/* All done */
return OPAL_SUCCESS;
}

42
opal/mca/memcpy/base/memcpy_base_default.h Обычный файл
Просмотреть файл

@ -0,0 +1,42 @@
/*
* Copyright (c) 2004-2006 The University of Tennessee and The University
* of Tennessee Research Foundation. All rights
* reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
#ifndef OPAL_MCA_MEMCPY_BASE_MEMCPY_BASE_NULL_H
#define OPAL_MCA_MEMCPY_BASE_MEMCPY_BASE_NULL_H
#define opal_memcpy( dst, src, length ) \
memcpy( (dst), (src), (length) );
#define opal_memcpy_tov( dst_iov, src, count ) \
do { \
int _i; \
char* _src = (char*)src; \
\
for( _i = 0; _i < count; _i++ ) { \
opal_memcpy( dst_iov[_i].iov_base, _src, \
dst_iov[_i].iov_len ); \
_src += dst_iov[_i].iov_len; \
} \
} while (0)
#define opal_memcpy_fromv( dst, src_iov, count ) \
do { \
int _i; \
char* _dst = (char*)dst; \
\
for( _i = 0; _i < count; _i++ ) { \
opal_memcpy( _dst, src_iov[_i].iov_base, \
src_iov[_i].iov_len ); \
_dst += src_iov[_i].iov_len; \
} \
} while (0)
#endif

55
opal/mca/memcpy/base/memcpy_base_open.c Обычный файл
Просмотреть файл

@ -0,0 +1,55 @@
/*
* Copyright (c) 2004-2005 The University of Tennessee and The University
* of Tennessee Research Foundation. All rights
* reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
#include "opal_config.h"
#include "opal/constants.h"
#include "opal/util/output.h"
#include "opal/mca/mca.h"
#include "opal/mca/base/base.h"
#include "opal/mca/base/mca_base_param.h"
#include "opal/mca/memcpy/memcpy.h"
#include "opal/mca/memcpy/base/base.h"
/*
* The following file was created by configure. It contains extern
* statements and the definition of an array of pointers to each
* component's public mca_base_component_t struct.
*/
#include "opal/mca/memcpy/base/static-components.h"
/*
* Globals
*/
opal_list_t opal_memcpy_base_components_opened;
/*
* Function for finding and opening either all MCA components, or the one
* that was specifically requested via a MCA parameter.
*/
int opal_memcpy_base_open(void)
{
OBJ_CONSTRUCT( &opal_memcpy_base_components_opened, opal_list_t );
/* Open up all available components */
if (OPAL_SUCCESS !=
mca_base_components_open("memcpy", 0,
mca_memcpy_base_static_components,
&opal_memcpy_base_components_opened,
true)) {
return OPAL_ERROR;
}
/* All done */
return OPAL_SUCCESS;
}

27
opal/mca/memcpy/configure.m4 Обычный файл
Просмотреть файл

@ -0,0 +1,27 @@
dnl -*- shell-script -*-
dnl
dnl Copyright (c) 2004-2006 The University of Tennessee and The University
dnl of Tennessee Research Foundation. All rights
dnl reserved.
dnl $COPYRIGHT$
dnl
dnl Additional copyrights may follow
dnl
dnl $HEADER$
dnl
m4_define(MCA_memcpy_CONFIGURE_MODE, STOP_AT_FIRST)
AC_DEFUN([MCA_memcpy_CONFIG],[
memcpy_base_include=
# first, compile all the components
MCA_CONFIGURE_FRAMEWORK($1, $2)
# someone should have set this...
if test "$memcpy_base_include" = "" ; then
memcpy_base_include="base/memcpy_base_default.h"
fi
AC_CONFIG_LINKS([opal/mca/memcpy/base/base_impl.h:opal/mca/memcpy/$memcpy_base_include])
])

50
opal/mca/memcpy/memcpy.h Обычный файл
Просмотреть файл

@ -0,0 +1,50 @@
/*
* Copyright (c) 2004-2006 The University of Tennessee and The University
* of Tennessee Research Foundation. All rights
* reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
/**
* @file
*
*/
#ifndef OPAL_MCA_MEMCPY_MEMCPY_H
#define OPAL_MCA_MEMCPY_MEMCPY_H
#include "opal_config.h"
#include "opal/mca/mca.h"
#include "opal/mca/base/base.h"
/**
* Structure for memcpy v1.0.0 components.
* Chained to MCA v1.0.0
*/
struct opal_memcpy_base_component_1_0_0_t {
/** MCA base component */
mca_base_component_t memcpyc_version;
/** MCA base data */
mca_base_component_data_1_0_0_t memcpyc_data;
};
/**
* Convenience typedef
*/
typedef struct opal_memcpy_base_component_1_0_0_t opal_memcpy_base_component_1_0_0_t;
/*
* Macro for use in components that are of type memcpy v1.0.0
*/
#define OPAL_MEMCPY_BASE_VERSION_1_0_0 \
/* memcpy v1.0 is chained to MCA v1.0 */ \
MCA_BASE_VERSION_1_0_0, \
/* memcpy v1.0 */ \
"memcpy", 1, 0, 0
#endif /* OPAL_MCA_MEMCPY_MEMCPY_H */