diff --git a/Makefile.coh b/Makefile.coh index 98de717..7c4934f 100755 --- a/Makefile.coh +++ b/Makefile.coh @@ -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) @@ -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, $^) diff --git a/src/main_cohort.cpp b/src/main_cohort.cpp index d4036aa..d30fef1 100755 --- a/src/main_cohort.cpp +++ b/src/main_cohort.cpp @@ -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) { @@ -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); @@ -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 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 localData = cohort->GetCohortDensity(); @@ -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) { @@ -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);