root/ompi/mca/pml/cm/pml_cm_component.c

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

DEFINITIONS

This source file includes following definitions.
  1. mca_pml_cm_component_register
  2. mca_pml_cm_component_open
  3. mca_pml_cm_component_close
  4. mca_pml_cm_component_init
  5. mca_pml_cm_component_fini

   1 /* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
   2 /*
   3  * Copyright (c) 2006-2007 The Trustees of Indiana University and Indiana
   4  *                         University Research and Technology
   5  *                         Corporation.  All rights reserved.
   6  * Copyright (c) 2004-2007 The University of Tennessee and The University
   7  *                         of Tennessee Research Foundation.  All rights
   8  *                         reserved.
   9  * Copyright (c) 2004-2006 The Regents of the University of California.
  10  *                         All rights reserved.
  11  * Copyright (c) 2010-2012 Cisco Systems, Inc.  All rights reserved.
  12  * Copyright (c) 2013      Sandia National Laboratories.  All rights reserved.
  13  * Copyright (c) 2015      Los Alamos National Security, LLC.  All rights
  14  *                         reserved.
  15  * $COPYRIGHT$
  16  *
  17  * Additional copyrights may follow
  18  *
  19  * $HEADER$
  20  */
  21 
  22 #include "ompi_config.h"
  23 
  24 #include "pml_cm.h"
  25 #include "opal/mca/event/event.h"
  26 #include "ompi/mca/mtl/mtl.h"
  27 #include "ompi/mca/mtl/base/base.h"
  28 #include "ompi/mca/pml/base/pml_base_bsend.h"
  29 
  30 #include "pml_cm_sendreq.h"
  31 #include "pml_cm_recvreq.h"
  32 #include "pml_cm_component.h"
  33 
  34 static int mca_pml_cm_component_register(void);
  35 static int mca_pml_cm_component_open(void);
  36 static int mca_pml_cm_component_close(void);
  37 static mca_pml_base_module_t* mca_pml_cm_component_init( int* priority,
  38                             bool enable_progress_threads, bool enable_mpi_threads);
  39 static int mca_pml_cm_component_fini(void);
  40 
  41 mca_pml_base_component_2_0_0_t mca_pml_cm_component = {
  42     /* First, the mca_base_component_t struct containing meta
  43      * information about the component itself */
  44 
  45     .pmlm_version = {
  46         MCA_PML_BASE_VERSION_2_0_0,
  47 
  48         .mca_component_name = "cm",
  49         MCA_BASE_MAKE_VERSION(component, OMPI_MAJOR_VERSION, OMPI_MINOR_VERSION,
  50                               OMPI_RELEASE_VERSION),
  51         .mca_open_component = mca_pml_cm_component_open,
  52         .mca_close_component = mca_pml_cm_component_close,
  53         .mca_register_component_params = mca_pml_cm_component_register,
  54     },
  55     .pmlm_data = {
  56         /* This component is not checkpoint ready */
  57         MCA_BASE_METADATA_PARAM_NONE
  58     },
  59 
  60     .pmlm_init = mca_pml_cm_component_init,
  61     .pmlm_finalize = mca_pml_cm_component_fini,
  62 };
  63 
  64 /* Array of send completion callback - one per send type
  65  * These are called internally by the library when the send
  66  * is completed from its perspective.
  67  */
  68 void (*send_completion_callbacks[MCA_PML_BASE_SEND_SIZE])
  69     (struct mca_mtl_request_t *mtl_request) =
  70   { mca_pml_cm_send_request_completion,
  71     mca_pml_cm_send_request_completion,
  72     mca_pml_cm_send_request_completion,
  73     mca_pml_cm_send_request_completion,
  74     mca_pml_cm_send_request_completion } ;
  75 
  76 static int
  77 mca_pml_cm_component_register(void)
  78 {
  79 
  80     ompi_pml_cm.free_list_num = 4;
  81     (void) mca_base_component_var_register(&mca_pml_cm_component.pmlm_version, "free_list_num",
  82                                            "Initial size of request free lists",
  83                                            MCA_BASE_VAR_TYPE_INT, NULL, 0, 0,
  84                                            OPAL_INFO_LVL_9,
  85                                            MCA_BASE_VAR_SCOPE_READONLY,
  86                                            &ompi_pml_cm.free_list_num);
  87 
  88     ompi_pml_cm.free_list_max = -1;
  89     (void) mca_base_component_var_register(&mca_pml_cm_component.pmlm_version, "free_list_max",
  90                                            "Maximum size of request free lists",
  91                                            MCA_BASE_VAR_TYPE_INT, NULL, 0, 0,
  92                                            OPAL_INFO_LVL_9,
  93                                            MCA_BASE_VAR_SCOPE_READONLY,
  94                                            &ompi_pml_cm.free_list_max);
  95 
  96     ompi_pml_cm.free_list_inc = 64;
  97     (void) mca_base_component_var_register(&mca_pml_cm_component.pmlm_version, "free_list_inc",
  98                                            "Number of elements to add when growing request free lists",
  99                                            MCA_BASE_VAR_TYPE_INT, NULL, 0, 0,
 100                                            OPAL_INFO_LVL_9,
 101                                            MCA_BASE_VAR_SCOPE_READONLY,
 102                                            &ompi_pml_cm.free_list_inc);
 103 
 104     return OPAL_SUCCESS;
 105 }
 106 
 107 static int
 108 mca_pml_cm_component_open(void)
 109 {
 110     int ret;
 111 
 112     ret = mca_base_framework_open(&ompi_mtl_base_framework, 0);
 113     if (OMPI_SUCCESS == ret) {
 114       /* If no MTL components initialized CM component can be unloaded */
 115       if (0 == opal_list_get_size(&ompi_mtl_base_framework.framework_components)) {
 116         ret = OPAL_ERR_NOT_AVAILABLE;
 117       }
 118     }
 119 
 120     return ret;
 121 }
 122 
 123 
 124 static int
 125 mca_pml_cm_component_close(void)
 126 {
 127     return mca_base_framework_close(&ompi_mtl_base_framework);
 128 }
 129 
 130 
 131 static mca_pml_base_module_t*
 132 mca_pml_cm_component_init(int* priority,
 133                           bool enable_progress_threads,
 134                           bool enable_mpi_threads)
 135 {
 136     int ret;
 137 
 138     *priority = -1;
 139 
 140     opal_output_verbose( 10, 0,
 141                          "in cm pml priority is %d\n", *priority);
 142     /* find a useable MTL */
 143     ret = ompi_mtl_base_select(enable_progress_threads, enable_mpi_threads, priority);
 144     if (OMPI_SUCCESS != ret) {
 145         return NULL;
 146     }
 147 
 148     if (ompi_mtl->mtl_flags & MCA_MTL_BASE_FLAG_REQUIRE_WORLD) {
 149         ompi_pml_cm.super.pml_flags |= MCA_PML_BASE_FLAG_REQUIRE_WORLD;
 150     }
 151 
 152     /* update our tag / context id max values based on MTL
 153        information */
 154     ompi_pml_cm.super.pml_max_contextid = ompi_mtl->mtl_max_contextid;
 155     ompi_pml_cm.super.pml_max_tag = ompi_mtl->mtl_max_tag;
 156 
 157     return &ompi_pml_cm.super;
 158 }
 159 
 160 
 161 static int
 162 mca_pml_cm_component_fini(void)
 163 {
 164     if (NULL != ompi_mtl) {
 165         return OMPI_MTL_CALL(finalize(ompi_mtl));
 166     }
 167 
 168     return OMPI_SUCCESS;
 169 }
 170 

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