diff --git a/Makefile b/Makefile index 3f23057ef2a95296129a1eb5f481d5c6356313b3..e88c8863424d006a9eab42fddb7d96cb87912283 100644 --- a/Makefile +++ b/Makefile @@ -21,6 +21,8 @@ MPICC = /apps/INTEL/2017.4/impi/2017.3.196/bin64/mpicc DLB_FLAGS = -I$(DLB_HOME)/include -L$(DLB_HOME)/lib -ldlb -Wl,-rpath,$(DLB_HOME)/lib +TALP_NUM_REGIONS ?= 30 + all: pils pils_regions pils: pils.c @@ -29,6 +31,9 @@ pils: pils.c pils_regions: pils.c $(MPICC) $^ -o $@ $(DLB_FLAGS) -DTALP_REGIONS +pils_several_regions: pils.c + $(MPICC) $^ -o $@ $(DLB_FLAGS) -DTALP_SEVERAL_REGIONS=$(TALP_NUM_REGIONS) + .PHONY: clean clean: rm -f pils pils_regions diff --git a/pils.c b/pils.c index 2a8bffe5780763edadf7d572cd70639409040915..ea9491c594a2bd2ccbfe78b5203624a987e3bd1b 100644 --- a/pils.c +++ b/pils.c @@ -26,7 +26,11 @@ #include #include -#if TALP_REGIONS +#if defined(TALP_REGIONS) && defined(TALP_SEVERAL_REGIONS) +#error TALP_REGIONS and TALP_SEVERAL_REGIONS are incompatible +#endif + +#if defined(TALP_REGIONS) || defined(TALP_SEVERAL_REGIONS) #include #endif @@ -226,6 +230,16 @@ int main(int argc, char* argv[]) { dlb_monitor_t *region = DLB_MonitoringRegionRegister(NULL); #endif +#ifdef TALP_SEVERAL_REGIONS + dlb_monitor_t *region[TALP_SEVERAL_REGIONS]; + { + int i = 0; + for (i = 0; i < TALP_SEVERAL_REGIONS; i++) { + region[i] = DLB_MonitoringRegionRegister(NULL); + DLB_MonitoringRegionStart(region[i]); + } + } +#endif /***********************************************************************/ /************** MAIN LOOP **********************************************/ int k; @@ -260,6 +274,15 @@ int main(int argc, char* argv[]) { MPI_Allreduce(&iter_time, &final_time, 1, MPI_DOUBLE , MPI_SUM, MPI_COMM_WORLD); } +#ifdef TALP_SEVERAL_REGIONS + dlb_monitor_t *region[TALP_SEVERAL_REGIONS]; + { + int i = 0; + for (i = 0; i < TALP_SEVERAL_REGIONS; i++) { + DLB_MonitoringRegionStop(region[i]); + } +#endif + if (mpi_rank == 0) printf("Total time: %6.3f\n", final_time); // Application elapsed time @@ -271,6 +294,10 @@ int main(int argc, char* argv[]) { printf("\nApplication time = %.4f \n", app_time); } + } + } +#endif + MPI_Finalize(); free(loads);