Skip to content

Commit

Permalink
* Support of new dco repo
Browse files Browse the repository at this point in the history
* Bugfixes
* Tests updated
* OpenMP removed
  • Loading branch information
Michel Schanen committed Mar 12, 2014
1 parent ef0eb01 commit c34a3bd
Show file tree
Hide file tree
Showing 17 changed files with 94 additions and 82 deletions.
1 change: 0 additions & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ AC_PROG_CC
AC_PROG_CPP
AC_PROG_RANLIB
AC_LANG([C])
AC_OPENMP
AC_HEADER_STDC

AM_PROG_AR
Expand Down
2 changes: 1 addition & 1 deletion interfaces/dco/ampi_interface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ extern "C" {
//forward declare von AMPI

#ifndef DCO_AMPI
void ampi_interpret_tape(long int idx) {}
//void ampi_interpret_tape(long int idx) {}
#endif
//long int ampi_counter=0;

Expand Down
117 changes: 58 additions & 59 deletions src/ampi_tape.c
Original file line number Diff line number Diff line change
Expand Up @@ -442,79 +442,78 @@ int AMPI_Reduce(void *sendbuf, void *recvbuf, int count, MPI_Datatype datatype,
}

int AMPI_Allreduce(void *sendbuf, void *recvbuf, int count, MPI_Datatype datatype, MPI_Op op, MPI_Comm comm) {
int ierr=0;
#ifdef AMPI_COUNT_COMMS
ampi_comm_count=ampi_comm_count+1;
ampi_comm_count=ampi_comm_count+1;
#endif
if(datatype!=AMPI_DOUBLE) {
MPI_Allreduce(sendbuf, recvbuf, count, datatype, op, comm);
}
ampi_check_tape_size(2*count+1);
int tapeActive = ampi_is_tape_active();
int i=0;
double * tmp_send = (double*) malloc(sizeof(double)*count);
double * tmp_recv = (double*) malloc(sizeof(double)*count);
if(datatype!=AMPI_DOUBLE) {
return MPI_Allreduce(sendbuf, recvbuf, count, datatype, op, comm);
}
ampi_check_tape_size(2*count+1);
int tapeActive = ampi_is_tape_active();
int i=0;
double * tmp_send = (double*) malloc(sizeof(double)*count);
double * tmp_recv = (double*) malloc(sizeof(double)*count);

long int new_vac = 0;
if(tapeActive) {
ampi_tape[ampi_vac+count].arg=(int*) malloc(sizeof(int)*3);
new_vac = ampi_vac+count;
long int new_vac = 0;
if(tapeActive) {
ampi_tape[ampi_vac+count].arg=(int*) malloc(sizeof(int)*3);
new_vac = ampi_vac+count;

ampi_create_dummies(recvbuf, &count);
ampi_create_tape_entry(&new_vac);
}
ampi_create_dummies(recvbuf, &count);
ampi_create_tape_entry(&new_vac);
}

/*sendbuf dummies*/
/*sendbuf dummies*/

#pragma omp parallel for
for(i=0 ; i<count ; i=i+1) {
ampi_get_val(sendbuf,&i,&tmp_send[i]);
for(i=0 ; i<count ; i=i+1) {
ampi_get_val(sendbuf,&i,&tmp_send[i]);

if(tapeActive) {
ampi_tape[ampi_vac+i].oc = MPI_DUMMY;
ampi_get_idx(sendbuf, &i, &ampi_tape[ampi_vac+i].idx);
}
if(tapeActive) {
ampi_tape[ampi_vac+i].oc = MPI_DUMMY;
ampi_get_idx(sendbuf, &i, &ampi_tape[ampi_vac+i].idx);
}
}

if(tapeActive) {
/*actual reduce entry*/

ampi_tape[ampi_vac+count].oc = ALLREDUCE;
ampi_tape[ampi_vac+count].arg[0] = count;
ampi_tape[ampi_vac+count].comm = comm;
/*ampi_tape[ampi_vac+count].arg[1] = root;*/
if(op == MPI_SUM){
ampi_tape[ampi_vac+count].arg[2] = AMPI_REDUCE_ADD;
}
if(op == MPI_PROD){
ampi_tape[ampi_vac+count].arg[2] = AMPI_REDUCE_MUL;
}
if(op == MPI_MIN){
ampi_tape[ampi_vac+count].arg[2] = AMPI_REDUCE_MIN;
}
if(op == MPI_MAX){
ampi_tape[ampi_vac+count].arg[2] = AMPI_REDUCE_MAX;
}
if(tapeActive) {
/*actual reduce entry*/

ampi_tape[ampi_vac+count].oc = ALLREDUCE;
ampi_tape[ampi_vac+count].arg[0] = count;
ampi_tape[ampi_vac+count].comm = comm;
/*ampi_tape[ampi_vac+count].arg[1] = root;*/
if(op == MPI_SUM){
ampi_tape[ampi_vac+count].arg[2] = AMPI_REDUCE_ADD;
}
if(op == MPI_PROD){
ampi_tape[ampi_vac+count].arg[2] = AMPI_REDUCE_MUL;
}
if(op == MPI_MIN){
ampi_tape[ampi_vac+count].arg[2] = AMPI_REDUCE_MIN;
}
if(op == MPI_MAX){
ampi_tape[ampi_vac+count].arg[2] = AMPI_REDUCE_MAX;
}
}

AMPI_Allreduce_f(tmp_send, tmp_recv, count, datatype, op, comm);
ierr=AMPI_Allreduce_f(tmp_send, tmp_recv, count, datatype, op, comm);

/*recvbuf entry*/
/*recvbuf entry*/

#pragma omp parallel for
for(i=0 ; i<count ; i=i+1) {
if(tapeActive) {
ampi_tape[ampi_vac+count+1+i].oc = MPI_DUMMY;
ampi_get_idx(recvbuf, &i, &ampi_tape[ampi_vac+count+1+i].idx);
}
ampi_set_val(recvbuf, &i, &tmp_recv[i]);
}
for(i=0 ; i<count ; i=i+1) {
if(tapeActive) {
ampi_tape[ampi_vac+count+1+i].oc = MPI_DUMMY;
ampi_get_idx(recvbuf, &i, &ampi_tape[ampi_vac+count+1+i].idx);
}
ampi_set_val(recvbuf, &i, &tmp_recv[i]);
}

if(tapeActive) {
ampi_vac+=2*count+1;
}
free(tmp_send);
free(tmp_recv);
return 0;
if(tapeActive) {
ampi_vac+=2*count+1;
}
free(tmp_send);
free(tmp_recv);
return ierr;
}

int AMPI_Scatter(void *sendbuf, int sendcnt, MPI_Datatype sendtype, void *recvbuf, int recvcnt, MPI_Datatype recvtype, int root, MPI_Comm comm) {
Expand Down
6 changes: 3 additions & 3 deletions test/Allreduce/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ include ../Makefile.inc
NPROC=4
PSIZE=10

DCO_BUILD=$(DCO_BASE_DIR)/build/dco_cpp
DCO_INCLUDE=$(DCO_BASE_DIR)/src/dco

CXXFLAGS=-g -O0 -I$(DCO_BUILD)/include -L$(DCO_BUILD)/lib -fopenmp
CXXFLAGS=-g -O0 -I$(DCO_INCLUDE) $(DCO_FLAGS)

all: driver.out fdDriver.out ampiDriver.out

Expand All @@ -31,7 +31,7 @@ fdDriver.o: fdDriver.cpp
${MPICXX} $(CXXFLAGS) -c -o $@ fdDriver.cpp

ampiDriver: ampiDriver.o ampi_interface.o
$(MPICXX) $(CXXFLAGS) -o $@ ampiDriver.o ampi_interface.o -ldco $(AMPI_DIR)/src/libAMPI.a
$(MPICXX) $(CXXFLAGS) -o $@ ampiDriver.o ampi_interface.o $(AMPI_DIR)/src/libAMPI.a

ampiDriver.o: ampiDriver.cpp
$(MPICXX) $(CXXFLAGS) -I$(AMPI_DIR)/include -c -o $@ ampiDriver.cpp
Expand Down
2 changes: 2 additions & 0 deletions test/Allreduce/ampiDriver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ using namespace std;

typedef dco::a1s::type active;

dco::a1s::tape *dco::a1s::global_tape=0;

void comp(active *x, active &y, int &n) {
int rank;
MPI_Comm_rank(MPI_COMM_WORLD,&rank);
Expand Down
6 changes: 3 additions & 3 deletions test/Bcast/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ include ../Makefile.inc
NPROC=2
PSIZE=10

DCO_BUILD=$(DCO_BASE_DIR)/build/dco_cpp
DCO_INCLUDE=$(DCO_BASE_DIR)/src/dco

CXXFLAGS=-g -O0 -I$(DCO_BUILD)/include -L$(DCO_BUILD)/lib -fopenmp
CXXFLAGS=-g -O0 -I$(DCO_INCLUDE) $(DCO_FLAGS)

all: driver.out fdDriver.out ampiDriver.out

Expand All @@ -31,7 +31,7 @@ fdDriver.o: fdDriver.cpp
${MPICXX} $(CXXFLAGS) -c -o $@ fdDriver.cpp

ampiDriver: ampiDriver.o ampi_interface.o
$(MPICXX) $(CXXFLAGS) -o $@ ampiDriver.o ampi_interface.o -ldco $(AMPI_DIR)/src/libAMPI.a
$(MPICXX) $(CXXFLAGS) -o $@ ampiDriver.o ampi_interface.o $(AMPI_DIR)/src/libAMPI.a

ampiDriver.o: ampiDriver.cpp
$(MPICXX) $(CXXFLAGS) -I$(AMPI_DIR)/include -c -o $@ ampiDriver.cpp
Expand Down
2 changes: 2 additions & 0 deletions test/Bcast/ampiDriver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ using namespace std;

typedef dco::a1s::type active;

dco::a1s::tape *dco::a1s::global_tape=0;

void comp(active *x, active &y, int &n) {
int rank;
MPI_Comm_rank(MPI_COMM_WORLD,&rank);
Expand Down
6 changes: 3 additions & 3 deletions test/IsendIrecv/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ include ../Makefile.inc
NPROC=2
PSIZE=10

DCO_BUILD=$(DCO_BASE_DIR)/build/dco_cpp
DCO_INCLUDE=$(DCO_BASE_DIR)/src/dco

CXXFLAGS=-g -O0 -I$(DCO_BUILD)/include -L$(DCO_BUILD)/lib -fopenmp
CXXFLAGS=-g -O0 -I$(DCO_INCLUDE) $(DCO_FLAGS)

all: driver.out fdDriver.out ampiDriver.out

Expand All @@ -31,7 +31,7 @@ fdDriver.o: fdDriver.cpp
${MPICXX} $(CXXFLAGS) -c -o $@ fdDriver.cpp

ampiDriver: ampiDriver.o ampi_interface.o
$(MPICXX) $(CXXFLAGS) -o $@ ampiDriver.o ampi_interface.o -ldco $(AMPI_DIR)/src/libAMPI.a
$(MPICXX) $(CXXFLAGS) -o $@ ampiDriver.o ampi_interface.o $(AMPI_DIR)/src/libAMPI.a

ampiDriver.o: ampiDriver.cpp
$(MPICXX) $(CXXFLAGS) -I$(AMPI_DIR)/include -c -o $@ ampiDriver.cpp
Expand Down
2 changes: 2 additions & 0 deletions test/IsendIrecv/ampiDriver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ using namespace std;

typedef dco::a1s::type active;

dco::a1s::tape *dco::a1s::global_tape=0;

void comp(active *x, active &y, int &n) {
int rank;
MPI_Comm_rank(MPI_COMM_WORLD,&rank);
Expand Down
6 changes: 3 additions & 3 deletions test/Reduce/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ include ../Makefile.inc
NPROC=4
PSIZE=10

DCO_BUILD=$(DCO_BASE_DIR)/build/dco_cpp
DCO_INCLUDE=$(DCO_BASE_DIR)/src/dco

CXXFLAGS=-g -O0 -I$(DCO_BUILD)/include -L$(DCO_BUILD)/lib -fopenmp
CXXFLAGS=-g -O0 -I$(DCO_INCLUDE) $(DCO_FLAGS)

all: driver.out fdDriver.out ampiDriver.out

Expand All @@ -31,7 +31,7 @@ fdDriver.o: fdDriver.cpp
${MPICXX} $(CXXFLAGS) -c -o $@ fdDriver.cpp

ampiDriver: ampiDriver.o ampi_interface.o
$(MPICXX) $(CXXFLAGS) -o $@ ampiDriver.o ampi_interface.o -ldco $(AMPI_DIR)/src/libAMPI.a
$(MPICXX) $(CXXFLAGS) -o $@ ampiDriver.o ampi_interface.o $(AMPI_DIR)/src/libAMPI.a

ampiDriver.o: ampiDriver.cpp
$(MPICXX) $(CXXFLAGS) -I$(AMPI_DIR)/include -c -o $@ ampiDriver.cpp
Expand Down
2 changes: 2 additions & 0 deletions test/Reduce/ampiDriver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ using namespace std;

typedef dco::a1s::type active;

dco::a1s::tape *dco::a1s::global_tape=0;

void comp(active *x, active &y, int &n) {
int rank;
MPI_Comm_rank(MPI_COMM_WORLD,&rank);
Expand Down
6 changes: 3 additions & 3 deletions test/ScatterGather/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ include ../Makefile.inc
NPROC=4
PSIZE=10

DCO_BUILD=$(DCO_BASE_DIR)/build/dco_cpp
DCO_INCLUDE=$(DCO_BASE_DIR)/src/dco

CXXFLAGS=-g -O0 -I$(DCO_BUILD)/include -L$(DCO_BUILD)/lib -fopenmp
CXXFLAGS=-g -O0 -I$(DCO_INCLUDE) $(DCO_FLAGS)

all: driver.out fdDriver.out ampiDriver.out

Expand All @@ -31,7 +31,7 @@ fdDriver.o: fdDriver.cpp
${MPICXX} $(CXXFLAGS) -c -o $@ fdDriver.cpp

ampiDriver: ampiDriver.o ampi_interface.o
$(MPICXX) $(CXXFLAGS) -o $@ ampiDriver.o ampi_interface.o -ldco $(AMPI_DIR)/src/libAMPI.a
$(MPICXX) $(CXXFLAGS) -o $@ ampiDriver.o ampi_interface.o $(AMPI_DIR)/src/libAMPI.a

ampiDriver.o: ampiDriver.cpp
$(MPICXX) $(CXXFLAGS) -I$(AMPI_DIR)/include -c -o $@ ampiDriver.cpp
Expand Down
2 changes: 2 additions & 0 deletions test/ScatterGather/ampiDriver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ using namespace std;

typedef dco::a1s::type active;

dco::a1s::tape *dco::a1s::global_tape=0;

void comp(active *x, active &y, int n) {
int numprocs, rank;
MPI_Comm_rank(MPI_COMM_WORLD,&rank);
Expand Down
6 changes: 3 additions & 3 deletions test/SendRecv/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ include ../Makefile.inc
NPROC=2
PSIZE=10

DCO_BUILD=$(DCO_BASE_DIR)/build/dco_cpp
DCO_INCLUDE=$(DCO_BASE_DIR)/src/dco

CXXFLAGS=-g -O0 -I$(DCO_BUILD)/include -L$(DCO_BUILD)/lib -fopenmp
CXXFLAGS=-g -O0 -I$(DCO_INCLUDE) $(DCO_FLAGS)

all: driver.out fdDriver.out ampiDriver.out

Expand All @@ -31,7 +31,7 @@ fdDriver.o: fdDriver.cpp
${MPICXX} $(CXXFLAGS) -c -o $@ fdDriver.cpp

ampiDriver: ampiDriver.o ampi_interface.o
$(MPICXX) $(CXXFLAGS) -o $@ ampiDriver.o ampi_interface.o -ldco $(AMPI_DIR)/src/libAMPI.a
$(MPICXX) $(CXXFLAGS) -o $@ ampiDriver.o ampi_interface.o $(AMPI_DIR)/src/libAMPI.a

ampiDriver.o: ampiDriver.cpp
$(MPICXX) $(CXXFLAGS) -I$(AMPI_DIR)/include -c -o $@ ampiDriver.cpp
Expand Down
2 changes: 2 additions & 0 deletions test/SendRecv/ampiDriver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ using namespace std;

typedef dco::a1s::type active;

dco::a1s::tape *dco::a1s::global_tape=0;

void comp(active *x, active &y, int &n) {
int rank;
MPI_Comm_rank(MPI_COMM_WORLD,&rank);
Expand Down
6 changes: 3 additions & 3 deletions test/Sendrecv_replace/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ include ../Makefile.inc
NPROC=2
PSIZE=10

DCO_BUILD=$(DCO_BASE_DIR)/build/dco_cpp
DCO_INCLUDE=$(DCO_BASE_DIR)/src/dco

CXXFLAGS=-g -O0 -I$(DCO_BUILD)/include -L$(DCO_BUILD)/lib -fopenmp
CXXFLAGS=-g -O0 -I$(DCO_INCLUDE) $(DCO_FLAGS)

all: driver.out fdDriver.out ampiDriver.out

Expand All @@ -31,7 +31,7 @@ fdDriver.o: fdDriver.cpp
${MPICXX} $(CXXFLAGS) -c -o $@ fdDriver.cpp

ampiDriver: ampiDriver.o ampi_interface.o
$(MPICXX) $(CXXFLAGS) -o $@ ampiDriver.o ampi_interface.o -ldco $(AMPI_DIR)/src/libAMPI.a
$(MPICXX) $(CXXFLAGS) -o $@ ampiDriver.o ampi_interface.o $(AMPI_DIR)/src/libAMPI.a

ampiDriver.o: ampiDriver.cpp
$(MPICXX) $(CXXFLAGS) -I$(AMPI_DIR)/include -c -o $@ ampiDriver.cpp
Expand Down
2 changes: 2 additions & 0 deletions test/Sendrecv_replace/ampiDriver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ using namespace std;

typedef dco::a1s::type active;

dco::a1s::tape *dco::a1s::global_tape=0;

void comp(active *x, active &y, int &n) {
int rank;
MPI_Comm_rank(MPI_COMM_WORLD,&rank);
Expand Down

0 comments on commit c34a3bd

Please sign in to comment.