1
1

Add MPI_Alloc_mem and MPI_Free_mem

This commit was SVN r201.
Этот коммит содержится в:
Jeff Squyres 2004-01-10 08:22:06 +00:00
родитель 51a330f2ad
Коммит 5d54543fd7
8 изменённых файлов: 142 добавлений и 4 удалений

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

@ -22,10 +22,12 @@ noinst_LTLIBRARIES = libmpi_c.la
headers = bindings.h
libmpi_c_la_SOURCES = \
alloc_mem.c \
comm_get_name.c \
comm_set_name.c \
init.c \
finalize.c
finalize.c \
free_mem.c
libmpi_c_la_LIBADD = $(profile_lib)

34
src/mpi/interface/c/alloc_mem.c Обычный файл
Просмотреть файл

@ -0,0 +1,34 @@
/*
* $HEADER$
*/
#include "lam_config.h"
#include <stdio.h>
#include "mpi.h"
#include "mpi/c/bindings.h"
#if LAM_WANT_MPI_PROFILING && LAM_HAVE_WEAK_SYMBOLS
#pragma weak PMPI_Alloc_mem = MPI_Alloc_mem
#endif
int MPI_Alloc_mem(MPI_Aint size, MPI_Info info, void *baseptr)
{
if (size < 0) {
/* Return error on MPI_COMM_WORLD */
}
if (baseptr == NULL) {
/* Return error on MPI_COMM_WORLD */
}
/* Check the MPI_Info and see if we requested a specific MCA
type/module. If so, invoke that module's alloc_mem function
(query the MCA base ?or the type base? to find the module and/or
invoke the alloc_mem on it). Otherwise, call malloc().
If either fails, return an error on MPI_COMM_WORLD. */
return MPI_SUCCESS;
}

30
src/mpi/interface/c/free_mem.c Обычный файл
Просмотреть файл

@ -0,0 +1,30 @@
/*
* $HEADER$
*/
#include "lam_config.h"
#include <stdio.h>
#include "mpi.h"
#if LAM_WANT_MPI_PROFILING && LAM_HAVE_WEAK_SYMBOLS
#pragma weak PMPI_Free_mem = MPI_Free_mem
#endif
int MPI_Free_mem(void *baseptr)
{
if (baseptr == NULL) {
/* Return error on MPI_COMM_WORLD */
}
/* Look and see if this pointer was allocated with a specific
MPI_Info that got the memory from a module's alloc_mem function.
If so, call the module's corresponding free_mem function.
Otherwise, call free().
If either fails, return an error on MPI_COMM_WORLD. */
return MPI_SUCCESS;
}

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

@ -22,10 +22,12 @@ noinst_LTLIBRARIES = $(lib)
headers = defines.h
nodist_libmpi_c_profile_la_SOURCES = \
palloc_mem.c \
pcomm_get_name.c \
pcomm_set_name.c \
pinit.c \
pfinalize.c
pfinalize.c \
pfree_mem.c
# Sym link in the sources from the real MPI directory

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

@ -36,10 +36,12 @@ headers = \
prototypes.h
libmpi_f77_la_SOURCES = \
alloc_mem_f.c \
comm_get_name_f.c \
comm_set_name_f.c \
init_f.c \
finalize_f.c
finalize_f.c \
free_mem_f.c
libmpi_f77_la_LIBADD = $(profile_lib)

33
src/mpi/interface/f77/alloc_mem_f.c Обычный файл
Просмотреть файл

@ -0,0 +1,33 @@
/*
* $HEADER$
*/
#include "lam_config.h"
#include <stdio.h>
#include "mpi.h"
#include "mpi/f77/bindings.h"
#if LAM_HAVE_WEAK_SYMBOLS
#pragma weak MPI_ALLOC_MEM = mpi_alloc_mem_f
#pragma weak mpi_alloc_mem = mpi_alloc_mem_f
#pragma weak mpi_alloc_mem_ = mpi_alloc_mem_f
#pragma weak mpi_alloc_mem__ = mpi_alloc_mem_f
#if LAM_WANT_MPI_PROFILING
#pragma weak PMPI_ALLOC_MEM = mpi_alloc_mem_f
#pragma weak pmpi_alloc_mem = mpi_alloc_mem_f
#pragma weak pmpi_alloc_mem_ = mpi_alloc_mem_f
#pragma weak pmpi_alloc_mem__ = mpi_alloc_mem_f
#endif
#endif
void mpi_alloc_mem_(int *size, int *info, char *baseptr, int *ierr)
{
#if 0
/* JMS Need fortran -> C handle lookups, and a safe way to do the
baseptr pointer */
*ierr = MPI_Alloc_mem(*size, GETHDL(*info), BUF(baseptr));
#endif
}

33
src/mpi/interface/f77/free_mem_f.c Обычный файл
Просмотреть файл

@ -0,0 +1,33 @@
/*
* $HEADER$
*/
#include "lam_config.h"
#include <stdio.h>
#include "mpi.h"
#include "mpi/f77/bindings.h"
#if LAM_HAVE_WEAK_SYMBOLS
#pragma weak MPI_FREE_MEM = mpi_free_mem_f
#pragma weak mpi_free_mem = mpi_free_mem_f
#pragma weak mpi_free_mem_ = mpi_free_mem_f
#pragma weak mpi_free_mem__ = mpi_free_mem_f
#if LAM_WANT_MPI_PROFILING
#pragma weak PMPI_FREE_MEM = mpi_free_mem_f
#pragma weak pmpi_free_mem = mpi_free_mem_f
#pragma weak pmpi_free_mem_ = mpi_free_mem_f
#pragma weak pmpi_free_mem__ = mpi_free_mem_f
#endif
#endif
void mpi_free_mem_(char *baseptr, int *ierr)
{
#if 0
/* JMS Need fortran -> C handle lookups, and a safe way to do the
baseptr pointer */
*ierr = MPI_Free_mem(BUF(baseptr));
#endif
}

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

@ -27,10 +27,12 @@ noinst_LTLIBRARIES = $(f77_lib)
headers = defines.h
nodist_libmpi_f77_profile_la_SOURCES = \
palloc_mem_f.c \
pcomm_get_name_f.c \
pcomm_set_name_f.c \
pinit_f.c \
pfinalize_f.c
pfinalize_f.c \
pfree_mem_f.c
# Sym link in the sources from the real MPI directory