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.
|
2006-08-24 20:38:08 +04:00
|
|
|
* Copyright (c) 2004-2006 The University of Tennessee and The University
|
2005-11-05 22:57:48 +03:00
|
|
|
* 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.
|
2009-04-01 21:52:16 +04:00
|
|
|
* Copyright (c) 2008-2009 Cisco Systems, Inc. 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"
|
2006-08-21 18:00:30 +04:00
|
|
|
|
2009-04-01 21:52:16 +04:00
|
|
|
BEGIN_C_DECLS
|
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) {
|
2006-10-20 07:57:44 +04:00
|
|
|
return (void*) (((intptr_t) addr) & (~(intptr_t) 0) << shift);
|
2005-09-27 06:01:21 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
static inline void *up_align_addr(void*addr, unsigned int shift) {
|
2006-10-20 07:57:44 +04:00
|
|
|
return (void*) ((((intptr_t) addr) | ~((~(intptr_t) 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;
|
|
|
|
|
2006-08-24 20:38:08 +04:00
|
|
|
OMPI_DECLSPEC 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;
|
2007-05-16 19:46:52 +04:00
|
|
|
extern opal_list_t mca_mpool_base_modules;
|
2007-02-27 18:17:17 +03:00
|
|
|
OMPI_DECLSPEC extern uint32_t mca_mpool_base_page_size;
|
|
|
|
OMPI_DECLSPEC extern uint32_t mca_mpool_base_page_size_log;
|
2008-06-14 02:32:49 +04:00
|
|
|
|
|
|
|
/* only used within base -- no need to DECLSPEC */
|
2008-07-25 02:51:26 +04:00
|
|
|
extern int mca_mpool_base_used_mem_hooks;
|
2007-02-27 18:17:17 +03:00
|
|
|
|
2009-04-01 21:52:16 +04:00
|
|
|
END_C_DECLS
|
2004-10-21 02:31:03 +04:00
|
|
|
|
2004-06-15 23:07:45 +04:00
|
|
|
#endif /* MCA_MEM_BASE_H */
|