8
8
* Copyright (c) 2013-2015 Los Alamos National Security, LLC. All rights
9
9
* reserved.
10
10
* Copyright (c) 2014 NVIDIA Corporation. All rights reserved.
11
- * Copyright (c) 2014-2017 Research Organization for Information Science
12
- * and Technology (RIST). All rights reserved.
11
+ * Copyright (c) 2014-2018 Research Organization for Information Science
12
+ * and Technology (RIST). All rights reserved.
13
13
* Copyright (c) 2017 IBM Corporation. All rights reserved.
14
14
* Copyright (c) 2018 FUJITSU LIMITED. All rights reserved.
15
15
* $COPYRIGHT$
@@ -58,7 +58,8 @@ static int nbc_alltoall_init(const void* sendbuf, int sendcount, MPI_Datatype se
58
58
MPI_Datatype recvtype , struct ompi_communicator_t * comm , ompi_request_t * * request ,
59
59
struct mca_coll_base_module_2_3_0_t * module , bool persistent )
60
60
{
61
- int rank , p , res , datasize ;
61
+ int rank , p , res ;
62
+ MPI_Aint datasize ;
62
63
size_t a2asize , sndsize ;
63
64
NBC_Schedule * schedule ;
64
65
MPI_Aint rcvext , sndext ;
@@ -118,16 +119,15 @@ static int nbc_alltoall_init(const void* sendbuf, int sendcount, MPI_Datatype se
118
119
return OMPI_ERR_OUT_OF_RESOURCE ;
119
120
}
120
121
} else if (alg == NBC_A2A_DISS ) {
121
- /* persistent operation is not supported currently for this algorithm;
122
- * we need to replace PMPI_Pack, PMPI_Unpack, and mempcy */
122
+ /* persistent operation is not supported currently for this algorithm */
123
123
assert (! persistent );
124
124
125
125
if (NBC_Type_intrinsic (sendtype )) {
126
126
datasize = sndext * sendcount ;
127
127
} else {
128
- res = PMPI_Pack_size ( sendcount , sendtype , comm , & datasize );
128
+ res = ompi_datatype_pack_external_size ( "external32" , sendcount , sendtype , & datasize );
129
129
if (MPI_SUCCESS != res ) {
130
- NBC_Error ("MPI Error in PMPI_Pack_size () (%i)" , res );
130
+ NBC_Error ("MPI Error in ompi_datatype_pack_external_size () (%i)" , res );
131
131
return res ;
132
132
}
133
133
}
@@ -156,23 +156,23 @@ static int nbc_alltoall_init(const void* sendbuf, int sendcount, MPI_Datatype se
156
156
memcpy ((char * ) tmpbuf + datasize * (p - rank ), sendbuf , datasize * rank );
157
157
}
158
158
} else {
159
- int pos = 0 ;
159
+ MPI_Aint pos = 0 ;
160
160
161
161
/* non-contiguous - pack */
162
- res = PMPI_Pack ( (char * ) sendbuf + rank * sendcount * sndext , (p - rank ) * sendcount , sendtype , tmpbuf ,
163
- (p - rank ) * datasize , & pos , comm );
162
+ res = ompi_datatype_pack_external ( "external32" , (char * ) sendbuf + ( intptr_t ) rank * ( intptr_t ) sendcount * sndext , (intptr_t )( p - rank ) * ( intptr_t ) sendcount , sendtype , tmpbuf ,
163
+ (intptr_t )( p - rank ) * datasize , & pos );
164
164
if (OPAL_UNLIKELY (MPI_SUCCESS != res )) {
165
- NBC_Error ("MPI Error in PMPI_Pack () (%i)" , res );
165
+ NBC_Error ("MPI Error in ompi_datatype_pack_external () (%i)" , res );
166
166
free (tmpbuf );
167
167
return res ;
168
168
}
169
169
170
170
if (rank != 0 ) {
171
171
pos = 0 ;
172
- res = PMPI_Pack ( sendbuf , rank * sendcount , sendtype , (char * ) tmpbuf + datasize * (p - rank ),
173
- rank * datasize , & pos , comm );
172
+ res = ompi_datatype_pack_external ( "external32" , sendbuf , ( intptr_t ) rank * ( intptr_t ) sendcount , sendtype , (char * ) tmpbuf + datasize * ( intptr_t ) (p - rank ),
173
+ rank * datasize , & pos );
174
174
if (OPAL_UNLIKELY (MPI_SUCCESS != res )) {
175
- NBC_Error ("MPI Error in PMPI_Pack () (%i)" , res );
175
+ NBC_Error ("MPI Error in ompi_datatype_pack_external () (%i)" , res );
176
176
free (tmpbuf );
177
177
return res ;
178
178
}
@@ -200,8 +200,8 @@ static int nbc_alltoall_init(const void* sendbuf, int sendcount, MPI_Datatype se
200
200
201
201
if (!inplace ) {
202
202
/* copy my data to receive buffer */
203
- rbuf = (char * ) recvbuf + rank * recvcount * rcvext ;
204
- sbuf = (char * ) sendbuf + rank * sendcount * sndext ;
203
+ rbuf = (char * ) recvbuf + ( MPI_Aint ) rank * ( MPI_Aint ) recvcount * rcvext ;
204
+ sbuf = (char * ) sendbuf + ( MPI_Aint ) rank * ( MPI_Aint ) sendcount * sndext ;
205
205
res = NBC_Sched_copy (sbuf , false, sendcount , sendtype ,
206
206
rbuf , false, recvcount , recvtype , schedule , false);
207
207
if (OPAL_UNLIKELY (OMPI_SUCCESS != res )) {
@@ -424,13 +424,13 @@ static inline int a2a_sched_linear(int rank, int p, MPI_Aint sndext, MPI_Aint rc
424
424
continue ;
425
425
}
426
426
427
- char * rbuf = (char * ) recvbuf + r * recvcount * rcvext ;
427
+ char * rbuf = (char * ) recvbuf + ( intptr_t ) r * ( intptr_t ) recvcount * rcvext ;
428
428
res = NBC_Sched_recv (rbuf , false, recvcount , recvtype , r , schedule , false);
429
429
if (OPAL_UNLIKELY (OMPI_SUCCESS != res )) {
430
430
return res ;
431
431
}
432
432
433
- char * sbuf = (char * ) sendbuf + r * sendcount * sndext ;
433
+ char * sbuf = (char * ) sendbuf + ( intptr_t ) r * ( intptr_t ) sendcount * sndext ;
434
434
res = NBC_Sched_send (sbuf , false, sendcount , sendtype , r , schedule , false);
435
435
if (OPAL_UNLIKELY (OMPI_SUCCESS != res )) {
436
436
return res ;
@@ -443,7 +443,8 @@ static inline int a2a_sched_linear(int rank, int p, MPI_Aint sndext, MPI_Aint rc
443
443
static inline int a2a_sched_diss (int rank , int p , MPI_Aint sndext , MPI_Aint rcvext , NBC_Schedule * schedule ,
444
444
const void * sendbuf , int sendcount , MPI_Datatype sendtype , void * recvbuf , int recvcount ,
445
445
MPI_Datatype recvtype , MPI_Comm comm , void * tmpbuf ) {
446
- int res , speer , rpeer , datasize , offset , virtp ;
446
+ int res , speer , rpeer , virtp ;
447
+ MPI_Aint datasize , offset ;
447
448
char * rbuf , * rtmpbuf , * stmpbuf ;
448
449
449
450
if (p < 2 ) {
@@ -453,9 +454,9 @@ static inline int a2a_sched_diss(int rank, int p, MPI_Aint sndext, MPI_Aint rcve
453
454
if (NBC_Type_intrinsic (sendtype )) {
454
455
datasize = sndext * sendcount ;
455
456
} else {
456
- res = PMPI_Pack_size ( sendcount , sendtype , comm , & datasize );
457
+ res = ompi_datatype_pack_external_size ( "external32" , sendcount , sendtype , & datasize );
457
458
if (MPI_SUCCESS != res ) {
458
- NBC_Error ("MPI Error in PMPI_Pack_size () (%i)" , res );
459
+ NBC_Error ("MPI Error in ompi_datatype_pack_external_size () (%i)" , res );
459
460
return res ;
460
461
}
461
462
}
@@ -540,8 +541,8 @@ static inline int a2a_sched_inplace(int rank, int p, NBC_Schedule* schedule, voi
540
541
for (int i = 1 ; i < (p + 1 )/2 ; i ++ ) {
541
542
int speer = (rank + i ) % p ;
542
543
int rpeer = (rank + p - i ) % p ;
543
- char * sbuf = (char * ) buf + speer * count * ext ;
544
- char * rbuf = (char * ) buf + rpeer * count * ext ;
544
+ char * sbuf = (char * ) buf + ( intptr_t ) speer * ( intptr_t ) count * ext ;
545
+ char * rbuf = (char * ) buf + ( intptr_t ) rpeer * ( intptr_t ) count * ext ;
545
546
546
547
res = NBC_Sched_copy (rbuf , false, count , type ,
547
548
(void * )(- gap ), true, count , type ,
@@ -570,7 +571,7 @@ static inline int a2a_sched_inplace(int rank, int p, NBC_Schedule* schedule, voi
570
571
if (0 == (p %2 )) {
571
572
int peer = (rank + p /2 ) % p ;
572
573
573
- char * tbuf = (char * ) buf + peer * count * ext ;
574
+ char * tbuf = (char * ) buf + ( intptr_t ) peer * ( intptr_t ) count * ext ;
574
575
res = NBC_Sched_copy (tbuf , false, count , type ,
575
576
(void * )(- gap ), true, count , type ,
576
577
schedule , true);
0 commit comments