2004-06-15 23:07:45 +04:00
|
|
|
/*
|
2005-11-05 22:57:48 +03:00
|
|
|
* 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.
|
2004-11-28 23:09:25 +03:00
|
|
|
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
|
|
|
|
* University of Stuttgart. All rights reserved.
|
2005-03-24 15:43:37 +03:00
|
|
|
* Copyright (c) 2004-2005 The Regents of the University of California.
|
|
|
|
* All rights reserved.
|
2004-11-22 04:38:40 +03:00
|
|
|
* $COPYRIGHT$
|
|
|
|
*
|
|
|
|
* Additional copyrights may follow
|
|
|
|
*
|
2004-06-15 23:07:45 +04:00
|
|
|
* $HEADER$
|
|
|
|
*/
|
|
|
|
/**
|
|
|
|
* @file
|
|
|
|
*/
|
|
|
|
#ifndef MCA_MEM_BASE_H
|
|
|
|
#define MCA_MEM_BASE_H
|
|
|
|
|
|
|
|
#include "ompi_config.h"
|
|
|
|
|
2005-07-03 20:22:16 +04:00
|
|
|
#include "opal/class/opal_list.h"
|
2006-02-12 04:33:29 +03:00
|
|
|
#include "ompi/class/ompi_rb_tree.h"
|
|
|
|
#include "opal/mca/mca.h"
|
|
|
|
#include "ompi/mca/mpool/mpool.h"
|
2005-07-04 02:45:48 +04:00
|
|
|
#include "opal/threads/mutex.h"
|
2004-06-15 23:07:45 +04:00
|
|
|
|
2004-10-21 02:31:03 +04:00
|
|
|
#if defined(c_plusplus) || defined(__cplusplus)
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
2004-06-15 23:07:45 +04:00
|
|
|
|
2005-09-27 18:23:51 +04:00
|
|
|
static inline unsigned int my_log2(unsigned long val) {
|
|
|
|
unsigned int count = 0;
|
2005-09-27 06:01:21 +04:00
|
|
|
while(val > 0) {
|
|
|
|
val = val >> 1;
|
|
|
|
count++;
|
|
|
|
}
|
2005-09-27 18:23:51 +04:00
|
|
|
return count > 0 ? count-1: 0;
|
2005-09-27 06:01:21 +04:00
|
|
|
}
|
|
|
|
static inline void *down_align_addr(void* addr, unsigned int shift) {
|
|
|
|
return (void*) (((unsigned long) addr) & (~(unsigned long) 0) << shift);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline void *up_align_addr(void*addr, unsigned int shift) {
|
2005-09-27 22:10:44 +04:00
|
|
|
return (void*) ((((unsigned long) addr) | ~((~(unsigned long) 0) << shift)));
|
2005-09-27 06:01:21 +04:00
|
|
|
}
|
|
|
|
|
2004-06-15 23:07:45 +04:00
|
|
|
struct mca_mpool_base_selected_module_t {
|
2005-07-03 20:22:16 +04:00
|
|
|
opal_list_item_t super;
|
2005-06-23 19:53:51 +04:00
|
|
|
mca_mpool_base_component_t *mpool_component;
|
|
|
|
mca_mpool_base_module_t *mpool_module;
|
|
|
|
void* user_data;
|
|
|
|
struct mca_mpool_base_resources_t *mpool_resources;
|
2004-06-15 23:07:45 +04:00
|
|
|
};
|
|
|
|
typedef struct mca_mpool_base_selected_module_t mca_mpool_base_selected_module_t;
|
|
|
|
|
2004-06-16 19:41:29 +04:00
|
|
|
OBJ_CLASS_DECLARATION(mca_mpool_base_selected_module_t);
|
2004-06-15 23:07:45 +04:00
|
|
|
|
2005-05-31 23:07:27 +04:00
|
|
|
/*
|
|
|
|
* Data structures for the tree of allocated memory
|
|
|
|
*/
|
|
|
|
|
2004-06-15 23:07:45 +04:00
|
|
|
/*
|
2004-07-13 00:05:29 +04:00
|
|
|
* Global functions for MCA: overall mpool open and close
|
2004-06-15 23:07:45 +04:00
|
|
|
*/
|
|
|
|
|
2004-10-22 20:06:05 +04:00
|
|
|
OMPI_DECLSPEC int mca_mpool_base_open(void);
|
2005-06-21 21:10:28 +04:00
|
|
|
OMPI_DECLSPEC int mca_mpool_base_init(bool enable_progress_threads, bool enable_mpi_threads);
|
2004-10-22 20:06:05 +04:00
|
|
|
OMPI_DECLSPEC int mca_mpool_base_close(void);
|
2005-01-15 16:20:26 +03:00
|
|
|
OMPI_DECLSPEC mca_mpool_base_component_t* mca_mpool_base_component_lookup(const char* name);
|
2005-06-21 21:10:28 +04:00
|
|
|
OMPI_DECLSPEC mca_mpool_base_module_t* mca_mpool_base_module_create(
|
|
|
|
const char* name,
|
2005-06-23 19:53:51 +04:00
|
|
|
void* user_data,
|
|
|
|
struct mca_mpool_base_resources_t* mpool_resources);
|
2005-07-16 00:01:35 +04:00
|
|
|
OMPI_DECLSPEC mca_mpool_base_module_t* mca_mpool_base_module_lookup(const char* name);
|
2005-09-03 04:07:34 +04:00
|
|
|
OMPI_DECLSPEC int mca_mpool_base_module_destroy(mca_mpool_base_module_t *module);
|
2005-06-21 21:10:28 +04:00
|
|
|
|
2004-06-15 23:07:45 +04:00
|
|
|
/*
|
|
|
|
* Globals
|
|
|
|
*/
|
2004-10-22 20:06:05 +04:00
|
|
|
OMPI_DECLSPEC extern int mca_mpool_base_output;
|
2005-07-03 20:22:16 +04:00
|
|
|
OMPI_DECLSPEC extern opal_list_t mca_mpool_base_components;
|
|
|
|
OMPI_DECLSPEC extern opal_list_t mca_mpool_base_modules;
|
2004-06-15 23:07:45 +04:00
|
|
|
|
2004-10-21 02:31:03 +04:00
|
|
|
#if defined(c_plusplus) || defined(__cplusplus)
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2004-06-15 23:07:45 +04:00
|
|
|
#endif /* MCA_MEM_BASE_H */
|
2005-09-14 06:17:04 +04:00
|
|
|
|
|
|
|
|
|
|
|
|