2013-07-02 19:23:55 +04:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2013 Sandia National Laboratories. All rights reserved.
|
|
|
|
* $COPYRIGHT$
|
|
|
|
*
|
|
|
|
* Additional copyrights may follow
|
|
|
|
*
|
|
|
|
* $HEADER$
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef MCA_COLL_PORTALS4_EXPORT_H
|
|
|
|
#define MCA_COLL_PORTALS4_EXPORT_H
|
|
|
|
|
|
|
|
#include "ompi_config.h"
|
|
|
|
|
2013-07-03 01:42:10 +04:00
|
|
|
#include <portals4.h>
|
|
|
|
|
2013-07-02 19:23:55 +04:00
|
|
|
#include "mpi.h"
|
|
|
|
#include "opal/mca/mca.h"
|
|
|
|
#include "ompi/mca/coll/coll.h"
|
|
|
|
#include "ompi/request/request.h"
|
|
|
|
#include "ompi/communicator/communicator.h"
|
2013-07-03 01:42:10 +04:00
|
|
|
#include "ompi/mca/mtl/portals4/mtl_portals4_endpoint.h"
|
2013-07-02 19:23:55 +04:00
|
|
|
|
|
|
|
BEGIN_C_DECLS
|
|
|
|
|
2013-07-03 01:42:10 +04:00
|
|
|
|
|
|
|
struct mca_coll_portals4_component_t {
|
|
|
|
mca_coll_base_component_t super;
|
|
|
|
|
|
|
|
/** Network interface handle for matched interface */
|
|
|
|
ptl_handle_ni_t ni_h;
|
2013-07-03 21:29:02 +04:00
|
|
|
ptl_uid_t uid;
|
2013-07-03 01:42:10 +04:00
|
|
|
ptl_pt_index_t pt_idx;
|
|
|
|
ptl_pt_index_t finish_pt_idx;
|
|
|
|
ptl_handle_eq_t eq_h;
|
|
|
|
ptl_handle_me_t barrier_unex_me_h;
|
2013-07-03 02:07:27 +04:00
|
|
|
ptl_handle_me_t finish_me_h;
|
2013-07-09 01:27:37 +04:00
|
|
|
/** Send MD handle(s). Use ompi_coll_portals4_get_md() to get the right md */
|
2014-07-28 23:25:03 +04:00
|
|
|
#if OPAL_PORTALS4_MAX_MD_SIZE < OPAL_PORTALS4_MAX_VA_SIZE
|
2013-07-09 01:27:37 +04:00
|
|
|
ptl_handle_md_t *md_hs;
|
|
|
|
#else
|
2013-07-03 01:42:10 +04:00
|
|
|
ptl_handle_md_t md_h;
|
2013-07-09 01:27:37 +04:00
|
|
|
#endif
|
2013-07-03 01:42:10 +04:00
|
|
|
|
|
|
|
ompi_free_list_t requests; /* request free list for the i collectives */
|
|
|
|
};
|
|
|
|
typedef struct mca_coll_portals4_component_t mca_coll_portals4_component_t;
|
|
|
|
OMPI_MODULE_DECLSPEC extern mca_coll_portals4_component_t mca_coll_portals4_component;
|
2013-07-02 19:23:55 +04:00
|
|
|
|
|
|
|
struct mca_coll_portals4_module_t {
|
|
|
|
mca_coll_base_module_t super;
|
2013-07-03 01:42:10 +04:00
|
|
|
|
|
|
|
size_t barrier_count;
|
2013-07-02 19:23:55 +04:00
|
|
|
};
|
|
|
|
typedef struct mca_coll_portals4_module_t mca_coll_portals4_module_t;
|
|
|
|
OBJ_CLASS_DECLARATION(mca_coll_portals4_module_t);
|
|
|
|
|
2013-07-03 01:42:10 +04:00
|
|
|
struct ompi_coll_portals4_request_t;
|
|
|
|
|
|
|
|
/* match/ignore bit manipulation
|
|
|
|
*
|
|
|
|
* 01234567 0123 4 567 012 34567 01234567 01234567 01234567 01234567 01234567
|
|
|
|
* | | |
|
|
|
|
* context id |^| type | op count
|
|
|
|
* ||| |
|
|
|
|
* +- eager switch
|
|
|
|
*/
|
|
|
|
|
|
|
|
#define COLL_PORTALS4_CID_MASK 0xFFF0000000000000ULL
|
|
|
|
#define COLL_PORTALS4_OP_COUNT_MASK 0x00001FFFFFFFFFFFULL
|
|
|
|
|
|
|
|
#define COLL_PORTALS4_BARRIER 0x01
|
|
|
|
|
2013-07-09 01:27:37 +04:00
|
|
|
#define COLL_PORTALS4_SET_BITS(match_bits, contextid, eager, type, op_count) \
|
2013-07-03 01:42:10 +04:00
|
|
|
{ \
|
|
|
|
match_bits = contextid; \
|
|
|
|
match_bits = (match_bits << 1); \
|
|
|
|
match_bits |= (eager & 0x1); \
|
|
|
|
match_bits = (match_bits << 6); \
|
|
|
|
match_bits |= (type & 0x3F); \
|
|
|
|
match_bits = (match_bits << 45); \
|
|
|
|
match_bits |= (op_count & 0x1FFFFFFFFFFF); \
|
|
|
|
}
|
|
|
|
|
|
|
|
int ompi_coll_portals4_barrier_intra(struct ompi_communicator_t *comm,
|
|
|
|
mca_coll_base_module_t *module);
|
|
|
|
int ompi_coll_portals4_ibarrier_intra(struct ompi_communicator_t *comm,
|
|
|
|
ompi_request_t ** request,
|
|
|
|
mca_coll_base_module_t *module);
|
|
|
|
int ompi_coll_portals4_ibarrier_intra_fini(struct ompi_coll_portals4_request_t *request);
|
|
|
|
|
|
|
|
|
|
|
|
static inline ptl_process_t
|
|
|
|
ompi_coll_portals4_get_peer(struct ompi_communicator_t *comm, int rank)
|
|
|
|
{
|
|
|
|
ompi_proc_t *proc = ompi_comm_peer_lookup(comm, rank);
|
2013-08-30 20:54:55 +04:00
|
|
|
return *((ptl_process_t*) proc->proc_endpoints[OMPI_PROC_ENDPOINT_TAG_PORTALS4]);
|
2013-07-03 01:42:10 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
static inline int
|
|
|
|
ompi_coll_portals4_get_nchildren(int cube_dim, int hibit, int rank, int size)
|
|
|
|
{
|
|
|
|
int guess = cube_dim - (hibit + 1);
|
2013-11-06 19:21:09 +04:00
|
|
|
if ((rank | (1 << (cube_dim - 1))) >= size) guess--;
|
2013-07-03 01:42:10 +04:00
|
|
|
if (guess < 0) return 0;
|
|
|
|
return guess;
|
|
|
|
}
|
|
|
|
|
2013-07-09 01:27:37 +04:00
|
|
|
/*
|
|
|
|
* See note in mtl/portals4/mtl_portals4.h for why this exists.
|
|
|
|
*/
|
|
|
|
static inline void
|
|
|
|
ompi_coll_portals4_get_md(const void *ptr, ptl_handle_md_t *md_h, void **base_ptr)
|
|
|
|
{
|
2014-07-28 23:25:03 +04:00
|
|
|
#if OPAL_PORTALS4_MAX_MD_SIZE < OPAL_PORTALS4_MAX_VA_SIZE
|
|
|
|
int mask = (1ULL << (OPAL_PORTALS4_MAX_VA_SIZE - OPAL_PORTALS4_MAX_MD_SIZE + 1)) - 1;
|
|
|
|
int which = (((uintptr_t) ptr) >> (OPAL_PORTALS4_MAX_MD_SIZE - 1)) & mask;
|
2013-07-09 01:27:37 +04:00
|
|
|
*md_h = mca_coll_portals4_component.md_hs[which];
|
2014-07-28 23:25:03 +04:00
|
|
|
*base_ptr = (void*) (which * (1ULL << (OPAL_PORTALS4_MAX_MD_SIZE - 1)));
|
2013-07-09 01:27:37 +04:00
|
|
|
#else
|
|
|
|
*md_h = mca_coll_portals4_component.md_h;
|
|
|
|
*base_ptr = 0;
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static inline int
|
|
|
|
ompi_coll_portals4_get_num_mds(void)
|
|
|
|
{
|
2014-07-28 23:25:03 +04:00
|
|
|
#if OPAL_PORTALS4_MAX_MD_SIZE < OPAL_PORTALS4_MAX_VA_SIZE
|
|
|
|
return (1 << (OPAL_PORTALS4_MAX_VA_SIZE - OPAL_PORTALS4_MAX_MD_SIZE + 1));
|
2013-07-09 01:27:37 +04:00
|
|
|
#else
|
|
|
|
return 1;
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2013-07-03 01:42:10 +04:00
|
|
|
|
2013-07-02 19:23:55 +04:00
|
|
|
END_C_DECLS
|
|
|
|
|
|
|
|
#endif /* MCA_COLL_PORTALS4_EXPORT_H */
|