Skip to content

Commit 1fe20c4

Browse files
committed
Merge pull request #43 from manodeep/develop
Exposed the internal SILENT option that suppresses most informational…
2 parents 62670aa + 17ec0a8 commit 1fe20c4

File tree

17 files changed

+217
-70
lines changed

17 files changed

+217
-70
lines changed

common.mk

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,18 @@ ifeq (osx, $(findstring osx, ${TRAVIS_OS_NAME}))
4242
endif
4343
# done with removing USE_AVX under osx on Travis
4444

45+
# Check if all progressbar output is to be suppressed
46+
OUTPUT_PGBAR := 1
47+
ifeq (SILENT, $(findstring SILENT, $(CFLAGS)))
48+
OUTPUT_PGBAR := 0
49+
endif
50+
51+
ifeq (SILENT, $(findstring SILENT, $(OPT)))
52+
OUTPUT_PGBAR := 0
53+
endif
54+
#end of progressbar checks
55+
56+
4557
# Now check if gcc is set to be the compiler but if clang is really under the hood.
4658
export CC_IS_CLANG ?= -1
4759
ifeq ($(CC_IS_CLANG), -1)

xi_mocks/DDrppi/Makefile

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,19 @@ ifneq (clean,$(findstring clean,$(MAKECMDGOALS)))
33
include ../../common.mk
44
endif
55

6-
target=DDrppi_mocks wprp_mocks
7-
8-
INCL = countpairs_rp_pi_mocks.h ../../io/io.h ../../io/ftread.h ../../io/io.h ../../utils/gridlink_mocks.h ../../utils/cellarray_mocks.h \
6+
target := DDrppi_mocks wprp_mocks
7+
SRC1 := DDrppi_mocks.c countpairs_rp_pi_mocks.c ../../utils/gridlink_mocks.c \
8+
../../utils/set_cosmo_dist.c ../../utils/cosmology_params.c \
9+
../../utils/utils.c ../../io/io.c ../../io/ftread.c
10+
INCL := countpairs_rp_pi_mocks.h ../../io/io.h ../../io/ftread.h ../../io/io.h ../../utils/gridlink_mocks.h ../../utils/cellarray_mocks.h \
911
../../utils/set_cosmo_dist.h ../../utils/cosmology_params.h \
10-
../../utils/utils.h ../../utils/function_precision.h ../../utils/avx_calls.h ../../utils/defs.h ../../utils/progressbar.h
12+
../../utils/utils.h ../../utils/function_precision.h ../../utils/avx_calls.h ../../utils/defs.h
13+
14+
ifeq ($(OUTPUT_PGBAR), 1)
15+
SRC1 += ../../utils/progressbar.c
16+
INCL += ../../utils/progressbar.h
17+
endif
1118

12-
SRC1= DDrppi_mocks.c countpairs_rp_pi_mocks.c ../../utils/gridlink_mocks.c \
13-
../../utils/set_cosmo_dist.c ../../utils/cosmology_params.c \
14-
../../utils/utils.c ../../io/io.c ../../io/ftread.c ../../utils/progressbar.c
1519

1620
OBJS1=$(SRC1:.c=.o)
1721

xi_mocks/DDrppi/countpairs_rp_pi_mocks.c

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,14 @@
1616
#include "utils.h"
1717
#include "cellarray_mocks.h"
1818
#include "gridlink_mocks.h"
19-
#include "progressbar.h"
2019
#include "countpairs_rp_pi_mocks.h"
2120
#include "cosmology_params.h"
2221
#include "set_cosmo_dist.h"
2322

23+
#ifndef SILENT
24+
#include "progressbar.h"
25+
#endif
26+
2427
#if defined(USE_AVX) && defined(__AVX__)
2528
#include "avx_calls.h"
2629
#endif
@@ -321,11 +324,17 @@ results_countpairs_mocks * countpairs_mocks(const int64_t ND1, DOUBLE *phi1, DOU
321324
/* const DOUBLE cz_binsize=(d2max-d2min)/ngrid; */
322325
const DOUBLE inv_cz_binsize=ngrid/(d2max-d2min);
323326

327+
#ifndef SILENT
324328
int interrupted=0,numdone=0;
325329
init_my_progressbar(ND1,&interrupted);
330+
#endif
326331

327332
#ifdef USE_OMP
333+
#ifndef SILENT
328334
#pragma omp parallel shared(numdone)
335+
#else
336+
#pragma omp parallel
337+
#endif//SILENT
329338
{
330339
const int tid = omp_get_thread_num();
331340
uint64_t npairs[totnbins] __attribute__ ((aligned(ALIGNMENT)));
@@ -336,9 +345,12 @@ results_countpairs_mocks * countpairs_mocks(const int64_t ND1, DOUBLE *phi1, DOU
336345
#endif
337346

338347
#pragma omp for schedule(dynamic)
339-
#endif
348+
#endif//USE_OMP
340349
/*---Loop-over-Data1-particles--------------------*/
341350
for(int i=0;i<ND1;i++) {
351+
352+
353+
#ifndef SILENT
342354
#ifdef USE_OMP
343355
if (omp_get_thread_num() == 0)
344356
#endif
@@ -349,7 +361,8 @@ results_countpairs_mocks * countpairs_mocks(const int64_t ND1, DOUBLE *phi1, DOU
349361
#pragma omp atomic
350362
#endif
351363
numdone++;
352-
364+
#endif//SILENT
365+
353366
const DOUBLE x1 = d1[i]*COSD(theta1[i])*COSD(phi1[i]) ;
354367
const DOUBLE y1 = d1[i]*COSD(theta1[i])*SIND(phi1[i]) ;
355368
const DOUBLE z1 = d1[i]*SIND(theta1[i]) ;
@@ -715,7 +728,9 @@ results_countpairs_mocks * countpairs_mocks(const int64_t ND1, DOUBLE *phi1, DOU
715728
}//close the omp parallel region
716729
#endif//USE_OMP
717730

731+
#ifndef SILENT
718732
finish_myprogressbar(&interrupted);
733+
#endif
719734

720735
#ifdef USE_OMP
721736
uint64_t npairs[totnbins];

xi_mocks/vpf/Makefile

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,19 @@ ifneq (clean,$(findstring clean,$(MAKECMDGOALS)))
33
include ../../common.mk
44
endif
55

6-
target=vpf_mocks
7-
SRC1 = vpf_mocks.c countspheres_mocks.c ../../utils/gridlink_mocks.c ../../utils/utils.c \
8-
../../utils/progressbar.c ../../io/ftread.c ../../io/io.c \
9-
../../utils/set_cosmo_dist.c ../../utils/cosmology_params.c
10-
OBJS1 = $(SRC1:.c=.o)
11-
INCL = countspheres_mocks.h ../../io/ftread.h ../../io/io.h ../../utils/utils.h ../../utils/gridlink_mocks.h \
6+
target := vpf_mocks
7+
SRC1 := vpf_mocks.c countspheres_mocks.c ../../utils/gridlink_mocks.c ../../utils/utils.c \
8+
../../io/ftread.c ../../io/io.c ../../utils/set_cosmo_dist.c ../../utils/cosmology_params.c
9+
INCL := countspheres_mocks.h ../../io/ftread.h ../../io/io.h ../../utils/utils.h ../../utils/gridlink_mocks.h \
1210
../../utils/function_precision.h ../../utils/cellarray.h ../../utils/avx_calls.h \
13-
../../utils/defs.h ../../utils/progressbar.h ../../utils/set_cosmo_dist.h ../../utils/cosmology_params.h
11+
../../utils/defs.h ../../utils/set_cosmo_dist.h ../../utils/cosmology_params.h
12+
13+
ifeq ($(OUTPUT_PGBAR), 1)
14+
SRC1 += ../../utils/progressbar.c
15+
INCL += ../../utils/progressbar.h
16+
endif
17+
18+
OBJS1 := $(SRC1:.c=.o)
1419

1520
all: $(target) $(SRC1) $(INCL) Makefile ../../mocks.options ../../common.mk
1621

xi_mocks/vpf/countspheres_mocks.c

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,13 @@
1515
#include "countspheres_mocks.h" //function proto-type
1616
#include "gridlink_mocks.h"//function proto-type for gridlink (which is a copy of the theory gridlink in order to avoid name-space collisions)
1717
#include "utils.h" //all of the utilities
18-
#include "progressbar.h" //for the progressbar
1918
#include "set_cosmo_dist.h"//cosmological distance calculations
2019
#include "cosmology_params.h"//init_cosmology
2120

21+
#ifndef SILENT
22+
#include "progressbar.h" //for the progressbar
23+
#endif
24+
2225
#if defined(USE_AVX) && defined(__AVX__)
2326
#include "avx_calls.h"
2427
#endif
@@ -267,15 +270,21 @@ results_countspheres_mocks * countspheres_mocks(const int64_t Ngal, DOUBLE *xgal
267270

268271
itry=0 ;
269272
isucceed=0 ;
270-
int interrupted;
271273
int ncenters_written=0;
274+
275+
#ifndef SILENT
276+
int interrupted;
272277
init_my_progressbar(nc, &interrupted);
278+
#endif
273279
while(isucceed < nc && itry < Nran) {
274-
my_progressbar(isucceed,&interrupted);
275280

276-
DOUBLE xcen,ycen,zcen;
277-
int Nnbrs_ran=0;
278-
if((need_randoms == 1 && isucceed > num_centers_in_file) || num_centers_in_file == 0) {
281+
#ifndef SILENT
282+
my_progressbar(isucceed,&interrupted);
283+
#endif
284+
285+
DOUBLE xcen,ycen,zcen;
286+
int Nnbrs_ran=0;
287+
if((need_randoms == 1 && isucceed > num_centers_in_file) || num_centers_in_file == 0) {
279288
xcen = xran[itry] ;
280289
ycen = yran[itry] ;
281290
zcen = zran[itry] ;
@@ -443,8 +452,9 @@ results_countspheres_mocks * countspheres_mocks(const int64_t Ngal, DOUBLE *xgal
443452
itry++ ;
444453
}
445454
fclose(fpcen);
446-
finish_myprogressbar(&interrupted);
455+
447456
#ifndef SILENT
457+
finish_myprogressbar(&interrupted);
448458
fprintf(stderr,"%s> Placed %d centers out of %d trials.\n",__FUNCTION__,isucceed,itry);
449459
fprintf(stderr,"%s> num_centers_in_file = %"PRId64" ncenters_written = %d\n",__FUNCTION__,num_centers_in_file,ncenters_written);
450460
#endif

xi_mocks/wtheta/Makefile

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,22 @@ ifneq (clean,$(findstring clean,$(MAKECMDGOALS)))
33
include ../../common.mk
44
endif
55

6-
target=DDtheta_mocks wtheta
7-
86
# ifeq (USE_MKL,$(findstring USE_MKL,$(OPT)))
97
# MKL_CHECK=mkl
108
# endif
119

12-
INCL = countpairs_theta_mocks.h ../../io/io.h ../../io/ftread.h ../../io/io.h ../../utils/utils.h ../../utils/gridlink_mocks.h \
10+
target := DDtheta_mocks wtheta
11+
SRC1 := DDtheta_mocks.c countpairs_theta_mocks.c ../../utils/gridlink_mocks.c \
12+
../../utils/utils.c ../../io/io.c ../../io/ftread.c
13+
INCL := countpairs_theta_mocks.h ../../io/io.h ../../io/ftread.h ../../io/io.h ../../utils/utils.h ../../utils/gridlink_mocks.h \
1314
../../utils/function_precision.h ../../utils/cellarray_mocks.h ../../utils/avx_calls.h \
14-
../../utils/defs.h ../../utils/progressbar.h
15+
../../utils/defs.h
16+
17+
ifeq ($(OUTPUT_PGBAR), 1)
18+
SRC1 += ../../utils/progressbar.c
19+
INCL += ../../utils/progressbar.h
20+
endif
1521

16-
SRC1= DDtheta_mocks.c countpairs_theta_mocks.c ../../utils/gridlink_mocks.c \
17-
../../utils/utils.c ../../io/io.c ../../io/ftread.c ../../utils/progressbar.c
1822
OBJS1=$(SRC1:.c=.o)
1923

2024
all: $(target) $(SRC1) $(INCL) ../../mocks.options ../../common.mk Makefile

xi_mocks/wtheta/countpairs_theta_mocks.c

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,10 @@
2727
#include "countpairs_theta_mocks.h" //function proto-type
2828
#include "cellarray_mocks.h" //definition of struct cellarray_mocks
2929
#include "utils.h" //all of the utilities
30-
#include "progressbar.h" //for the progressbar
3130

31+
#ifndef SILENT
32+
#include "progressbar.h" //for the progressbar
33+
#endif
3234

3335
#if defined(USE_AVX) && defined(__AVX__)
3436
#include "avx_calls.h"
@@ -318,10 +320,12 @@ results_countpairs_theta * countpairs_theta_mocks(const int64_t ND1, DOUBLE *phi
318320
/* } */
319321
#endif
320322

323+
324+
#ifndef SILENT
321325
int interrupted=0;
322326
int numdone=0;
323-
324327
init_my_progressbar(ND1,&interrupted);
328+
#endif
325329

326330
/*---Loop-over-Data1-particles--------------------*/
327331
#ifdef USE_OMP
@@ -343,6 +347,8 @@ results_countpairs_theta * countpairs_theta_mocks(const int64_t ND1, DOUBLE *phi
343347
#pragma omp for schedule(dynamic)
344348
#endif
345349
for(int i=0;i<ND1;i++) {
350+
351+
#ifndef SILENT
346352
#ifdef USE_OMP
347353
if (omp_get_thread_num() == 0)
348354
#endif
@@ -352,6 +358,7 @@ results_countpairs_theta * countpairs_theta_mocks(const int64_t ND1, DOUBLE *phi
352358
#pragma omp atomic
353359
#endif
354360
numdone++;
361+
#endif//SILENT
355362

356363

357364
const DOUBLE x1pos = x1[i];
@@ -589,7 +596,10 @@ results_countpairs_theta * countpairs_theta_mocks(const int64_t ND1, DOUBLE *phi
589596

590597
}//close the omp parallel region
591598
#endif
599+
600+
#ifndef SILENT
592601
finish_myprogressbar(&interrupted);
602+
#endif
593603

594604
#ifdef USE_OMP
595605
uint64_t npairs[nthetabin];

xi_theory/vpf/Makefile

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,17 @@ ifneq (clean,$(findstring clean,$(MAKECMDGOALS)))
33
include ../../common.mk
44
endif
55

6-
target=vpf
7-
SRC1 = vpf.c countspheres.c ../../utils/gridlink.c ../../utils/utils.c ../../utils/progressbar.c ../../io/ftread.c ../../io/io.c
8-
OBJS1 = $(SRC1:.c=.o)
9-
INCL = countspheres.h ../../io/ftread.h ../../io/io.h ../../utils/utils.h ../../utils/gridlink.h \
6+
target := vpf
7+
SRC1 := vpf.c countspheres.c ../../utils/gridlink.c ../../utils/utils.c ../../io/ftread.c ../../io/io.c
8+
OBJS1 := $(SRC1:.c=.o)
9+
INCL := countspheres.h ../../io/ftread.h ../../io/io.h ../../utils/utils.h ../../utils/gridlink.h \
1010
../../utils/function_precision.h ../../utils/cellarray.h ../../utils/avx_calls.h \
11-
../../utils/defs.h ../../utils/progressbar.h
11+
../../utils/defs.h
12+
13+
ifeq ($(OUTPUT_PGBAR), 1)
14+
SRC1 += ../../utils/progressbar.c
15+
INCL += ../../utils/progressbar.h
16+
endif
1217

1318
all: $(target) $(SRC1) $(INCL) ../../theory.options ../../common.mk Makefile
1419

xi_theory/vpf/countspheres.c

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,10 @@
1616
#include "countspheres.h" //function proto-type
1717
#include "cellarray.h" //definition of struct cellarray
1818
#include "utils.h" //all of the utilities
19+
20+
#ifndef SILENT
1921
#include "progressbar.h" //for the progressbar
22+
#endif
2023

2124
#if defined(USE_AVX) && defined(__AVX__)
2225
#include "avx_calls.h"
@@ -99,13 +102,17 @@ results_countspheres * countspheres(const int64_t np, const DOUBLE * restrict X,
99102
const DOUBLE inv_ydiff = ((DOUBLE) 1.0)/ydiff;
100103
const DOUBLE inv_zdiff = ((DOUBLE) 1.0)/zdiff;
101104

105+
#ifndef SILENT
102106
int interrupted=0;
103107
init_my_progressbar(nc,&interrupted);
104-
108+
#endif
109+
105110
/* loop through centers, placing each randomly */
106111
int ic=0;
107112
while(ic < nc) {
113+
#ifndef SILENT
108114
my_progressbar(ic,&interrupted);
115+
#endif
109116
const DOUBLE xc = xdiff*gsl_rng_uniform (rng) + xmin;
110117
const DOUBLE yc = ydiff*gsl_rng_uniform (rng) + ymin;
111118
const DOUBLE zc = zdiff*gsl_rng_uniform (rng) + zmin;
@@ -303,7 +310,10 @@ results_countspheres * countspheres(const int64_t np, const DOUBLE * restrict X,
303310
/* free(lattice[i].z); */
304311
}
305312
free(lattice);
313+
314+
#ifndef SILENT
306315
finish_myprogressbar(&interrupted);
316+
#endif
307317

308318
//prepare the results
309319
results_countspheres *results = my_malloc(sizeof(*results),1);

xi_theory/wp/Makefile

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,17 @@ ifneq (clean,$(findstring clean,$(MAKECMDGOALS)))
33
include ../../common.mk
44
endif
55

6-
target=wp
7-
SRC1= wp.c countpairs_wp.c ../../utils/utils.c ../../utils/gridlink.c ../../utils/progressbar.c ../../io/io.c ../../io/ftread.c
8-
OBJS1 = $(SRC1:.c=.o)
9-
INCL = countpairs_wp.h ../../io/ftread.h ../../io/io.h ../../utils/utils.h ../../utils/gridlink.h \
6+
target := wp
7+
SRC1 := wp.c countpairs_wp.c ../../utils/utils.c ../../utils/gridlink.c ../../io/io.c ../../io/ftread.c
8+
OBJS1 := $(SRC1:.c=.o)
9+
INCL := countpairs_wp.h ../../io/ftread.h ../../io/io.h ../../utils/utils.h ../../utils/gridlink.h \
1010
../../utils/function_precision.h ../../utils/cellarray.h ../../utils/avx_calls.h \
11-
../../utils/defs.h ../../utils/sglib.h ../../utils/progressbar.h
11+
../../utils/defs.h ../../utils/sglib.h
12+
13+
ifeq ($(OUTPUT_PGBAR), 1)
14+
SRC1 += ../../utils/progressbar.c
15+
INCL += ../../utils/progressbar.h
16+
endif
1217

1318
all: $(target) $(SRC1) $(INCL) ../../theory.options ../../common.mk Makefile
1419

0 commit comments

Comments
 (0)