2004-06-15 19:07:45 +00:00
|
|
|
/*
|
2005-11-05 19:57:48 +00:00
|
|
|
* Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
|
|
|
|
* University Research and Technology
|
|
|
|
* Corporation. All rights reserved.
|
2006-08-24 16:38:08 +00:00
|
|
|
* Copyright (c) 2004-2006 The University of Tennessee and The University
|
2005-11-05 19:57:48 +00:00
|
|
|
* of Tennessee Research Foundation. All rights
|
|
|
|
* reserved.
|
2004-11-28 20:09:25 +00:00
|
|
|
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
|
|
|
|
* University of Stuttgart. All rights reserved.
|
2005-03-24 12:43:37 +00:00
|
|
|
* Copyright (c) 2004-2005 The Regents of the University of California.
|
|
|
|
* All rights reserved.
|
2009-04-01 17:52:16 +00:00
|
|
|
* Copyright (c) 2008-2009 Cisco Systems, Inc. All rights reserved.
|
2004-11-22 01:38:40 +00:00
|
|
|
* $COPYRIGHT$
|
|
|
|
*
|
|
|
|
* Additional copyrights may follow
|
|
|
|
*
|
2004-06-15 19:07:45 +00:00
|
|
|
* $HEADER$
|
|
|
|
*/
|
|
|
|
/**
|
|
|
|
* @file
|
|
|
|
*/
|
|
|
|
#ifndef MCA_MEM_BASE_H
|
|
|
|
#define MCA_MEM_BASE_H
|
|
|
|
|
|
|
|
#include "ompi_config.h"
|
|
|
|
|
2005-07-03 16:22:16 +00:00
|
|
|
#include "opal/class/opal_list.h"
|
2006-02-12 01:33:29 +00:00
|
|
|
#include "opal/mca/mca.h"
|
|
|
|
#include "ompi/mca/mpool/mpool.h"
|
2006-08-21 14:00:30 +00:00
|
|
|
|
2009-04-01 17:52:16 +00:00
|
|
|
BEGIN_C_DECLS
|
2004-06-15 19:07:45 +00:00
|
|
|
|
2005-09-27 14:23:51 +00:00
|
|
|
static inline unsigned int my_log2(unsigned long val) {
|
|
|
|
unsigned int count = 0;
|
2005-09-27 02:01:21 +00:00
|
|
|
while(val > 0) {
|
|
|
|
val = val >> 1;
|
|
|
|
count++;
|
|
|
|
}
|
2005-09-27 14:23:51 +00:00
|
|
|
return count > 0 ? count-1: 0;
|
2005-09-27 02:01:21 +00:00
|
|
|
}
|
|
|
|
static inline void *down_align_addr(void* addr, unsigned int shift) {
|
2006-10-20 03:57:44 +00:00
|
|
|
return (void*) (((intptr_t) addr) & (~(intptr_t) 0) << shift);
|
2005-09-27 02:01:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static inline void *up_align_addr(void*addr, unsigned int shift) {
|
2006-10-20 03:57:44 +00:00
|
|
|
return (void*) ((((intptr_t) addr) | ~((~(intptr_t) 0) << shift)));
|
2005-09-27 02:01:21 +00:00
|
|
|
}
|
|
|
|
|
2004-06-15 19:07:45 +00:00
|
|
|
struct mca_mpool_base_selected_module_t {
|
2005-07-03 16:22:16 +00:00
|
|
|
opal_list_item_t super;
|
2005-06-23 15:53:51 +00: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 19:07:45 +00:00
|
|
|
};
|
|
|
|
typedef struct mca_mpool_base_selected_module_t mca_mpool_base_selected_module_t;
|
|
|
|
|
2006-08-24 16:38:08 +00:00
|
|
|
OMPI_DECLSPEC OBJ_CLASS_DECLARATION(mca_mpool_base_selected_module_t);
|
2004-06-15 19:07:45 +00:00
|
|
|
|
2005-05-31 19:07:27 +00:00
|
|
|
/*
|
|
|
|
* Data structures for the tree of allocated memory
|
|
|
|
*/
|
|
|
|
|
2004-06-15 19:07:45 +00:00
|
|
|
/*
|
2004-07-12 20:05:29 +00:00
|
|
|
* Global functions for MCA: overall mpool open and close
|
2004-06-15 19:07:45 +00:00
|
|
|
*/
|
|
|
|
|
2004-10-22 16:06:05 +00:00
|
|
|
OMPI_DECLSPEC int mca_mpool_base_open(void);
|
2005-06-21 17:10:28 +00:00
|
|
|
OMPI_DECLSPEC int mca_mpool_base_init(bool enable_progress_threads, bool enable_mpi_threads);
|
2004-10-22 16:06:05 +00:00
|
|
|
OMPI_DECLSPEC int mca_mpool_base_close(void);
|
2005-01-15 13:20:26 +00:00
|
|
|
OMPI_DECLSPEC mca_mpool_base_component_t* mca_mpool_base_component_lookup(const char* name);
|
2005-06-21 17:10:28 +00:00
|
|
|
OMPI_DECLSPEC mca_mpool_base_module_t* mca_mpool_base_module_create(
|
|
|
|
const char* name,
|
2005-06-23 15:53:51 +00:00
|
|
|
void* user_data,
|
|
|
|
struct mca_mpool_base_resources_t* mpool_resources);
|
2005-07-15 20:01:35 +00:00
|
|
|
OMPI_DECLSPEC mca_mpool_base_module_t* mca_mpool_base_module_lookup(const char* name);
|
2005-09-03 00:07:34 +00:00
|
|
|
OMPI_DECLSPEC int mca_mpool_base_module_destroy(mca_mpool_base_module_t *module);
|
2005-06-21 17:10:28 +00:00
|
|
|
|
2004-06-15 19:07:45 +00:00
|
|
|
/*
|
|
|
|
* Globals
|
|
|
|
*/
|
2004-10-22 16:06:05 +00:00
|
|
|
OMPI_DECLSPEC extern int mca_mpool_base_output;
|
2005-07-03 16:22:16 +00:00
|
|
|
OMPI_DECLSPEC extern opal_list_t mca_mpool_base_components;
|
2007-05-16 15:46:52 +00:00
|
|
|
extern opal_list_t mca_mpool_base_modules;
|
2007-02-27 15:17:17 +00:00
|
|
|
OMPI_DECLSPEC extern uint32_t mca_mpool_base_page_size;
|
|
|
|
OMPI_DECLSPEC extern uint32_t mca_mpool_base_page_size_log;
|
2008-06-13 22:32:49 +00:00
|
|
|
|
|
|
|
/* only used within base -- no need to DECLSPEC */
|
2008-07-24 22:51:26 +00:00
|
|
|
extern int mca_mpool_base_used_mem_hooks;
|
2007-02-27 15:17:17 +00:00
|
|
|
|
2009-04-01 17:52:16 +00:00
|
|
|
END_C_DECLS
|
2004-10-20 22:31:03 +00:00
|
|
|
|
2004-06-15 19:07:45 +00:00
|
|
|
#endif /* MCA_MEM_BASE_H */
|