2013-09-10 19:34:09 +04:00
|
|
|
/*
|
2016-03-15 19:21:39 +03:00
|
|
|
* Copyright (c) 2013-2016 Mellanox Technologies, Inc.
|
2015-06-24 06:59:57 +03:00
|
|
|
* All rights reserved.
|
2013-09-10 19:34:09 +04:00
|
|
|
* $COPYRIGHT$
|
2015-06-24 06:59:57 +03:00
|
|
|
*
|
2013-09-10 19:34:09 +04:00
|
|
|
* Additional copyrights may follow
|
2015-06-24 06:59:57 +03:00
|
|
|
*
|
2013-09-10 19:34:09 +04:00
|
|
|
* $HEADER$
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef MCA_SCOLL_BASIC_H
|
|
|
|
#define MCA_SCOLL_BASIC_H
|
|
|
|
|
|
|
|
#include "oshmem_config.h"
|
|
|
|
|
2015-03-06 06:50:44 +03:00
|
|
|
#include "oshmem/mca/mca.h"
|
2013-09-10 19:34:09 +04:00
|
|
|
#include "oshmem/mca/scoll/scoll.h"
|
2014-01-28 11:30:36 +04:00
|
|
|
#include "oshmem/util/oshmem_util.h"
|
2013-09-10 19:34:09 +04:00
|
|
|
|
|
|
|
BEGIN_C_DECLS
|
|
|
|
|
2014-02-18 19:07:03 +04:00
|
|
|
/* These functions (BARRIER_FUNC, BCAST_FUNC) may be called from any basic algorithm.
|
|
|
|
* In case of shmem, the implementation of broadcast doesn't require
|
|
|
|
* each process to know message size ( just root should know).
|
|
|
|
* It differs from other implementations, so it may cause problems if
|
|
|
|
* BCAST_FUNC is a callback to another implementation (e.g, fca, hcoll).
|
|
|
|
* So we replace a callback (group->g_scoll.scoll_[func])
|
|
|
|
* with a corresponding basic function. */
|
|
|
|
|
|
|
|
#define BARRIER_FUNC mca_scoll_basic_barrier
|
|
|
|
#define BCAST_FUNC mca_scoll_basic_broadcast
|
|
|
|
|
2013-09-10 19:34:09 +04:00
|
|
|
/* Globally exported variables */
|
|
|
|
|
|
|
|
OSHMEM_MODULE_DECLSPEC extern mca_scoll_base_component_1_0_0_t
|
|
|
|
mca_scoll_basic_component;
|
|
|
|
|
|
|
|
extern int mca_scoll_basic_priority_param;
|
|
|
|
OSHMEM_DECLSPEC extern int mca_scoll_basic_param_barrier_algorithm;
|
|
|
|
extern int mca_scoll_basic_param_broadcast_algorithm;
|
|
|
|
extern int mca_scoll_basic_param_collect_algorithm;
|
|
|
|
extern int mca_scoll_basic_param_reduce_algorithm;
|
|
|
|
|
|
|
|
/* API functions */
|
|
|
|
|
|
|
|
int mca_scoll_basic_init(bool enable_progress_threads, bool enable_threads);
|
|
|
|
mca_scoll_base_module_t*
|
|
|
|
mca_scoll_basic_query(struct oshmem_group_t *group, int *priority);
|
|
|
|
|
|
|
|
enum {
|
|
|
|
SHMEM_SYNC_INIT = _SHMEM_SYNC_VALUE,
|
|
|
|
SHMEM_SYNC_WAIT = -2,
|
|
|
|
SHMEM_SYNC_RUN = -3,
|
|
|
|
SHMEM_SYNC_READY = -4,
|
|
|
|
};
|
|
|
|
|
|
|
|
int mca_scoll_basic_barrier(struct oshmem_group_t *group, long *pSync, int alg);
|
|
|
|
int mca_scoll_basic_broadcast(struct oshmem_group_t *group,
|
|
|
|
int PE_root,
|
|
|
|
void *target,
|
|
|
|
const void *source,
|
|
|
|
size_t nlong,
|
|
|
|
long *pSync,
|
|
|
|
int alg);
|
|
|
|
int mca_scoll_basic_collect(struct oshmem_group_t *group,
|
|
|
|
void *target,
|
|
|
|
const void *source,
|
|
|
|
size_t nlong,
|
|
|
|
long *pSync,
|
|
|
|
bool nlong_type,
|
|
|
|
int alg);
|
|
|
|
int mca_scoll_basic_reduce(struct oshmem_group_t *group,
|
|
|
|
struct oshmem_op_t *op,
|
|
|
|
void *target,
|
|
|
|
const void *source,
|
|
|
|
size_t nlong,
|
|
|
|
long *pSync,
|
|
|
|
void *pWrk,
|
|
|
|
int alg);
|
2016-03-15 19:21:39 +03:00
|
|
|
int mca_scoll_basic_alltoall(struct oshmem_group_t *group,
|
|
|
|
void *target,
|
|
|
|
const void *source,
|
|
|
|
ptrdiff_t dst, ptrdiff_t sst,
|
2016-03-18 13:43:55 +03:00
|
|
|
size_t nelems,
|
|
|
|
size_t element_size,
|
2016-03-15 19:21:39 +03:00
|
|
|
long *pSync,
|
|
|
|
int alg);
|
2013-09-10 19:34:09 +04:00
|
|
|
|
|
|
|
static inline unsigned int scoll_log2(unsigned long val)
|
|
|
|
{
|
|
|
|
unsigned int count = 0;
|
|
|
|
|
|
|
|
while (val > 0) {
|
|
|
|
val = val >> 1;
|
|
|
|
count++;
|
|
|
|
}
|
|
|
|
|
|
|
|
return count > 0 ? count - 1 : 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
struct mca_scoll_basic_module_t {
|
|
|
|
mca_scoll_base_module_t super;
|
|
|
|
};
|
|
|
|
typedef struct mca_scoll_basic_module_t mca_scoll_basic_module_t;
|
|
|
|
OBJ_CLASS_DECLARATION(mca_scoll_basic_module_t);
|
|
|
|
|
|
|
|
END_C_DECLS
|
|
|
|
|
|
|
|
#endif /* MCA_SCOLL_BASIC_H */
|