KarypisLab / METIS

METIS - Serial Graph Partitioning and Fill-reducing Matrix Ordering
Other
665 stars 134 forks source link

Division by 0 on PartGraphKway when *nparts = 1 #67

Open tim-tim707 opened 1 year ago

tim-tim707 commented 1 year ago

Division by 0 occurs in kmetis.c line 56 on this computation:

  /* set various run parameters that depend on the graph */
  ctrl->CoarsenTo = gk_max((*nvtxs)/(40*gk_log2(*nparts)), 30*(*nparts));

This is because gk_log2 will return 0 if its input is 1.


=================================================================
==6382==ERROR: AddressSanitizer: FPE on unknown address 0x5622b6c7e8f0 (pc 0x5622b6c7e8f0 bp 0x7fff6575cc10 sp 0x7fff6575cb70 T0)
    #0 0x5622b6c7e8f0 in METIS_PartGraphKway METIS/libmetis/kmetis.c:56

AddressSanitizer can not provide additional info.
SUMMARY: AddressSanitizer: FPE METIS/libmetis/kmetis.c:56 in METIS_PartGraphKway
==6382==ABORTING```

There should be an error handling or a message of help for users.
(I am very happy that I could compile with gdb=1 to backtrack the bug, thanks !)