2013-09-10 15:34:09 +00:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2013 Mellanox Technologies, Inc.
|
|
|
|
* All rights reserved.
|
|
|
|
* $COPYRIGHT$
|
|
|
|
*
|
|
|
|
* Additional copyrights may follow
|
|
|
|
*
|
|
|
|
* $HEADER$
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "oshmem_config.h"
|
|
|
|
#include "ompi/mca/bml/base/base.h"
|
|
|
|
#include "opal/datatype/opal_convertor.h"
|
|
|
|
#include "orte/include/orte/types.h"
|
|
|
|
#include "orte/runtime/orte_globals.h"
|
|
|
|
#include "oshmem/mca/spml/yoda/spml_yoda.h"
|
|
|
|
#include "oshmem/proc/proc.h"
|
|
|
|
#include "oshmem/mca/spml/base/base.h"
|
|
|
|
#include "oshmem/mca/spml/yoda/spml_yoda_putreq.h"
|
|
|
|
#include "oshmem/mca/spml/yoda/spml_yoda_getreq.h"
|
George did the work and deserves all the credit for it. Ralph did the merge, and deserves whatever blame results from errors in it :-)
WHAT: Open our low-level communication infrastructure by moving all necessary components (btl/rcache/allocator/mpool) down in OPAL
All the components required for inter-process communications are currently deeply integrated in the OMPI layer. Several groups/institutions have express interest in having a more generic communication infrastructure, without all the OMPI layer dependencies. This communication layer should be made available at a different software level, available to all layers in the Open MPI software stack. As an example, our ORTE layer could replace the current OOB and instead use the BTL directly, gaining access to more reactive network interfaces than TCP. Similarly, external software libraries could take advantage of our highly optimized AM (active message) communication layer for their own purpose. UTK with support from Sandia, developped a version of Open MPI where the entire communication infrastucture has been moved down to OPAL (btl/rcache/allocator/mpool). Most of the moved components have been updated to match the new schema, with few exceptions (mainly BTLs where I have no way of compiling/testing them). Thus, the completion of this RFC is tied to being able to completing this move for all BTLs. For this we need help from the rest of the Open MPI community, especially those supporting some of the BTLs. A non-exhaustive list of BTLs that qualify here is: mx, portals4, scif, udapl, ugni, usnic.
This commit was SVN r32317.
2014-07-26 00:47:28 +00:00
|
|
|
#include "opal/mca/btl/btl.h"
|
2013-09-10 15:34:09 +00:00
|
|
|
|
|
|
|
#define SPML_BASE_DO_CMP(res, addr, op, val) \
|
|
|
|
switch((op)) { \
|
|
|
|
case SHMEM_CMP_EQ: \
|
|
|
|
res = *(addr) == (val) ? 1 : 0; \
|
|
|
|
break; \
|
|
|
|
case SHMEM_CMP_NE: \
|
|
|
|
res = *(addr) != (val) ? 1 : 0; \
|
|
|
|
break; \
|
|
|
|
case SHMEM_CMP_GT: \
|
|
|
|
res = *(addr) > (val) ? 1 : 0; \
|
|
|
|
break; \
|
|
|
|
case SHMEM_CMP_LE: \
|
|
|
|
res = *(addr) <= (val) ? 1 : 0; \
|
|
|
|
break; \
|
|
|
|
case SHMEM_CMP_LT: \
|
|
|
|
res = *(addr) < (val) ? 1: 0; \
|
|
|
|
break; \
|
|
|
|
case SHMEM_CMP_GE: \
|
|
|
|
res = *(addr) >= (val) ? 1 : 0; \
|
|
|
|
break; \
|
|
|
|
}
|
|
|
|
|
|
|
|
#define SPML_BASE_DO_WAIT(cond, val, addr, op) \
|
|
|
|
do { \
|
|
|
|
SPML_BASE_DO_CMP(cond, val,addr,op); \
|
|
|
|
opal_progress(); \
|
|
|
|
} while (cond == 0) ;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Wait for data delivery.
|
|
|
|
* Pool on a variable given in addr until it is not equal to value.
|
|
|
|
*/
|
|
|
|
int mca_spml_base_wait(void* addr, int cmp, void* value, int datatype)
|
|
|
|
{
|
|
|
|
int *int_addr, int_value;
|
|
|
|
long *long_addr, long_value;
|
|
|
|
short *short_addr, short_value;
|
|
|
|
long long *longlong_addr, longlong_value;
|
2014-04-30 12:03:23 +00:00
|
|
|
int32_t *int32_addr, int32_value;
|
|
|
|
int64_t *int64_addr, int64_value;
|
2013-09-10 15:34:09 +00:00
|
|
|
ompi_fortran_integer_t *fint_addr, fint_value;
|
|
|
|
ompi_fortran_integer4_t *fint4_addr, fint4_value;
|
|
|
|
ompi_fortran_integer8_t *fint8_addr, fint8_value;
|
|
|
|
int res = 0;
|
|
|
|
|
|
|
|
switch (datatype) {
|
|
|
|
|
|
|
|
/* Int */
|
|
|
|
case SHMEM_INT:
|
|
|
|
int_value = *(int*) value;
|
|
|
|
int_addr = (int*) addr;
|
|
|
|
SPML_BASE_DO_WAIT(res, int_addr, cmp, int_value);
|
|
|
|
break;
|
|
|
|
|
|
|
|
/* Short */
|
|
|
|
case SHMEM_SHORT:
|
|
|
|
short_value = *(short*) value;
|
|
|
|
short_addr = (short*) addr;
|
|
|
|
SPML_BASE_DO_WAIT(res, short_addr, cmp, short_value);
|
|
|
|
break;
|
|
|
|
|
|
|
|
/* Long */
|
|
|
|
case SHMEM_LONG:
|
|
|
|
long_value = *(long*) value;
|
|
|
|
long_addr = (long*) addr;
|
|
|
|
SPML_BASE_DO_WAIT(res, long_addr, cmp, long_value);
|
|
|
|
break;
|
|
|
|
|
|
|
|
/* Long-Long */
|
|
|
|
case SHMEM_LLONG:
|
|
|
|
longlong_value = *(long long*) value;
|
|
|
|
longlong_addr = (long long*) addr;
|
|
|
|
SPML_BASE_DO_WAIT(res, longlong_addr, cmp, longlong_value);
|
|
|
|
break;
|
|
|
|
|
2014-04-30 12:03:23 +00:00
|
|
|
/* Int32_t */
|
|
|
|
case SHMEM_INT32_T:
|
|
|
|
int32_value = *(int32_t*) value;
|
|
|
|
int32_addr = (int32_t*) addr;
|
|
|
|
SPML_BASE_DO_WAIT(res, int32_addr, cmp, int32_value);
|
|
|
|
break;
|
|
|
|
|
|
|
|
/* Int64_t */
|
|
|
|
case SHMEM_INT64_T:
|
|
|
|
int64_value = *(int64_t*) value;
|
|
|
|
int64_addr = (int64_t*) addr;
|
|
|
|
SPML_BASE_DO_WAIT(res, int64_addr, cmp, int64_value);
|
|
|
|
break;
|
|
|
|
|
2013-09-10 15:34:09 +00:00
|
|
|
/*C equivalent of Fortran integer type */
|
|
|
|
case SHMEM_FINT:
|
|
|
|
fint_value = *(ompi_fortran_integer_t *) value;
|
|
|
|
fint_addr = (ompi_fortran_integer_t *) addr;
|
|
|
|
SPML_BASE_DO_WAIT(res, fint_addr, cmp, fint_value);
|
|
|
|
break;
|
|
|
|
|
|
|
|
/*C equivalent of Fortran int4 type*/
|
|
|
|
case SHMEM_FINT4:
|
|
|
|
fint4_value = *(ompi_fortran_integer4_t *) value;
|
|
|
|
fint4_addr = (ompi_fortran_integer4_t *) addr;
|
|
|
|
SPML_BASE_DO_WAIT(res, fint4_addr, cmp, fint4_value);
|
|
|
|
break;
|
|
|
|
|
|
|
|
/*C equivalent of Fortran int8 type*/
|
|
|
|
case SHMEM_FINT8:
|
|
|
|
fint8_value = *(ompi_fortran_integer8_t *) value;
|
|
|
|
fint8_addr = (ompi_fortran_integer8_t *) addr;
|
|
|
|
SPML_BASE_DO_WAIT(res, fint8_addr, cmp, fint8_value);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return OSHMEM_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Waits for completion of a non-blocking put or get issued by the calling PE.
|
|
|
|
* This function waits for completion of a single non-blocking transfer issued by
|
|
|
|
* shmem_put_nb() or shmem_get_nb() (or related functions) when called with the
|
|
|
|
* address of a completion handle.
|
|
|
|
* Completion of the call to shmem_wait_nb() ensures that a non-blocking transfer has
|
|
|
|
* completed. The source buffer may then be reused.
|
|
|
|
*/
|
|
|
|
int mca_spml_base_wait_nb(void* handle)
|
|
|
|
{
|
2015-06-23 20:59:57 -07:00
|
|
|
/* TODO fence is a gag for more accurate code
|
2013-09-10 15:34:09 +00:00
|
|
|
* Use shmem_quiet() (or a function calling shmem_quiet()) or
|
|
|
|
* shmem_wait_nb() to force completion of transfers for non-blocking operations.
|
|
|
|
*/
|
|
|
|
MCA_SPML_CALL(fence());
|
|
|
|
|
|
|
|
return OSHMEM_SUCCESS;
|
|
|
|
}
|
|
|
|
|
2014-02-26 16:32:23 +00:00
|
|
|
int mca_spml_base_oob_get_mkeys(int pe, uint32_t seg, sshmem_mkey_t *mkeys)
|
2013-09-10 15:34:09 +00:00
|
|
|
{
|
|
|
|
return OSHMEM_ERROR;
|
|
|
|
}
|
|
|
|
|