2005-06-30 18:31:41 +04:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2004-2005 The Trustees of Indiana University.
|
|
|
|
* All rights reserved.
|
|
|
|
* Copyright (c) 2004-2005 The Trustees of the University of Tennessee.
|
|
|
|
* All rights reserved.
|
|
|
|
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
|
|
|
|
* University of Stuttgart. All rights reserved.
|
|
|
|
* Copyright (c) 2004-2005 The Regents of the University of California.
|
|
|
|
* All rights reserved.
|
|
|
|
* $COPYRIGHT$
|
|
|
|
*
|
|
|
|
* Additional copyrights may follow
|
|
|
|
*
|
|
|
|
* $HEADER$
|
|
|
|
*/
|
|
|
|
/**
|
|
|
|
* @file
|
|
|
|
*/
|
|
|
|
#ifndef MCA_MPOOL_VAPI_H
|
|
|
|
#define MCA_MPOOL_VAPI_H
|
|
|
|
|
2005-07-03 20:22:16 +04:00
|
|
|
#include "opal/class/opal_list.h"
|
2005-06-30 18:31:41 +04:00
|
|
|
#include "class/ompi_free_list.h"
|
2005-07-04 03:09:55 +04:00
|
|
|
#include "opal/event/event.h"
|
2005-06-30 18:31:41 +04:00
|
|
|
#include "mca/mpool/mpool.h"
|
|
|
|
|
|
|
|
#if defined(c_plusplus) || defined(__cplusplus)
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
static inline void * DOWN_ALIGN_ADDR(void * addr, uint32_t cnt) {
|
2005-07-20 01:04:22 +04:00
|
|
|
return (void*)((uintptr_t)((unsigned char*) addr) & (~((uintptr_t)0) << (cnt)));
|
2005-06-30 18:31:41 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
static inline void* ALIGN_ADDR(void* addr, uint32_t cnt ) {
|
2005-07-20 01:04:22 +04:00
|
|
|
DOWN_ALIGN_ADDR((((unsigned char*) addr) + ~(~((uintptr_t)0) << (cnt))), (cnt));
|
2005-06-30 18:31:41 +04:00
|
|
|
return addr;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-07-01 01:28:35 +04:00
|
|
|
struct mca_mpool_openib_component_t {
|
2005-06-30 18:31:41 +04:00
|
|
|
mca_mpool_base_component_t super;
|
2005-09-13 02:28:23 +04:00
|
|
|
char* rcache_name;
|
2005-06-30 18:31:41 +04:00
|
|
|
};
|
|
|
|
|
2005-07-01 01:28:35 +04:00
|
|
|
typedef struct mca_mpool_openib_component_t mca_mpool_openib_component_t;
|
2005-06-30 18:31:41 +04:00
|
|
|
|
2005-07-01 01:28:35 +04:00
|
|
|
OMPI_COMP_EXPORT extern mca_mpool_openib_component_t mca_mpool_openib_component;
|
2005-06-30 18:31:41 +04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
struct mca_mpool_base_resources_t {
|
2005-07-12 17:38:54 +04:00
|
|
|
struct ibv_pd* ib_pd;
|
2005-06-30 18:31:41 +04:00
|
|
|
};
|
|
|
|
typedef struct mca_mpool_base_resources_t mca_mpool_base_resources_t;
|
|
|
|
|
2005-07-01 01:28:35 +04:00
|
|
|
struct mca_mpool_openib_module_t {
|
2005-06-30 18:31:41 +04:00
|
|
|
mca_mpool_base_module_t super;
|
2005-07-12 17:38:54 +04:00
|
|
|
struct mca_mpool_base_resources_t resources;
|
2005-07-01 01:28:35 +04:00
|
|
|
}; typedef struct mca_mpool_openib_module_t mca_mpool_openib_module_t;
|
2005-07-12 17:38:54 +04:00
|
|
|
|
2005-06-30 18:31:41 +04:00
|
|
|
|
2005-07-01 01:28:35 +04:00
|
|
|
struct mca_mpool_openib_registration_t {
|
2005-06-30 18:31:41 +04:00
|
|
|
mca_mpool_base_registration_t base_reg;
|
2005-07-12 17:38:54 +04:00
|
|
|
struct ibv_mr *mr;
|
2005-07-15 20:05:05 +04:00
|
|
|
|
2005-06-30 18:31:41 +04:00
|
|
|
};
|
2005-07-01 01:28:35 +04:00
|
|
|
typedef struct mca_mpool_openib_registration_t mca_mpool_openib_registration_t;
|
|
|
|
OMPI_DECLSPEC OBJ_CLASS_DECLARATION(mca_mpool_openib_registration_t);
|
2005-06-30 18:31:41 +04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Initializes the mpool module.
|
|
|
|
*/
|
2005-07-01 01:28:35 +04:00
|
|
|
void mca_mpool_openib_module_init(mca_mpool_openib_module_t* mpool);
|
2005-06-30 18:31:41 +04:00
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Returns base address of shared memory mapping.
|
|
|
|
*/
|
2005-07-01 01:28:35 +04:00
|
|
|
void* mca_mpool_openib_base(mca_mpool_base_module_t*);
|
2005-06-30 18:31:41 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Allocate block of shared memory.
|
|
|
|
*/
|
2005-07-01 01:28:35 +04:00
|
|
|
void* mca_mpool_openib_alloc(
|
2005-06-30 18:31:41 +04:00
|
|
|
mca_mpool_base_module_t* mpool,
|
|
|
|
size_t size,
|
|
|
|
size_t align,
|
2005-09-13 02:28:23 +04:00
|
|
|
uint32_t flags,
|
2005-06-30 18:31:41 +04:00
|
|
|
mca_mpool_base_registration_t** registration);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* realloc function typedef
|
|
|
|
*/
|
2005-07-01 01:28:35 +04:00
|
|
|
void* mca_mpool_openib_realloc(
|
2005-06-30 18:31:41 +04:00
|
|
|
mca_mpool_base_module_t* mpool,
|
|
|
|
void* addr,
|
|
|
|
size_t size,
|
|
|
|
mca_mpool_base_registration_t** registration);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* register function typedef
|
|
|
|
*/
|
2005-07-01 01:28:35 +04:00
|
|
|
int mca_mpool_openib_register(
|
2005-06-30 18:31:41 +04:00
|
|
|
mca_mpool_base_module_t* mpool,
|
|
|
|
void *addr,
|
|
|
|
size_t size,
|
2005-09-13 02:28:23 +04:00
|
|
|
uint32_t flags,
|
2005-06-30 18:31:41 +04:00
|
|
|
mca_mpool_base_registration_t** registration);
|
|
|
|
|
2005-07-01 01:28:35 +04:00
|
|
|
int mca_mpool_openib_deregister(
|
2005-06-30 18:31:41 +04:00
|
|
|
mca_mpool_base_module_t* mpool,
|
|
|
|
mca_mpool_base_registration_t* );
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* free function typedef
|
|
|
|
*/
|
2005-07-01 01:28:35 +04:00
|
|
|
void mca_mpool_openib_free(mca_mpool_base_module_t* mpool,
|
2005-06-30 18:31:41 +04:00
|
|
|
void * addr,
|
|
|
|
mca_mpool_base_registration_t* registration);
|
|
|
|
|
2005-09-13 02:28:23 +04:00
|
|
|
|
|
|
|
int mca_mpool_openib_find(
|
|
|
|
struct mca_mpool_base_module_t* mpool,
|
|
|
|
void* addr,
|
|
|
|
size_t size,
|
|
|
|
ompi_pointer_array_t *regs,
|
|
|
|
uint32_t *cnt
|
|
|
|
);
|
|
|
|
|
|
|
|
int mca_mpool_openib_release(
|
|
|
|
struct mca_mpool_base_module_t* mpool,
|
|
|
|
mca_mpool_base_registration_t* registraion
|
|
|
|
);
|
|
|
|
|
|
|
|
int mca_mpool_openib_retain(
|
|
|
|
struct mca_mpool_base_module_t* mpool,
|
|
|
|
mca_mpool_base_registration_t* registraion
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
|
2005-06-30 18:31:41 +04:00
|
|
|
#if defined(c_plusplus) || defined(__cplusplus)
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|