Skip to content

Commit

Permalink
print warning if Lanczos did not converge
Browse files Browse the repository at this point in the history
  • Loading branch information
stgeke committed Nov 1, 2020
1 parent fabcd44 commit 4e8af7b
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/genmap-impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,9 @@ void metric_finalize();
void metric_acc(metric m,double count);
void metric_tic(struct comm *c,metric m);
void metric_toc(struct comm *c,metric m);
double metric_get_value(int level,metric m);
void metric_push_level();
uint metric_get_levels();
void metric_print(struct comm *c);

struct GenmapHandle_private {
Expand Down
13 changes: 13 additions & 0 deletions src/genmap-rsb.c
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,19 @@ void GenmapRSB(GenmapHandle h,int verbose){
metric_push_level();
}

sint converged=1,buf;
for(i=0; i<metric_get_levels(); i++){
int val=(int)metric_get_value(i,NFIEDLER);
if(val>=npass*maxIter){
converged=0;
break;
}
}
comm_allreduce(&global_c->gsc,gs_int,gs_min,&converged,1,&buf);// min
if(converged==0 && GenmapCommRank(global_c)==0){
printf("WARNING: Lanczos failed to converge during partitioning!");
}

//metric_print(&global_c->gsc);
metric_finalize();

Expand Down
8 changes: 8 additions & 0 deletions src/genmap-statistics.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ void metric_toc(struct comm *c,metric m){
comm_barrier(c);
}

double metric_get_value(int level,metric m){
return stack[level*MAXMETS+m];
}

void metric_push_level(){
assert(stack_size<=stack_max && "stack_size > stack_max");

Expand All @@ -52,6 +56,10 @@ void metric_push_level(){
stack_size++;
}

uint metric_get_levels(){
return stack_size;
}

void metric_print(struct comm *c){
double min[MAXSIZE],max[MAXSIZE],sum[MAXSIZE],buf[MAXSIZE];
uint max_size=stack_size*MAXMETS;
Expand Down

0 comments on commit 4e8af7b

Please sign in to comment.