Skip to content
Snippets Groups Projects
Commit 07c0a8b4 authored by Debolskiy Andrey's avatar Debolskiy Andrey :bicyclist_tone5:
Browse files

Merge branch '22withman' of http://tesla.parallel.ru/debol/parlib

parents ddb75aa4 a00307e1
No related branches found
No related tags found
No related merge requests found
......@@ -3,7 +3,7 @@
AR = ar crl
RANLIB = ranlib
INSTALLDIR = $(HOME)/ParLib.v2.1
INSTALLDIR = $(HOME)/ParLib.v2.2
#INSTALLDIR = $(HOME)
......@@ -76,7 +76,7 @@ install: libparlib.a libparlibf.a
plutils.o: plutils.h
parlib.o: parlib.h plutils.h
parlibf.o: parlib.h plutils.h
parlib.o: parlib.h plutils.h
bexchange.o: parlib.h plutils.h
bexchangef.o: parlib.h plutils.h
transpose.o: parlib.h plutils.h
......
......@@ -16,12 +16,13 @@
* 999 - incorrect exchange mode (only for generic calls)
*/
int P_BExchange_init ( ndims, stride, blklen, bdim, overlap, datatype,
comm, period, bexchange )
int P_BExchange_ginit(ndims, stride, blklen, bdim, overlap, datatype,
comm, period, only_period, bexchange)
int ndims, *stride, *blklen, bdim, overlap[2];
MPI_Datatype datatype;
MPI_Comm comm;
int period;
int period, only_period;
BExchange *bexchange;
{
int nproc, iproc, direct, idim, sendproc[2], recvproc[2];
......@@ -49,6 +50,7 @@ int P_BExchange_init ( ndims, stride, blklen, bdim, overlap, datatype,
if (overlap[direct] < 0) { return 3; }
if (overlap[direct] > blklen[bdim - 1]) { return 5; }
}
if ((only_period) && (!period)) { return 0; }
//
// Define the number of processors in the group and the rank
......@@ -63,8 +65,8 @@ int P_BExchange_init ( ndims, stride, blklen, bdim, overlap, datatype,
recvproc[0] = (iproc == nproc - 1 ? 0 : iproc + 1);
sendproc[1] = recvproc[0];
recvproc[1] = sendproc[0];
send[0] = iproc > 0 || period;
recv[0] = iproc < nproc - 1 || period;
send[0] = ((iproc > 0) && (!only_period)) || ((iproc == 0) && period);
recv[0] = ((iproc < nproc - 1) && (!only_period)) || ((iproc == nproc - 1) && period);
send[1] = recv[0];
recv[1] = send[0];
MPI_Type_get_extent(datatype, &lb, &fsize);
......@@ -135,6 +137,21 @@ int P_BExchange_init ( ndims, stride, blklen, bdim, overlap, datatype,
}
// -------------------------------------------------------------------------- //
// -------------------------------------------------------------------------- //
int P_BExchange_init ( ndims, stride, blklen, bdim, overlap, datatype,
comm, period, bexchange )
int ndims, *stride, *blklen, bdim, overlap[2];
MPI_Datatype datatype;
MPI_Comm comm;
int period;
BExchange *bexchange;
{
const int only_period = 0;
return P_BExchange_ginit(ndims, stride, blklen, bdim, overlap, datatype,
comm, period, only_period, bexchange);
}
// -------------------------------------------------------------------------- //
// -------------------------------------------------------------------------- //
int P_BExchange_start ( a, bexchange )
void *a;
......@@ -227,24 +244,49 @@ int P_BExchange ( a, ndims, stride, blklen, bdim, overlap, datatype,
}
// -------------------------------------------------------------------------- //
// -------------------------------------------------------------------------- //
int P_BExchange_period( a, ndims, stride, blklen, bdim, overlap, datatype,
comm)
void *a;
int ndims, *stride, *blklen, bdim, overlap[2];
MPI_Datatype datatype;
MPI_Comm comm;
{
const int only_period = 1;
const int period = 1;
BExchange bexchange;
int ierr;
if (ierr = P_BExchange_ginit(ndims, stride, blklen, bdim, overlap,
datatype, comm, period, only_period, &bexchange) != 0) {
return ierr;
}
P_BExchange_start(a, &bexchange);
P_BExchange_end(&bexchange);
P_BExchange_free(&bexchange);
return 0;
}
// -------------------------------------------------------------------------- //
// v.1.3 - persistent exchanges //
// -------------------------------------------------------------------------- //
int PST_BExchange_init ( a, ndims, stride, blklen, bdim, overlap, datatype,
comm, period, bexchange )
int PST_BExchange_ginit ( a, ndims, stride, blklen, bdim, overlap, datatype,
comm, period, only_period, bexchange )
void *a;
int ndims, *stride, *blklen, bdim, overlap[2];
MPI_Datatype datatype;
MPI_Comm comm;
int period;
int period, only_period;
BExchange *bexchange;
{
int direct;
char *ach = (char *)a;
int ierr = P_BExchange_init(ndims, stride, blklen, bdim, overlap, datatype,
comm, period, bexchange);
int ierr = P_BExchange_ginit(ndims, stride, blklen, bdim, overlap, datatype,
comm, period, only_period, bexchange);
if (ierr != 0) return ierr;
for (direct = 0; direct < 2; direct++) {
......@@ -265,6 +307,23 @@ int PST_BExchange_init ( a, ndims, stride, blklen, bdim, overlap, datatype,
}
// -------------------------------------------------------------------------- //
// -------------------------------------------------------------------------- //
int PST_BExchange_init ( a, ndims, stride, blklen, bdim, overlap, datatype,
comm, period, bexchange )
void *a;
int ndims, *stride, *blklen, bdim, overlap[2];
MPI_Datatype datatype;
MPI_Comm comm;
int period;
BExchange *bexchange;
{
const int only_period = 0;
return PST_BExchange_ginit(a, ndims, stride, blklen, bdim, overlap,
datatype, comm, period, only_period, bexchange);
}
// -------------------------------------------------------------------------- //
// -------------------------------------------------------------------------- //
int PST_BExchange_start ( bexchange )
BExchange *bexchange;
......@@ -353,15 +412,41 @@ int PST_BExchange( a, ndims, stride, blklen, bdim, overlap, datatype,
}
// -------------------------------------------------------------------------- //
// -------------------------------------------------------------------------- //
int PST_BExchange_period( a, ndims, stride, blklen, bdim, overlap, datatype,
comm )
void *a;
int ndims, *stride, *blklen, bdim, overlap[2];
MPI_Datatype datatype;
MPI_Comm comm;
{
const int only_period = 1;
const int period = 1;
BExchange bexchange;
int ierr;
if (ierr = PST_BExchange_ginit(a, ndims, stride, blklen, bdim, overlap,
datatype, comm, period, only_period, &bexchange) != 0) {
return ierr;
}
PST_BExchange_start(&bexchange);
PST_BExchange_end(&bexchange);
PST_BExchange_free(&bexchange);
return 0;
}
// -------------------------------------------------------------------------- //
// v.1.4 - manual packing //
// -------------------------------------------------------------------------- //
int P_BExchange_mp_init ( ndims, stride, blklen, bdim, overlap, datatype,
comm, period, bexchange )
int P_BExchange_mp_ginit ( ndims, stride, blklen, bdim, overlap, datatype,
comm, period, only_period, bexchange )
int ndims, *stride, *blklen, bdim, overlap[2];
MPI_Datatype datatype;
MPI_Comm comm;
int period;
int period, only_period;
BExchange *bexchange;
{
int nproc, iproc, direct, idim, sendproc[2], recvproc[2];
......@@ -393,6 +478,8 @@ int P_BExchange_mp_init ( ndims, stride, blklen, bdim, overlap, datatype,
if (overlap[direct] > blklen[bdim - 1]) { return 5; }
}
if (ndims > MAX_PARLIB_MP_DIMS) { return 6; }
if ((only_period) && (!period)) { return 0; }
//
// Define the number of processors in the group and the rank
//
......@@ -406,8 +493,8 @@ int P_BExchange_mp_init ( ndims, stride, blklen, bdim, overlap, datatype,
recvproc[0] = (iproc == nproc - 1 ? 0 : iproc + 1);
sendproc[1] = recvproc[0];
recvproc[1] = sendproc[0];
send[0] = iproc > 0 || period;
recv[0] = iproc < nproc - 1 || period;
send[0] = ((iproc > 0) && (!only_period)) || ((iproc == 0) && period);
recv[0] = ((iproc < nproc - 1) && (!only_period)) || ((iproc == nproc - 1) && period);
send[1] = recv[0];
recv[1] = send[0];
MPI_Type_get_extent(datatype, &lb, &fsize);
......@@ -505,6 +592,22 @@ int P_BExchange_mp_init ( ndims, stride, blklen, bdim, overlap, datatype,
}
// -------------------------------------------------------------------------- //
int P_BExchange_mp_init ( ndims, stride, blklen, bdim, overlap, datatype,
comm, period, bexchange )
int ndims, *stride, *blklen, bdim, overlap[2];
MPI_Datatype datatype;
MPI_Comm comm;
int period;
BExchange *bexchange;
{
const int only_period = 0;
return P_BExchange_mp_ginit(ndims, stride, blklen, bdim, overlap, datatype,
comm, period, only_period, bexchange);
}
// -------------------------------------------------------------------------- //
// -------------------------------------------------------------------------- //
int P_BExchange_mp_start( a, bexchange )
void *a;
......@@ -621,22 +724,47 @@ int P_BExchange_mp(a, ndims, stride, blklen, bdim, overlap, datatype,
}
// -------------------------------------------------------------------------- //
// -------------------------------------------------------------------------- //
int P_BExchange_period_mp(a, ndims, stride, blklen, bdim, overlap, datatype,
comm)
void *a;
int ndims, *stride, *blklen, bdim, overlap[2];
MPI_Datatype datatype;
MPI_Comm comm;
{
const int only_period = 1;
const int period = 1;
BExchange bexchange;
int ierr;
if (ierr = P_BExchange_mp_ginit(ndims, stride, blklen, bdim, overlap,
datatype, comm, period, only_period, &bexchange) != 0) {
return ierr;
}
P_BExchange_mp_start(a, &bexchange);
P_BExchange_mp_end(a, &bexchange);
P_BExchange_mp_free(&bexchange);
return 0;
}
// -------------------------------------------------------------------------- //
// v.1.5 - persistent exchanges for manual packing //
// -------------------------------------------------------------------------- //
int PST_BExchange_mp_init(ndims, stride, blklen, bdim, overlap, datatype,
comm, period, bexchange)
int PST_BExchange_mp_ginit(ndims, stride, blklen, bdim, overlap, datatype,
comm, period, only_period, bexchange)
int ndims, *stride, *blklen, bdim, overlap[2];
MPI_Datatype datatype;
MPI_Comm comm;
int period;
int period, only_period;
BExchange *bexchange;
{
int direct;
int ierr = P_BExchange_mp_init(ndims, stride, blklen, bdim, overlap, datatype,
comm, period, bexchange);
int ierr = P_BExchange_mp_ginit(ndims, stride, blklen, bdim, overlap, datatype,
comm, period, only_period, bexchange);
if (ierr != 0) return ierr;
for (direct = 0; direct < 2; direct++) {
......@@ -657,6 +785,22 @@ int PST_BExchange_mp_init(ndims, stride, blklen, bdim, overlap, datatype,
}
// -------------------------------------------------------------------------- //
// -------------------------------------------------------------------------- //
int PST_BExchange_mp_init(ndims, stride, blklen, bdim, overlap, datatype,
comm, period, bexchange)
int ndims, *stride, *blklen, bdim, overlap[2];
MPI_Datatype datatype;
MPI_Comm comm;
int period;
BExchange *bexchange;
{
const int only_period = 0;
return PST_BExchange_mp_ginit(ndims, stride, blklen, bdim, overlap,
datatype, comm, period, only_period, bexchange);
}
// -------------------------------------------------------------------------- //
// -------------------------------------------------------------------------- //
int PST_BExchange_mp_start( a, bexchange )
void *a;
......@@ -748,6 +892,31 @@ int PST_BExchange_mp( a, ndims, stride, blklen, bdim, overlap, datatype,
}
// -------------------------------------------------------------------------- //
// -------------------------------------------------------------------------- //
int PST_BExchange_period_mp( a, ndims, stride, blklen, bdim, overlap, datatype,
comm )
void *a;
MPI_Datatype datatype;
int ndims, *stride, *blklen, bdim, overlap[2];
MPI_Comm comm;
{
const int only_period = 1;
const int period = 1;
BExchange bexchange;
int ierr;
if (ierr = PST_BExchange_mp_ginit(ndims, stride, blklen, bdim, overlap,
datatype, comm, period, only_period, &bexchange) != 0) {
return ierr;
}
PST_BExchange_mp_start(a, &bexchange);
PST_BExchange_mp_end(a, &bexchange);
PST_BExchange_mp_free(&bexchange);
return 0;
}
// -------------------------------------------------------------------------- //
// v.1.95 - choice subroutines //
// -------------------------------------------------------------------------- //
int P_BExchange_opt_init ( a, ndims, stride, blklen, bdim, overlap, datatype,
......@@ -912,3 +1081,67 @@ int P_BExchange_opt ( a, ndims, stride, blklen, bdim, overlap, datatype,
return 999;
}
// -------------------------------------------------------------------------- //
// -------------------------------------------------------------------------- //
int P_BExchange_period_opt ( a, ndims, stride, blklen, bdim, overlap, datatype,
comm, exch_mode )
void *a;
int ndims, *stride, *blklen, bdim, overlap[2];
MPI_Datatype datatype;
MPI_Comm comm;
int exch_mode;
{
const int period = 1;
const int only_period = 1;
BExchange bexchange;
int ierr;
if (exch_mode == IS_MPI_TYPED) {
if (ierr = P_BExchange_ginit(ndims, stride, blklen, bdim, overlap, datatype,
comm, period, only_period, &bexchange) != 0) {
return ierr;
}
P_BExchange_start(a, &bexchange);
P_BExchange_end(&bexchange);
P_BExchange_free(&bexchange);
return 0;
}
if (exch_mode == IS_MPI_MANUAL_PACK) {
if (ierr = P_BExchange_mp_ginit(ndims, stride, blklen, bdim, overlap, datatype,
comm, period, only_period, &bexchange) != 0) {
return ierr;
}
P_BExchange_mp_start(a, &bexchange);
P_BExchange_mp_end(a, &bexchange);
P_BExchange_mp_free(&bexchange);
return 0;
}
if (exch_mode == IS_MPI_TYPED_PERSISTENT) {
if (ierr = PST_BExchange_ginit(a, ndims, stride, blklen, bdim, overlap, datatype,
comm, period, only_period, &bexchange) != 0) {
return ierr;
}
PST_BExchange_start(&bexchange);
PST_BExchange_end(&bexchange);
PST_BExchange_free(&bexchange);
return 0;
}
if (exch_mode == IS_MPI_MANUAL_PACK_PERSISTENT) {
if (ierr = PST_BExchange_mp_ginit(ndims, stride, blklen, bdim, overlap, datatype,
comm, period, only_period, &bexchange) != 0) {
return ierr;
}
PST_BExchange_mp_start(a, &bexchange);
PST_BExchange_mp_end(a, &bexchange);
PST_BExchange_mp_free(&bexchange);
return 0;
}
return 999;
}
// -------------------------------------------------------------------------- //
......@@ -448,6 +448,29 @@ void p_bexchange_opt ( a, ndims, stride, blklen, bdim, overlap, datatype,
(int)*bdim, (int *)overlap, MPI_Type_f2c(*datatype),
MPI_Comm_f2c(*comm), (int)*period, (int)*exch_mode);
}
// v.2.2: periodicity conditions only
#ifdef FORTRANUNDERSCORE
void p_bexchange_period_opt_ ( a, ndims, stride, blklen, bdim, overlap, datatype,
comm, exch_mode, ierr )
#elif defined(FORTRANDOUBLEUNDERSCORE)
void p_bexchange_period_opt__ ( a, ndims, stride, blklen, bdim, overlap, datatype,
comm, exch_mode, ierr )
#else
void p_bexchange_period_opt ( a, ndims, stride, blklen, bdim, overlap, datatype,
comm, exch_mode, ierr )
#endif
void *a;
MPI_Fint *ndims, *stride, *blklen, *bdim, *overlap, *ierr;
MPI_Fint *datatype;
MPI_Fint *comm;
MPI_Fint *exch_mode;
{
*ierr = P_BExchange_period_opt(a, (int)*ndims, (int *)stride, (int *)blklen,
(int)*bdim, (int *)overlap, MPI_Type_f2c(*datatype),
MPI_Comm_f2c(*comm), (int)*exch_mode);
}
// -------------------------------------------------------------------------- //
......
......@@ -59,6 +59,13 @@ void remove_bexch_handle(int exch_id);
// -------------------------------------------------------------------------- //
// -------------------------------------------------------------------------- //
// v.2.2: general exchange init call
// : includes periodic only case by using additional parameter
int P_BExchange_ginit(int, int*, int*, int, int*, MPI_Datatype,
MPI_Comm, int, int, BExchange*);
int P_BExchange_init ( int, int*, int*, int, int*, MPI_Datatype,
MPI_Comm, int, BExchange* );
int P_BExchange_start ( void*, BExchange* );
......@@ -66,10 +73,19 @@ int P_BExchange_end ( BExchange* );
int P_BExchange_free ( BExchange* );
int P_BExchange ( void*, int, int*, int*, int, int*, MPI_Datatype,
MPI_Comm, int );
// v.2.2: periodicity conditions only
int P_BExchange_period(void*, int, int*, int*, int, int*, MPI_Datatype,
MPI_Comm);
// -------------------------------------------------------------------------- //
// v.1.3 - persistent exchanges //
// -------------------------------------------------------------------------- //
// v.2.2: general exchange init call
// : includes periodic only case by using additional parameter
int PST_BExchange_ginit(void*, int, int*, int*, int, int*, MPI_Datatype,
MPI_Comm, int, int, BExchange*);
int PST_BExchange_init(void*, int, int*, int*, int, int*, MPI_Datatype,
MPI_Comm, int, BExchange*);
int PST_BExchange_start(BExchange*);
......@@ -77,10 +93,19 @@ int PST_BExchange_end(BExchange*);
int PST_BExchange_free(BExchange*);
int PST_BExchange(void*, int, int*, int*, int, int*, MPI_Datatype,
MPI_Comm, int);
// v.2.2: periodicity conditions only
int PST_BExchange_period(void*, int, int*, int*, int, int*, MPI_Datatype,
MPI_Comm);
// -------------------------------------------------------------------------- //
// v.1.4 - manual packing //
// -------------------------------------------------------------------------- //
// v.2.2: general exchange init call
// : includes periodic only case by using additional parameter
int P_BExchange_mp_ginit(int, int*, int*, int, int*, MPI_Datatype,
MPI_Comm, int, int, BExchange*);
int P_BExchange_mp_init(int, int*, int*, int, int*, MPI_Datatype,
MPI_Comm, int, BExchange*);
int P_BExchange_mp_start(void*, BExchange*);
......@@ -88,10 +113,19 @@ int P_BExchange_mp_end(void*, BExchange*);
int P_BExchange_mp_free(BExchange*);
int P_BExchange_mp(void*, int, int*, int*, int, int*, MPI_Datatype,
MPI_Comm, int);
// v.2.2: periodicity conditions only
int P_BExchange_period_mp(void*, int, int*, int*, int, int*, MPI_Datatype,
MPI_Comm);
// -------------------------------------------------------------------------- //
// v.1.4 - persistent exchanges for manual packing //
// -------------------------------------------------------------------------- //
// v.2.2: general exchange init call
// : includes periodic only case by using additional parameter
int PST_BExchange_mp_ginit(int, int*, int*, int, int*, MPI_Datatype,
MPI_Comm, int, int, BExchange*);
int PST_BExchange_mp_init(int, int*, int*, int, int*, MPI_Datatype,
MPI_Comm, int, BExchange*);
int PST_BExchange_mp_start(void*, BExchange*);
......@@ -99,6 +133,10 @@ int PST_BExchange_mp_end(void*, BExchange*);
int PST_BExchange_mp_free(BExchange*);
int PST_BExchange_mp(void*, int, int*, int*, int, int*, MPI_Datatype,
MPI_Comm, int);
// v.2.2: periodicity conditions only
int PST_BExchange_period_mp(void*, int, int*, int*, int, int*, MPI_Datatype,
MPI_Comm);
// -------------------------------------------------------------------------- //
......@@ -111,6 +149,10 @@ int P_BExchange_opt_end(void*, BExchange*, int);
int P_BExchange_opt_free(BExchange*, int);
int P_BExchange_opt(void*, int, int*, int*, int, int*, MPI_Datatype,
MPI_Comm, int, int);
// v.2.2: periodicity conditions only
int P_BExchange_period_opt(void*, int, int*, int*, int, int*, MPI_Datatype,
MPI_Comm, int);
// -------------------------------------------------------------------------- //
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment