root/opal/mca/btl/smcuda/btl_smcuda_frag.h

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

INCLUDED FROM


   1 /* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
   2 /*
   3  * Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
   4  *                         University Research and Technology
   5  *                         Corporation.  All rights reserved.
   6  * Copyright (c) 2004-2013 The University of Tennessee and The University
   7  *                         of Tennessee Research Foundation.  All rights
   8  *                         reserved.
   9  * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
  10  *                         University of Stuttgart.  All rights reserved.
  11  * Copyright (c) 2004-2005 The Regents of the University of California.
  12  *                         All rights reserved.
  13  * Copyright (c) 2008      Sun Microsystems, Inc.  All rights reserved.
  14  * Copyright (c) 2009      Cisco Systems, Inc.  All rights reserved.
  15  * Copyright (c) 2012      NVIDIA Corporation.  All rights reserved.
  16  * Copyright (c) 2015      Los Alamos National Security, LLC. All rights
  17  *                         reserved.
  18  * $COPYRIGHT$
  19  *
  20  * Additional copyrights may follow
  21  *
  22  * $HEADER$
  23  */
  24 /**
  25  * @file
  26  */
  27 #ifndef MCA_BTL_SMCUDA_SEND_FRAG_H
  28 #define MCA_BTL_SMCUDA_SEND_FRAG_H
  29 
  30 #include "opal_config.h"
  31 #include "btl_smcuda.h"
  32 
  33 #if OPAL_CUDA_SUPPORT
  34 #include "opal/mca/common/cuda/common_cuda.h"
  35 #endif
  36 
  37 #define MCA_BTL_SMCUDA_FRAG_TYPE_MASK ((uintptr_t)0x3)
  38 #define MCA_BTL_SMCUDA_FRAG_SEND ((uintptr_t)0x0)
  39 #define MCA_BTL_SMCUDA_FRAG_ACK ((uintptr_t)0x1)
  40 #define MCA_BTL_SMCUDA_FRAG_PUT ((uintptr_t)0x2)
  41 #define MCA_BTL_SMCUDA_FRAG_GET ((uintptr_t)0x3)
  42 
  43 #define MCA_BTL_SMCUDA_FRAG_STATUS_MASK ((uintptr_t)0x4)
  44 
  45 struct mca_btl_smcuda_frag_t;
  46 
  47 struct mca_btl_smcuda_hdr_t {
  48     struct mca_btl_smcuda_frag_t *frag;
  49     size_t len;
  50     int my_smp_rank;
  51     mca_btl_base_tag_t tag;
  52 };
  53 typedef struct mca_btl_smcuda_hdr_t mca_btl_smcuda_hdr_t;
  54 
  55 #if OPAL_CUDA_SUPPORT
  56 struct mca_btl_base_registration_handle_t {
  57     mca_rcache_common_cuda_reg_data_t reg_data;
  58 };
  59 #endif
  60 
  61 struct mca_btl_smcuda_segment_t {
  62     mca_btl_base_segment_t base;
  63 #if OPAL_CUDA_SUPPORT
  64     uint8_t key[128]; /* 64 bytes for CUDA mem handle, 64 bytes for CUDA event handle */
  65     /** Address of the entire memory handle */
  66     opal_ptr_t memh_seg_addr;
  67      /** Length in bytes of entire memory handle */
  68     uint32_t memh_seg_len;
  69 #endif /* OPAL_CUDA_SUPPORT */
  70 };
  71 typedef struct mca_btl_smcuda_segment_t mca_btl_smcuda_segment_t;
  72 
  73 /**
  74  * shared memory send fragment derived type.
  75  */
  76 struct mca_btl_smcuda_frag_t {
  77     mca_btl_base_descriptor_t base;
  78     mca_btl_base_segment_t segment;
  79     struct mca_btl_base_endpoint_t *endpoint;
  80 #if OPAL_CUDA_SUPPORT
  81     struct mca_rcache_base_registration_t *registration;
  82     struct mca_btl_base_registration_handle_t *local_handle;
  83 #endif /* OPAL_CUDA_SUPPORT */
  84     size_t size;
  85     /* pointer written to the FIFO, this is the base of the shared memory region */
  86     mca_btl_smcuda_hdr_t *hdr;
  87     opal_free_list_t* my_list;
  88 };
  89 typedef struct mca_btl_smcuda_frag_t mca_btl_smcuda_frag_t;
  90 typedef struct mca_btl_smcuda_frag_t mca_btl_smcuda_frag1_t;
  91 typedef struct mca_btl_smcuda_frag_t mca_btl_smcuda_frag2_t;
  92 typedef struct mca_btl_smcuda_frag_t mca_btl_smcuda_user_t;
  93 
  94 
  95 OBJ_CLASS_DECLARATION(mca_btl_smcuda_frag_t);
  96 OBJ_CLASS_DECLARATION(mca_btl_smcuda_frag1_t);
  97 OBJ_CLASS_DECLARATION(mca_btl_smcuda_frag2_t);
  98 OBJ_CLASS_DECLARATION(mca_btl_smcuda_user_t);
  99 
 100 #define MCA_BTL_SMCUDA_FRAG_ALLOC_EAGER(frag)                           \
 101 {                                                                       \
 102     frag = (mca_btl_smcuda_frag_t *)                                    \
 103         opal_free_list_get (&mca_btl_smcuda_component.sm_frags_eager);  \
 104 }
 105 
 106 #define MCA_BTL_SMCUDA_FRAG_ALLOC_MAX(frag)                             \
 107 {                                                                       \
 108     frag = (mca_btl_smcuda_frag_t *)                                    \
 109         opal_free_list_get (&mca_btl_smcuda_component.sm_frags_max);    \
 110 }
 111 
 112 #define MCA_BTL_SMCUDA_FRAG_ALLOC_USER(frag)                            \
 113 {                                                                       \
 114     frag = (mca_btl_smcuda_frag_t *)                                    \
 115         opal_free_list_get (&mca_btl_smcuda_component.sm_frags_user);   \
 116 }
 117 
 118 #define MCA_BTL_SMCUDA_FRAG_RETURN(frag)                                \
 119 {                                                                       \
 120     opal_free_list_return (frag->my_list, (opal_free_list_item_t*)(frag)); \
 121 }
 122 #endif

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