2015-03-06 06:50:44 +03:00
|
|
|
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
|
|
|
|
/*
|
|
|
|
* Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
|
|
|
|
* University Research and Technology
|
|
|
|
* Corporation. All rights reserved.
|
|
|
|
* Copyright (c) 2004-2007 The University of Tennessee and The University
|
|
|
|
* of Tennessee Research Foundation. All rights
|
|
|
|
* reserved.
|
2015-06-24 06:59:57 +03:00
|
|
|
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
|
2015-03-06 06:50:44 +03:00
|
|
|
* University of Stuttgart. All rights reserved.
|
|
|
|
* Copyright (c) 2004-2005 The Regents of the University of California.
|
|
|
|
* All rights reserved.
|
|
|
|
* Copyright (c) 2009 IBM Corporation. All rights reserved.
|
2018-02-16 22:13:17 +03:00
|
|
|
* Copyright (c) 2015-2018 Los Alamos National Security, LLC. All rights
|
2015-03-06 06:50:44 +03:00
|
|
|
* reserved.
|
|
|
|
* $COPYRIGHT$
|
|
|
|
*
|
|
|
|
* Additional copyrights may follow
|
|
|
|
*
|
|
|
|
* $HEADER$
|
|
|
|
*/
|
2005-09-04 08:17:00 +04:00
|
|
|
/**
|
|
|
|
* @file
|
|
|
|
* Description of the Registration Cache framework
|
|
|
|
*/
|
|
|
|
#ifndef MCA_RCACHE_H
|
|
|
|
#define MCA_RCACHE_H
|
2006-02-12 04:33:29 +03:00
|
|
|
#include "opal/mca/mca.h"
|
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 04:47:28 +04:00
|
|
|
#include "opal/mca/mpool/mpool.h"
|
2005-09-14 02:06:44 +04:00
|
|
|
#include "opal/threads/mutex.h"
|
2005-09-04 08:17:00 +04:00
|
|
|
|
|
|
|
|
2015-11-02 22:07:08 +03:00
|
|
|
/* forward-declaration of rcache module structure */
|
|
|
|
struct mca_rcache_base_module_t;
|
|
|
|
typedef struct mca_rcache_base_module_t mca_rcache_base_module_t;
|
|
|
|
|
|
|
|
enum {
|
|
|
|
/** bypass the cache when registering */
|
|
|
|
MCA_RCACHE_FLAGS_CACHE_BYPASS = 0x0001,
|
|
|
|
/** persistent registration */
|
|
|
|
MCA_RCACHE_FLAGS_PERSIST = 0x0002,
|
|
|
|
/** registation requires strong ordering (disables relaxed ordering) */
|
|
|
|
MCA_RCACHE_FLAGS_SO_MEM = 0x0004,
|
|
|
|
/** address range is cuda buffer */
|
|
|
|
MCA_RCACHE_FLAGS_CUDA_GPU_MEM = 0x0008,
|
|
|
|
/** register with common cuda */
|
|
|
|
MCA_RCACHE_FLAGS_CUDA_REGISTER_MEM = 0x0010,
|
|
|
|
/** invalid registration (no valid for passing to rcache register) */
|
|
|
|
MCA_RCACHE_FLAGS_INVALID = 0x0080,
|
2018-02-16 22:13:17 +03:00
|
|
|
/** reserved for rcache module */
|
|
|
|
MCA_RCACHE_FLAGS_MOD_RESV0 = 0x0100,
|
|
|
|
/** reserved for rcache module */
|
|
|
|
MCA_RCACHE_FLAGS_MOD_RESV1 = 0x0200,
|
|
|
|
/** reserved for rcache module */
|
|
|
|
MCA_RCACHE_FLAGS_MOD_RESV2 = 0x0400,
|
|
|
|
/** reserved for rcache module */
|
|
|
|
MCA_RCACHE_FLAGS_MOD_RESV3 = 0x0800,
|
2015-11-02 22:07:08 +03:00
|
|
|
/** reserved for register function */
|
|
|
|
MCA_RCACHE_FLAGS_RESV0 = 0x1000,
|
|
|
|
/** reserved for register function */
|
|
|
|
MCA_RCACHE_FLAGS_RESV1 = 0x2000,
|
|
|
|
/** reserved for register function */
|
|
|
|
MCA_RCACHE_FLAGS_RESV2 = 0x4000,
|
|
|
|
/** reserved for register function */
|
|
|
|
MCA_RCACHE_FLAGS_RESV3 = 0x8000,
|
|
|
|
};
|
|
|
|
|
|
|
|
/** access flags */
|
|
|
|
enum {
|
|
|
|
/** register for local write */
|
|
|
|
MCA_RCACHE_ACCESS_LOCAL_WRITE = 0x01,
|
|
|
|
/** register for remote read */
|
|
|
|
MCA_RCACHE_ACCESS_REMOTE_READ = 0x02,
|
|
|
|
/** register for remote write */
|
|
|
|
MCA_RCACHE_ACCESS_REMOTE_WRITE = 0x04,
|
|
|
|
/** register for local/remote atomic operations */
|
|
|
|
MCA_RCACHE_ACCESS_REMOTE_ATOMIC = 0x08,
|
|
|
|
/** register for any access */
|
|
|
|
MCA_RCACHE_ACCESS_ANY = 0x0f,
|
|
|
|
};
|
|
|
|
|
|
|
|
/** base class for all rcache registrations */
|
|
|
|
struct mca_rcache_base_registration_t {
|
|
|
|
/** alloc registrations to be allocated from an opal_free_list_t */
|
|
|
|
opal_free_list_item_t super;
|
|
|
|
/** rcache this registration belongs to */
|
|
|
|
mca_rcache_base_module_t *rcache;
|
|
|
|
/** base of registered region */
|
|
|
|
unsigned char *base;
|
|
|
|
/** bound of registered region */
|
|
|
|
unsigned char *bound;
|
|
|
|
/** artifact of old mpool/rcache architecture. used by cuda code */
|
|
|
|
unsigned char *alloc_base;
|
|
|
|
/** number of outstanding references */
|
2018-07-11 22:34:03 +03:00
|
|
|
opal_atomic_int32_t ref_count;
|
2015-11-02 22:07:08 +03:00
|
|
|
/** registration flags */
|
2018-07-11 22:34:03 +03:00
|
|
|
opal_atomic_uint32_t flags;
|
2015-11-02 22:07:08 +03:00
|
|
|
/** internal rcache context */
|
|
|
|
void *rcache_context;
|
|
|
|
#if OPAL_CUDA_GDR_SUPPORT
|
|
|
|
/** CUDA gpu buffer identifier */
|
|
|
|
unsigned long long gpu_bufID;
|
|
|
|
#endif /* OPAL_CUDA_GDR_SUPPORT */
|
|
|
|
/** registration access flags */
|
|
|
|
int32_t access_flags;
|
|
|
|
unsigned char padding[64];
|
|
|
|
};
|
|
|
|
|
|
|
|
typedef struct mca_rcache_base_registration_t mca_rcache_base_registration_t;
|
|
|
|
|
|
|
|
OPAL_DECLSPEC OBJ_CLASS_DECLARATION(mca_rcache_base_registration_t);
|
|
|
|
|
|
|
|
struct mca_rcache_base_resources_t {
|
|
|
|
char *cache_name;
|
|
|
|
void *reg_data;
|
|
|
|
size_t sizeof_reg;
|
|
|
|
int (*register_mem) (void *reg_data, void *base, size_t size,
|
|
|
|
mca_rcache_base_registration_t *reg);
|
|
|
|
int (*deregister_mem) (void *reg_data, mca_rcache_base_registration_t *reg);
|
|
|
|
};
|
|
|
|
typedef struct mca_rcache_base_resources_t mca_rcache_base_resources_t;
|
|
|
|
|
|
|
|
|
2005-09-04 08:17:00 +04:00
|
|
|
/**
|
|
|
|
* component initialize
|
|
|
|
*/
|
2015-11-02 22:07:08 +03:00
|
|
|
typedef struct mca_rcache_base_module_t *(*mca_rcache_base_component_init_fn_t)(mca_rcache_base_resources_t *);
|
2005-09-04 08:17:00 +04:00
|
|
|
|
2015-11-02 22:07:08 +03:00
|
|
|
/**
|
|
|
|
* register memory
|
|
|
|
*/
|
|
|
|
typedef int (*mca_rcache_base_module_register_fn_t) (mca_rcache_base_module_t *rcache,
|
|
|
|
void *addr, size_t size, uint32_t flags,
|
|
|
|
int32_t access_flags,
|
|
|
|
mca_rcache_base_registration_t **reg);
|
2005-09-04 08:17:00 +04:00
|
|
|
|
2015-11-02 22:07:08 +03:00
|
|
|
/**
|
|
|
|
* deregister memory
|
|
|
|
*/
|
|
|
|
typedef int (*mca_rcache_base_module_deregister_fn_t) (mca_rcache_base_module_t *rcache,
|
|
|
|
mca_rcache_base_registration_t *reg);
|
2006-12-17 15:26:41 +03:00
|
|
|
|
2015-11-02 22:07:08 +03:00
|
|
|
/**
|
|
|
|
* find registration in this memory pool
|
|
|
|
*/
|
2006-12-17 15:26:41 +03:00
|
|
|
|
2015-11-02 22:07:08 +03:00
|
|
|
typedef int (*mca_rcache_base_module_find_fn_t) (mca_rcache_base_module_t *rcache, void *addr,
|
|
|
|
size_t size, mca_rcache_base_registration_t **reg);
|
2005-09-04 08:17:00 +04:00
|
|
|
|
2015-11-02 22:07:08 +03:00
|
|
|
/**
|
|
|
|
* release memory region
|
|
|
|
*/
|
|
|
|
typedef int (*mca_rcache_base_module_invalidate_range_fn_t) (mca_rcache_base_module_t *rcache,
|
|
|
|
void *addr, size_t size);
|
2010-02-22 14:19:15 +03:00
|
|
|
|
2015-11-02 22:07:08 +03:00
|
|
|
/**
|
|
|
|
* evict one stale registration
|
|
|
|
*
|
|
|
|
* @returns true if successful
|
|
|
|
* @returns false if no registration could be evicted
|
|
|
|
*/
|
|
|
|
typedef bool (*mca_rcache_base_module_evict_fn_t) (mca_rcache_base_module_t *rcache);
|
2010-02-22 14:19:15 +03:00
|
|
|
|
2005-09-04 08:17:00 +04:00
|
|
|
/**
|
|
|
|
* finalize
|
|
|
|
*/
|
2015-11-02 22:07:08 +03:00
|
|
|
typedef void (*mca_rcache_base_module_finalize_fn_t)(mca_rcache_base_module_t *rcache);
|
2005-09-04 08:17:00 +04:00
|
|
|
|
2015-06-24 06:59:57 +03:00
|
|
|
/**
|
|
|
|
* rcache component descriptor. Contains component version information and
|
|
|
|
* open/close/init functions
|
|
|
|
*/
|
2005-09-04 08:17:00 +04:00
|
|
|
|
2015-06-24 06:59:57 +03:00
|
|
|
struct mca_rcache_base_component_2_0_0_t{
|
|
|
|
mca_base_component_t rcache_version; /**< version */
|
|
|
|
mca_base_component_data_t rcache_data; /**<metadata */
|
|
|
|
mca_rcache_base_component_init_fn_t rcache_init; /**<init function */
|
|
|
|
};
|
2005-09-04 08:17:00 +04:00
|
|
|
|
2015-06-24 06:59:57 +03:00
|
|
|
typedef struct mca_rcache_base_component_2_0_0_t mca_rcache_base_component_2_0_0_t;
|
2005-09-04 08:17:00 +04:00
|
|
|
|
2015-06-24 06:59:57 +03:00
|
|
|
typedef struct mca_rcache_base_component_2_0_0_t mca_rcache_base_component_t;
|
2005-09-04 08:17:00 +04:00
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* rcache module descriptor
|
2015-06-24 06:59:57 +03:00
|
|
|
*/
|
2006-12-17 15:26:41 +03:00
|
|
|
struct mca_rcache_base_module_t {
|
|
|
|
mca_rcache_base_component_t *rcache_component; /**< component struct */
|
2015-11-02 22:07:08 +03:00
|
|
|
|
|
|
|
mca_rcache_base_module_register_fn_t rcache_register;
|
|
|
|
mca_rcache_base_module_deregister_fn_t rcache_deregister;
|
2006-12-17 15:26:41 +03:00
|
|
|
mca_rcache_base_module_find_fn_t rcache_find;
|
2015-11-02 22:07:08 +03:00
|
|
|
mca_rcache_base_module_invalidate_range_fn_t rcache_invalidate_range;
|
2006-12-17 15:26:41 +03:00
|
|
|
mca_rcache_base_module_finalize_fn_t rcache_finalize;
|
2015-11-02 22:07:08 +03:00
|
|
|
mca_rcache_base_module_evict_fn_t rcache_evict;
|
2005-09-14 02:06:44 +04:00
|
|
|
opal_mutex_t lock;
|
2006-12-17 15:26:41 +03:00
|
|
|
};
|
2005-09-08 00:37:17 +04:00
|
|
|
|
2015-12-18 19:04:15 +03:00
|
|
|
#define RCACHE_MAJOR_VERSION 3
|
|
|
|
#define RCACHE_MINOR_VERSION 0
|
|
|
|
#define RCACHE_RELEASE_VERSION 0
|
|
|
|
|
2005-09-04 08:17:00 +04:00
|
|
|
/**
|
2008-07-29 02:40:57 +04:00
|
|
|
* Macro for use in components that are of type rcache
|
2005-09-04 08:17:00 +04:00
|
|
|
*/
|
2015-11-02 22:07:08 +03:00
|
|
|
#define MCA_RCACHE_BASE_VERSION_3_0_0 \
|
2015-12-18 19:04:15 +03:00
|
|
|
OPAL_MCA_BASE_VERSION_2_1_0("rcache", RCACHE_MAJOR_VERSION, RCACHE_MAJOR_VERSION, RCACHE_RELEASE_VERSION)
|
2005-09-04 08:17:00 +04:00
|
|
|
|
|
|
|
#endif /* MCA_RCACHE_H */
|
|
|
|
|