Hi,
I solved the error using if-else.
Zulfi.
#include <iostream>
#include <fstream>
#include <cmath>
#include <mpi.h>
#include <ctime>
#include <vector>
#define MYBUFFERLENGTH 1024
char myinbuffer[MYBUFFERLENGTH];
char myoutbuffer[MYBUFFERLENGTH];
extern "C" {
int mikes_MPI_SIZE (MPI_Datatype datatype) {
if(datatype ==MPI_CHAR){
return sizeof(char);
}
else if(datatype == MPI_DOUBLE){
return sizeof(double);
}
return -1;
}
}
int MMPI_Reduce(void * sendbuf, void * recvbuf, int count,
MPI_Datatype datatype, MPI_Op op, int root, MPI_Comm comm) {
int bit,processor1,i;
int *iaccum1;
int *iaccum2;
double *daccum1;
double *daccum2;
int * locaccum1;
int * locaccum2;
iaccum1=(int *) myinbuffer;
iaccum2=(int *)(myinbuffer+mikes_MPI_SIZE(datatype));
daccum1=(double *) myinbuffer;
daccum2=(double *)(myinbuffer+mikes_MPI_SIZE(datatype));
locaccum1=(int*)(myinbuffer+mikes_MPI_SIZE(datatype)-sizeof(int));
locaccum2=(int*)(myinbuffer+2*mikes_MPI_SIZE(datatype)-sizeof(int));
*locaccum1=*locaccum2=processor1;
return MPI_SUCCESS;
}
int main(){
}