This source file includes following definitions.
- ompi_coll_base_sendrecv_actual
- ompi_mirror_perm
- ompi_rounddown
   1 
   2 
   3 
   4 
   5 
   6 
   7 
   8 
   9 
  10 
  11 
  12 
  13 
  14 
  15 
  16 
  17 
  18 
  19 
  20 
  21 #include "ompi_config.h"
  22 
  23 #include "mpi.h"
  24 #include "ompi/constants.h"
  25 #include "ompi/datatype/ompi_datatype.h"
  26 #include "ompi/communicator/communicator.h"
  27 #include "ompi/mca/coll/base/coll_tags.h"
  28 #include "ompi/mca/coll/base/coll_base_functions.h"
  29 #include "ompi/mca/pml/pml.h"
  30 #include "coll_base_util.h"
  31 
  32 int ompi_coll_base_sendrecv_actual( const void* sendbuf, size_t scount,
  33                                     ompi_datatype_t* sdatatype,
  34                                     int dest, int stag,
  35                                     void* recvbuf, size_t rcount,
  36                                     ompi_datatype_t* rdatatype,
  37                                     int source, int rtag,
  38                                     struct ompi_communicator_t* comm,
  39                                     ompi_status_public_t* status )
  40 
  41 { 
  42     int err, line = 0;
  43     size_t rtypesize, stypesize;
  44     ompi_request_t *req = MPI_REQUEST_NULL;
  45     ompi_status_public_t rstatus;
  46 
  47     
  48     ompi_datatype_type_size(rdatatype, &rtypesize);
  49     err = MCA_PML_CALL(irecv( recvbuf, rcount, rdatatype, source, rtag,
  50                               comm, &req));
  51     if (err != MPI_SUCCESS) { line = __LINE__; goto error_handler; }
  52 
  53     
  54     ompi_datatype_type_size(sdatatype, &stypesize);
  55     err = MCA_PML_CALL(send( sendbuf, scount, sdatatype, dest, stag,
  56                              MCA_PML_BASE_SEND_STANDARD, comm));
  57     if (err != MPI_SUCCESS) { line = __LINE__; goto error_handler; }
  58 
  59     err = ompi_request_wait( &req, &rstatus);
  60     if (err != MPI_SUCCESS) { line = __LINE__; goto error_handler; }
  61 
  62     if (MPI_STATUS_IGNORE != status) {
  63         *status = rstatus;
  64     }
  65 
  66     return (MPI_SUCCESS);
  67 
  68  error_handler:
  69     
  70 
  71 
  72     OPAL_OUTPUT ((ompi_coll_base_framework.framework_output, "%s:%d: Error %d occurred\n",
  73                   __FILE__, line, err));
  74     (void)line;  
  75     if (MPI_STATUS_IGNORE != status) {
  76         status->MPI_ERROR = err;
  77     }
  78     return (err);
  79 }
  80 
  81 
  82 
  83 
  84 
  85 
  86 
  87 unsigned int ompi_mirror_perm(unsigned int x, int nbits)
  88 {
  89     x = (((x & 0xaaaaaaaa) >> 1) | ((x & 0x55555555) << 1));
  90     x = (((x & 0xcccccccc) >> 2) | ((x & 0x33333333) << 2));
  91     x = (((x & 0xf0f0f0f0) >> 4) | ((x & 0x0f0f0f0f) << 4));
  92     x = (((x & 0xff00ff00) >> 8) | ((x & 0x00ff00ff) << 8));
  93     x = ((x >> 16) | (x << 16));
  94     return x >> (sizeof(x) * CHAR_BIT - nbits);
  95 }
  96 
  97 
  98 
  99 
 100 
 101 int ompi_rounddown(int num, int factor)
 102 {
 103     num /= factor;
 104     return num * factor;    
 105 }