2004-11-22 00:37:56 +00:00
|
|
|
/*
|
2004-11-22 01:38:40 +00:00
|
|
|
* Copyright (c) 2004-2005 The Trustees of Indiana University.
|
|
|
|
* All rights reserved.
|
|
|
|
* Copyright (c) 2004-2005 The Trustees of the University of Tennessee.
|
|
|
|
* All rights reserved.
|
2004-11-28 20:09:25 +00:00
|
|
|
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
|
|
|
|
* University of Stuttgart. All rights reserved.
|
2005-03-24 12:43:37 +00:00
|
|
|
* Copyright (c) 2004-2005 The Regents of the University of California.
|
|
|
|
* All rights reserved.
|
2004-11-22 01:38:40 +00:00
|
|
|
* $COPYRIGHT$
|
|
|
|
*
|
|
|
|
* Additional copyrights may follow
|
|
|
|
*
|
2004-11-22 00:37:56 +00:00
|
|
|
* $HEADER$
|
|
|
|
*/
|
|
|
|
|
2004-09-30 20:54:26 +00:00
|
|
|
#include "ompi_config.h"
|
|
|
|
#include "include/constants.h"
|
2005-03-14 20:57:21 +00:00
|
|
|
#include "util/proc_info.h"
|
|
|
|
|
|
|
|
#include "mca/ns/ns.h"
|
2004-09-30 20:54:26 +00:00
|
|
|
#include "mca/oob/oob.h"
|
|
|
|
#include "mca/oob/base/base.h"
|
|
|
|
|
|
|
|
|
|
|
|
int mca_oob_barrier(void)
|
|
|
|
{
|
2005-03-14 20:57:21 +00:00
|
|
|
orte_process_name_t* peers;
|
|
|
|
size_t i, npeers, self;
|
2004-09-30 20:54:26 +00:00
|
|
|
struct iovec iov;
|
2004-10-12 18:11:26 +00:00
|
|
|
int foo = 0;
|
2004-09-30 20:54:26 +00:00
|
|
|
|
2005-03-14 20:57:21 +00:00
|
|
|
int rc = orte_ns.get_peers(&peers,&npeers,&self);
|
2005-08-15 18:25:35 +00:00
|
|
|
if(rc != ORTE_SUCCESS) {
|
2004-09-30 20:54:26 +00:00
|
|
|
return rc;
|
2005-08-15 18:25:35 +00:00
|
|
|
}
|
2004-09-30 20:54:26 +00:00
|
|
|
|
2004-11-20 19:12:43 +00:00
|
|
|
iov.iov_base = (void*)&foo;
|
2004-09-30 20:54:26 +00:00
|
|
|
iov.iov_len = sizeof(foo);
|
|
|
|
|
|
|
|
/* All non-root send & receive zero-length message. */
|
2005-03-14 20:57:21 +00:00
|
|
|
if (0 < self) {
|
2004-09-30 20:54:26 +00:00
|
|
|
int tag=-1;
|
|
|
|
rc = mca_oob_send(&peers[0],&iov,1,tag,0);
|
|
|
|
if (rc < 0) {
|
|
|
|
return rc;
|
|
|
|
}
|
|
|
|
|
2005-03-14 20:57:21 +00:00
|
|
|
rc = mca_oob_recv(&peers[0],&iov,1,tag,0);
|
2004-09-30 20:54:26 +00:00
|
|
|
if (rc < 0) {
|
|
|
|
return rc;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* The root collects and broadcasts the messages. */
|
|
|
|
else {
|
|
|
|
int tag=-1;
|
|
|
|
for (i = 1; i < npeers; i++) {
|
2005-03-14 20:57:21 +00:00
|
|
|
rc = mca_oob_recv(&peers[i],&iov,1,tag,0);
|
2004-09-30 20:54:26 +00:00
|
|
|
if (rc < 0) {
|
|
|
|
return rc;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
for (i = 1; i < npeers; i++) {
|
2004-10-04 15:57:28 +00:00
|
|
|
rc = mca_oob_send(&peers[i],&iov,1,tag,0);
|
2004-09-30 20:54:26 +00:00
|
|
|
if (rc < 0) {
|
|
|
|
return rc;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2005-08-15 18:25:35 +00:00
|
|
|
return ORTE_SUCCESS;
|
2004-09-30 20:54:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|