Skip to content

Commit 0cf6b5d

Browse files
Fix whitespacing
This commit removes all tabs, in favour of two spaces, in files touched by ecmwf-ifs#26 and ecmwf-ifs#27.
1 parent 7c56580 commit 0cf6b5d

File tree

4 files changed

+148
-141
lines changed

4 files changed

+148
-141
lines changed

src/fiat/drhook/drhook.c

+128-122
Original file line numberDiff line numberDiff line change
@@ -1051,7 +1051,8 @@ insert_calltree(int tid, drhook_key_t *keyptr)
10511051
static void
10521052
remove_calltree(int tid, drhook_key_t *keyptr,
10531053
const double *delta_wall, const double *delta_cpu,
1054-
const long long int *delta_cycles,long_long * delta_counters)
1054+
const long long int *delta_cycles,long_long * delta_counters
1055+
)
10551056
{
10561057
if (tid >= 1 && tid <= numthreads) {
10571058
drhook_calltree_t *treeptr = thiscall[tid-1];
@@ -1061,10 +1062,10 @@ remove_calltree(int tid, drhook_key_t *keyptr,
10611062
drhook_key_t *parent_keyptr = treeptr->prev->keyptr;
10621063
if (parent_keyptr) { /* extra security */
10631064
#if defined(DR_HOOK_HAVE_PAPI)
1064-
drhook_papi_add(NULL,
1065-
parent_keyptr->delta_counters_child,
1066-
delta_counters
1067-
);
1065+
drhook_papi_add(NULL,
1066+
parent_keyptr->delta_counters_child,
1067+
delta_counters
1068+
);
10681069
#endif
10691070
if (opt_walltime) {
10701071
parent_keyptr->delta_wall_child += (*delta_wall);
@@ -1626,7 +1627,7 @@ signal_drhook(int sig SIG_EXTRA_ARGS)
16261627
------------------------------------------------------------*/
16271628

16281629
/* if (sig != SIGTERM) signal(SIGTERM, SIG_DFL); */ /* Let the default SIGTERM to occur */
1629-
1630+
16301631
// max_threads = drhook_oml_get_max_threads();
16311632
if (nsigs == 1) {
16321633
/*---- First call to signal handler: call alarm(drhook_harakiri_timeout), tracebacks, exit ------*/
@@ -2648,7 +2649,7 @@ process_options()
26482649
opt_callpath = 1;
26492650
OPTPRINT(fp,"%s%s",comma,"CALLPATH"); comma = ",";
26502651
} else {
2651-
printf("DrHook: Note - no match for HOOK_OPT : %s\n",p);
2652+
printf("DrHook: Note - no match for HOOK_OPT : %s\n",p);
26522653
}
26532654
p = strtok(NULL,delim);
26542655
}
@@ -2865,9 +2866,9 @@ getkey(int tid, const char *name, int name_len,
28652866
(opt_trim && strncasecmp(keyptr->name, name, name_len) == 0)))) {
28662867
if (opt_walltime) keyptr->wall_in = walltime ? *walltime : WALLTIME();
28672868
if (opt_cputime) keyptr->cpu_in = cputime ? *cputime : CPUTIME();
2868-
if (opt_cycles) keyptr->cycles_in = cycles ? *cycles : ec_get_cycles();
2869+
if (opt_cycles) keyptr->cycles_in = cycles ? *cycles : ec_get_cycles();
28692870
#if defined(DR_HOOK_HAVE_PAPI)
2870-
drhook_papi_readAll(keyptr->counters_in);
2871+
drhook_papi_readAll(keyptr->counters_in);
28712872
#endif
28722873
if (any_memstat) memstat(keyptr,&tid,1);
28732874
if (opt_calls) {
@@ -3465,7 +3466,7 @@ c_drhook_check_watch_(const char *where,
34653466
double cputime = opt_cputime ? CPUTIME() : 0; \
34663467
long long int cycles = opt_cycles ? ec_get_cycles() : 0; \
34673468
long long int hwm = opt_gethwm ? gethwm_() : 0; \
3468-
long long int stk = opt_getstk ? getstk_() : 0; \
3469+
long long int stk = opt_getstk ? getstk_() : 0; \
34693470
PAPIREAD
34703471

34713472
/*=== c_drhook_set_lhook_ ===*/
@@ -4349,11 +4350,11 @@ c_drhook_print_(const int *ftnunitno,
43494350
while (keyptr) {
43504351
if (keyptr->name && (keyptr->status == 0 || signal_handler_called)) {
43514352
#if defined(DR_HOOK_HAVE_PAPI)
4352-
drhook_papi_subtract(p->counter_self,
4353-
keyptr->delta_counters_all,
4354-
keyptr->delta_counters_child);
4355-
drhook_papi_cpy(p->counter_tot,
4356-
keyptr->delta_counters_all);
4353+
drhook_papi_subtract(p->counter_self,
4354+
keyptr->delta_counters_all,
4355+
keyptr->delta_counters_child
4356+
);
4357+
drhook_papi_cpy(p->counter_tot, keyptr->delta_counters_all);
43574358
#endif
43584359
p->self = opt_wallprof ?
43594360
keyptr->delta_wall_all - keyptr->delta_wall_child :
@@ -4406,19 +4407,20 @@ c_drhook_print_(const int *ftnunitno,
44064407
pfx,TIMESTR(tid),FFL,
44074408
myproc,filename);
44084409
}
4409-
fp = fopen(filename,"w");
4410+
fp = fopen(filename,"w");
44104411
if (!fp) goto finish_3;
44114412

4412-
if (opt_papi==1){
4413-
if ((myproc == 1 && mon_out_procs == -1) || mon_out_procs == myproc) {
4414-
fprintf(stderr,
4415-
"%s %s [%s@%s:%d] Writing counter information of proc#%d into file '%s'\n",
4416-
pfx,TIMESTR(tid),FFL,
4417-
myproc,csvfilename);
4418-
}
4419-
fpcsv = fopen(csvfilename,"w");
4420-
if (!fpcsv) goto finish_3;
4421-
}
4413+
if (opt_papi==1){
4414+
if ((myproc == 1 && mon_out_procs == -1) || mon_out_procs == myproc) {
4415+
fprintf(stderr,
4416+
"%s %s [%s@%s:%d] Writing counter information of proc#%d into file '%s'\n",
4417+
pfx,TIMESTR(tid),FFL,
4418+
myproc,csvfilename
4419+
);
4420+
}
4421+
fpcsv = fopen(csvfilename,"w");
4422+
if (!fpcsv) goto finish_3;
4423+
}
44224424

44234425
/* alphanumerical sorting to find out clusters of the same routine but on different threads */
44244426
/* also find out total wall clock time */
@@ -4574,105 +4576,109 @@ c_drhook_print_(const int *ftnunitno,
45744576
}
45754577
}
45764578

4577-
fprintf(fp,"\n");
4578-
{
4579-
len =
4580-
fprintf(fp," # %% Time Cumul Self Total # of calls Self Total ");
4581-
}
4582-
fprintf(fp,"Routine@<thread-id>");
4583-
if (opt_clusterinfo) fprintf(fp," [Cluster:(id,size)]");
4584-
fprintf(fp,"\n");
4585-
if (opt_sizeinfo) fprintf(fp,"%*s %s\n",len-20," ","(Size; Size/sec; Size/call; MinSize; MaxSize)");
4586-
fprintf(fp, " (self) (sec) (sec) (sec) ms/call ms/call\n");
4587-
fprintf(fp,"\n");
4588-
4589-
cumul = 0;
4590-
for (j=0; j<nprof; ) {
4591-
int cluster_size = clusize[p->cluster];
4592-
if (p->pc < percent_limit) break;
4593-
if (opt_cputime) {
4594-
cumul += p->self;
4595-
}
4596-
else {
4597-
if (p->is_max || cluster_size == 1) cumul += p->self;
4598-
}
4599-
4600-
{
4601-
fprintf(fp, fmt,
4602-
++j, p->pc, cumul, p->self, p->total, p->calls,
4603-
p->percall_ms_self, p->percall_ms_total,
4604-
p->is_max ? "*" : " ");
4605-
}
4606-
print_routine_name(fp, p, len, cluster_size);
4607-
4608-
if (opt_sizeinfo && p->sizeinfo > 0) {
4609-
char s1[DRHOOK_STRBUF], s2[DRHOOK_STRBUF], s3[DRHOOK_STRBUF];
4610-
char s4[DRHOOK_STRBUF], s5[DRHOOK_STRBUF];
4611-
lld_commie(p->sizeinfo,s1);
4612-
dbl_commie(p->sizespeed,s2);
4613-
dbl_commie(p->sizeavg,s3);
4614-
lld_commie(p->min_sizeinfo,s4);
4615-
lld_commie(p->max_sizeinfo,s5);
4616-
fprintf(fp,"\n%*s (%s; %s; %s; %s; %s)",len-20," ",s1,s2,s3,s4,s5);
4617-
}
4618-
fprintf(fp,"\n");
4619-
p++;
4620-
} /* for (j=0; j<nprof; ) */
4579+
fprintf(fp,"\n");
4580+
{
4581+
len =
4582+
fprintf(fp," # %% Time Cumul Self Total # of calls Self Total ");
4583+
}
4584+
fprintf(fp, "Routine@<thread-id>");
4585+
if (opt_clusterinfo)
4586+
fprintf(fp, " [Cluster:(id,size)]");
4587+
fprintf(fp, "\n");
4588+
if (opt_sizeinfo)
4589+
fprintf(fp, "%*s %s\n",len-20," ","(Size; Size/sec; Size/call; MinSize; MaxSize)");
4590+
fprintf(fp, " (self) (sec) (sec) (sec) ms/call ms/call\n");
4591+
fprintf(fp, "\n");
4592+
4593+
cumul = 0;
4594+
for (j = 0; j < nprof; ) {
4595+
int cluster_size = clusize[p->cluster];
4596+
if (p->pc < percent_limit)
4597+
break;
4598+
if (opt_cputime) {
4599+
cumul += p->self;
4600+
} else {
4601+
if (p->is_max || cluster_size == 1)
4602+
cumul += p->self;
4603+
}
4604+
4605+
{
4606+
fprintf(fp, fmt,
4607+
++j, p->pc, cumul, p->self, p->total, p->calls,
4608+
p->percall_ms_self, p->percall_ms_total,
4609+
p->is_max ? "*" : " ");
4610+
}
4611+
print_routine_name(fp, p, len, cluster_size);
4612+
4613+
if (opt_sizeinfo && p->sizeinfo > 0) {
4614+
char s1[DRHOOK_STRBUF], s2[DRHOOK_STRBUF], s3[DRHOOK_STRBUF];
4615+
char s4[DRHOOK_STRBUF], s5[DRHOOK_STRBUF];
4616+
lld_commie(p->sizeinfo,s1);
4617+
dbl_commie(p->sizespeed,s2);
4618+
dbl_commie(p->sizeavg,s3);
4619+
lld_commie(p->min_sizeinfo,s4);
4620+
lld_commie(p->max_sizeinfo,s5);
4621+
fprintf(fp,"\n%*s (%s; %s; %s; %s; %s)",len-20," ",s1,s2,s3,s4,s5);
4622+
}
4623+
fprintf(fp,"\n");
4624+
p++;
4625+
} /* for (j=0; j<nprof; ) */
46214626
fclose(fp);
46224627

46234628
#if defined(DR_HOOK_HAVE_PAPI)
4624-
if (opt_papi){
4625-
p=prof;
4626-
int first_counter_is_cyc=0;
4627-
char event_name[drhook_papi_max_name_len()];
4628-
drhook_papi_counter_name(0,event_name);
4629-
if (strcmp(event_name,"PAPI_TOT_CYC")==0)
4630-
first_counter_is_cyc=1;
4631-
{
4632-
len =
4633-
fprintf(fpcsv,"Routine,MPI Rank,ThreadId,SelfRank,%% Self Time,Cumul,Excl Time,Incl. Time,#Calls");
4634-
for (int c=0;c<drhook_papi_num_counters();c++){
4635-
drhook_papi_counter_name(c,event_name);
4636-
fprintf(fpcsv,",%s(excl)",event_name);
4637-
}
4638-
for (int c=0;c<drhook_papi_num_counters();c++) {
4639-
drhook_papi_counter_name(c,event_name);
4640-
fprintf(fpcsv,",%s(incl)",event_name);
4641-
}
4642-
if (first_counter_is_cyc==1)
4643-
fprintf(fpcsv,",Mcyc/sec(excl),Mcyc/sec(incl)");
4644-
fprintf(fpcsv,"\n");
4645-
}
4646-
4647-
cumul = 0;
4648-
for (j=0; j<nprof; ) {
4649-
int cluster_size = clusize[p->cluster];
4650-
if (opt_cputime)
4651-
cumul += p->self;
4652-
else
4653-
if (p->is_max || cluster_size == 1) cumul += p->self;
4654-
4655-
{
4656-
fprintf(fpcsv, csvfmt,
4657-
p->name,
4658-
myproc-1,
4659-
p->tid-1
4660-
,++j, p->pc, cumul, p->self, p->total, p->calls,
4661-
p->is_max ? "*" : " ");
4662-
for (int c=0;c<drhook_papi_num_counters();c++)
4663-
fprintf(fpcsv,",%lld",p->counter_self[c]);
4664-
for (int c=0;c<drhook_papi_num_counters();c++)
4665-
fprintf(fpcsv,",%lld",p->counter_tot[c]);
4666-
if (first_counter_is_cyc==1)
4667-
fprintf(fpcsv,",%.3f,%.3f",
4668-
p->counter_self[0]/p->self/1000000.0,
4669-
p->counter_tot[0]/p->total/1000000.0
4670-
);
4671-
}
4672-
fprintf(fpcsv,"\n");
4673-
p++;
4674-
} /* for (j=0; j<nprof; ) */
4675-
}
4629+
if (opt_papi){
4630+
p=prof;
4631+
int first_counter_is_cyc=0;
4632+
char event_name[drhook_papi_max_name_len()];
4633+
drhook_papi_counter_name(0, event_name);
4634+
if (strcmp(event_name,"PAPI_TOT_CYC") == 0)
4635+
first_counter_is_cyc=1;
4636+
{
4637+
len =
4638+
fprintf(fpcsv,"Routine,MPI Rank,ThreadId,SelfRank,%% Self Time,Cumul,Excl Time,Incl. Time,#Calls");
4639+
for (int c=0; c < drhook_papi_num_counters(); c++) {
4640+
drhook_papi_counter_name(c, event_name);
4641+
fprintf(fpcsv, ",%s(excl)", event_name);
4642+
}
4643+
for (int c=0; c < drhook_papi_num_counters(); c++) {
4644+
drhook_papi_counter_name(c, event_name);
4645+
fprintf(fpcsv, ",%s(incl)", event_name);
4646+
}
4647+
if (first_counter_is_cyc == 1)
4648+
fprintf(fpcsv, ",Mcyc/sec(excl),Mcyc/sec(incl)");
4649+
fprintf(fpcsv, "\n");
4650+
}
4651+
4652+
cumul = 0;
4653+
for (j=0; j<nprof; ) {
4654+
int cluster_size = clusize[p->cluster];
4655+
if (opt_cputime)
4656+
cumul += p->self;
4657+
else
4658+
if (p->is_max || cluster_size == 1) cumul += p->self;
4659+
4660+
{
4661+
fprintf(fpcsv, csvfmt,
4662+
p->name,
4663+
myproc-1,
4664+
p->tid-1,
4665+
++j, p->pc, cumul, p->self, p->total, p->calls,
4666+
p->is_max ? "*" : " "
4667+
);
4668+
for (int c=0;c<drhook_papi_num_counters();c++)
4669+
fprintf(fpcsv,",%lld",p->counter_self[c]);
4670+
for (int c=0;c<drhook_papi_num_counters();c++)
4671+
fprintf(fpcsv,",%lld",p->counter_tot[c]);
4672+
if (first_counter_is_cyc==1)
4673+
fprintf(fpcsv,",%.3f,%.3f",
4674+
p->counter_self[0]/p->self/1000000.0,
4675+
p->counter_tot[0]/p->total/1000000.0
4676+
);
4677+
}
4678+
fprintf(fpcsv, "\n");
4679+
p++;
4680+
} /* for (j=0; j<nprof; ) */
4681+
}
46764682
#endif
46774683
finish_3:
46784684
free_drhook(filename);

src/fiat/drhook/drhook_papi.c

+13-14
Original file line numberDiff line numberDiff line change
@@ -161,8 +161,7 @@ int drhook_papi_init(int rank){
161161

162162
paperr=PAPI_library_init(PAPI_VER_CURRENT);
163163
if (paperr != PAPI_VER_CURRENT){
164-
snprintf(pmsg,STD_MSG_LEN,"DRHOOK:PAPI:PAPI_library_init: ret code=%d version loaded =%d ",
165-
paperr,PAPI_VER_CURRENT);
164+
snprintf(pmsg,STD_MSG_LEN,"DRHOOK:PAPI:PAPI_library_init: ret code=%d version loaded =%d ", paperr,PAPI_VER_CURRENT);
166165
printf("%s\n",pmsg);
167166
if (paperr > 0) {
168167
snprintf(pmsg,STD_MSG_LEN,"DRHOOK:PAPI: Error, library version mismatch between compilation and run!\n");
@@ -209,10 +208,10 @@ int drhook_papi_init(int rank){
209208
}
210209

211210
snprintf(pmsg,STD_MSG_LEN,"DRHOOK:PAPI: Version %d.%d.%d initialised with %d threads",
212-
PAPI_VERSION_MAJOR( lib_version ),
213-
PAPI_VERSION_MINOR( lib_version ),
214-
PAPI_VERSION_REVISION( lib_version ),
215-
nthreads );
211+
PAPI_VERSION_MAJOR( lib_version ),
212+
PAPI_VERSION_MINOR( lib_version ),
213+
PAPI_VERSION_REVISION( lib_version ),
214+
nthreads);
216215

217216
if (drhook_papi_rank==0 && !silent) printf("%s\n",pmsg);
218217

@@ -271,17 +270,17 @@ int dr_hook_papi_start_threads(int* events){
271270
snprintf(pmsg,STD_MSG_LEN,"DRHOOK:PAPI: Error, add_event failed: %d (%s)",papiErr,PAPI_strerror(papiErr));
272271
printf("%s\n",pmsg);
273272
if (papiErr == PAPI_EINVAL)
274-
printf("Invalid argument\n");
273+
printf("Invalid argument\n");
275274
else if (papiErr == PAPI_ENOMEM)
276-
printf("Out of memory\n");
275+
printf("Out of memory\n");
277276
else if (papiErr == PAPI_ENOEVST)
278-
printf("EventSet does not exist\n");
277+
printf("EventSet does not exist\n");
279278
else if (papiErr == PAPI_EISRUN)
280-
printf("EventSet is running\n");
279+
printf("EventSet is running\n");
281280
else if (papiErr == PAPI_ECNFLCT)
282-
printf("Conflict\n");
281+
printf("Conflict\n");
283282
else if (papiErr == PAPI_ENOEVNT)
284-
printf("Preset not available\n");
283+
printf("Preset not available\n");
285284
return 0;
286285
}
287286
else {
@@ -304,8 +303,8 @@ int dr_hook_papi_start_threads(int* events){
304303
}
305304
#if defined(DEBUG)
306305
for (int counter=0;counter<number;counter++) {
307-
snprintf(pmsg,STD_MSG_LEN,"DRHOOK:PAPI: Ev: %d=%d",counter,events[counter]);
308-
printf("%s\n",pmsg);
306+
snprintf(pmsg,STD_MSG_LEN,"DRHOOK:PAPI: Ev: %d=%d",counter,events[counter]);
307+
printf("%s\n",pmsg);
309308
}
310309
#endif
311310

src/fiat/drhook/internal/drhook_run_omp_parallel.F90

+1-1
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ subroutine drhook_run_omp_parallel_papi_startup(events,n, rcOut) bind(c)
9494
rcOut=0
9595
!$OMP PARALLEL
9696
DO thread=0,nThreads-1
97-
if (thread==myThread) then
97+
if (thread==myThread) then
9898
rc=dr_hook_papi_start_threads(events)
9999
if (rc==0)rcOut=1
100100
end if

0 commit comments

Comments
 (0)