@@ -77,40 +77,39 @@ static int nbc_alltoall_init(const void* sendbuf, int sendcount, MPI_Datatype se
7777 rank = ompi_comm_rank (comm );
7878 p = ompi_comm_size (comm );
7979
80+ res = ompi_datatype_type_extent (sendtype , & sndext );
81+ if (MPI_SUCCESS != res ) {
82+ NBC_Error ("MPI Error in ompi_datatype_type_extent() (%i)" , res );
83+ return res ;
84+ }
85+
8086 res = ompi_datatype_type_extent (recvtype , & rcvext );
8187 if (MPI_SUCCESS != res ) {
8288 NBC_Error ("MPI Error in ompi_datatype_type_extent() (%i)" , res );
8389 return res ;
8490 }
8591
92+ res = ompi_datatype_type_size (sendtype , & sndsize );
93+ if (MPI_SUCCESS != res ) {
94+ NBC_Error ("MPI Error in ompi_datatype_type_size() (%i)" , res );
95+ return res ;
96+ }
97+
98+ /* algorithm selection */
99+ a2asize = sndsize * sendcount * p ;
100+ /* this number is optimized for TCP on odin.cs.indiana.edu */
86101 if (inplace ) {
87102 alg = NBC_A2A_INPLACE ;
88- } else {
89- /* algorithm selection */
90- res = ompi_datatype_type_extent (sendtype , & sndext );
91- if (MPI_SUCCESS != res ) {
92- NBC_Error ("MPI Error in ompi_datatype_type_extent() (%i)" , res );
93- return res ;
94- }
95- res = ompi_datatype_type_size (sendtype , & sndsize );
96- if (MPI_SUCCESS != res ) {
97- NBC_Error ("MPI Error in ompi_datatype_type_size() (%i)" , res );
98- return res ;
99- }
100-
101- a2asize = sndsize * sendcount * p ;
102- /* this number is optimized for TCP on odin.cs.indiana.edu */
103- if ((p <= 8 ) && ((a2asize < 1 <<17 ) || (sndsize * sendcount < 1 <<12 ))) {
104- /* just send as fast as we can if we have less than 8 peers, if the
105- * total communicated size is smaller than 1<<17 *and* if we don't
106- * have eager messages (msgsize < 1<<13) */
107- alg = NBC_A2A_LINEAR ;
108- } else if (a2asize < (1 <<12 )* (unsigned int )p ) {
109- /*alg = NBC_A2A_DISS;*/
110- alg = NBC_A2A_LINEAR ;
111- } else
112- alg = NBC_A2A_LINEAR ; /*NBC_A2A_PAIRWISE;*/
113- }
103+ } else if ((p <= 8 ) && ((a2asize < 1 <<17 ) || (sndsize * sendcount < 1 <<12 ))) {
104+ /* just send as fast as we can if we have less than 8 peers, if the
105+ * total communicated size is smaller than 1<<17 *and* if we don't
106+ * have eager messages (msgsize < 1<<13) */
107+ alg = NBC_A2A_LINEAR ;
108+ } else if (a2asize < (1 <<12 )* (unsigned int )p ) {
109+ /*alg = NBC_A2A_DISS;*/
110+ alg = NBC_A2A_LINEAR ;
111+ } else
112+ alg = NBC_A2A_LINEAR ; /*NBC_A2A_PAIRWISE;*/
114113
115114 /* allocate temp buffer if we need one */
116115 if (alg == NBC_A2A_INPLACE ) {
0 commit comments