Implement barrier
This commit was SVN r1074.
Этот коммит содержится в:
родитель
5e5655e778
Коммит
cc569843f6
@ -6,7 +6,10 @@
|
|||||||
#include "coll_basic.h"
|
#include "coll_basic.h"
|
||||||
|
|
||||||
#include "constants.h"
|
#include "constants.h"
|
||||||
|
#include "communicator/communicator.h"
|
||||||
|
#include "util/hibit.h"
|
||||||
#include "mpi.h"
|
#include "mpi.h"
|
||||||
|
#include "mca/pml/pml.h"
|
||||||
#include "mca/coll/coll.h"
|
#include "mca/coll/coll.h"
|
||||||
#include "mca/coll/base/coll_tags.h"
|
#include "mca/coll/base/coll_tags.h"
|
||||||
#include "coll_basic.h"
|
#include "coll_basic.h"
|
||||||
@ -21,71 +24,51 @@
|
|||||||
*/
|
*/
|
||||||
int mca_coll_basic_barrier_lin(MPI_Comm comm)
|
int mca_coll_basic_barrier_lin(MPI_Comm comm)
|
||||||
{
|
{
|
||||||
#if 1
|
|
||||||
return LAM_ERR_NOT_IMPLEMENTED;
|
|
||||||
#else
|
|
||||||
int size;
|
|
||||||
int rank;
|
|
||||||
int err;
|
|
||||||
int i;
|
int i;
|
||||||
|
int err;
|
||||||
MPI_Comm_size(comm, &size);
|
int size = lam_comm_size(comm);
|
||||||
MPI_Comm_rank(comm, &rank);
|
int rank = lam_comm_rank(comm);
|
||||||
|
|
||||||
/* All non-root send & receive zero-length message. */
|
/* All non-root send & receive zero-length message. */
|
||||||
|
|
||||||
if (rank > 0) {
|
if (rank > 0) {
|
||||||
#if 0
|
err = mca_pml.pml_send(NULL, 0, MPI_BYTE, 0, MCA_COLL_BASE_TAG_BARRIER,
|
||||||
/* JMS: Need to replace this with negative tags and and direct PML
|
MCA_PML_BASE_SEND_STANDARD, comm);
|
||||||
calls */
|
|
||||||
err = MPI_Send((void *) 0, 0, MPI_BYTE, 0, BLKMPIBARRIER, comm);
|
|
||||||
if (MPI_SUCCESS != err) {
|
if (MPI_SUCCESS != err) {
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
#if 0
|
err = mca_pml.pml_recv(NULL, 0, MPI_BYTE, 0, MCA_COLL_BASE_TAG_BARRIER,
|
||||||
/* JMS: Need to replace this with negative tags and and direct PML
|
comm, MPI_STATUS_IGNORE);
|
||||||
calls */
|
|
||||||
err = MPI_Recv((void *) 0, 0, MPI_BYTE, 0, BLKMPIBARRIER, comm,
|
|
||||||
MPI_STATUS_IGNORE);
|
|
||||||
if (MPI_SUCCESS != err) {
|
if (MPI_SUCCESS != err) {
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* The root collects and broadcasts the messages. */
|
/* The root collects and broadcasts the messages. */
|
||||||
|
|
||||||
else {
|
else {
|
||||||
for (i = 1; i < size; ++i) {
|
for (i = 1; i < size; ++i) {
|
||||||
#if 0
|
err = mca_pml.pml_recv(NULL, 0, MPI_BYTE, MPI_ANY_SOURCE,
|
||||||
/* JMS: Need to replace this with negative tags and and direct PML
|
MCA_COLL_BASE_TAG_BARRIER,
|
||||||
calls */
|
comm, MPI_STATUS_IGNORE);
|
||||||
err = MPI_Recv((void *) 0, 0, MPI_BYTE, MPI_ANY_SOURCE,
|
|
||||||
BLKMPIBARRIER, comm, MPI_STATUS_IGNORE);
|
|
||||||
if (MPI_SUCCESS != err) {
|
if (MPI_SUCCESS != err) {
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 1; i < size; ++i) {
|
for (i = 1; i < size; ++i) {
|
||||||
#if 0
|
err = mca_pml.pml_send(NULL, 0, MPI_BYTE, i, MCA_COLL_BASE_TAG_BARRIER,
|
||||||
/* JMS: Need to replace this with negative tags and and direct PML
|
MCA_PML_BASE_SEND_STANDARD, comm);
|
||||||
calls */
|
|
||||||
err = MPI_Send((void *) 0, 0, MPI_BYTE, i, BLKMPIBARRIER, comm);
|
|
||||||
if (MPI_SUCCESS != err) {
|
if (MPI_SUCCESS != err) {
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* All done */
|
/* All done */
|
||||||
|
|
||||||
return MPI_SUCCESS;
|
return MPI_SUCCESS;
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -99,28 +82,20 @@ int mca_coll_basic_barrier_lin(MPI_Comm comm)
|
|||||||
int
|
int
|
||||||
mca_coll_basic_barrier_log(MPI_Comm comm)
|
mca_coll_basic_barrier_log(MPI_Comm comm)
|
||||||
{
|
{
|
||||||
#if 1
|
int i;
|
||||||
return LAM_ERR_NOT_IMPLEMENTED;
|
int err;
|
||||||
#else
|
|
||||||
int size;
|
|
||||||
int rank;
|
|
||||||
int peer;
|
int peer;
|
||||||
int dim;
|
int dim;
|
||||||
int hibit;
|
int hibit;
|
||||||
int mask;
|
int mask;
|
||||||
int err;
|
int size = lam_comm_size(comm);
|
||||||
int i;
|
int rank = lam_comm_rank(comm);
|
||||||
|
|
||||||
/* Send null-messages up and down the tree. Synchronization at the
|
/* Send null-messages up and down the tree. Synchronization at the
|
||||||
root (rank 0). */
|
root (rank 0). */
|
||||||
|
|
||||||
MPI_Comm_rank(comm, &rank);
|
|
||||||
MPI_Comm_size(comm, &size);
|
|
||||||
#if 0
|
|
||||||
/* JMS Need to cache this info somewhere */
|
|
||||||
dim = comm->c_cube_dim;
|
dim = comm->c_cube_dim;
|
||||||
hibit = lam_hibit(rank, dim);
|
hibit = lam_hibit(rank, dim);
|
||||||
#endif
|
|
||||||
--dim;
|
--dim;
|
||||||
|
|
||||||
/* Receive from children. */
|
/* Receive from children. */
|
||||||
@ -128,15 +103,12 @@ mca_coll_basic_barrier_log(MPI_Comm comm)
|
|||||||
for (i = dim, mask = 1 << i; i > hibit; --i, mask >>= 1) {
|
for (i = dim, mask = 1 << i; i > hibit; --i, mask >>= 1) {
|
||||||
peer = rank | mask;
|
peer = rank | mask;
|
||||||
if (peer < size) {
|
if (peer < size) {
|
||||||
#if 0
|
err = mca_pml.pml_recv(NULL, 0, MPI_BYTE, peer,
|
||||||
/* JMS: Need to replace this with negative tags and and direct PML
|
MCA_COLL_BASE_TAG_BARRIER,
|
||||||
calls */
|
comm, MPI_STATUS_IGNORE);
|
||||||
err = MPI_Recv((void *) 0, 0, MPI_BYTE,
|
|
||||||
peer, BLKMPIBARRIER, comm, MPI_STATUS_IGNORE);
|
|
||||||
if (MPI_SUCCESS != err) {
|
if (MPI_SUCCESS != err) {
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -144,24 +116,15 @@ mca_coll_basic_barrier_log(MPI_Comm comm)
|
|||||||
|
|
||||||
if (rank > 0) {
|
if (rank > 0) {
|
||||||
peer = rank & ~(1 << hibit);
|
peer = rank & ~(1 << hibit);
|
||||||
#if 0
|
err = mca_pml.pml_send(NULL, 0, MPI_BYTE, peer, MCA_COLL_BASE_TAG_BARRIER,
|
||||||
/* JMS: Need to replace this with negative tags and and direct PML
|
MCA_PML_BASE_SEND_STANDARD, comm);
|
||||||
calls */
|
|
||||||
err = MPI_Send((void *) 0, 0, MPI_BYTE, peer, BLKMPIBARRIER, comm);
|
|
||||||
if (MPI_SUCCESS != err) {
|
if (MPI_SUCCESS != err) {
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
#if 0
|
err = mca_pml.pml_recv(NULL, 0, MPI_BYTE, peer,
|
||||||
/* JMS: Need to replace this with negative tags and and direct PML
|
MCA_COLL_BASE_TAG_BARRIER,
|
||||||
calls */
|
comm, MPI_STATUS_IGNORE);
|
||||||
err = MPI_Recv((void *) 0, 0, MPI_BYTE, peer,
|
|
||||||
BLKMPIBARRIER, comm, MPI_STATUS_IGNORE);
|
|
||||||
if (MPI_SUCCESS != err) {
|
|
||||||
return err;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Send to children. */
|
/* Send to children. */
|
||||||
@ -169,19 +132,16 @@ mca_coll_basic_barrier_log(MPI_Comm comm)
|
|||||||
for (i = hibit + 1, mask = 1 << i; i <= dim; ++i, mask <<= 1) {
|
for (i = hibit + 1, mask = 1 << i; i <= dim; ++i, mask <<= 1) {
|
||||||
peer = rank | mask;
|
peer = rank | mask;
|
||||||
if (peer < size) {
|
if (peer < size) {
|
||||||
#if 0
|
err = mca_pml.pml_send(NULL, 0, MPI_BYTE, peer,
|
||||||
/* JMS: Need to replace this with negative tags and and direct PML
|
MCA_COLL_BASE_TAG_BARRIER,
|
||||||
calls */
|
MCA_PML_BASE_SEND_STANDARD, comm);
|
||||||
err = MPI_Send((void *) 0, 0, MPI_BYTE, peer, BLKMPIBARRIER, comm);
|
|
||||||
if (MPI_SUCCESS != err) {
|
if (MPI_SUCCESS != err) {
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* All done */
|
/* All done */
|
||||||
|
|
||||||
return MPI_SUCCESS;
|
return MPI_SUCCESS;
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user