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
4 changes: 2 additions & 2 deletions Makefile.coh
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ CFLAGS=-DTRUE=true -DFALSE=false -D __GNUDOS__ -Dlinux -O3 -DOPT_LIB -Wall -Wno-
#LFLAGS=-lm -L$(ADMODEL_HOME)/lib -ladmb -lstdc++ -lxml2

###### with optimized library ###########################
LFLAGS= -L$(SEA_PARALLEL)/lib -lseapodym_api -L$(ADMODEL_HOME)/lib -ladmbo -lstdc++ -lxml2 -lm
LFLAGS= -L$(SEA_PARALLEL)/lib -lseapodym_api -lspdlog -lfmt -L$(ADMODEL_HOME)/lib -ladmbo -lstdc++ -lxml2 -lm

CC=mpicxx
LL=$(CC)
Expand Down Expand Up @@ -145,7 +145,7 @@ docs: $(SRCS) $(HEADERS)

$(BINPATH)/seapodym_cohort : $(OBJECTS)
@make -p $(BINDIR)
$(LL) -o$@ $(DEBUG) $^ $(LFLAGS)
$(LL) -o$@ $(DEBUG) $^ $(LFLAGS)

$(OBJPATH)/%.o : %.cpp
$(CC) -o$@ $(DEBUG) -c $(CFLAGS) $(filter %.cpp, $^)
Expand Down
17 changes: 10 additions & 7 deletions src/main_cohort.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ SeapodymCohort* seapodym_cohort(const char* parfile, const int cmp_regime, const
void buffers_init(long int &mv, long int &mc, long int &mg, const bool grad_calc);
void buffers_set(long int &mv, long int &mc, long int &mg);

double tik, tak, time_init, time_calc, time_mpi, time_step, time_overhead;

double tik, tak, time_init = 0.0, time_init2 = 0.0, time_calc = 0.0, time_mpi = 0.0, time_step = 0.0, time_overhead = 0.0;

SeapodymCohort xinit_prerun_wrapper(const char* parfile) {

Expand Down Expand Up @@ -49,6 +50,8 @@ taskFunction(int task_id, int stepBeg, int stepEnd, MPI_Comm comm,
DistDataCollector* dataCollector,
SeapodymCohort* cohort)
{
tik = MPI_Wtime();

//initialize variables of optimization
const int nvar = cohort->nvarcalc();
independent_variables x(1, nvar);
Expand All @@ -57,17 +60,18 @@ taskFunction(int task_id, int stepBeg, int stepEnd, MPI_Comm comm,
int cohort_id = task_id;
cohort->restart(cohort_id);
//initialize cohort either from restart or from spawning
tik = MPI_Wtime();
cohort->init_cohort(x,*dataCollector);

std::vector<double> localData(numData);

// advance the cohort
// advance the cohort
tak = MPI_Wtime();
time_init2 += tak - tik;
for (auto step = stepBeg; step < stepEnd; ++step) {

double tik_step = MPI_Wtime();
cohort->stepForward(false);
time_step += MPI_Wtime() - tik_step;
time_step += MPI_Wtime() - tik_step;

// Send the data to the manager.
std::vector<double> localData = cohort->GetCohortDensity();
Expand All @@ -87,9 +91,7 @@ taskFunction(int task_id, int stepBeg, int stepEnd, MPI_Comm comm,
time_mpi += MPI_Wtime() - tik_mpi;
}

tak = MPI_Wtime();
time_calc += tak - tik;

time_calc += MPI_Wtime() - tak;
}

int main(int argc, char** argv) {
Expand Down Expand Up @@ -203,6 +205,7 @@ int main(int argc, char** argv) {
time_overhead = cohort.time_overhead;
}


printf("[%d] Timings calc/step/overhead/init/comm: %10.3lf/%10.3lf/%10.3lf/%10.3lf/%10.3lf\n", workerId,
time_calc, time_step, time_overhead, time_init, time_mpi);

Expand Down