1
/* Copyright 2010 ENSEIRB, INRIA & CNRS
3
** This file is part of the Scotch software package for static mapping,
4
** graph partitioning and sparse matrix ordering.
6
** This software is governed by the CeCILL-C license under French law
7
** and abiding by the rules of distribution of free software. You can
8
** use, modify and/or redistribute the software under the terms of the
9
** CeCILL-C license as circulated by CEA, CNRS and INRIA at the following
10
** URL: "http://www.cecill.info".
12
** As a counterpart to the access to the source code and rights to copy,
13
** modify and redistribute granted by the license, users are provided
14
** only with a limited warranty and the software's author, the holder of
15
** the economic rights, and the successive licensors have only limited
18
** In this respect, the user's attention is drawn to the risks associated
19
** with loading, using, modifying and/or developing or reproducing the
20
** software by the user in light of its specific status of free software,
21
** that may mean that it is complicated to manipulate, and that also
22
** therefore means that it is reserved for developers and experienced
23
** professionals having in-depth computer knowledge. Users are therefore
24
** encouraged to load and test the software's suitability as regards
25
** their requirements in conditions enabling the security of their
26
** systems and/or data to be ensured and, more generally, to use and
27
** operate it in the same conditions as regards security.
29
** The fact that you are presently reading this means that you have had
30
** knowledge of the CeCILL-C license and that you accept its terms.
32
/************************************************************/
36
/** AUTHOR : Francois PELLEGRINI **/
38
/** FUNCTION : This module contains the large size **/
39
/** communication handling routines. **/
41
/** DATES : # Version 5.1 : from : 30 jul 2010 **/
42
/** to : 30 jul 2010 **/
44
/************************************************************/
47
** The defines and includes.
56
/************************************/
58
/* These routines handle large size */
61
/************************************/
69
void * const senddattab,
70
const Gnum sendcntnbr,
71
MPI_Datatype sendtypval,
72
void * const recvdattab,
73
const Gnum * const recvcnttab,
74
const Gnum * const recvdsptab,
75
MPI_Datatype recvtypval,
78
int * restrict ircvcnttab;
79
int * restrict ircvdsptab;
84
MPI_Comm_size (comm, &procglbnbr);
85
if (memAllocGroup ((void **) (void *)
86
&ircvcnttab, (size_t) (procglbnbr * sizeof (int)),
87
&ircvdsptab, (size_t) (procglbnbr * sizeof (int)), NULL) == NULL) {
88
errorPrint ("commAllgatherv: out of memory");
89
return (MPI_ERR_OTHER);
92
for (procnum = 0; procnum < procglbnbr; procnum ++) {
93
ircvcnttab[procnum] = (int) recvcnttab[procnum];
94
ircvdsptab[procnum] = (int) recvdsptab[procnum];
95
if (((Gnum) ircvcnttab[procnum] != recvcnttab[procnum]) ||
96
((Gnum) ircvdsptab[procnum] != recvdsptab[procnum])) {
97
errorPrint ("commAllgatherv: communication indices out of range");
103
o = MPI_Allgatherv (senddattab, sendcntnbr, sendtypval,
104
recvdattab, ircvcnttab, ircvdsptab, recvtypval, comm);
106
memFree (ircvcnttab);
117
void * const senddattab,
118
const Gnum sendcntnbr,
119
MPI_Datatype sendtypval,
120
void * const recvdattab,
121
const Gnum * const recvcnttab,
122
const Gnum * const recvdsptab,
123
MPI_Datatype recvtypval,
127
int * restrict ircvcnttab;
128
int * restrict ircvdsptab;
132
MPI_Comm_rank (comm, &proclocnum);
136
if (rootnum == proclocnum) {
140
MPI_Comm_size (comm, &procglbnbr);
141
if (memAllocGroup ((void **) (void *)
142
&ircvcnttab, (size_t) (procglbnbr * sizeof (int)),
143
&ircvdsptab, (size_t) (procglbnbr * sizeof (int)), NULL) == NULL) {
144
errorPrint ("commGatherv: out of memory");
145
return (MPI_ERR_OTHER);
148
for (procnum = 0; procnum < procglbnbr; procnum ++) {
149
ircvcnttab[procnum] = (int) recvcnttab[procnum];
150
ircvdsptab[procnum] = (int) recvdsptab[procnum];
151
if (((Gnum) ircvcnttab[procnum] != recvcnttab[procnum]) ||
152
((Gnum) ircvdsptab[procnum] != recvdsptab[procnum])) {
153
errorPrint ("commGatherv: communication indices out of range");
154
memFree (ircvcnttab);
155
return (MPI_ERR_ARG);
160
o = MPI_Gatherv (senddattab, sendcntnbr, sendtypval,
161
recvdattab, ircvcnttab, ircvdsptab, recvtypval, rootnum, comm);
163
if (ircvcnttab != NULL)
164
memFree (ircvcnttab);
175
void * const senddattab,
176
const Gnum * const sendcnttab,
177
const Gnum * const senddsptab,
178
MPI_Datatype sendtypval,
179
void * const recvdattab,
180
const Gnum recvcntnbr,
181
MPI_Datatype recvtypval,
185
int * restrict isndcnttab;
186
int * restrict isnddsptab;
190
MPI_Comm_rank (comm, &proclocnum);
194
if (rootnum == proclocnum) {
198
MPI_Comm_size (comm, &procglbnbr);
199
if (memAllocGroup ((void **) (void *)
200
&isndcnttab, (size_t) (procglbnbr * sizeof (int)),
201
&isnddsptab, (size_t) (procglbnbr * sizeof (int)), NULL) == NULL) {
202
errorPrint ("commScatterv: out of memory");
203
return (MPI_ERR_OTHER);
206
for (procnum = 0; procnum < procglbnbr; procnum ++) {
207
isndcnttab[procnum] = (int) sendcnttab[procnum];
208
isnddsptab[procnum] = (int) senddsptab[procnum];
209
if (((Gnum) isndcnttab[procnum] != sendcnttab[procnum]) ||
210
((Gnum) isnddsptab[procnum] != senddsptab[procnum])) {
211
errorPrint ("commScatterv: communication indices out of range");
212
memFree (isndcnttab);
213
return (MPI_ERR_ARG);
218
o = MPI_Scatterv (senddattab, isndcnttab, isnddsptab, sendtypval,
219
recvdattab, (int) recvcntnbr, recvtypval, rootnum, comm);
221
if (isndcnttab != NULL)
222
memFree (isndcnttab);