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

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

DEFINITIONS

This source file includes following definitions.
  1. mca_pml_cm_enable
  2. mca_pml_cm_add_comm
  3. mca_pml_cm_del_comm
  4. mca_pml_cm_add_procs
  5. mca_pml_cm_del_procs
  6. mca_pml_cm_dump

   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) 2011      Sandia National Laboratories. All rights reserved.
  12  * Copyright (c) 2015      Los Alamos National Security, LLC. All rights
  13  *                         reserved.
  14  * $COPYRIGHT$
  15  *
  16  * Additional copyrights may follow
  17  *
  18  * $HEADER$
  19  */
  20 
  21 #include "ompi_config.h"
  22 
  23 #include "ompi/communicator/communicator.h"
  24 #include "ompi/mca/pml/base/pml_base_request.h"
  25 #include "ompi/mca/pml/base/pml_base_bsend.h"
  26 #include "ompi/mca/pml/base/base.h"
  27 
  28 #include "pml_cm.h"
  29 #include "pml_cm_sendreq.h"
  30 #include "pml_cm_recvreq.h"
  31 
  32 ompi_pml_cm_t ompi_pml_cm = {
  33     {
  34         mca_pml_cm_add_procs,
  35         mca_pml_cm_del_procs,
  36         mca_pml_cm_enable,
  37         NULL, /* No progress function. The MTL register their own */
  38         mca_pml_cm_add_comm,
  39         mca_pml_cm_del_comm,
  40         mca_pml_cm_irecv_init,
  41         mca_pml_cm_irecv,
  42         mca_pml_cm_recv,
  43         mca_pml_cm_isend_init,
  44         mca_pml_cm_isend,
  45         mca_pml_cm_send,
  46         mca_pml_cm_iprobe,
  47         mca_pml_cm_probe,
  48         mca_pml_cm_start,
  49         mca_pml_cm_improbe,
  50         mca_pml_cm_mprobe,
  51         mca_pml_cm_imrecv,
  52         mca_pml_cm_mrecv,
  53         mca_pml_cm_dump,
  54         NULL,
  55         0,
  56         0
  57     }
  58 };
  59 
  60 
  61 int
  62 mca_pml_cm_enable(bool enable)
  63 {
  64     /* BWB - FIX ME - need to have this actually do something,
  65        maybe? */
  66     opal_free_list_init (&mca_pml_base_send_requests,
  67                          sizeof(mca_pml_cm_hvy_send_request_t) + ompi_mtl->mtl_request_size,
  68                          opal_cache_line_size,
  69                          OBJ_CLASS(mca_pml_cm_hvy_send_request_t),
  70                          0,opal_cache_line_size,
  71                          ompi_pml_cm.free_list_num,
  72                          ompi_pml_cm.free_list_max,
  73                          ompi_pml_cm.free_list_inc,
  74                          NULL, 0, NULL, NULL, NULL);
  75 
  76     opal_free_list_init (&mca_pml_base_recv_requests,
  77                          sizeof(mca_pml_cm_hvy_recv_request_t) + ompi_mtl->mtl_request_size,
  78                          opal_cache_line_size,
  79                          OBJ_CLASS(mca_pml_cm_hvy_recv_request_t),
  80                          0,opal_cache_line_size,
  81                          ompi_pml_cm.free_list_num,
  82                          ompi_pml_cm.free_list_max,
  83                          ompi_pml_cm.free_list_inc,
  84                          NULL, 0, NULL, NULL, NULL);
  85 
  86     return OMPI_SUCCESS;
  87 }
  88 
  89 
  90 int
  91 mca_pml_cm_add_comm(ompi_communicator_t* comm)
  92 {
  93     /* should never happen, but it was, so check */
  94     if (comm->c_contextid > ompi_pml_cm.super.pml_max_contextid) {
  95         return OMPI_ERR_OUT_OF_RESOURCE;
  96     }
  97 
  98     /* initialize per-communicator data. MTLs may override this. */
  99     comm->c_pml_comm = NULL;
 100 
 101     /* notify the MTL about the added communicator */
 102     return OMPI_MTL_CALL(add_comm(ompi_mtl, comm));
 103 }
 104 
 105 
 106 int
 107 mca_pml_cm_del_comm(ompi_communicator_t* comm)
 108 {
 109     /* notify the MTL about the deleted communicator */
 110     return OMPI_MTL_CALL(del_comm(ompi_mtl, comm));
 111 }
 112 
 113 
 114 int
 115 mca_pml_cm_add_procs(struct ompi_proc_t** procs, size_t nprocs)
 116 {
 117     int ret;
 118 
 119 #if OPAL_ENABLE_HETEROGENEOUS_SUPPORT
 120     for (size_t i = 0 ; i < nprocs ; ++i) {
 121         if (procs[i]->super.proc_arch != ompi_proc_local()->super.proc_arch) {
 122             return OMPI_ERR_NOT_SUPPORTED;
 123         }
 124     }
 125 #endif
 126 
 127     /* make sure remote procs are using the same PML as us */
 128     if (OMPI_SUCCESS != (ret = mca_pml_base_pml_check_selected("cm",
 129                                                               procs,
 130                                                               nprocs))) {
 131         return ret;
 132     }
 133 
 134     ret = OMPI_MTL_CALL(add_procs(ompi_mtl, nprocs, procs));
 135     return ret;
 136 }
 137 
 138 
 139 int
 140 mca_pml_cm_del_procs(struct ompi_proc_t** procs, size_t nprocs)
 141 {
 142     int ret;
 143 
 144     ret = OMPI_MTL_CALL(del_procs(ompi_mtl, nprocs, procs));
 145     return ret;
 146 }
 147 
 148 
 149 /* print any available useful information from this communicator */
 150 int
 151 mca_pml_cm_dump(struct ompi_communicator_t* comm, int verbose)
 152 {
 153     return OMPI_ERR_NOT_IMPLEMENTED;
 154 }

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