1
1
openmpi/oshmem/mca/memheap/ptmalloc/memheap_ptmalloc.h
Ralph Castain 552c9ca5a0 George did the work and deserves all the credit for it. Ralph did the merge, and deserves whatever blame results from errors in it :-)
WHAT:    Open our low-level communication infrastructure by moving all necessary components (btl/rcache/allocator/mpool) down in OPAL

All the components required for inter-process communications are currently deeply integrated in the OMPI layer. Several groups/institutions have express interest in having a more generic communication infrastructure, without all the OMPI layer dependencies.  This communication layer should be made available at a different software level, available to all layers in the Open MPI software stack. As an example, our ORTE layer could replace the current OOB and instead use the BTL directly, gaining access to more reactive network interfaces than TCP.  Similarly, external software libraries could take advantage of our highly optimized AM (active message) communication layer for their own purpose.  UTK with support from Sandia, developped a version of Open MPI where the entire communication infrastucture has been moved down to OPAL (btl/rcache/allocator/mpool). Most of the moved components have been updated to match the new schema, with few exceptions (mainly BTLs where I have no way of compiling/testing them). Thus, the completion of this RFC is tied to being able to completing this move for all BTLs. For this we need help from the rest of the Open MPI community, especially those supporting some of the BTLs.  A non-exhaustive list of BTLs that qualify here is: mx, portals4, scif, udapl, ugni, usnic.

This commit was SVN r32317.
2014-07-26 00:47:28 +00:00

73 строки
2.2 KiB
C

/**
* Copyright (c) 2013 Mellanox Technologies, Inc.
* All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
/**
* @file
* Description of the Registration Cache framework
*/
#ifndef MCA_MEMHEAP_PTMALLOC_H
#define MCA_MEMHEAP_PTMALLOC_H
#include "oshmem_config.h"
#include "opal/mca/mca.h"
#include "opal/class/opal_list.h"
#include "opal/threads/mutex.h"
#include "oshmem/mca/memheap/memheap.h"
#include "oshmem/mca/memheap/base/base.h"
#include "oshmem/mca/spml/spml.h"
#include "oshmem/util/oshmem_util.h"
#include "opal/class/opal_hash_table.h"
#include "opal/mca/btl/btl.h"
#include <string.h>
#include <sys/types.h>
#include <math.h>
BEGIN_C_DECLS
#include "malloc_defs.h"
/*
* At the moment we use only dlmalloc part of the ptmalloc3. Thread safety is implemented by using locks on
* alloc operations. Since all shmem alloc ops are collectives, malloc performance is not a problem. So it makes
* sense to use simpler algorithm.
*
* Heap is allocate in one chunk, and we implement our on sbrk like function that serves portions of the memory
* to malloc.
*
* At the moment we do not support growing/returning heap based memory to OS.
*/
/* Structure for managing shmem symmetric heap */
struct mca_memheap_ptmalloc_module_t {
mca_memheap_base_module_t super;
int priority; /** Module's Priority */
void *base;
size_t cur_size;
size_t max_size;
size_t max_alloc_size;
opal_mutex_t lock; /** Part of the allocator */
};
typedef struct mca_memheap_ptmalloc_module_t mca_memheap_ptmalloc_module_t;
OSHMEM_DECLSPEC extern mca_memheap_ptmalloc_module_t memheap_ptmalloc;
/*
* Buddy interface.
* Please pay attention to the new differences in the interface.
*/
OSHMEM_DECLSPEC extern int mca_memheap_ptmalloc_module_init(memheap_context_t *);
OSHMEM_DECLSPEC extern int mca_memheap_ptmalloc_alloc(size_t, void**);
OSHMEM_DECLSPEC extern int mca_memheap_ptmalloc_realloc(size_t, void*, void **);
OSHMEM_DECLSPEC extern int mca_memheap_ptmalloc_align(size_t, size_t, void**);
OSHMEM_DECLSPEC extern int mca_memheap_ptmalloc_free(void*);
OSHMEM_DECLSPEC extern int mca_memheap_ptmalloc_finalize(void);
END_C_DECLS
#endif /* MCA_MEMHEAP_BUDDY_H */