Skip to content

Commit de6d437

Browse files
committed
Align mpi-serial function prototypes with MPICH for consistency
The mpi-serial library supports most common MPI calls, but some function prototypes differ from their MPICH counterparts. This update ensures consistency by aligning function declarations with those in MPICH 4.3.0 (see src/include/mpi_proto.h).
1 parent 925ba3c commit de6d437

File tree

14 files changed

+146
-147
lines changed

14 files changed

+146
-147
lines changed

cart.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ int FC_FUNC( mpi_cart_create , MPI_CART_CREATE )
1717
}
1818

1919

20-
int MPI_Cart_create( MPI_Comm comm_old, int ndims, int *dims, int *periods,
20+
int MPI_Cart_create( MPI_Comm comm_old, int ndims, const int dims[], const int periods[],
2121
int reorder, MPI_Comm *comm_cart)
2222
{
2323
int i;
@@ -54,8 +54,8 @@ int FC_FUNC( mpi_cart_get , MPI_CART_GET )
5454
}
5555

5656

57-
int MPI_Cart_get(MPI_Comm comm, int maxdims, int *dims,
58-
int *periods, int *coords)
57+
int MPI_Cart_get(MPI_Comm comm, int maxdims, int dims[],
58+
int periods[], int coords[])
5959
{
6060
int i;
6161
for (i=0;i<maxdims;i++)
@@ -84,7 +84,7 @@ int FC_FUNC( mpi_cart_coords , MPI_CART_COORDS)
8484
}
8585

8686

87-
int MPI_Cart_coords(MPI_Comm comm, int rank, int maxdims, int *coords)
87+
int MPI_Cart_coords(MPI_Comm comm, int rank, int maxdims, int coords[])
8888
{
8989
int i;
9090

@@ -116,7 +116,7 @@ int FC_FUNC( mpi_dims_create , MPI_DIMS_CREATE )
116116
}
117117

118118

119-
int MPI_Dims_create(int nnodes, int ndims, int *dims)
119+
int MPI_Dims_create(int nnodes, int ndims, int dims[])
120120
{
121121
int i;
122122

collective.c

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ int FC_FUNC( mpi_gather , MPI_GATHER )
6565
}
6666

6767

68-
int MPI_Gather(void* sendbuf, int sendcount, MPI_Datatype sendtype,
68+
int MPI_Gather(const void* sendbuf, int sendcount, MPI_Datatype sendtype,
6969
void* recvbuf, int recvcount, MPI_Datatype recvtype,
7070
int root, MPI_Comm comm)
7171
{
@@ -104,8 +104,8 @@ int FC_FUNC( mpi_gatherv , MPI_GATHERV )
104104
}
105105

106106

107-
int MPI_Gatherv(void* sendbuf, int sendcount, MPI_Datatype sendtype,
108-
void* recvbuf, int *recvcounts, int *displs,
107+
int MPI_Gatherv(const void* sendbuf, int sendcount, MPI_Datatype sendtype,
108+
void* recvbuf, const int recvcounts[], const int displs[],
109109
MPI_Datatype recvtype, int root, MPI_Comm comm)
110110
{
111111
int offset;
@@ -151,7 +151,7 @@ int FC_FUNC( mpi_allgather , MPI_ALLGATHER )
151151
}
152152

153153

154-
int MPI_Allgather(void* sendbuf, int sendcount, MPI_Datatype sendtype,
154+
int MPI_Allgather(const void* sendbuf, int sendcount, MPI_Datatype sendtype,
155155
void* recvbuf, int recvcount, MPI_Datatype recvtype,
156156
MPI_Comm comm)
157157
{
@@ -182,8 +182,8 @@ int FC_FUNC( mpi_allgatherv , MPI_ALLGATHERV )
182182
}
183183

184184

185-
int MPI_Allgatherv(void* sendbuf, int sendcount, MPI_Datatype sendtype,
186-
void* recvbuf, int *recvcounts, int *displs,
185+
int MPI_Allgatherv(const void* sendbuf, int sendcount, MPI_Datatype sendtype,
186+
void* recvbuf, const int recvcounts[], const int displs[],
187187
MPI_Datatype recvtype, MPI_Comm comm)
188188
{
189189
int offset;
@@ -222,7 +222,7 @@ int FC_FUNC( mpi_scatter, MPI_SCATTER )
222222
return MPI_SUCCESS;
223223
}
224224

225-
int MPI_Scatter(void * sendbuf, int sendcount, MPI_Datatype sendtype,
225+
int MPI_Scatter(const void * sendbuf, int sendcount, MPI_Datatype sendtype,
226226
void * recvbuf, int recvcount, MPI_Datatype recvtype,
227227
int root, MPI_Comm comm)
228228
{
@@ -262,7 +262,7 @@ int FC_FUNC( mpi_scatterv , MPI_SCATTERV )
262262

263263

264264

265-
int MPI_Scatterv(void* sendbuf, int *sendcounts, int *displs,
265+
int MPI_Scatterv(const void* sendbuf, const int sendcounts[], const int displs[],
266266
MPI_Datatype sendtype, void* recvbuf, int recvcount,
267267
MPI_Datatype recvtype, int root, MPI_Comm comm)
268268
{
@@ -307,7 +307,7 @@ int FC_FUNC( mpi_reduce , MPI_REDUCE )
307307

308308

309309

310-
int MPI_Reduce(void* sendbuf, void* recvbuf, int count,
310+
int MPI_Reduce(const void* sendbuf, void* recvbuf, int count,
311311
MPI_Datatype datatype, MPI_Op op, int root, MPI_Comm comm)
312312

313313
{
@@ -338,7 +338,7 @@ int FC_FUNC( mpi_allreduce , MPI_ALLREDUCE )
338338
}
339339

340340

341-
int MPI_Allreduce(void* sendbuf, void* recvbuf, int count,
341+
int MPI_Allreduce(const void* sendbuf, void* recvbuf, int count,
342342
MPI_Datatype datatype, MPI_Op op, MPI_Comm comm)
343343
{
344344
if (sendbuf==MPI_IN_PLACE)
@@ -369,7 +369,7 @@ int FC_FUNC(mpi_reduce_scatter, MPI_REDUCE_SCATTER)
369369
}
370370

371371

372-
int MPI_Reduce_scatter(void* sendbuf, void* recvbuf, int *recvcounts,
372+
int MPI_Reduce_scatter(const void* sendbuf, void* recvbuf, const int recvcounts[],
373373
MPI_Datatype datatype, MPI_Op op, MPI_Comm comm)
374374
{
375375
copy_data2(sendbuf, recvcounts[0], datatype, recvbuf, recvcounts[0], datatype);
@@ -392,7 +392,7 @@ int FC_FUNC( mpi_scan , MPI_SCAN)
392392

393393

394394

395-
int MPI_Scan(void* sendbuf, void* recvbuf, int count,
395+
int MPI_Scan(const void* sendbuf, void* recvbuf, int count,
396396
MPI_Datatype datatype, MPI_Op op, MPI_Comm comm )
397397
{
398398
copy_data2(sendbuf, count, datatype, recvbuf, count, datatype);
@@ -415,7 +415,7 @@ int FC_FUNC( mpi_alltoall , MPI_ALLTOALL )
415415
}
416416

417417

418-
int MPI_Alltoall(void *sendbuf, int sendcount, MPI_Datatype sendtype,
418+
int MPI_Alltoall(const void *sendbuf, int sendcount, MPI_Datatype sendtype,
419419
void *recvbuf, int recvcount, MPI_Datatype recvtype,
420420
MPI_Comm comm)
421421
{
@@ -442,10 +442,10 @@ int FC_FUNC( mpi_alltoallv , MPI_ALLTOALLV )
442442
return MPI_SUCCESS;
443443
}
444444

445-
int MPI_Alltoallv(void *sendbuf, int *sendcounts,
446-
int *sdispls, MPI_Datatype sendtype,
447-
void *recvbuf, int *recvcounts,
448-
int *rdispls, MPI_Datatype recvtype,
445+
int MPI_Alltoallv(const void *sendbuf, const int sendcounts[],
446+
const int sdispls[], MPI_Datatype sendtype,
447+
void *recvbuf, const int recvcounts[],
448+
const int rdispls[], MPI_Datatype recvtype,
449449
MPI_Comm comm)
450450

451451
{
@@ -488,10 +488,10 @@ int FC_FUNC( mpi_alltoallw , MPI_ALLTOALLW )
488488
}
489489

490490

491-
int MPI_Alltoallw(void *sendbuf, int *sendcounts,
492-
int *sdispls, MPI_Datatype *sendtypes,
493-
void *recvbuf, int *recvcounts,
494-
int *rdispls, MPI_Datatype *recvtypes,
491+
int MPI_Alltoallw(const void *sendbuf, const int sendcounts[],
492+
const int sdispls[], const MPI_Datatype sendtypes[],
493+
void *recvbuf, const int recvcounts[],
494+
const int rdispls[], const MPI_Datatype recvtypes[],
495495
MPI_Comm comm)
496496

497497
{

copy.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,11 @@
2323
* fix this issue later...
2424
*/
2525

26-
extern int Pcopy_data2(void *source, int src_count, Datatype src_type,
26+
extern int Pcopy_data2(const void *source, int src_count, Datatype src_type,
2727
void *dest, int dest_count, Datatype dest_type);
2828

2929

30-
int copy_data2(void *source, int src_count, MPI_Datatype src_type,
30+
int copy_data2(const void *source, int src_count, MPI_Datatype src_type,
3131
void *dest, int dest_count, MPI_Datatype dest_type)
3232
{
3333
Datatype src_ptr = *(Datatype*) mpi_handle_to_datatype(src_type);
@@ -39,7 +39,7 @@ int copy_data2(void *source, int src_count, MPI_Datatype src_type,
3939

4040

4141

42-
int Pcopy_data2(void *source, int src_count, Datatype src_type,
42+
int Pcopy_data2(const void *source, int src_count, Datatype src_type,
4343
void *dest, int dest_count, Datatype dest_type)
4444
{
4545
int i;

group.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ int FC_FUNC( mpi_group_incl, MPI_GROUP_INCL )
1313
}
1414

1515

16-
int MPI_Group_incl(MPI_Group group, int n, int *ranks, MPI_Group *newgroup)
16+
int MPI_Group_incl(MPI_Group group, int n, const int ranks[], MPI_Group *newgroup)
1717
{
1818

1919
if (group==MPI_GROUP_NULL)
@@ -211,7 +211,7 @@ int FC_FUNC( mpi_group_translate_ranks, MPI_GROUP_TRANSLATE_RANKS )
211211

212212

213213

214-
int MPI_Group_translate_ranks(MPI_Group group1, int n, int *ranks1,
214+
int MPI_Group_translate_ranks(MPI_Group group1, int n, const int ranks1[],
215215
MPI_Group group2, int *ranks2)
216216
{
217217
int i;

info.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ int FC_FUNC( mpi_info_set , MPI_INFO_SET ) (int *info, char *key, char *value, i
3232
}
3333

3434

35-
int MPI_Info_set(MPI_Info info, char *key, char *value)
35+
int MPI_Info_set(MPI_Info info, const char *key, const char *value)
3636
{
3737
/* for now, don't bother storing anything */
3838
return(MPI_SUCCESS);

mpi.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ int MPI_Init_thread(int *argc, char **argv[], int required, int *provided)
161161
return MPI_Init(argc, argv);
162162
}
163163

164-
int MPI_Init(int *argc, char **argv[])
164+
int MPI_Init(int *argc, char ***argv)
165165
{
166166
MPI_Comm my_comm_world;
167167

@@ -333,10 +333,10 @@ void FC_FUNC( mpi_get_library_version, MPI_GET_LIBRARY_VERSION) (char *version,
333333

334334

335335

336-
int MPI_Get_Version(int *mpi_vers, int *mpi_subvers)
336+
int MPI_Get_Version(int *version, int *subversion)
337337
{
338-
*mpi_vers = 1;
339-
*mpi_subvers = 0;
338+
*version = 1;
339+
*subversion = 0;
340340

341341
return (MPI_SUCCESS);
342342
}

0 commit comments

Comments
 (0)