Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions BLACS/SRC/BI_Arecv.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
void BI_Arecv(BLACSCONTEXT *ctxt, Int src, Int msgid, BLACBUFF *bp)
{
Int i, info;
MpiInt errclass;
int errclass;

info=MPI_Irecv(bp->Buff, bp->N, bp->dtype, src, msgid, ctxt->scp->comm,
info=_MPI_Irecv(bp->Buff, bp->N, bp->dtype, src, msgid, ctxt->scp->comm,
&bp->Aops[bp->nAops]);
while(info != MPI_SUCCESS)
{
Expand All @@ -22,7 +22,7 @@ void BI_Arecv(BLACSCONTEXT *ctxt, Int src, Int msgid, BLACBUFF *bp)
"MPI error %d assumed to mean out of non-blocking resources on call to MPI_Irecv",
info);
#endif
info=MPI_Irecv(bp->Buff, bp->N, bp->dtype, src, msgid, ctxt->scp->comm,
info=_MPI_Irecv(bp->Buff, bp->N, bp->dtype, src, msgid, ctxt->scp->comm,
&bp->Aops[bp->nAops]);
}
bp->nAops++;
Expand Down
6 changes: 3 additions & 3 deletions BLACS/SRC/BI_Asend.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
void BI_Asend(BLACSCONTEXT *ctxt, Int dest, Int msgid, BLACBUFF *bp)
{
Int i, info;
MpiInt errclass;
int errclass;

info=MPI_Isend(bp->Buff, bp->N, bp->dtype, dest, msgid, ctxt->scp->comm,
info=_MPI_Isend(bp->Buff, bp->N, bp->dtype, dest, msgid, ctxt->scp->comm,
&bp->Aops[bp->nAops]);
while(info != MPI_SUCCESS)
{
Expand All @@ -22,7 +22,7 @@ void BI_Asend(BLACSCONTEXT *ctxt, Int dest, Int msgid, BLACBUFF *bp)
"MPI error %d assumed to mean out of non-blocking resources on call to MPI_Isend",
info);
#endif
info=MPI_Isend(bp->Buff, bp->N, bp->dtype, dest, msgid, ctxt->scp->comm,
info=_MPI_Isend(bp->Buff, bp->N, bp->dtype, dest, msgid, ctxt->scp->comm,
&bp->Aops[bp->nAops]);
}
bp->nAops++;
Expand Down
2 changes: 1 addition & 1 deletion BLACS/SRC/BI_BuffIsFree.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Int BI_BuffIsFree(BLACBUFF *bp, Int Wait)
* wait for all async. operations to complete.
*/
{
MpiInt i, info;
int i, info;
extern MPI_Status *BI_Stats;
extern Int BI_Np;

Expand Down
2 changes: 1 addition & 1 deletion BLACS/SRC/BI_GetMpiGeType.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include "Bdef.h"
MPI_Datatype BI_GetMpiGeType(BLACSCONTEXT *ctxt, Int m, Int n, Int lda,
MPI_Datatype Dtype, Int *N)
MPI_Datatype Dtype, MpiInt *N)
{
Int info;
MPI_Datatype GeType;
Expand Down
6 changes: 3 additions & 3 deletions BLACS/SRC/BI_GetMpiTrType.c
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#include "Bdef.h"

MPI_Datatype BI_GetMpiTrType(BLACSCONTEXT *ctxt, char uplo, char diag,
Int m, Int n, Int lda, MPI_Datatype Dtype,
Int *N)
MpiInt m, MpiInt n, Int lda, MPI_Datatype Dtype,
MpiInt *N)
{
BLACBUFF *BI_GetBuff(Int);
MPI_Datatype TrType;
Expand Down Expand Up @@ -116,7 +116,7 @@ MPI_Datatype BI_GetMpiTrType(BLACSCONTEXT *ctxt, char uplo, char diag,
}
#endif

i=MPI_Type_indexed(n, len, disp, Dtype, &TrType);
i=_MPI_Type_indexed(n, len, disp, Dtype, &TrType);
i=MPI_Type_commit(&TrType);
return(TrType);
}
3 changes: 2 additions & 1 deletion BLACS/SRC/BI_Pack.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
BLACBUFF *BI_Pack(BLACSCONTEXT *ctxt,BVOID *A,BLACBUFF *bp,MPI_Datatype Dtype)
{
BLACBUFF *BI_GetBuff(Int);
MpiInt i, info, one=1;
int i, info, one=1;
MPI_Aint eltsiz;
#ifdef ZeroByteTypeBug
char *cptr;
Expand Down Expand Up @@ -38,6 +38,7 @@ BLACBUFF *BI_Pack(BLACSCONTEXT *ctxt,BVOID *A,BLACBUFF *bp,MPI_Datatype Dtype)
#endif
if (bp == NULL)
{
// MPI_Pack_size_c exists but no need to invoke it for a count of one==1
info=MPI_Pack_size(one, Dtype, ctxt->scp->comm, &i);
bp = BI_GetBuff(i);
}
Expand Down
4 changes: 2 additions & 2 deletions BLACS/SRC/BI_TransUserComm.c
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
#include "Bdef.h"

MPI_Comm BI_TransUserComm(Int Ucomm, Int Np, Int *pmap)
MPI_Comm BI_TransUserComm(Int Ucomm, int Np, Int *pmap)
{
MPI_Comm bcomm, ucomm;
MPI_Group bgrp, ugrp;
Int i;

MpiInt *mpmap = (MpiInt *)malloc(Np * sizeof(MpiInt));
int *mpmap = (int *)malloc(Np * sizeof(int));
for (i=0; i<Np; i++) mpmap[i] = pmap[i];

ucomm = MPI_Comm_f2c(Ucomm);
Expand Down
5 changes: 4 additions & 1 deletion BLACS/SRC/BI_Unpack.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

void BI_Unpack(BLACSCONTEXT *ctxt, BVOID *A, BLACBUFF *bp, MPI_Datatype Dtype)
{
MpiInt i=0, info, one=1;
int i=0, info, one=1;

/*
* Some versions of mpich and its derivitives cannot handle 0 byte typedefs,
Expand All @@ -11,6 +11,9 @@ void BI_Unpack(BLACSCONTEXT *ctxt, BVOID *A, BLACBUFF *bp, MPI_Datatype Dtype)
#ifdef ZeroByteTypeBug
if (Dtype == MPI_BYTE) return;
#endif
// TODO
// MPI_Unpack_c exists but no need to invoke it for a count of one==1
// however not clear how to handle bp->Len which may be 64-bit, see BLACS/SRC/Bdef.h:54
info=MPI_Unpack(bp->Buff, bp->Len, &i, A, one, Dtype, ctxt->scp->comm);
info=MPI_Type_free(&Dtype);
}
2 changes: 1 addition & 1 deletion BLACS/SRC/BI_cMPI_sum.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include "Bdef.h"
void BI_cMPI_sum(void *in, void *inout, MpiInt *N, MPI_Datatype *dtype)
{
void BI_cvvsum(Int, char *, char *);
void BI_cvvsum(MpiInt, char *, char *);
BI_cvvsum(*N, inout, in);
}
4 changes: 2 additions & 2 deletions BLACS/SRC/BI_cvvamx.c
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#include "Bdef.h"
void BI_cvvamx(Int N, char *vec1, char *vec2)
void BI_cvvamx(MpiInt N, char *vec1, char *vec2)
{
SCOMPLEX *v1=(SCOMPLEX*)vec1, *v2=(SCOMPLEX*)vec2;
float diff;
BI_DistType *dist1, *dist2;
Int i, k;
MpiInt i, k;

k = N * sizeof(SCOMPLEX);
i = k % sizeof(BI_DistType);
Expand Down
4 changes: 2 additions & 2 deletions BLACS/SRC/BI_cvvamx2.c
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include "Bdef.h"
void BI_cvvamx2(Int N, char *vec1, char *vec2)
void BI_cvvamx2(MpiInt N, char *vec1, char *vec2)
{
Int r, i;
MpiInt r, i;
float *v1=(float*)vec1, *v2=(float*)vec2;
float diff;

Expand Down
4 changes: 2 additions & 2 deletions BLACS/SRC/BI_cvvsum.c
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#include "Bdef.h"
void BI_cvvsum(Int N, char *vec1, char *vec2)
void BI_cvvsum(MpiInt N, char *vec1, char *vec2)
{
float *v1=(float*)vec1, *v2=(float*)vec2;
Int k;
MpiInt k; // size_t might be more appropriate, as in BI_cvvsum.c BI_dvvsum.c BI_ivvsum.c BI_svvsum.c BI_zvvsum.c
N *=2;
for (k=0; k < N; k++) v1[k] += v2[k];
}
4 changes: 2 additions & 2 deletions BLACS/SRC/BI_dvvsum.c
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include "Bdef.h"
void BI_dvvsum(Int N, char *vec1, char *vec2)
void BI_dvvsum(MpiInt N, char *vec1, char *vec2)
{
double *v1=(double*)vec1, *v2=(double*)vec2;
Int k;
MpiInt k; // size_t might be more appropriate, as in BI_cvvsum.c BI_dvvsum.c BI_ivvsum.c BI_svvsum.c BI_zvvsum.c
for (k=0; k < N; k++) v1[k] += v2[k];
}
4 changes: 2 additions & 2 deletions BLACS/SRC/BI_ivvamn.c
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#include "Bdef.h"
void BI_ivvamn(Int N, char *vec1, char *vec2)
void BI_ivvamn(MpiInt N, char *vec1, char *vec2)
{
Int *v1=(Int*)vec1, *v2=(Int*)vec2;
Int diff;
BI_DistType *dist1, *dist2;
Int i, k;
MpiInt i, k;

k = N * sizeof(Int);
i = k % sizeof(BI_DistType);
Expand Down
4 changes: 2 additions & 2 deletions BLACS/SRC/BI_ivvamn2.c
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#include "Bdef.h"

void BI_ivvamn2(Int N, char *vec1, char *vec2)
void BI_ivvamn2(MpiInt N, char *vec1, char *vec2)
{
Int k;
MpiInt k;
Int *v1=(Int*)vec1, *v2=(Int*)vec2;
Int diff;

Expand Down
4 changes: 2 additions & 2 deletions BLACS/SRC/BI_ivvsum.c
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include "Bdef.h"
void BI_ivvsum(Int N, char *vec1, char *vec2)
void BI_ivvsum(MpiInt N, char *vec1, char *vec2)
{
Int *v1=(Int*)vec1, *v2=(Int*)vec2;
Int k;
MpiInt k; // size_t might be more appropriate, as in BI_cvvsum.c BI_dvvsum.c BI_ivvsum.c BI_svvsum.c BI_zvvsum.c
for (k=0; k < N; k++) v1[k] += v2[k];
}
4 changes: 2 additions & 2 deletions BLACS/SRC/BI_svvsum.c
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include "Bdef.h"
void BI_svvsum(Int N, char *vec1, char *vec2)
void BI_svvsum(MpiInt N, char *vec1, char *vec2)
{
float *v1=(float*)vec1, *v2=(float*)vec2;
Int k;
MpiInt k; // size_t might be more appropriate, as in BI_cvvsum.c BI_dvvsum.c BI_ivvsum.c BI_svvsum.c BI_zvvsum.c
for (k=0; k < N; k++) v1[k] += v2[k];
}
4 changes: 2 additions & 2 deletions BLACS/SRC/BI_zvvsum.c
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#include "Bdef.h"
void BI_zvvsum(Int N, char *vec1, char *vec2)
void BI_zvvsum(MpiInt N, char *vec1, char *vec2)
{
double *v1=(double*)vec1, *v2=(double*)vec2;
Int k;
MpiInt k; // size_t might be more appropriate, as in BI_cvvsum.c BI_dvvsum.c BI_ivvsum.c BI_svvsum.c BI_zvvsum.c
N *=2;
for (k=0; k < N; k++) v1[k] += v2[k];
}
102 changes: 100 additions & 2 deletions BLACS/SRC/Bconfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,107 @@
#ifndef Int
#define Int int
#endif
#ifndef MpiInt

/* If somebody is building with BigMPI
* give it priority compared to other
* solutions since otherwise they would
* not have bothered to configure BLACS
* with BigMPI
*/
#ifdef BIGMPI
#define MpiInt MPI_Count
inline int _MPI_Isend(const void *buf, MPI_Count count, MPI_Datatype datatype, int dest,
int tag, MPI_Comm comm, MPI_Request *request) {
return MPIX_Isend_x(buf, count, datatype, dest, tag, comm, request);
}
inline int _MPI_Irecv(void *buf, MPI_Count count, MPI_Datatype datatype,
int source, int tag, MPI_Comm comm, MPI_Request *request) {
return MPIX_Irecv_x (buf, count, datatype, source, tag, comm, request);
}
inline int _MPI_Op_create(MPI_User_function_c *user_fn, int commute, MPI_Op *op) {
return BigMPI_Op_create (user_fn, commute, op);
}
inline int _MPI_Type_create_struct(MPI_Count count,
const MPI_Count array_of_blocklengths[],
const MPI_Count array_of_displacements[],
const MPI_Datatype array_of_types[],
MPI_Datatype *newtype) {
// TODO not sure what to do here
}
inline int _MPI_Type_indexed(MPI_Count count, const MPI_Count array_of_blocklengths[],
const MPI_Count array_of_displacements[],
MPI_Datatype oldtype, MPI_Datatype *newtype) {
// TODO not sure what to do here
}
#else // no BIGMPI
/* If there is no BigMPI, but there is
* an MPI implementation v4.x use
* that for large tranfers. Caveat:
* there are some incomplete v4.x
* implementations around which will fail.
* Hopefully they will be fixed
* before this goes to production
*/
#if MPI_VERSION==4
#define MpiInt MPI_Count
inline int _MPI_Isend(const void *buf, MPI_Count count, MPI_Datatype datatype, int dest,
int tag, MPI_Comm comm, MPI_Request *request) {
return MPI_Isend_c(buf, count, datatype, dest, tag, comm, request);
}
inline int _MPI_Irecv(void *buf, MPI_Count count, MPI_Datatype datatype,
int source, int tag, MPI_Comm comm, MPI_Request *request) {
return MPI_Irecv_c (buf, count, datatype, source, tag, comm, request);
}
inline int _MPI_Op_create(MPI_User_function_c *user_fn, int commute, MPI_Op *op) {
return MPI_Op_create_c (user_fn, commute, op);
}
inline int _MPI_Type_create_struct(MPI_Count count,
const MPI_Count array_of_blocklengths[],
const MPI_Count array_of_displacements[],
const MPI_Datatype array_of_types[],
MPI_Datatype *newtype) {
return MPI_Type_create_struct_c(count, array_of_blocklengths,
array_of_displacements, array_of_types,
newtype);
}
inline int _MPI_Type_indexed(MPI_Count count, const MPI_Count array_of_blocklengths[],
const MPI_Count array_of_displacements[],
MPI_Datatype oldtype, MPI_Datatype *newtype) {
return MPI_Type_indexed_c(count, array_of_blocklengths, array_of_displacements,
oldtype, newtype);
}
/* Otherwise default to non-big
* transfers
*/
#else // no MPI v4
#define MpiInt int
#endif
inline int _MPI_Isend(const void *buf, int count, MPI_Datatype datatype, int dest,
int tag, MPI_Comm comm, MPI_Request *request) {
return MPI_Isend(buf, count, datatype, dest, tag, comm, request);
}
inline int _MPI_Irecv(void *buf, int count, MPI_Datatype datatype,
int source, int tag, MPI_Comm comm, MPI_Request *request) {
return MPI_Irecv (buf, count, datatype, source, tag, comm, request);
}
inline int _MPI_Op_create(MPI_User_function *user_fn, int commute, MPI_Op *op) {
return MPI_Op_create (user_fn, commute, op);
}
inline int _MPI_Type_create_struct(int count, const int array_of_blocklengths[],
const MPI_Aint array_of_displacements[],
const MPI_Datatype array_of_types[],
MPI_Datatype *newtype)
return MPI_Type_create_struct(count, array_of_blocklengths,
array_of_displacements, array_of_types,
newtype);
}
int MPI_Type_indexed(int count, const int array_of_blocklengths[],
const int array_of_displacements[], MPI_Datatype oldtype,
MPI_Datatype *newtype) {
return MPI_Type_indexed(count, array_of_blocklengths, array_of_displacements,
oldtype, newtype);
}
#endif // MPI version
#endif // BIGMPI

/*
* These macros define the naming strategy needed for a fortran
Expand Down
4 changes: 2 additions & 2 deletions BLACS/SRC/Bdef.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,14 +58,14 @@ struct bLaCbUfF
Int nAops; /* number of asynchronous operations out of buff */
MPI_Request *Aops; /* list of async. operations out of buff */
MPI_Datatype dtype; /* data type of buffer */
Int N; /* number of elements of data type in buff */
MpiInt N; /* number of elements of data type in buff */
BLACBUFF *prev, *next; /* pointer to the other BLACBUFF in queue */
};

/*
* Pointer to the combine's vector-vector functions
*/
typedef void (*VVFUNPTR)(Int, char *, char *);
typedef void (*VVFUNPTR)(MpiInt, char *, char *);
typedef void (*SDRVPTR)(BLACSCONTEXT *, Int, Int, BLACBUFF *);


Expand Down
2 changes: 1 addition & 1 deletion BLACS/SRC/blacs_get_.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ F_VOID_FUNC blacs_get_(Int *ConTxt, Int *what, Int *val)
{
Int Csys2blacs_handle(MPI_Comm);
Int ierr, *iptr;
MpiInt flag;
int flag;
Int comm;
BLACSCONTEXT *ctxt;

Expand Down
4 changes: 2 additions & 2 deletions BLACS/SRC/blacs_map_.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ F_VOID_FUNC blacs_gridmap_(Int *ConTxt, Int *usermap, Int *ldup, Int *nprow0,
MPI_Comm Cblacs2sys_handle(Int BlacsCtxt);
MPI_Comm BI_TransUserComm(Int, Int, Int *);

MpiInt Iam;
int Iam;
Int info, i, j, *iptr;
Int myrow, mycol, nprow, npcol, Ng;
BLACSCONTEXT *ctxt, **tCTxts;
Expand Down Expand Up @@ -53,7 +53,7 @@ F_VOID_FUNC blacs_gridmap_(Int *ConTxt, Int *usermap, Int *ldup, Int *nprow0,
for (i=0; i < nprow; i++) iptr[i*npcol+j] = usermap[j*Mpval(ldup)+i];
}
#if (INTFACE == C_CALL)
MpiInt *miptr = (MpiInt *) malloc(Ng*sizeof(MpiInt));
int *miptr = (int *) malloc(Ng*sizeof(int));
for (j=0; j < Ng; j++) miptr[j] = iptr[j];
tcomm = Cblacs2sys_handle(*ConTxt);
MPI_Comm_group(tcomm, &grp); /* find input comm's group */
Expand Down
Loading