@@ -859,4 +859,98 @@ _EXTERN_C_ void mpi_iscatter_(MPI_Fint *sendbuf, MPI_Fint *sendcount, MPI_Fint *
859
859
860
860
_EXTERN_C_ void mpi_iscatter__ (MPI_Fint * sendbuf , MPI_Fint * sendcount , MPI_Fint * sendtype , MPI_Fint * recvbuf , MPI_Fint * recvcount , MPI_Fint * recvtype , MPI_Fint * root , MPI_Fint * comm , MPI_Fint * request , MPI_Fint * ierr ) {
861
861
MPI_Iscatter_fortran_wrapper (sendbuf , sendcount , sendtype , recvbuf , recvcount , recvtype , root , comm , request , ierr );
862
+ }
863
+
864
+
865
+ static void MPI_Ireduce_fortran_wrapper (MPI_Fint * sendbuf , MPI_Fint * recvbuf , MPI_Fint * count , MPI_Fint * datatype , MPI_Fint * op , MPI_Fint * root , MPI_Fint * comm , MPI_Fint * request , MPI_Fint * ierr ) {
866
+ int _wrap_py_return_val = 0 ;
867
+
868
+ Tsc const tsc = rdtsc ();
869
+
870
+ #if (!defined(MPICH_HAS_C2F ) && defined(MPICH_NAME ) && (MPICH_NAME == 1 )) /* MPICH test */
871
+ _wrap_py_return_val = PMPI_Ireduce ((const void * )sendbuf , (void * )recvbuf , * count , (MPI_Datatype )(* datatype ), (MPI_Op )(* op ), * root , (MPI_Comm )(* comm ), (MPI_Request * )request );
872
+ #else /* MPI-2 safe call */
873
+ MPI_Request temp_request ;
874
+ temp_request = MPI_Request_f2c (* request );
875
+ _wrap_py_return_val = PMPI_Ireduce ((const void * )sendbuf , (void * )recvbuf , * count , MPI_Type_f2c (* datatype ), MPI_Op_f2c (* op ), * root , MPI_Comm_f2c (* comm ), & temp_request );
876
+ * request = MPI_Request_c2f (temp_request );
877
+ #endif /* MPICH test */
878
+
879
+ Tsc const duration = rdtsc () - tsc ;
880
+
881
+ int nb_bytes ;
882
+ PMPI_Type_size (MPI_Type_f2c (* datatype ), & nb_bytes );
883
+
884
+ MpiOp op_type ;
885
+ if ((MPI_Op )op == MPI_MAX ) {
886
+ op_type = Max ;
887
+ } else if ((MPI_Op )op == MPI_MIN ) {
888
+ op_type = Min ;
889
+ } else if ((MPI_Op )op == MPI_SUM ) {
890
+ op_type = Sum ;
891
+ } else if ((MPI_Op )op == MPI_PROD ) {
892
+ op_type = Prod ;
893
+ } else if ((MPI_Op )op == MPI_LAND ) {
894
+ op_type = Land ;
895
+ } else if ((MPI_Op )op == MPI_BAND ) {
896
+ op_type = Band ;
897
+ } else if ((MPI_Op )op == MPI_LOR ) {
898
+ op_type = Lor ;
899
+ } else if ((MPI_Op )op == MPI_BOR ) {
900
+ op_type = Bor ;
901
+ } else if ((MPI_Op )op == MPI_LXOR ) {
902
+ op_type = Lxor ;
903
+ } else if ((MPI_Op )op == MPI_BXOR ) {
904
+ op_type = Bxor ;
905
+ } else if ((MPI_Op )op == MPI_MAXLOC ) {
906
+ op_type = Maxloc ;
907
+ } else if ((MPI_Op )op == MPI_MINLOC ) {
908
+ op_type = Minloc ;
909
+ } else if ((MPI_Op )op == MPI_REPLACE ) {
910
+ op_type = Replace ;
911
+ } else if ((MPI_Op )op == MPI_OP_NULL ) {
912
+ op_type = Opnull ;
913
+ } else if ((MPI_Op )op == MPI_NO_OP ) {
914
+ op_type = Opnull ;
915
+ } else {
916
+ op_type = -1 ;
917
+ }
918
+
919
+ MpiCall const ireduce = {
920
+ .kind = Ireduce ,
921
+ .time = -1.0 ,
922
+ .tsc = tsc ,
923
+ .duration = duration ,
924
+ .current_rank = current_rank ,
925
+ .partner_rank = * root ,
926
+ .nb_bytes_s = nb_bytes ,
927
+ .nb_bytes_r = nb_bytes * (* count ),
928
+ .comm = PMPI_Comm_c2f ((MPI_Comm )comm ),
929
+ .req = * request ,
930
+ .tag = -1 ,
931
+ .required_thread_lvl = -1 ,
932
+ .provided_thread_lvl = -1 ,
933
+ .op_type = op_type ,
934
+ .finished = false,
935
+ };
936
+
937
+ register_mpi_call (ireduce );
938
+
939
+ * ierr = _wrap_py_return_val ;
940
+ }
941
+
942
+ _EXTERN_C_ void MPI_IREDUCE (MPI_Fint * sendbuf , MPI_Fint * recvbuf , MPI_Fint * count , MPI_Fint * datatype , MPI_Fint * op , MPI_Fint * root , MPI_Fint * comm , MPI_Fint * request , MPI_Fint * ierr ) {
943
+ MPI_Ireduce_fortran_wrapper (sendbuf , recvbuf , count , datatype , op , root , comm , request , ierr );
944
+ }
945
+
946
+ _EXTERN_C_ void mpi_ireduce (MPI_Fint * sendbuf , MPI_Fint * recvbuf , MPI_Fint * count , MPI_Fint * datatype , MPI_Fint * op , MPI_Fint * root , MPI_Fint * comm , MPI_Fint * request , MPI_Fint * ierr ) {
947
+ MPI_Ireduce_fortran_wrapper (sendbuf , recvbuf , count , datatype , op , root , comm , request , ierr );
948
+ }
949
+
950
+ _EXTERN_C_ void mpi_ireduce_ (MPI_Fint * sendbuf , MPI_Fint * recvbuf , MPI_Fint * count , MPI_Fint * datatype , MPI_Fint * op , MPI_Fint * root , MPI_Fint * comm , MPI_Fint * request , MPI_Fint * ierr ) {
951
+ MPI_Ireduce_fortran_wrapper (sendbuf , recvbuf , count , datatype , op , root , comm , request , ierr );
952
+ }
953
+
954
+ _EXTERN_C_ void mpi_ireduce__ (MPI_Fint * sendbuf , MPI_Fint * recvbuf , MPI_Fint * count , MPI_Fint * datatype , MPI_Fint * op , MPI_Fint * root , MPI_Fint * comm , MPI_Fint * request , MPI_Fint * ierr ) {
955
+ MPI_Ireduce_fortran_wrapper (sendbuf , recvbuf , count , datatype , op , root , comm , request , ierr );
862
956
}
0 commit comments