diff --git a/ompi/mca/coll/base/coll_base_comm_select.c b/ompi/mca/coll/base/coll_base_comm_select.c index 30b1e42c0b..bae8520f59 100644 --- a/ompi/mca/coll/base/coll_base_comm_select.c +++ b/ompi/mca/coll/base/coll_base_comm_select.c @@ -197,7 +197,12 @@ int mca_coll_base_comm_select(ompi_communicator_t * comm) (NULL == comm->c_coll.coll_reduce_scatter) || ((OMPI_COMM_IS_INTRA(comm)) && (NULL == comm->c_coll.coll_scan)) || (NULL == comm->c_coll.coll_scatter) || - (NULL == comm->c_coll.coll_scatterv) || + (NULL == comm->c_coll.coll_scatterv) + +#if 0 + /* JMS These need to be activated before the nb coll branch is + done */ + || (NULL == comm->c_coll.coll_iallgather) || (NULL == comm->c_coll.coll_iallgatherv) || (NULL == comm->c_coll.coll_iallreduce) || @@ -214,10 +219,12 @@ int mca_coll_base_comm_select(ompi_communicator_t * comm) ((OMPI_COMM_IS_INTRA(comm)) && (NULL == comm->c_coll.coll_iscan)) || (NULL == comm->c_coll.coll_iscatter) || (NULL == comm->c_coll.coll_iscatterv) +#endif ) { mca_coll_base_comm_unselect(comm); return OMPI_ERR_NOT_FOUND; } + return OMPI_SUCCESS; } diff --git a/ompi/mca/coll/libnbc/.ompi_ignore b/ompi/mca/coll/libnbc/.ompi_ignore new file mode 100644 index 0000000000..e69de29bb2 diff --git a/ompi/mca/coll/libnbc/.ompi_unignore b/ompi/mca/coll/libnbc/.ompi_unignore new file mode 100644 index 0000000000..269b13243b --- /dev/null +++ b/ompi/mca/coll/libnbc/.ompi_unignore @@ -0,0 +1 @@ +bwbarre diff --git a/ompi/mca/coll/libnbc/Makefile.am b/ompi/mca/coll/libnbc/Makefile.am index e7d0eb2e72..993f4498e8 100644 --- a/ompi/mca/coll/libnbc/Makefile.am +++ b/ompi/mca/coll/libnbc/Makefile.am @@ -21,29 +21,8 @@ EXTRA_DIST = sources = \ coll_libnbc_component.c \ - coll_libnbc_not_implemented.c \ nbc.c \ - nbc_internal.h \ - libdict/dict.h \ - libdict/dict_private.h \ - libdict/dict.c \ - libdict/hb_tree.h \ - libdict/hb_tree.c \ - nbc_iallgather.c \ - nbc_iallgatherv.c \ - nbc_iallreduce.c \ - nbc_ialltoall.c \ - nbc_ialltoallv.c \ - nbc_ibarrier.c \ - nbc_ibcast.c \ - nbc_ibcast_inter.c \ - nbc_igather.c \ - nbc_igatherv.c \ - nbc_ireduce.c \ - nbc_ireduce_scatter.c \ - nbc_iscan.c \ - nbc_iscatter.c \ - nbc_iscatterv.c + nbc_ibarrier.c # Make the output library in this directory, and name it either # mca__.la (for DSO builds) or libmca__.la diff --git a/ompi/mca/coll/libnbc/coll_libnbc.h b/ompi/mca/coll/libnbc/coll_libnbc.h index b5641d6465..6967396bea 100644 --- a/ompi/mca/coll/libnbc/coll_libnbc.h +++ b/ompi/mca/coll/libnbc/coll_libnbc.h @@ -113,116 +113,8 @@ typedef ompi_coll_libnbc_request_t NBC_Handle; int NBC_Init_comm(MPI_Comm comm, ompi_coll_libnbc_module_t *module); int NBC_Progress(NBC_Handle *handle); -int NBC_Operation(void *buf3, void *buf1, void *buf2, MPI_Op op, MPI_Datatype type, int count); - -int ompi_coll_libnbc_iallgather(void* sendbuf, int sendcount, MPI_Datatype sendtype, void* recvbuf, int recvcount, - MPI_Datatype recvtype, struct ompi_communicator_t *comm, ompi_request_t ** request, - struct mca_coll_base_module_2_0_0_t *module); -int ompi_coll_libnbc_iallgatherv(void* sendbuf, int sendcount, MPI_Datatype sendtype, void* recvbuf, int *recvcounts, int *displs, - MPI_Datatype recvtype, struct ompi_communicator_t *comm, ompi_request_t ** request, - struct mca_coll_base_module_2_0_0_t *module); -int ompi_coll_libnbc_iallreduce(void* sendbuf, void* recvbuf, int count, MPI_Datatype datatype, MPI_Op op, - struct ompi_communicator_t *comm, ompi_request_t ** request, - struct mca_coll_base_module_2_0_0_t *module); -int ompi_coll_libnbc_ialltoall(void* sendbuf, int sendcount, MPI_Datatype sendtype, void* recvbuf, int recvcount, - MPI_Datatype recvtype, struct ompi_communicator_t *comm, ompi_request_t ** request, - struct mca_coll_base_module_2_0_0_t *module); -int ompi_coll_libnbc_ialltoallv(void* sendbuf, int *sendcounts, int *sdispls, - MPI_Datatype sendtype, void* recvbuf, int *recvcounts, int *rdispls, - MPI_Datatype recvtype, struct ompi_communicator_t *comm, ompi_request_t ** request, - struct mca_coll_base_module_2_0_0_t *module); -int ompi_coll_libnbc_ialltoallw(void *sbuf, int *scounts, int *sdisps, struct ompi_datatype_t **sdtypes, - void *rbuf, int *rcounts, int *rdisps, struct ompi_datatype_t **rdtypes, - struct ompi_communicator_t *comm, ompi_request_t **request, - struct mca_coll_base_module_2_0_0_t *module); int ompi_coll_libnbc_ibarrier(struct ompi_communicator_t *comm, ompi_request_t ** request, struct mca_coll_base_module_2_0_0_t *module); -int ompi_coll_libnbc_ibcast(void *buffer, int count, MPI_Datatype datatype, int root, - struct ompi_communicator_t *comm, ompi_request_t ** request, - struct mca_coll_base_module_2_0_0_t *module); -int ompi_coll_libnbc_iexscan(void *sbuf, void *rbuf, int count, struct ompi_datatype_t *dtype, - struct ompi_op_t *op, struct ompi_communicator_t *comm, ompi_request_t **request, - struct mca_coll_base_module_2_0_0_t *module); -int ompi_coll_libnbc_igather(void* sendbuf, int sendcount, MPI_Datatype sendtype, void* recvbuf, int recvcount, - MPI_Datatype recvtype, int root, struct ompi_communicator_t *comm, ompi_request_t ** request, - struct mca_coll_base_module_2_0_0_t *module); -int ompi_coll_libnbc_igatherv(void* sendbuf, int sendcount, MPI_Datatype sendtype, - void* recvbuf, int *recvcounts, int *displs, MPI_Datatype recvtype, - int root, struct ompi_communicator_t *comm, ompi_request_t ** request, - struct mca_coll_base_module_2_0_0_t *module); -int ompi_coll_libnbc_ireduce(void* sendbuf, void* recvbuf, int count, MPI_Datatype datatype, - MPI_Op op, int root, struct ompi_communicator_t *comm, ompi_request_t ** request, - struct mca_coll_base_module_2_0_0_t *module); -int ompi_coll_libnbc_ireduce_scatter(void* sendbuf, void* recvbuf, int *recvcounts, MPI_Datatype datatype, - MPI_Op op, struct ompi_communicator_t *comm, ompi_request_t ** request, - struct mca_coll_base_module_2_0_0_t *module); -int ompi_coll_libnbc_ireduce_scatter_block(void *sbuf, void *rbuf, int rcount, struct ompi_datatype_t *dtype, - struct ompi_op_t *op, struct ompi_communicator_t *comm, - ompi_request_t **request, - struct mca_coll_base_module_2_0_0_t *module); -int ompi_coll_libnbc_iscan(void* sendbuf, void* recvbuf, int count, MPI_Datatype datatype, MPI_Op op, - struct ompi_communicator_t *comm, ompi_request_t ** request, - struct mca_coll_base_module_2_0_0_t *module); -int ompi_coll_libnbc_iscatter(void* sendbuf, int sendcount, MPI_Datatype sendtype, - void* recvbuf, int recvcount, MPI_Datatype recvtype, int root, - struct ompi_communicator_t *comm, ompi_request_t ** request, - struct mca_coll_base_module_2_0_0_t *module); -int ompi_coll_libnbc_iscatterv(void* sendbuf, int *sendcounts, int *displs, MPI_Datatype sendtype, - void* recvbuf, int recvcount, MPI_Datatype recvtype, int root, - struct ompi_communicator_t *comm, ompi_request_t ** request, - struct mca_coll_base_module_2_0_0_t *module); - - -int ompi_coll_libnbc_iallgather_inter(void* sendbuf, int sendcount, MPI_Datatype sendtype, void* recvbuf, int recvcount, - MPI_Datatype recvtype, struct ompi_communicator_t *comm, ompi_request_t ** request, - struct mca_coll_base_module_2_0_0_t *module); -int ompi_coll_libnbc_iallgatherv_inter(void* sendbuf, int sendcount, MPI_Datatype sendtype, void* recvbuf, int *recvcounts, int *displs, - MPI_Datatype recvtype, struct ompi_communicator_t *comm, ompi_request_t ** request, - struct mca_coll_base_module_2_0_0_t *module); -int ompi_coll_libnbc_iallreduce_inter(void* sendbuf, void* recvbuf, int count, MPI_Datatype datatype, MPI_Op op, - struct ompi_communicator_t *comm, ompi_request_t ** request, - struct mca_coll_base_module_2_0_0_t *module); -int ompi_coll_libnbc_ialltoall_inter(void* sendbuf, int sendcount, MPI_Datatype sendtype, void* recvbuf, int recvcount, - MPI_Datatype recvtype, struct ompi_communicator_t *comm, ompi_request_t ** request, - struct mca_coll_base_module_2_0_0_t *module); -int ompi_coll_libnbc_ialltoallv_inter(void* sendbuf, int *sendcounts, int *sdispls, - MPI_Datatype sendtype, void* recvbuf, int *recvcounts, int *rdispls, - MPI_Datatype recvtype, struct ompi_communicator_t *comm, ompi_request_t ** request, - struct mca_coll_base_module_2_0_0_t *module); -int ompi_coll_libnbc_ialltoallw_inter(void *sbuf, int *scounts, int *sdisps, struct ompi_datatype_t **sdtypes, - void *rbuf, int *rcounts, int *rdisps, struct ompi_datatype_t **rdtypes, - struct ompi_communicator_t *comm, ompi_request_t **request, - struct mca_coll_base_module_2_0_0_t *module); -int ompi_coll_libnbc_ibarrier_inter(struct ompi_communicator_t *comm, ompi_request_t ** request, - struct mca_coll_base_module_2_0_0_t *module); -int ompi_coll_libnbc_ibcast_inter(void *buffer, int count, MPI_Datatype datatype, int root, - struct ompi_communicator_t *comm, ompi_request_t ** request, - struct mca_coll_base_module_2_0_0_t *module); -int ompi_coll_libnbc_igather_inter(void* sendbuf, int sendcount, MPI_Datatype sendtype, void* recvbuf, int recvcount, - MPI_Datatype recvtype, int root, struct ompi_communicator_t *comm, ompi_request_t ** request, - struct mca_coll_base_module_2_0_0_t *module); -int ompi_coll_libnbc_igatherv_inter(void* sendbuf, int sendcount, MPI_Datatype sendtype, - void* recvbuf, int *recvcounts, int *displs, MPI_Datatype recvtype, - int root, struct ompi_communicator_t *comm, ompi_request_t ** request, - struct mca_coll_base_module_2_0_0_t *module); -int ompi_coll_libnbc_ireduce_inter(void* sendbuf, void* recvbuf, int count, MPI_Datatype datatype, - MPI_Op op, int root, struct ompi_communicator_t *comm, ompi_request_t ** request, - struct mca_coll_base_module_2_0_0_t *module); -int ompi_coll_libnbc_ireduce_scatter_inter(void* sendbuf, void* recvbuf, int *recvcounts, MPI_Datatype datatype, - MPI_Op op, struct ompi_communicator_t *comm, ompi_request_t ** request, - struct mca_coll_base_module_2_0_0_t *module); -int ompi_coll_libnbc_ireduce_scatter_block_inter(void *sbuf, void *rbuf, int rcount, struct ompi_datatype_t *dtype, - struct ompi_op_t *op, struct ompi_communicator_t *comm, - ompi_request_t **request, - struct mca_coll_base_module_2_0_0_t *module); -int ompi_coll_libnbc_iscatter_inter(void* sendbuf, int sendcount, MPI_Datatype sendtype, - void* recvbuf, int recvcount, MPI_Datatype recvtype, int root, - struct ompi_communicator_t *comm, ompi_request_t ** request, - struct mca_coll_base_module_2_0_0_t *module); -int ompi_coll_libnbc_iscatterv_inter(void* sendbuf, int *sendcounts, int *displs, MPI_Datatype sendtype, - void* recvbuf, int recvcount, MPI_Datatype recvtype, int root, - struct ompi_communicator_t *comm, ompi_request_t ** request, - struct mca_coll_base_module_2_0_0_t *module); END_C_DECLS diff --git a/ompi/mca/coll/libnbc/coll_libnbc_component.c b/ompi/mca/coll/libnbc/coll_libnbc_component.c index 7c3535519c..8cfe729e25 100644 --- a/ompi/mca/coll/libnbc/coll_libnbc_component.c +++ b/ompi/mca/coll/libnbc/coll_libnbc_component.c @@ -23,7 +23,7 @@ #include "mpi.h" #include "ompi/mca/coll/coll.h" -#include "ompi/communicator/communicator.h" + /* * Public string showing the coll ompi_libnbc component version number @@ -105,6 +105,10 @@ libnbc_close(void) { OBJ_DESTRUCT(&mca_coll_libnbc_component.requests); + if (0 < mca_coll_libnbc_component.active_comms) { + opal_progress_unregister(libnbc_progress); + } + return OMPI_SUCCESS; } @@ -156,43 +160,9 @@ libnbc_comm_query(struct ompi_communicator_t *comm, *priority = libnbc_priority; module->super.coll_module_enable = libnbc_module_enable; - if (OMPI_COMM_IS_INTER(comm)) { - module->super.coll_iallgather = ompi_coll_libnbc_iallgather_inter; - module->super.coll_iallgatherv = ompi_coll_libnbc_iallgatherv_inter; - module->super.coll_iallreduce = ompi_coll_libnbc_iallreduce_inter; - module->super.coll_ialltoall = ompi_coll_libnbc_ialltoall_inter; - module->super.coll_ialltoallv = ompi_coll_libnbc_ialltoallv_inter; - module->super.coll_ialltoallw = ompi_coll_libnbc_ialltoallw_inter; - module->super.coll_ibarrier = ompi_coll_libnbc_ibarrier_inter; - module->super.coll_ibcast = ompi_coll_libnbc_ibcast_inter; - module->super.coll_iexscan = NULL; - module->super.coll_igather = ompi_coll_libnbc_igather_inter; - module->super.coll_igatherv = ompi_coll_libnbc_igatherv_inter; - module->super.coll_ireduce = ompi_coll_libnbc_ireduce_inter; - module->super.coll_ireduce_scatter = ompi_coll_libnbc_ireduce_scatter_inter; - module->super.coll_ireduce_scatter_block = ompi_coll_libnbc_ireduce_scatter_block_inter; - module->super.coll_iscan = NULL; - module->super.coll_iscatter = ompi_coll_libnbc_iscatter_inter; - module->super.coll_iscatterv = ompi_coll_libnbc_iscatterv_inter; - } else { - module->super.coll_iallgather = ompi_coll_libnbc_iallgather; - module->super.coll_iallgatherv = ompi_coll_libnbc_iallgatherv; - module->super.coll_iallreduce = ompi_coll_libnbc_iallreduce; - module->super.coll_ialltoall = ompi_coll_libnbc_ialltoall; - module->super.coll_ialltoallv = ompi_coll_libnbc_ialltoallv; - module->super.coll_ialltoallw = ompi_coll_libnbc_ialltoallw; - module->super.coll_ibarrier = ompi_coll_libnbc_ibarrier; - module->super.coll_ibcast = ompi_coll_libnbc_ibcast; - module->super.coll_iexscan = ompi_coll_libnbc_iexscan; - module->super.coll_igather = ompi_coll_libnbc_igather; - module->super.coll_igatherv = ompi_coll_libnbc_igatherv; - module->super.coll_ireduce = ompi_coll_libnbc_ireduce; - module->super.coll_ireduce_scatter = ompi_coll_libnbc_ireduce_scatter; - module->super.coll_ireduce_scatter_block = ompi_coll_libnbc_ireduce_scatter_block; - module->super.coll_iscan = ompi_coll_libnbc_iscan; - module->super.coll_iscatter = ompi_coll_libnbc_iscatter; - module->super.coll_iscatterv = ompi_coll_libnbc_iscatterv; - } + + module->super.coll_ibarrier = ompi_coll_libnbc_ibarrier; + module->super.ft_event = NULL; if (OMPI_SUCCESS != NBC_Init_comm(comm, module)) { @@ -250,9 +220,6 @@ libnbc_module_construct(ompi_coll_libnbc_module_t *module) static void libnbc_module_destruct(ompi_coll_libnbc_module_t *module) { - if (0 == --mca_coll_libnbc_component.active_comms) { - opal_progress_unregister(libnbc_progress); - } } diff --git a/ompi/mca/coll/libnbc/coll_libnbc_not_implemented.c b/ompi/mca/coll/libnbc/coll_libnbc_not_implemented.c deleted file mode 100644 index a64902572c..0000000000 --- a/ompi/mca/coll/libnbc/coll_libnbc_not_implemented.c +++ /dev/null @@ -1,160 +0,0 @@ -#include "ompi_config.h" - -#include "coll_libnbc.h" -#include "ompi/constants.h" - -int -ompi_coll_libnbc_ialltoallw(void *sbuf, int *scounts, int *sdisps, struct ompi_datatype_t **sdtypes, - void *rbuf, int *rcounts, int *rdisps, struct ompi_datatype_t **rdtypes, - struct ompi_communicator_t *comm, ompi_request_t **request, - struct mca_coll_base_module_2_0_0_t *module) -{ - return OMPI_ERR_NOT_IMPLEMENTED; -} - - -int -ompi_coll_libnbc_iexscan(void *sbuf, void *rbuf, int count, struct ompi_datatype_t *dtype, - struct ompi_op_t *op, struct ompi_communicator_t *comm, ompi_request_t **request, - struct mca_coll_base_module_2_0_0_t *module) -{ - return OMPI_ERR_NOT_IMPLEMENTED; -} - - -int -ompi_coll_libnbc_ireduce_scatter_block(void *sbuf, void *rbuf, int rcount, struct ompi_datatype_t *dtype, - struct ompi_op_t *op, struct ompi_communicator_t *comm, - ompi_request_t **request, struct mca_coll_base_module_2_0_0_t *module) -{ - return OMPI_ERR_NOT_IMPLEMENTED; -} - - -int -ompi_coll_libnbc_iallgather_inter(void* sendbuf, int sendcount, MPI_Datatype sendtype, void* recvbuf, int recvcount, - MPI_Datatype recvtype, struct ompi_communicator_t *comm, ompi_request_t ** request, - struct mca_coll_base_module_2_0_0_t *module) -{ - return OMPI_ERR_NOT_IMPLEMENTED; -} - - -int -ompi_coll_libnbc_iallgatherv_inter(void* sendbuf, int sendcount, MPI_Datatype sendtype, void* recvbuf, int *recvcounts, int *displs, - MPI_Datatype recvtype, struct ompi_communicator_t *comm, ompi_request_t ** request, - struct mca_coll_base_module_2_0_0_t *module) -{ - return OMPI_ERR_NOT_IMPLEMENTED; -} - - -int -ompi_coll_libnbc_iallreduce_inter(void* sendbuf, void* recvbuf, int count, MPI_Datatype datatype, MPI_Op op, - struct ompi_communicator_t *comm, ompi_request_t ** request, - struct mca_coll_base_module_2_0_0_t *module) -{ - return OMPI_ERR_NOT_IMPLEMENTED; -} - - -int -ompi_coll_libnbc_ialltoall_inter(void* sendbuf, int sendcount, MPI_Datatype sendtype, void* recvbuf, int recvcount, - MPI_Datatype recvtype, struct ompi_communicator_t *comm, ompi_request_t ** request, - struct mca_coll_base_module_2_0_0_t *module) -{ - return OMPI_ERR_NOT_IMPLEMENTED; -} - - -int -ompi_coll_libnbc_ialltoallv_inter(void* sendbuf, int *sendcounts, int *sdispls, - MPI_Datatype sendtype, void* recvbuf, int *recvcounts, int *rdispls, - MPI_Datatype recvtype, struct ompi_communicator_t *comm, ompi_request_t ** request, - struct mca_coll_base_module_2_0_0_t *module) -{ - return OMPI_ERR_NOT_IMPLEMENTED; -} - - -int -ompi_coll_libnbc_ialltoallw_inter(void *sbuf, int *scounts, int *sdisps, struct ompi_datatype_t **sdtypes, - void *rbuf, int *rcounts, int *rdisps, struct ompi_datatype_t **rdtypes, - struct ompi_communicator_t *comm, ompi_request_t **request, - struct mca_coll_base_module_2_0_0_t *module) -{ - return OMPI_ERR_NOT_IMPLEMENTED; -} - - -int -ompi_coll_libnbc_ibarrier_inter(struct ompi_communicator_t *comm, ompi_request_t ** request, - struct mca_coll_base_module_2_0_0_t *module) -{ - return OMPI_ERR_NOT_IMPLEMENTED; -} - - -int -ompi_coll_libnbc_igather_inter(void* sendbuf, int sendcount, MPI_Datatype sendtype, void* recvbuf, int recvcount, - MPI_Datatype recvtype, int root, struct ompi_communicator_t *comm, ompi_request_t ** request, - struct mca_coll_base_module_2_0_0_t *module) -{ - return OMPI_ERR_NOT_IMPLEMENTED; -} - - -int -ompi_coll_libnbc_igatherv_inter(void* sendbuf, int sendcount, MPI_Datatype sendtype, - void* recvbuf, int *recvcounts, int *displs, MPI_Datatype recvtype, - int root, struct ompi_communicator_t *comm, ompi_request_t ** request, - struct mca_coll_base_module_2_0_0_t *module) -{ - return OMPI_ERR_NOT_IMPLEMENTED; -} - - -int -ompi_coll_libnbc_ireduce_inter(void* sendbuf, void* recvbuf, int count, MPI_Datatype datatype, - MPI_Op op, int root, struct ompi_communicator_t *comm, ompi_request_t ** request, - struct mca_coll_base_module_2_0_0_t *module) -{ - return OMPI_ERR_NOT_IMPLEMENTED; -} - - -int -ompi_coll_libnbc_ireduce_scatter_inter(void* sendbuf, void* recvbuf, int *recvcounts, MPI_Datatype datatype, - MPI_Op op, struct ompi_communicator_t *comm, ompi_request_t ** request, - struct mca_coll_base_module_2_0_0_t *module) -{ - return OMPI_ERR_NOT_IMPLEMENTED; -} - - -int -ompi_coll_libnbc_ireduce_scatter_block_inter(void *sbuf, void *rbuf, int rcount, struct ompi_datatype_t *dtype, - struct ompi_op_t *op, struct ompi_communicator_t *comm, - ompi_request_t **request, struct mca_coll_base_module_2_0_0_t *module) -{ - return OMPI_ERR_NOT_IMPLEMENTED; -} - - -int ompi_coll_libnbc_iscatter_inter(void* sendbuf, int sendcount, MPI_Datatype sendtype, - void* recvbuf, int recvcount, MPI_Datatype recvtype, int root, - struct ompi_communicator_t *comm, ompi_request_t ** request, - struct mca_coll_base_module_2_0_0_t *module) -{ - return OMPI_ERR_NOT_IMPLEMENTED; -} - - -int -ompi_coll_libnbc_iscatterv_inter(void* sendbuf, int *sendcounts, int *displs, MPI_Datatype sendtype, - void* recvbuf, int recvcount, MPI_Datatype recvtype, int root, - struct ompi_communicator_t *comm, ompi_request_t ** request, - struct mca_coll_base_module_2_0_0_t *module) -{ - return OMPI_ERR_NOT_IMPLEMENTED; -} diff --git a/ompi/mca/coll/libnbc/nbc.h b/ompi/mca/coll/libnbc/nbc.h new file mode 100644 index 0000000000..f13333edb4 --- /dev/null +++ b/ompi/mca/coll/libnbc/nbc.h @@ -0,0 +1,51 @@ +/* + * Copyright (c) 2006 The Trustees of Indiana University and Indiana + * University Research and Technology + * Corporation. All rights reserved. + * Copyright (c) 2006 The Technical University of Chemnitz. All + * rights reserved. + * + * Author(s): Torsten Hoefler + * + */ +#ifndef __NBC_H__ +#define __NBC_H__ + +#ifdef __cplusplus +extern "C" { +#endif + + +/******************************************************* + ****** external NBC functions are defined here ******* + *******************************************************/ + +/* external function prototypes */ +int NBC_Ibarrier(MPI_Comm comm, NBC_Handle* handle); +int NBC_Ibcast(void *buffer, int count, MPI_Datatype datatype, int root, MPI_Comm comm, NBC_Handle* handle); +int NBC_Ibcast_inter(void *buffer, int count, MPI_Datatype datatype, int root, MPI_Comm comm, NBC_Handle* handle); +int NBC_Ialltoallv(void* sendbuf, int *sendcounts, int *sdispls, MPI_Datatype sendtype, void* recvbuf, int *recvcounts, int *rdispls, MPI_Datatype recvtype, MPI_Comm comm, NBC_Handle* handle); +int NBC_Igather(void* sendbuf, int sendcount, MPI_Datatype sendtype, void* recvbuf, int recvcount, MPI_Datatype recvtype, int root, MPI_Comm comm, NBC_Handle* handle); +int NBC_Igatherv(void* sendbuf, int sendcount, MPI_Datatype sendtype, void* recvbuf, int *recvcounts, int *displs, MPI_Datatype recvtype, int root, MPI_Comm comm, NBC_Handle* handle); +int NBC_Iscatter(void* sendbuf, int sendcount, MPI_Datatype sendtype, void* recvbuf, int recvcount, MPI_Datatype recvtype, int root, MPI_Comm comm, NBC_Handle* handle); +int NBC_Iscatterv(void* sendbuf, int *sendcounts, int *displs, MPI_Datatype sendtype, void* recvbuf, int recvcount, MPI_Datatype recvtype, int root, MPI_Comm comm, NBC_Handle* handle); +int NBC_Iallgather(void* sendbuf, int sendcount, MPI_Datatype sendtype, void* recvbuf, int recvcount, MPI_Datatype recvtype, MPI_Comm comm, NBC_Handle *handle); +int NBC_Iallgatherv(void* sendbuf, int sendcount, MPI_Datatype sendtype, void* recvbuf, int *recvcounts, int *displs, MPI_Datatype recvtype, MPI_Comm comm, NBC_Handle *handle); +int NBC_Ialltoall(void* sendbuf, int sendcount, MPI_Datatype sendtype, void* recvbuf, int recvcount, MPI_Datatype recvtype, MPI_Comm comm, NBC_Handle *handle); +int NBC_Ireduce(void* sendbuf, void* recvbuf, int count, MPI_Datatype datatype, MPI_Op op, int root, MPI_Comm comm, NBC_Handle* handle); +int NBC_Iallreduce(void* sendbuf, void* recvbuf, int count, MPI_Datatype datatype, MPI_Op op, MPI_Comm comm, NBC_Handle* handle); +int NBC_Iscan(void* sendbuf, void* recvbuf, int count, MPI_Datatype datatype, MPI_Op op, MPI_Comm comm, NBC_Handle* handle); +int NBC_Ireduce_scatter(void* sendbuf, void* recvbuf, int *recvcounts, MPI_Datatype datatype, MPI_Op op, MPI_Comm comm, NBC_Handle* handle); + +/* TODO: some hacks */ +int NBC_Operation(void *buf3, void *buf1, void *buf2, MPI_Op op, MPI_Datatype type, int count); + +void NBC_Reset_times(void); +void NBC_Print_times(double div); + + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/ompi/mca/coll/libnbc/nbc_iallgather.c b/ompi/mca/coll/libnbc/nbc_iallgather.c index d2ed176af9..51f22f4b05 100644 --- a/ompi/mca/coll/libnbc/nbc_iallgather.c +++ b/ompi/mca/coll/libnbc/nbc_iallgather.c @@ -29,14 +29,16 @@ int NBC_Allgather_args_compare(NBC_Allgather_args *a, NBC_Allgather_args *b, voi } #endif +#ifdef HAVE_SYS_WEAK_ALIAS_PRAGMA +#pragma weak NBC_Iallgather=PNBC_Iallgather +#define NBC_Iallgather PNBC_Iallgather +#endif + /* simple linear MPI_Iallgather * the algorithm uses p-1 rounds * each node sends the packet it received last round (or has in round 0) to it's right neighbor (modulo p) * each node receives from it's left (modulo p) neighbor */ -int ompi_coll_libnbc_iallgather(void* sendbuf, int sendcount, MPI_Datatype sendtype, void* recvbuf, int recvcount, - MPI_Datatype recvtype, struct ompi_communicator_t *comm, ompi_request_t ** request, - struct mca_coll_base_module_2_0_0_t *module) -{ +int NBC_Iallgather(void* sendbuf, int sendcount, MPI_Datatype sendtype, void* recvbuf, int recvcount, MPI_Datatype recvtype, MPI_Comm comm, NBC_Handle *handle) { int rank, p, res, r; MPI_Aint rcvext, sndext; NBC_Schedule *schedule; @@ -44,13 +46,10 @@ int ompi_coll_libnbc_iallgather(void* sendbuf, int sendcount, MPI_Datatype sendt #ifdef NBC_CACHE_SCHEDULE NBC_Allgather_args *args, *found, search; #endif - NBC_Handle *handle; - ompi_coll_libnbc_request_t **coll_req = (ompi_coll_libnbc_request_t**) request; - ompi_coll_libnbc_module_t *libnbc_module = (ompi_coll_libnbc_module_t*) module; NBC_IN_PLACE(sendbuf, recvbuf, inplace); - res = NBC_Init_handle(comm, coll_req, libnbc_module); + res = NBC_Init_handle(handle, comm); if(res != NBC_OK) { printf("Error in NBC_Init_handle(%i)\n", res); return res; } res = MPI_Comm_rank(comm, &rank); if (MPI_SUCCESS != res) { printf("MPI Error in MPI_Comm_rank() (%i)\n", res); return res; } @@ -216,3 +215,43 @@ static inline int a2a_sched_diss(int rank, int p, MPI_Aint sndext, MPI_Aint rcve return NBC_OK; } #endif + + +#ifdef __cplusplus +extern "C" { +#endif +/* Fortran bindings */ +#ifdef HAVE_SYS_WEAK_ALIAS_PRAGMA +NBC_F77_ALLFUNC_(nbc_iallgather,NBC_IALLGATHER,(void *sendbuf, int *sendcount, int *sendtype, void *recvbuf, int *recvcount, int *recvtype, int *fcomm, int *fhandle, int *ierr)); +#pragma weak NBC_IALLGATHER = nbc_iallgather_f +#pragma weak nbc_iallgather = nbc_iallgather_f +#pragma weak nbc_iallgather_ = nbc_iallgather_f +#pragma weak nbc_iallgather__ = nbc_iallgather_f +#pragma weak PNBC_IALLGATHER = nbc_iallgather_f +#pragma weak pnbc_iallgather = nbc_iallgather_f +#pragma weak pnbc_iallgather_ = nbc_iallgather_f +#pragma weak pnbc_iallgather__ = nbc_iallgather_f +void nbc_iallgather_f(void *sendbuf, int *sendcount, int *sendtype, void *recvbuf, int *recvcount, int *recvtype, int *fcomm, int *fhandle, int *ierr) { +#else +void NBC_F77_FUNC_(nbc_iallgather,NBC_IALLGATHER)(void *sendbuf, int *sendcount, int *sendtype, void *recvbuf, int *recvcount, int *recvtype, int *fcomm, int *fhandle, int *ierr); +void NBC_F77_FUNC_(nbc_iallgather,NBC_IALLGATHER)(void *sendbuf, int *sendcount, int *sendtype, void *recvbuf, int *recvcount, int *recvtype, int *fcomm, int *fhandle, int *ierr) { +#endif + MPI_Datatype rtype, stype; + MPI_Comm comm; + NBC_Handle *handle; + + /* this is the only MPI-2 we need :-( */ + rtype = MPI_Type_f2c(*recvtype); + stype = MPI_Type_f2c(*sendtype); + comm = MPI_Comm_f2c(*fcomm); + + /* create a new handle in handle table */ + NBC_Create_fortran_handle(fhandle, &handle); + + /* call NBC function */ + *ierr = NBC_Iallgather(sendbuf, *sendcount, stype, recvbuf, *recvcount, rtype, comm, handle); +} + +#ifdef __cplusplus +} +#endif diff --git a/ompi/mca/coll/libnbc/nbc_iallgatherv.c b/ompi/mca/coll/libnbc/nbc_iallgatherv.c index 3a0036dfcd..e022f0ff9d 100644 --- a/ompi/mca/coll/libnbc/nbc_iallgatherv.c +++ b/ompi/mca/coll/libnbc/nbc_iallgatherv.c @@ -14,6 +14,11 @@ * ot the recvcounts array may change, so a comparison of the address * would not be sufficient ... we simply do not cache it */ +#ifdef HAVE_SYS_WEAK_ALIAS_PRAGMA +#pragma weak NBC_Iallgatherv=PNBC_Iallgatherv +#define NBC_Iallgatherv PNBC_Iallgatherv +#endif + /* simple linear MPI_Iallgatherv * the algorithm uses p-1 rounds * first round: @@ -22,21 +27,15 @@ * second round: * each node sends to node (rank+2)%p sendcount elements * each node receives from node (rank-2)%p recvcounts[(rank+2)%p] elements */ -int ompi_coll_libnbc_iallgatherv(void* sendbuf, int sendcount, MPI_Datatype sendtype, void* recvbuf, int *recvcounts, int *displs, - MPI_Datatype recvtype, struct ompi_communicator_t *comm, ompi_request_t ** request, - struct mca_coll_base_module_2_0_0_t *module) -{ +int NBC_Iallgatherv(void* sendbuf, int sendcount, MPI_Datatype sendtype, void* recvbuf, int *recvcounts, int *displs, MPI_Datatype recvtype, MPI_Comm comm, NBC_Handle *handle) { int rank, p, res, r, speer, rpeer; MPI_Aint rcvext, sndext; NBC_Schedule *schedule; char *rbuf, inplace; - NBC_Handle *handle; - ompi_coll_libnbc_request_t **coll_req = (ompi_coll_libnbc_request_t**) request; - ompi_coll_libnbc_module_t *libnbc_module = (ompi_coll_libnbc_module_t*) module; NBC_IN_PLACE(sendbuf, recvbuf, inplace); - res = NBC_Init_handle(comm, coll_req, libnbc_module); + res = NBC_Init_handle(handle, comm); if(res != NBC_OK) { printf("Error in NBC_Init_handle(%i)\n", res); return res; } res = MPI_Comm_rank(comm, &rank); if (MPI_SUCCESS != res) { printf("MPI Error in MPI_Comm_rank() (%i)\n", res); return res; } @@ -82,3 +81,44 @@ int ompi_coll_libnbc_iallgatherv(void* sendbuf, int sendcount, MPI_Datatype send return NBC_OK; } + + + +#ifdef __cplusplus +extern "C" { +#endif +/* Fortran bindings */ +#ifdef HAVE_SYS_WEAK_ALIAS_PRAGMA +NBC_F77_ALLFUNC_(nbc_iallgatherv,NBC_IALLGATHERV,(void *sendbuf, int *sendcount, int *sendtype, void *recvbuf, int *recvcounts, int *displs, int *recvtype, int *fcomm, int *fhandle, int *ierr)); +#pragma weak NBC_IALLGATHERV = nbc_iallgatherv_f +#pragma weak nbc_iallgatherv = nbc_iallgatherv_f +#pragma weak nbc_iallgatherv_ = nbc_iallgatherv_f +#pragma weak nbc_iallgatherv__ = nbc_iallgatherv_f +#pragma weak PNBC_IALLGATHERV = nbc_iallgatherv_f +#pragma weak pnbc_iallgatherv = nbc_iallgatherv_f +#pragma weak pnbc_iallgatherv_ = nbc_iallgatherv_f +#pragma weak pnbc_iallgatherv__ = nbc_iallgatherv_f +void nbc_iallgatherv_f(void *sendbuf, int *sendcount, int *sendtype, void *recvbuf, int *recvcounts, int *displs, int *recvtype, int *fcomm, int *fhandle, int *ierr) { +#else +void NBC_F77_FUNC_(nbc_iallgatherv,NBC_IALLGATHERV)(void *sendbuf, int *sendcount, int *sendtype, void *recvbuf, int *recvcounts, int *displs, int *recvtype, int *fcomm, int *fhandle, int *ierr); +void NBC_F77_FUNC_(nbc_iallgatherv,NBC_IALLGATHERV)(void *sendbuf, int *sendcount, int *sendtype, void *recvbuf, int *recvcounts, int *displs, int *recvtype, int *fcomm, int *fhandle, int *ierr) { +#endif + MPI_Datatype rtype, stype; + MPI_Comm comm; + NBC_Handle *handle; + + /* this is the only MPI-2 we need :-( */ + rtype = MPI_Type_f2c(*recvtype); + stype = MPI_Type_f2c(*sendtype); + comm = MPI_Comm_f2c(*fcomm); + + /* create a new handle in handle table */ + NBC_Create_fortran_handle(fhandle, &handle); + + /* call NBC function */ + *ierr = NBC_Iallgatherv(sendbuf, *sendcount, stype, recvbuf, recvcounts, displs, rtype, comm, handle); +} + +#ifdef __cplusplus +} +#endif diff --git a/ompi/mca/coll/libnbc/nbc_iallreduce.c b/ompi/mca/coll/libnbc/nbc_iallreduce.c index d096c75ff3..9551860592 100644 --- a/ompi/mca/coll/libnbc/nbc_iallreduce.c +++ b/ompi/mca/coll/libnbc/nbc_iallreduce.c @@ -15,6 +15,31 @@ static inline int allred_sched_diss(int rank, int p, int count, MPI_Datatype dat static inline int allred_sched_chain(int rank, int p, int count, MPI_Datatype datatype, void *sendbuf, void *recvbuf, MPI_Op op, int size, int ext, NBC_Schedule *schedule, NBC_Handle *handle, int fragsize); static inline int allred_sched_ring(int rank, int p, int count, MPI_Datatype datatype, void *sendbuf, void *recvbuf, MPI_Op op, int size, int ext, NBC_Schedule *schedule, NBC_Handle *handle); +// DCMF allreduce is actually not non-blocking!!! +#ifdef USE_DCMF +#undef USE_DCMF +#endif + +#ifdef USE_DCMF +#error "DCMF allreduce is not nonblocking and thus disabled" +#include +static int initialized=0; +static void cbfunc(void *clientdata, DCMF_Error_t *error) { + //printf("in allreduce callback!\n"); + *(unsigned*)clientdata=2; +} + +DCMF_Protocol_t allred_reg; +DCMF_Request_t allred_req; + +static void init_dcmf_allred() { + DCMF_GlobalAllreduce_Configuration_t allred_config; + allred_config.protocol = DCMF_DEFAULT_GLOBALALLREDUCE_PROTOCOL; + DCMF_GlobalAllreduce_register(&allred_reg, &allred_config); + initialized=1; +} +#endif + #ifdef NBC_CACHE_SCHEDULE /* tree comparison function for schedule cache */ int NBC_Allreduce_args_compare(NBC_Allreduce_args *a, NBC_Allreduce_args *b, void *param) { @@ -33,10 +58,12 @@ int NBC_Allreduce_args_compare(NBC_Allreduce_args *a, NBC_Allreduce_args *b, voi } #endif -int ompi_coll_libnbc_iallreduce(void* sendbuf, void* recvbuf, int count, MPI_Datatype datatype, MPI_Op op, - struct ompi_communicator_t *comm, ompi_request_t ** request, - struct mca_coll_base_module_2_0_0_t *module) -{ +#ifdef HAVE_SYS_WEAK_ALIAS_PRAGMA +#pragma weak NBC_Iallreduce=PNBC_Iallreduce +#define NBC_Iallreduce PNBC_Iallreduce +#endif + +int NBC_Iallreduce(void* sendbuf, void* recvbuf, int count, MPI_Datatype datatype, MPI_Op op, MPI_Comm comm, NBC_Handle* handle) { int rank, p, res, size; MPI_Aint ext; NBC_Schedule *schedule; @@ -45,13 +72,74 @@ int ompi_coll_libnbc_iallreduce(void* sendbuf, void* recvbuf, int count, MPI_Dat #endif enum { NBC_ARED_BINOMIAL, NBC_ARED_RING } alg; char inplace; - NBC_Handle *handle; - ompi_coll_libnbc_request_t **coll_req = (ompi_coll_libnbc_request_t**) request; - ompi_coll_libnbc_module_t *libnbc_module = (ompi_coll_libnbc_module_t*) module; +#ifdef USE_DCMF + int ws, s; + MPI_Comm_size(comm, &s); + MPI_Comm_size(MPI_COMM_WORLD, &ws); + if(s != ws) { + printf("DCMF only works on MPI_COMM_WORLD (or dups of it) for now -- fallback needs to be implemented :-)\n"); + return NBC_NOT_IMPLEMENTED; + } + if(!initialized) init_dcmf_allred(); + handle->dcmf_hndl = (NBC_DCMF_Handle*)malloc(sizeof(NBC_DCMF_Handle)); + handle->dcmf_hndl->done=0; + handle->dcmf_hndl->type=DCMF_TYPE_ALLREDUCE; + DCMF_Callback_t callback={ cbfunc, &handle->dcmf_hndl->done }; + + + DCMF_Dt dt; + switch(datatype) { + case MPI_UNSIGNED_LONG_LONG: + dt = DCMF_UNSIGNED_LONG_LONG; + break; + case MPI_LONG_LONG: + dt = DCMF_SIGNED_LONG_LONG; + break; + case MPI_UNSIGNED: + dt = DCMF_UNSIGNED_INT; + break; + case MPI_INT: + dt = DCMF_SIGNED_INT; + break; + case MPI_UNSIGNED_LONG: // we assume it's the same as integer!!! + dt = DCMF_UNSIGNED_INT; + assert(sizeof(unsigned int) == sizeof(unsigned long)); + break; + case MPI_LONG: // we assume it's the same as integer !!! + dt = DCMF_SIGNED_INT; + assert(sizeof(int) == sizeof(long)); + break; + case MPI_DOUBLE: + dt = DCMF_DOUBLE; + break; + default: + printf("Datatype not supported\n"); + return NBC_NOT_IMPLEMENTED; + break; + } + + DCMF_Op dop; + switch(op) { + case MPI_SUM: + dop = DCMF_SUM; + break; + default: + printf("Operations not supported\n"); + return NBC_NOT_IMPLEMENTED; + break; + } + +int r; +MPI_Comm_rank(comm, &r); +printf("[%i] LibNBC starting allreduce\n", r); + DCMF_GlobalAllreduce(&allred_reg, &allred_req, callback, DCMF_MATCH_CONSISTENCY, -1 /* root?? */, (char*)sendbuf, (char*)recvbuf, count, dt, dop); +printf("[%i] LibNBC after allreduce\n", r); + +#else NBC_IN_PLACE(sendbuf, recvbuf, inplace); - res = NBC_Init_handle(comm, coll_req, libnbc_module); + res = NBC_Init_handle(handle, comm); if(res != NBC_OK) { printf("Error in NBC_Init_handle(%i)\n", res); return res; } res = MPI_Comm_rank(comm, &rank); if (MPI_SUCCESS != res) { printf("MPI Error in MPI_Comm_rank() (%i)\n", res); return res; } @@ -130,6 +218,7 @@ int ompi_coll_libnbc_iallreduce(void* sendbuf, void* recvbuf, int count, MPI_Dat res = NBC_Start(handle, schedule); if(res != NBC_OK) { free(handle->tmpbuf); printf("Error in NBC_Start() (%i)\n", res); return res; } +#endif /* tmpbuf is freed with the handle */ return NBC_OK; @@ -350,7 +439,8 @@ static inline int allred_sched_ring(int r, int p, int count, MPI_Datatype dataty int i; /* runner */ int segsize, *segsizes, *segoffsets; /* segment sizes and offsets per segment (number of segments == number of nodes */ int speer, rpeer; /* send and recvpeer */ - + int res; + if(count == 0) return NBC_OK; { @@ -369,7 +459,7 @@ static inline int allred_sched_ring(int r, int p, int count, MPI_Datatype dataty mycount = 0; } if(i) segoffsets[i] = segoffsets[i-1] + segsizes[i-1]; - /*if(!r) printf("count: %i, (%i) size: %i, offset: %i\n", count, i, segsizes[i], segoffsets[i]); */ + //if(!r) printf("count: %i, (%i) size: %i, offset: %i\n", count, i, segsizes[i], segoffsets[i]); } } @@ -487,12 +577,16 @@ static inline int allred_sched_ring(int r, int p, int count, MPI_Datatype dataty /* first message come out of sendbuf */ if(round == 0) { NBC_Sched_send((char*)sendbuf+soffset, false, segsizes[selement], datatype, speer, schedule); + //printf("[%i] round %i - sending %i\n", r, round, selement); } else { NBC_Sched_send((char*)recvbuf+soffset, false, segsizes[selement], datatype, speer, schedule); + //printf("[%i] round %i - sending %i\n", r, round, selement); } NBC_Sched_recv((char*)recvbuf+roffset, false, segsizes[relement], datatype, rpeer, schedule); + //printf("[%i] round %i - receiving %i\n", r, round, relement); NBC_Sched_barrier(schedule); + //printf("[%i] round %i - reducing %i\n", r, round, relement); NBC_Sched_op((char*)recvbuf+roffset, false, (char*)sendbuf+roffset, false, (char*)recvbuf+roffset, false, segsizes[relement], datatype, op, schedule); NBC_Sched_barrier(schedule); @@ -505,6 +599,7 @@ static inline int allred_sched_ring(int r, int p, int count, MPI_Datatype dataty int relement = (r-round + 2*p /*2*p avoids negative mod*/)%p; /* the element that I receive from my neighbor */ int roffset = segoffsets[relement]*ext; + //printf("[%i] round %i receiving %i sending %i\n", r, round, relement, selement); NBC_Sched_send((char*)recvbuf+soffset, false, segsizes[selement], datatype, speer, schedule); NBC_Sched_recv((char*)recvbuf+roffset, false, segsizes[relement], datatype, rpeer, schedule); NBC_Sched_barrier(schedule); @@ -512,5 +607,49 @@ static inline int allred_sched_ring(int r, int p, int count, MPI_Datatype dataty } while (round < 2*p-2); } + //NBC_PRINT_SCHED(*schedule); + return NBC_OK; } + + + +#ifdef __cplusplus +extern "C" { +#endif +/* Fortran bindings */ +#ifdef HAVE_SYS_WEAK_ALIAS_PRAGMA +NBC_F77_ALLFUNC_(nbc_iallreduce,NBC_IALLREDUCE,(void *sendbuf, void *recvbuf, int *count, int *datatype, int *fop, int *fcomm, int *fhandle, int *ierr)); +#pragma weak NBC_IALLREDUCE = nbc_iallreduce_f +#pragma weak nbc_iallreduce = nbc_iallreduce_f +#pragma weak nbc_iallreduce_ = nbc_iallreduce_f +#pragma weak nbc_iallreduce__ = nbc_iallreduce_f +#pragma weak PNBC_IALLREDUCE = nbc_iallreduce_f +#pragma weak pnbc_iallreduce = nbc_iallreduce_f +#pragma weak pnbc_iallreduce_ = nbc_iallreduce_f +#pragma weak pnbc_iallreduce__ = nbc_iallreduce_f +void nbc_iallreduce_f(void *sendbuf, void *recvbuf, int *count, int *datatype, int *fop, int *fcomm, int *fhandle, int *ierr) { +#else +void NBC_F77_FUNC_(nbc_iallreduce,NBC_IALLREDUCE)(void *sendbuf, void *recvbuf, int *count, int *datatype, int *fop, int *fcomm, int *fhandle, int *ierr); +void NBC_F77_FUNC_(nbc_iallreduce,NBC_IALLREDUCE)(void *sendbuf, void *recvbuf, int *count, int *datatype, int *fop, int *fcomm, int *fhandle, int *ierr) { +#endif + MPI_Datatype dtype; + MPI_Comm comm; + MPI_Op op; + NBC_Handle *handle; + + /* this is the only MPI-2 we need :-( */ + dtype = MPI_Type_f2c(*datatype); + comm = MPI_Comm_f2c(*fcomm); + op = MPI_Op_f2c(*fop); + + /* create a new handle in handle table */ + NBC_Create_fortran_handle(fhandle, &handle); + + /* call NBC function */ + *ierr = NBC_Iallreduce(sendbuf, recvbuf, *count, dtype, op, comm, handle); +} + +#ifdef __cplusplus +} +#endif diff --git a/ompi/mca/coll/libnbc/nbc_ialltoall.c b/ompi/mca/coll/libnbc/nbc_ialltoall.c index 9cdab277f9..72255a25bf 100644 --- a/ompi/mca/coll/libnbc/nbc_ialltoall.c +++ b/ompi/mca/coll/libnbc/nbc_ialltoall.c @@ -33,11 +33,13 @@ int NBC_Alltoall_args_compare(NBC_Alltoall_args *a, NBC_Alltoall_args *b, void * } #endif +#ifdef HAVE_SYS_WEAK_ALIAS_PRAGMA +#pragma weak NBC_Ialltoall=PNBC_Ialltoall +#define NBC_Ialltoall PNBC_Ialltoall +#endif + /* simple linear MPI_Ialltoall the (simple) algorithm just sends to all nodes */ -int ompi_coll_libnbc_ialltoall(void* sendbuf, int sendcount, MPI_Datatype sendtype, void* recvbuf, int recvcount, - MPI_Datatype recvtype, struct ompi_communicator_t *comm, ompi_request_t ** request, - struct mca_coll_base_module_2_0_0_t *module) -{ +int NBC_Ialltoall(void* sendbuf, int sendcount, MPI_Datatype sendtype, void* recvbuf, int recvcount, MPI_Datatype recvtype, MPI_Comm comm, NBC_Handle *handle) { int rank, p, res, a2asize, sndsize, datasize; NBC_Schedule *schedule; MPI_Aint rcvext, sndext; @@ -46,13 +48,10 @@ int ompi_coll_libnbc_ialltoall(void* sendbuf, int sendcount, MPI_Datatype sendty #endif char *rbuf, *sbuf, inplace; enum {NBC_A2A_LINEAR, NBC_A2A_PAIRWISE, NBC_A2A_DISS} alg; - NBC_Handle *handle; - ompi_coll_libnbc_request_t **coll_req = (ompi_coll_libnbc_request_t**) request; - ompi_coll_libnbc_module_t *libnbc_module = (ompi_coll_libnbc_module_t*) module; NBC_IN_PLACE(sendbuf, recvbuf, inplace); - res = NBC_Init_handle(comm, coll_req, libnbc_module); + res = NBC_Init_handle(handle, comm); if(res != NBC_OK) { printf("Error in NBC_Init_handle(%i)\n", res); return res; } res = MPI_Comm_rank(comm, &rank); if (MPI_SUCCESS != res) { printf("MPI Error in MPI_Comm_rank() (%i)\n", res); return res; } @@ -315,3 +314,45 @@ static inline int a2a_sched_diss(int rank, int p, MPI_Aint sndext, MPI_Aint rcve return NBC_OK; } + +#ifdef __cplusplus +extern "C" { +#endif +/* Fortran bindings */ +#ifdef HAVE_SYS_WEAK_ALIAS_PRAGMA +NBC_F77_ALLFUNC_(nbc_ialltoall,NBC_IALLTOALL,(void *sendbuf, int *sendcount, int *sendtype, + void *recvbuf, int *recvcount, int *recvtype, int *fcomm, int *fhandle, int *ierr)); +#pragma weak NBC_IALLTOALL = nbc_ialltoall_f +#pragma weak nbc_ialltoall = nbc_ialltoall_f +#pragma weak nbc_ialltoall_ = nbc_ialltoall_f +#pragma weak nbc_ialltoall__ = nbc_ialltoall_f +#pragma weak PNBC_IALLTOALL = nbc_ialltoall_f +#pragma weak pnbc_ialltoall = nbc_ialltoall_f +#pragma weak pnbc_ialltoall_ = nbc_ialltoall_f +#pragma weak pnbc_ialltoall__ = nbc_ialltoall_f +void nbc_ialltoall_f(void *sendbuf, int *sendcount, int *sendtype, + void *recvbuf, int *recvcount, int *recvtype, int *fcomm, int *fhandle, int *ierr) { +#else +void NBC_F77_FUNC_(nbc_ialltoall,NBC_IALLTOALL)(void *sendbuf, int *sendcount, int *sendtype, + void *recvbuf, int *recvcount, int *recvtype, int *fcomm, int *fhandle, int *ierr); +void NBC_F77_FUNC_(nbc_ialltoall,NBC_IALLTOALL)(void *sendbuf, int *sendcount, int *sendtype, + void *recvbuf, int *recvcount, int *recvtype, int *fcomm, int *fhandle, int *ierr) { +#endif + MPI_Datatype rtype, stype; + MPI_Comm comm; + NBC_Handle *handle; + + /* this is the only MPI-2 we need :-( */ + rtype = MPI_Type_f2c(*recvtype); + stype = MPI_Type_f2c(*sendtype); + comm = MPI_Comm_f2c(*fcomm); + + /* create a new handle in handle table */ + NBC_Create_fortran_handle(fhandle, &handle); + + /* call NBC function */ + *ierr = NBC_Ialltoall(sendbuf, *sendcount, stype, recvbuf, *recvcount, rtype, comm, handle); +} +#ifdef __cplusplus +} +#endif diff --git a/ompi/mca/coll/libnbc/nbc_ialltoallv.c b/ompi/mca/coll/libnbc/nbc_ialltoallv.c index 753a10ef78..e2705bc720 100644 --- a/ompi/mca/coll/libnbc/nbc_ialltoallv.c +++ b/ompi/mca/coll/libnbc/nbc_ialltoallv.c @@ -14,23 +14,24 @@ * ot the recvcounts array may change, so a comparison of the address * would not be sufficient ... we simply do not cache it */ +#ifdef HAVE_SYS_WEAK_ALIAS_PRAGMA +#pragma weak NBC_Ialltoallv=PNBC_Ialltoallv +#define NBC_Ialltoallv PNBC_Ialltoallv +#endif + /* simple linear Alltoallv */ -int ompi_coll_libnbc_ialltoallv(void* sendbuf, int *sendcounts, int *sdispls, - MPI_Datatype sendtype, void* recvbuf, int *recvcounts, int *rdispls, - MPI_Datatype recvtype, struct ompi_communicator_t *comm, ompi_request_t ** request, - struct mca_coll_base_module_2_0_0_t *module) -{ +int NBC_Ialltoallv(void* sendbuf, int *sendcounts, int *sdispls, + MPI_Datatype sendtype, void* recvbuf, int *recvcounts, int *rdispls, + MPI_Datatype recvtype, MPI_Comm comm, NBC_Handle* handle) { + int rank, p, res, i; MPI_Aint sndext, rcvext; NBC_Schedule *schedule; char *rbuf, *sbuf, inplace; - NBC_Handle *handle; - ompi_coll_libnbc_request_t **coll_req = (ompi_coll_libnbc_request_t**) request; - ompi_coll_libnbc_module_t *libnbc_module = (ompi_coll_libnbc_module_t*) module; NBC_IN_PLACE(sendbuf, recvbuf, inplace); - res = NBC_Init_handle(comm, coll_req, libnbc_module); + res = NBC_Init_handle(handle, comm); if(res != NBC_OK) { printf("Error in NBC_Init_handle(%i)\n", res); return res; } res = MPI_Comm_rank(comm, &rank); if (MPI_SUCCESS != res) { printf("MPI Error in MPI_Comm_rank() (%i)\n", res); return res; } @@ -83,3 +84,46 @@ int ompi_coll_libnbc_ialltoallv(void* sendbuf, int *sendcounts, int *sdispls, return NBC_OK; } + + +#ifdef __cplusplus +extern "C" { +#endif +/* Fortran bindings */ +#ifdef HAVE_SYS_WEAK_ALIAS_PRAGMA +NBC_F77_ALLFUNC_(nbc_ialltoallv,NBC_IALLTOALLV,(void *sendbuf, int *sendcounts, int *sdispls, int *sendtype, + void *recvbuf, int *recvcounts, int *rdispls, int *recvtype, int *fcomm, int *fhandle, int *ierr)); +#pragma weak NBC_IALLTOALLV = nbc_ialltoallv_f +#pragma weak nbc_ialltoallv = nbc_ialltoallv_f +#pragma weak nbc_ialltoallv_ = nbc_ialltoallv_f +#pragma weak nbc_ialltoallv__ = nbc_ialltoallv_f +#pragma weak PNBC_IALLTOALLV = nbc_ialltoallv_f +#pragma weak pnbc_ialltoallv = nbc_ialltoallv_f +#pragma weak pnbc_ialltoallv_ = nbc_ialltoallv_f +#pragma weak pnbc_ialltoallv__ = nbc_ialltoallv_f +void nbc_ialltoallv_f(void *sendbuf, int *sendcounts, int *sdispls, int *sendtype, + void *recvbuf, int *recvcounts, int *rdispls, int *recvtype, int *fcomm, int *fhandle, int *ierr) { +#else +void NBC_F77_FUNC_(nbc_ialltoallv,NBC_IALLTOALLV)(void *sendbuf, int *sendcounts, int *sdispls, int *sendtype, + void *recvbuf, int *recvcounts, int *rdispls, int *recvtype, int *fcomm, int *fhandle, int *ierr); +void NBC_F77_FUNC_(nbc_ialltoallv,NBC_IALLTOALLV)(void *sendbuf, int *sendcounts, int *sdispls, int *sendtype, + void *recvbuf, int *recvcounts, int *rdispls, int *recvtype, int *fcomm, int *fhandle, int *ierr) { +#endif + MPI_Datatype rtype, stype; + MPI_Comm comm; + NBC_Handle *handle; + + /* this is the only MPI-2 we need :-( */ + rtype = MPI_Type_f2c(*recvtype); + stype = MPI_Type_f2c(*sendtype); + comm = MPI_Comm_f2c(*fcomm); + + /* create a new handle in handle table */ + NBC_Create_fortran_handle(fhandle, &handle); + + /* call NBC function */ + *ierr = NBC_Ialltoallv(sendbuf, sendcounts, sdispls, stype, recvbuf, recvcounts, rdispls, rtype, comm, handle); +} +#ifdef __cplusplus +} +#endif diff --git a/ompi/mca/coll/libnbc/nbc_ibcast.c b/ompi/mca/coll/libnbc/nbc_ibcast.c index c7c8419320..9114020aad 100644 --- a/ompi/mca/coll/libnbc/nbc_ibcast.c +++ b/ompi/mca/coll/libnbc/nbc_ibcast.c @@ -31,21 +31,20 @@ int NBC_Bcast_args_compare(NBC_Bcast_args *a, NBC_Bcast_args *b, void *param) { } #endif -int ompi_coll_libnbc_ibcast(void *buffer, int count, MPI_Datatype datatype, int root, - struct ompi_communicator_t *comm, ompi_request_t ** request, - struct mca_coll_base_module_2_0_0_t *module) -{ +#ifdef HAVE_SYS_WEAK_ALIAS_PRAGMA +#pragma weak NBC_Ibcast=PNBC_Ibcast +#define NBC_Ibcast PNBC_Ibcast +#endif + +int NBC_Ibcast(void *buffer, int count, MPI_Datatype datatype, int root, MPI_Comm comm, NBC_Handle* handle) { int rank, p, res, size, segsize; NBC_Schedule *schedule; #ifdef NBC_CACHE_SCHEDULE NBC_Bcast_args *args, *found, search; #endif enum { NBC_BCAST_LINEAR, NBC_BCAST_BINOMIAL, NBC_BCAST_CHAIN } alg; - NBC_Handle *handle; - ompi_coll_libnbc_request_t **coll_req = (ompi_coll_libnbc_request_t**) request; - ompi_coll_libnbc_module_t *libnbc_module = (ompi_coll_libnbc_module_t*) module; - - res = NBC_Init_handle(comm, coll_req, libnbc_module); + + res = NBC_Init_handle(handle, comm); if(res != NBC_OK) { printf("Error in NBC_Init_handle(%i)\n", res); return res; } res = MPI_Comm_rank(comm, &rank); if (MPI_SUCCESS != res) { printf("MPI Error in MPI_Comm_rank() (%i)\n", res); return res; } @@ -249,3 +248,40 @@ static inline int bcast_sched_chain(int rank, int p, int root, NBC_Schedule *sch return NBC_OK; } + +#ifdef __cplusplus +extern "C" { +#endif +/* Fortran bindings */ +#ifdef HAVE_SYS_WEAK_ALIAS_PRAGMA +NBC_F77_ALLFUNC_(nbc_ibcast,NBC_IBCAST,(void *buf, int *count, int *datatype, int *root, int *fcomm, int *fhandle, int *ierr)); +#pragma weak NBC_IBCAST = nbc_ibcast_f +#pragma weak nbc_ibcast = nbc_ibcast_f +#pragma weak nbc_ibcast_ = nbc_ibcast_f +#pragma weak nbc_ibcast__ = nbc_ibcast_f +#pragma weak PNBC_IBCAST = nbc_ibcast_f +#pragma weak pnbc_ibcast = nbc_ibcast_f +#pragma weak pnbc_ibcast_ = nbc_ibcast_f +#pragma weak pnbc_ibcast__ = nbc_ibcast_f +void nbc_ibcast_f(void *buf, int *count, int *datatype, int *root, int *fcomm, int *fhandle, int *ierr) { +#else +void NBC_F77_FUNC_(nbc_ibcast,NBC_IBCAST)(void *buf, int *count, int *datatype, int *root, int *fcomm, int *fhandle, int *ierr); +void NBC_F77_FUNC_(nbc_ibcast,NBC_IBCAST)(void *buf, int *count, int *datatype, int *root, int *fcomm, int *fhandle, int *ierr) { +#endif + MPI_Datatype dtype; + MPI_Comm comm; + NBC_Handle *handle; + + /* this is the only MPI-2 we need :-( */ + dtype = MPI_Type_f2c(*datatype); + comm = MPI_Comm_f2c(*fcomm); + + /* create a new handle in handle table */ + NBC_Create_fortran_handle(fhandle, &handle); + + /* call NBC function */ + *ierr = NBC_Ibcast(buf, *count, dtype, *root, comm, handle); +} +#ifdef __cplusplus +} +#endif diff --git a/ompi/mca/coll/libnbc/nbc_ibcast_inter.c b/ompi/mca/coll/libnbc/nbc_ibcast_inter.c index 7f2e9451b2..dfaa889f4b 100644 --- a/ompi/mca/coll/libnbc/nbc_ibcast_inter.c +++ b/ompi/mca/coll/libnbc/nbc_ibcast_inter.c @@ -10,16 +10,15 @@ */ #include "nbc_internal.h" -int ompi_coll_libnbc_ibcast_inter(void *buffer, int count, MPI_Datatype datatype, int root, - struct ompi_communicator_t *comm, ompi_request_t ** request, - struct mca_coll_base_module_2_0_0_t *module) { - int rank, p, res, size, peer; - NBC_Schedule *schedule; - NBC_Handle *handle; - ompi_coll_libnbc_request_t **coll_req = (ompi_coll_libnbc_request_t**) request; - ompi_coll_libnbc_module_t *libnbc_module = (ompi_coll_libnbc_module_t*) module; +#ifdef __cplusplus +extern "C" { +#endif - res = NBC_Init_handle(comm, coll_req, libnbc_module); +int NBC_Ibcast_inter(void *buffer, int count, MPI_Datatype datatype, int root, MPI_Comm comm, NBC_Handle* handle) { + int rank, p, res, size, segsize, peer; + NBC_Schedule *schedule; + + res = NBC_Init_handle(handle, comm); if(res != NBC_OK) { printf("Error in NBC_Init_handle(%i)\n", res); return res; } res = MPI_Comm_rank(comm, &rank); if (MPI_SUCCESS != res) { printf("MPI Error in MPI_Comm_rank() (%i)\n", res); return res; } @@ -41,7 +40,7 @@ int ompi_coll_libnbc_ibcast_inter(void *buffer, int count, MPI_Datatype datatype int remsize; res = MPI_Comm_remote_size(comm, &remsize); - if(MPI_SUCCESS != res) { printf("MPI_Comm_remote_size() failed\n"); return res; } + if(MPI_SUCCESS != res) { printf("MPI_Comm_remote_size() failed\n", res); return res; } for (peer=0;peer #include #include diff --git a/ompi/mca/coll/libnbc/nbc_ireduce.c b/ompi/mca/coll/libnbc/nbc_ireduce.c index 13b4352625..50379e6ee0 100644 --- a/ompi/mca/coll/libnbc/nbc_ireduce.c +++ b/ompi/mca/coll/libnbc/nbc_ireduce.c @@ -32,10 +32,13 @@ int NBC_Reduce_args_compare(NBC_Reduce_args *a, NBC_Reduce_args *b, void *param) } #endif +#ifdef HAVE_SYS_WEAK_ALIAS_PRAGMA +#pragma weak NBC_Ireduce=PNBC_Ireduce +#define NBC_Ireduce PNBC_Ireduce +#endif + /* the non-blocking reduce */ -int ompi_coll_libnbc_ireduce(void* sendbuf, void* recvbuf, int count, MPI_Datatype datatype, - MPI_Op op, int root, struct ompi_communicator_t *comm, ompi_request_t ** request, - struct mca_coll_base_module_2_0_0_t *module) { +int NBC_Ireduce(void* sendbuf, void* recvbuf, int count, MPI_Datatype datatype, MPI_Op op, int root, MPI_Comm comm, NBC_Handle* handle) { int rank, p, res, segsize, size; MPI_Aint ext; NBC_Schedule *schedule; @@ -44,13 +47,10 @@ int ompi_coll_libnbc_ireduce(void* sendbuf, void* recvbuf, int count, MPI_Dataty NBC_Reduce_args *args, *found, search; #endif enum { NBC_RED_BINOMIAL, NBC_RED_CHAIN } alg; - NBC_Handle *handle; - ompi_coll_libnbc_request_t **coll_req = (ompi_coll_libnbc_request_t**) request; - ompi_coll_libnbc_module_t *libnbc_module = (ompi_coll_libnbc_module_t*) module; NBC_IN_PLACE(sendbuf, recvbuf, inplace); - res = NBC_Init_handle(comm, coll_req, libnbc_module); + res = NBC_Init_handle(handle, comm); if(res != NBC_OK) { printf("Error in NBC_Init_handle(%i)\n", res); return res; } res = MPI_Comm_rank(comm, &rank); if (MPI_SUCCESS != res) { printf("MPI Error in MPI_Comm_rank() (%i)\n", res); return res; } @@ -291,3 +291,43 @@ static inline int red_sched_chain(int rank, int p, int root, void *sendbuf, void return NBC_OK; } + + +#ifdef __cplusplus +extern "C" { +#endif +/* Fortran bindings */ +#ifdef HAVE_SYS_WEAK_ALIAS_PRAGMA +NBC_F77_ALLFUNC_(nbc_ireduce,NBC_IREDUCE,(void *sendbuf, void *recvbuf, int *count, int *datatype, int *fop, int *root, int *fcomm, int *fhandle, int *ierr)); +#pragma weak NBC_IREDUCE = nbc_ireduce_f +#pragma weak nbc_ireduce = nbc_ireduce_f +#pragma weak nbc_ireduce_ = nbc_ireduce_f +#pragma weak nbc_ireduce__ = nbc_ireduce_f +#pragma weak PNBC_IREDUCE = nbc_ireduce_f +#pragma weak pnbc_ireduce = nbc_ireduce_f +#pragma weak pnbc_ireduce_ = nbc_ireduce_f +#pragma weak pnbc_ireduce__ = nbc_ireduce_f +void nbc_ireduce_f(void *sendbuf, void *recvbuf, int *count, int *datatype, int *fop, int *root, int *fcomm, int *fhandle, int *ierr) { +#else +void NBC_F77_FUNC_(nbc_ireduce,NBC_IREDUCE)(void *sendbuf, void *recvbuf, int *count, int *datatype, int *fop, int *root, int *fcomm, int *fhandle, int *ierr); +void NBC_F77_FUNC_(nbc_ireduce,NBC_IREDUCE)(void *sendbuf, void *recvbuf, int *count, int *datatype, int *fop, int *root, int *fcomm, int *fhandle, int *ierr) { +#endif + MPI_Datatype dtype; + MPI_Comm comm; + MPI_Op op; + NBC_Handle *handle; + + /* this is the only MPI-2 we need :-( */ + dtype = MPI_Type_f2c(*datatype); + comm = MPI_Comm_f2c(*fcomm); + op = MPI_Op_f2c(*fop); + + /* create a new handle in handle table */ + NBC_Create_fortran_handle(fhandle, &handle); + + /* call NBC function */ + *ierr = NBC_Ireduce(sendbuf, recvbuf, *count, dtype, op, *root, comm, handle); +} +#ifdef __cplusplus +} +#endif diff --git a/ompi/mca/coll/libnbc/nbc_ireduce_scatter.c b/ompi/mca/coll/libnbc/nbc_ireduce_scatter.c index eeb53e30a5..4b5b453a8a 100644 --- a/ompi/mca/coll/libnbc/nbc_ireduce_scatter.c +++ b/ompi/mca/coll/libnbc/nbc_ireduce_scatter.c @@ -27,20 +27,19 @@ * */ -int ompi_coll_libnbc_ireduce_scatter(void* sendbuf, void* recvbuf, int *recvcounts, MPI_Datatype datatype, - MPI_Op op, struct ompi_communicator_t *comm, ompi_request_t ** request, - struct mca_coll_base_module_2_0_0_t *module) { +#ifdef HAVE_SYS_WEAK_ALIAS_PRAGMA +#pragma weak NBC_Ireduce_scatter=PNBC_Ireduce_scatter +#define NBC_Ireduce_scatter PNBC_Ireduce_scatter +#endif +int NBC_Ireduce_scatter(void* sendbuf, void* recvbuf, int *recvcounts, MPI_Datatype datatype, MPI_Op op, MPI_Comm comm, NBC_Handle* handle) { int peer, rank, maxr, p, r, res, count, offset, firstred; MPI_Aint ext; char *redbuf, *sbuf, inplace; NBC_Schedule *schedule; - NBC_Handle *handle; - ompi_coll_libnbc_request_t **coll_req = (ompi_coll_libnbc_request_t**) request; - ompi_coll_libnbc_module_t *libnbc_module = (ompi_coll_libnbc_module_t*) module; NBC_IN_PLACE(sendbuf, recvbuf, inplace); - res = NBC_Init_handle(comm, coll_req, libnbc_module); + res = NBC_Init_handle(handle, comm); if(res != NBC_OK) { printf("Error in NBC_Init_handle(%i)\n", res); return res; } res = MPI_Comm_rank(comm, &rank); if (MPI_SUCCESS != res) { printf("MPI Error in MPI_Comm_rank() (%i)\n", res); return res; } @@ -144,3 +143,43 @@ int ompi_coll_libnbc_ireduce_scatter(void* sendbuf, void* recvbuf, int *recvcoun /* tmpbuf is freed with the handle */ return NBC_OK; } + + +#ifdef __cplusplus +extern "C" { +#endif +/* Fortran bindings */ +#ifdef HAVE_SYS_WEAK_ALIAS_PRAGMA +NBC_F77_ALLFUNC_(nbc_ireduce_scatter,NBC_IREDUCE_SCATTER,(void *sendbuf, void *recvbuf, int *recvcounts, int *datatype, int *fop, int *fcomm, int *fhandle, int *ierr)); +#pragma weak NBC_IREDUCE_SCATTER = nbc_ireduce_scatter_f +#pragma weak nbc_ireduce_scatter = nbc_ireduce_scatter_f +#pragma weak nbc_ireduce_scatter_ = nbc_ireduce_scatter_f +#pragma weak nbc_ireduce_scatter__ = nbc_ireduce_scatter_f +#pragma weak PNBC_IREDUCE_SCATTER = nbc_ireduce_scatter_f +#pragma weak pnbc_ireduce_scatter = nbc_ireduce_scatter_f +#pragma weak pnbc_ireduce_scatter_ = nbc_ireduce_scatter_f +#pragma weak pnbc_ireduce_scatter__ = nbc_ireduce_scatter_f +void nbc_ireduce_scatter_f(void *sendbuf, void *recvbuf, int *recvcounts, int *datatype, int *fop, int *fcomm, int *fhandle, int *ierr) { +#else +void NBC_F77_FUNC_(nbc_ireduce_scatter,NBC_IREDUCE_SCATTER)(void *sendbuf, void *recvbuf, int *recvcounts, int *datatype, int *fop, int *fcomm, int *fhandle, int *ierr); +void NBC_F77_FUNC_(nbc_ireduce_scatter,NBC_IREDUCE_SCATTER)(void *sendbuf, void *recvbuf, int *recvcounts, int *datatype, int *fop, int *fcomm, int *fhandle, int *ierr) { +#endif + MPI_Datatype dtype; + MPI_Comm comm; + MPI_Op op; + NBC_Handle *handle; + + /* this is the only MPI-2 we need :-( */ + dtype = MPI_Type_f2c(*datatype); + comm = MPI_Comm_f2c(*fcomm); + op = MPI_Op_f2c(*fop); + + /* create a new handle in handle table */ + NBC_Create_fortran_handle(fhandle, &handle); + + /* call NBC function */ + *ierr = NBC_Ireduce_scatter(sendbuf, recvbuf, recvcounts, dtype, op, comm, handle); +} +#ifdef __cplusplus +} +#endif diff --git a/ompi/mca/coll/libnbc/nbc_iscan.c b/ompi/mca/coll/libnbc/nbc_iscan.c index 63db399325..aea6bbde2f 100644 --- a/ompi/mca/coll/libnbc/nbc_iscan.c +++ b/ompi/mca/coll/libnbc/nbc_iscan.c @@ -35,9 +35,11 @@ int NBC_Scan_args_compare(NBC_Scan_args *a, NBC_Scan_args *b, void *param) { * 3. all but rank p-1 do sends to it's right neigbor and exits * */ -int ompi_coll_libnbc_iscan(void* sendbuf, void* recvbuf, int count, MPI_Datatype datatype, MPI_Op op, - struct ompi_communicator_t *comm, ompi_request_t ** request, - struct mca_coll_base_module_2_0_0_t *module) { +#ifdef HAVE_SYS_WEAK_ALIAS_PRAGMA +#pragma weak NBC_Iscan=PNBC_Iscan +#define NBC_Iscan PNBC_Iscan +#endif +int NBC_Iscan(void* sendbuf, void* recvbuf, int count, MPI_Datatype datatype, MPI_Op op, MPI_Comm comm, NBC_Handle* handle) { int rank, p, res; MPI_Aint ext; NBC_Schedule *schedule; @@ -45,13 +47,10 @@ int ompi_coll_libnbc_iscan(void* sendbuf, void* recvbuf, int count, MPI_Datatype NBC_Scan_args *args, *found, search; #endif char inplace; - NBC_Handle *handle; - ompi_coll_libnbc_request_t **coll_req = (ompi_coll_libnbc_request_t**) request; - ompi_coll_libnbc_module_t *libnbc_module = (ompi_coll_libnbc_module_t*) module; NBC_IN_PLACE(sendbuf, recvbuf, inplace); - res = NBC_Init_handle(comm, coll_req, libnbc_module); + res = NBC_Init_handle(handle, comm); if(res != NBC_OK) { printf("Error in NBC_Init_handle(%i)\n", res); return res; } res = MPI_Comm_rank(comm, &rank); if (MPI_SUCCESS != res) { printf("MPI Error in MPI_Comm_rank() (%i)\n", res); return res; } @@ -133,3 +132,43 @@ int ompi_coll_libnbc_iscan(void* sendbuf, void* recvbuf, int count, MPI_Datatype /* tmpbuf is freed with the handle */ return NBC_OK; } + + +#ifdef __cplusplus +extern "C" { +#endif +/* Fortran bindings */ +#ifdef HAVE_SYS_WEAK_ALIAS_PRAGMA +NBC_F77_ALLFUNC_(nbc_iscan,NBC_ISCAN,(void *sendbuf, void *recvbuf, int *count, int *datatype, int *fop, int *fcomm, int *fhandle, int *ierr)); +#pragma weak NBC_ISCAN = nbc_iscan_f +#pragma weak nbc_iscan = nbc_iscan_f +#pragma weak nbc_iscan_ = nbc_iscan_f +#pragma weak nbc_iscan__ = nbc_iscan_f +#pragma weak PNBC_ISCAN = nbc_iscan_f +#pragma weak pnbc_iscan = nbc_iscan_f +#pragma weak pnbc_iscan_ = nbc_iscan_f +#pragma weak pnbc_iscan__ = nbc_iscan_f +void nbc_iscan_f(void *sendbuf, void *recvbuf, int *count, int *datatype, int *fop, int *fcomm, int *fhandle, int *ierr) { +#else +void NBC_F77_FUNC_(nbc_iscan,NBC_ISCAN)(void *sendbuf, void *recvbuf, int *count, int *datatype, int *fop, int *fcomm, int *fhandle, int *ierr); +void NBC_F77_FUNC_(nbc_iscan,NBC_ISCAN)(void *sendbuf, void *recvbuf, int *count, int *datatype, int *fop, int *fcomm, int *fhandle, int *ierr) { +#endif + MPI_Datatype dtype; + MPI_Comm comm; + MPI_Op op; + NBC_Handle *handle; + + /* this is the only MPI-2 we need :-( */ + dtype = MPI_Type_f2c(*datatype); + comm = MPI_Comm_f2c(*fcomm); + op = MPI_Op_f2c(*fop); + + /* create a new handle in handle table */ + NBC_Create_fortran_handle(fhandle, &handle); + + /* call NBC function */ + *ierr = NBC_Iscan(sendbuf, recvbuf, *count, dtype, op, comm, handle); +} +#ifdef __cplusplus +} +#endif diff --git a/ompi/mca/coll/libnbc/nbc_iscatter.c b/ompi/mca/coll/libnbc/nbc_iscatter.c index 5f232f2101..77d7b85a28 100644 --- a/ompi/mca/coll/libnbc/nbc_iscatter.c +++ b/ompi/mca/coll/libnbc/nbc_iscatter.c @@ -31,10 +31,11 @@ int NBC_Scatter_args_compare(NBC_Scatter_args *a, NBC_Scatter_args *b, void *par #endif /* simple linear MPI_Iscatter */ -int ompi_coll_libnbc_iscatter(void* sendbuf, int sendcount, MPI_Datatype sendtype, - void* recvbuf, int recvcount, MPI_Datatype recvtype, int root, - struct ompi_communicator_t *comm, ompi_request_t ** request, - struct mca_coll_base_module_2_0_0_t *module) { +#ifdef HAVE_SYS_WEAK_ALIAS_PRAGMA +#pragma weak NBC_Iscatter=PNBC_Iscatter +#define NBC_Iscatter PNBC_Iscatter +#endif +int NBC_Iscatter(void* sendbuf, int sendcount, MPI_Datatype sendtype, void* recvbuf, int recvcount, MPI_Datatype recvtype, int root, MPI_Comm comm, NBC_Handle* handle) { int rank, p, res, i; MPI_Aint sndext; NBC_Schedule *schedule; @@ -42,13 +43,10 @@ int ompi_coll_libnbc_iscatter(void* sendbuf, int sendcount, MPI_Datatype sendtyp #ifdef NBC_CACHE_SCHEDULE NBC_Scatter_args *args, *found, search; #endif - NBC_Handle *handle; - ompi_coll_libnbc_request_t **coll_req = (ompi_coll_libnbc_request_t**) request; - ompi_coll_libnbc_module_t *libnbc_module = (ompi_coll_libnbc_module_t*) module; NBC_IN_PLACE(sendbuf, recvbuf, inplace); - res = NBC_Init_handle(comm, coll_req, libnbc_module); + res = NBC_Init_handle(handle, comm); if(res != NBC_OK) { printf("Error in NBC_Init_handle(%i)\n", res); return res; } res = MPI_Comm_rank(comm, &rank); if (MPI_SUCCESS != res) { printf("MPI Error in MPI_Comm_rank() (%i)\n", res); return res; } @@ -131,3 +129,42 @@ int ompi_coll_libnbc_iscatter(void* sendbuf, int sendcount, MPI_Datatype sendtyp return NBC_OK; } + + +#ifdef __cplusplus +extern "C" { +#endif +/* Fortran bindings */ +#ifdef HAVE_SYS_WEAK_ALIAS_PRAGMA +NBC_F77_ALLFUNC_(nbc_iscatter,NBC_ISCATTER,(void *sendbuf, int *sendcount, int *sendtype, void *recvbuf, int *recvcount, int *recvtype, int *root, int *fcomm, int *fhandle, int *ierr)); +#pragma weak NBC_ISCATTER = nbc_iscatter_f +#pragma weak nbc_iscatter = nbc_iscatter_f +#pragma weak nbc_iscatter_ = nbc_iscatter_f +#pragma weak nbc_iscatter__ = nbc_iscatter_f +#pragma weak PNBC_ISCATTER = nbc_iscatter_f +#pragma weak pnbc_iscatter = nbc_iscatter_f +#pragma weak pnbc_iscatter_ = nbc_iscatter_f +#pragma weak pnbc_iscatter__ = nbc_iscatter_f +void nbc_iscatter_f(void *sendbuf, int *sendcount, int *sendtype, void *recvbuf, int *recvcount, int *recvtype, int *root, int *fcomm, int *fhandle, int *ierr) { +#else +void NBC_F77_FUNC_(nbc_iscatter,NBC_ISCATTER)(void *sendbuf, int *sendcount, int *sendtype, void *recvbuf, int *recvcount, int *recvtype, int *root, int *fcomm, int *fhandle, int *ierr); +void NBC_F77_FUNC_(nbc_iscatter,NBC_ISCATTER)(void *sendbuf, int *sendcount, int *sendtype, void *recvbuf, int *recvcount, int *recvtype, int *root, int *fcomm, int *fhandle, int *ierr) { +#endif + MPI_Datatype stype, rtype; + MPI_Comm comm; + NBC_Handle *handle; + + /* this is the only MPI-2 we need :-( */ + rtype = MPI_Type_f2c(*recvtype); + stype = MPI_Type_f2c(*sendtype); + comm = MPI_Comm_f2c(*fcomm); + + /* create a new handle in handle table */ + NBC_Create_fortran_handle(fhandle, &handle); + + /* call NBC function */ + *ierr = NBC_Iscatter(sendbuf, *sendcount, stype, recvbuf, *recvcount, rtype, *root, comm, handle); +} +#ifdef __cplusplus +} +#endif diff --git a/ompi/mca/coll/libnbc/nbc_iscatterv.c b/ompi/mca/coll/libnbc/nbc_iscatterv.c index fe8b914d54..b7706281b9 100644 --- a/ompi/mca/coll/libnbc/nbc_iscatterv.c +++ b/ompi/mca/coll/libnbc/nbc_iscatterv.c @@ -15,21 +15,19 @@ * would not be sufficient ... we simply do not cache it */ /* simple linear MPI_Iscatterv */ -int ompi_coll_libnbc_iscatterv(void* sendbuf, int *sendcounts, int *displs, MPI_Datatype sendtype, - void* recvbuf, int recvcount, MPI_Datatype recvtype, int root, - struct ompi_communicator_t *comm, ompi_request_t ** request, - struct mca_coll_base_module_2_0_0_t *module) { +#ifdef HAVE_SYS_WEAK_ALIAS_PRAGMA +#pragma weak NBC_Iscatterv=PNBC_Iscatterv +#define NBC_Iscatterv PNBC_Iscatterv +#endif +int NBC_Iscatterv(void* sendbuf, int *sendcounts, int *displs, MPI_Datatype sendtype, void* recvbuf, int recvcount, MPI_Datatype recvtype, int root, MPI_Comm comm, NBC_Handle* handle) { int rank, p, res, i; MPI_Aint sndext; NBC_Schedule *schedule; char *sbuf, inplace; - NBC_Handle *handle; - ompi_coll_libnbc_request_t **coll_req = (ompi_coll_libnbc_request_t**) request; - ompi_coll_libnbc_module_t *libnbc_module = (ompi_coll_libnbc_module_t*) module; NBC_IN_PLACE(sendbuf, recvbuf, inplace); - res = NBC_Init_handle(comm, coll_req, libnbc_module); + res = NBC_Init_handle(handle, comm); if(res != NBC_OK) { printf("Error in NBC_Init_handle(%i)\n", res); return res; } res = MPI_Comm_rank(comm, &rank); if (MPI_SUCCESS != res) { printf("MPI Error in MPI_Comm_rank() (%i)\n", res); return res; } @@ -76,3 +74,42 @@ int ompi_coll_libnbc_iscatterv(void* sendbuf, int *sendcounts, int *displs, MPI_ return NBC_OK; } + + +#ifdef __cplusplus +extern "C" { +#endif +/* Fortran bindings */ +#ifdef HAVE_SYS_WEAK_ALIAS_PRAGMA +NBC_F77_ALLFUNC_(nbc_iscatterv,NBC_ISCATTERV,(void *sendbuf, int *sendcounts, int *displs, int *sendtype, void *recvbuf, int *recvcount, int *recvtype, int *root, int *fcomm, int *fhandle, int *ierr)); +#pragma weak NBC_ISCATTERV = nbc_iscatterv_f +#pragma weak nbc_iscatterv = nbc_iscatterv_f +#pragma weak nbc_iscatterv_ = nbc_iscatterv_f +#pragma weak nbc_iscatterv__ = nbc_iscatterv_f +#pragma weak PNBC_ISCATTERV = nbc_iscatterv_f +#pragma weak pnbc_iscatterv = nbc_iscatterv_f +#pragma weak pnbc_iscatterv_ = nbc_iscatterv_f +#pragma weak pnbc_iscatterv__ = nbc_iscatterv_f +void nbc_iscatterv_f(void *sendbuf, int *sendcounts, int *displs, int *sendtype, void *recvbuf, int *recvcount, int *recvtype, int *root, int *fcomm, int *fhandle, int *ierr) { +#else +void NBC_F77_FUNC_(nbc_iscatterv,NBC_ISCATTERV)(void *sendbuf, int *sendcounts, int *displs, int *sendtype, void *recvbuf, int *recvcount, int *recvtype, int *root, int *fcomm, int *fhandle, int *ierr); +void NBC_F77_FUNC_(nbc_iscatterv,NBC_ISCATTERV)(void *sendbuf, int *sendcounts, int *displs, int *sendtype, void *recvbuf, int *recvcount, int *recvtype, int *root, int *fcomm, int *fhandle, int *ierr) { +#endif + MPI_Datatype stype, rtype; + MPI_Comm comm; + NBC_Handle *handle; + + /* this is the only MPI-2 we need :-( */ + rtype = MPI_Type_f2c(*recvtype); + stype = MPI_Type_f2c(*sendtype); + comm = MPI_Comm_f2c(*fcomm); + + /* create a new handle in handle table */ + NBC_Create_fortran_handle(fhandle, &handle); + + /* call NBC function */ + *ierr = NBC_Iscatterv(sendbuf, sendcounts, displs, stype, recvbuf, *recvcount, rtype, *root, comm, handle); +} +#ifdef __cplusplus +} +#endif diff --git a/ompi/mca/coll/libnbc/nbc_ompi_include.h b/ompi/mca/coll/libnbc/nbc_ompi_include.h new file mode 100644 index 0000000000..7bf02dee4a --- /dev/null +++ b/ompi/mca/coll/libnbc/nbc_ompi_include.h @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2006 The Trustees of Indiana University and Indiana + * University Research and Technology + * Corporation. All rights reserved. + * Copyright (c) 2006 The Technical University of Chemnitz. All + * rights reserved. + * + * Author(s): Torsten Hoefler + * + */ +/* this gets it's own file since it is used twice ... */ + +#include "ompi/include/mpi.h" +/* the autohell defines some macros ... that OMPI redefines ... but we + * need to undefine them before that *ARGH* */ +#undef PACKAGE_BUGREPORT +#undef PACKAGE_NAME +#undef PACKAGE_STRING +#undef PACKAGE_TARNAME +#undef PACKAGE_VERSION +#undef PACKAGE_BUGREPORT + +#include "ompi/include/ompi/constants.h" + +/* undefine the stuff set by ompi */ +#undef PACKAGE_BUGREPORT +#undef PACKAGE_NAME +#undef PACKAGE_STRING +#undef PACKAGE_TARNAME +#undef PACKAGE_VERSION +#undef PACKAGE_BUGREPORT + diff --git a/ompi/mca/coll/libnbc/nbc_op.c b/ompi/mca/coll/libnbc/nbc_op.c index 85fc55903d..5f03d617f6 100644 --- a/ompi/mca/coll/libnbc/nbc_op.c +++ b/ompi/mca/coll/libnbc/nbc_op.c @@ -8,7 +8,7 @@ * Author(s): Torsten Hoefler * */ -#include "nbc_internal.h" +#include "nbc.h" /****************** THIS FILE is automatically generated ********************* * changes will be deleted at the next generation of this file - see nbc_op.c.m4 */