root/opal/mca/pmix/pmix4x/pmix/src/mca/common/dstore/dstore_base.h

/* [<][>][^][v][top][bottom][index][help] */

INCLUDED FROM


   1 /*
   2  * Copyright (c) 2015-2017 Intel, Inc. All rights reserved.
   3  * Copyright (c) 2017      Mellanox Technologies, Inc.
   4  *                         All rights reserved.
   5  * $COPYRIGHT$
   6  *
   7  * Additional copyrights may follow
   8  *
   9  * $HEADER$
  10  */
  11 
  12 #ifndef PMIX_DSTORE_H
  13 #define PMIX_DSTORE_H
  14 
  15 #include <src/include/pmix_config.h>
  16 
  17 
  18 #include "src/mca/gds/gds.h"
  19 #include "src/mca/pshmem/pshmem.h"
  20 
  21 BEGIN_C_DECLS
  22 
  23 #include <src/include/pmix_config.h>
  24 #include "src/class/pmix_value_array.h"
  25 #include "dstore_common.h"
  26 #include "dstore_segment.h"
  27 #include "dstore_file.h"
  28 
  29 #define INITIAL_SEG_SIZE 4096
  30 #define NS_META_SEG_SIZE (1<<22)
  31 #define NS_DATA_SEG_SIZE (1<<22)
  32 
  33 #define PMIX_DSTORE_ESH_BASE_PATH "PMIX_DSTORE_ESH_BASE_PATH"
  34 #define PMIX_DSTORE_VER_BASE_PATH_FMT "PMIX_DSTORE_%d_BASE_PATH"
  35 
  36 typedef struct ns_map_data_s ns_map_data_t;
  37 typedef struct session_s session_t;
  38 typedef struct ns_map_s ns_map_t;
  39 
  40 typedef ns_map_data_t * (*session_map_search_fn_t)(pmix_common_dstore_ctx_t *ds_ctx,
  41                                                    const char *nspace);
  42 
  43 struct pmix_common_dstore_ctx_s {
  44     char *ds_name;
  45     char *base_path;
  46     uid_t jobuid;
  47     char setjobuid;
  48 
  49     pmix_value_array_t *session_array;
  50     pmix_value_array_t *ns_map_array;
  51     pmix_value_array_t *ns_track_array;
  52 
  53     pmix_common_lock_callbacks_t *lock_cbs;
  54     pmix_common_dstore_file_cbs_t *file_cbs;
  55 
  56     size_t initial_segment_size;
  57     size_t meta_segment_size;
  58     size_t data_segment_size;
  59     size_t lock_segment_size;
  60 
  61     size_t max_ns_num;
  62     size_t max_meta_elems;
  63 
  64     session_map_search_fn_t session_map_search;
  65     pmix_peer_t *clients_peer;
  66     /* If _direct_mode is set, it means that we use linear search
  67      * along the array of rank meta info objects inside a meta segment
  68      * to find the requested rank. Otherwise,  we do a fast lookup
  69      * based on rank and directly compute offset.
  70      * This mode is called direct because it's effectively used in
  71      * sparse communication patterns when direct modex is usually used.
  72      */
  73     int direct_mode;
  74     /* dstore ctx protect lock, uses for clients only */
  75     pthread_mutex_t lock;
  76 };
  77 
  78 struct session_s {
  79     int in_use;
  80     uid_t jobuid;
  81     char setjobuid;
  82     char *nspace_path;
  83     pmix_dstore_seg_desc_t *sm_seg_first;
  84     pmix_dstore_seg_desc_t *sm_seg_last;   
  85     pmix_common_dstor_lock_ctx_t lock;
  86 };
  87 
  88 struct ns_map_data_s {
  89     char name[PMIX_MAX_NSLEN+1];
  90     size_t tbl_idx;
  91     int track_idx;
  92 };
  93 
  94 struct ns_map_s {
  95     int in_use;
  96     ns_map_data_t data;
  97 };
  98 
  99 /* initial segment format:
 100  * size_t num_elems;
 101  * size_t full; //indicate to client that it needs to attach to the next segment
 102  * ns_seg_info_t ns_seg_info[max_ns_num];
 103  */
 104 
 105 typedef struct {
 106     ns_map_data_t ns_map;
 107     size_t num_meta_seg;/* read by clients to attach to this number of segments. */
 108     size_t num_data_seg;
 109 } ns_seg_info_t;
 110 
 111 /* meta segment format:
 112  * size_t num_elems;
 113  * rank_meta_info meta_info[max_meta_elems];
 114  */
 115 
 116 typedef struct {
 117     size_t rank;
 118     size_t offset;
 119     size_t count;
 120 } rank_meta_info;
 121 
 122 typedef struct {
 123     pmix_value_array_t super;
 124     ns_map_data_t ns_map;
 125     size_t num_meta_seg;
 126     size_t num_data_seg;
 127     pmix_dstore_seg_desc_t *meta_seg;
 128     pmix_dstore_seg_desc_t *data_seg;
 129     bool in_use;
 130 } ns_track_elem_t;
 131 
 132 typedef struct {
 133     pmix_list_item_t super;
 134     pmix_common_dstor_lock_ctx_t *lock;
 135 } lock_track_item_t;
 136 
 137 END_C_DECLS
 138 
 139 #endif

/* [<][>][^][v][top][bottom][index][help] */