KarypisLab/GKlib

Cannot Compile on ARM64 unrecognized instruction mnemonic

Closed this issue · 2 comments

Been trying to get METIS and ParMETIS to work on my MacBook pro with M1.
I was able to compile GKlib by changing two instruction in the function mem_flush found in the file test/gkuniq.c

on line 77 the assembly instruction

__asm__ volatile("clflush (%0)\n\t"
                 :
                 : "r"(&cp[i])
                 : "memory");

I replaced with
__asm__ volatile("dc cvac, %0" : : "r" (&cp[i]) : "memory");

and on line 83 the assembly instruction

  __asm__ volatile("sfence\n\t"
                :
                :
                : "memory");

I replaced with
__asm__ volatile("dmb ishst" : : : "memory");

After this I was able to compile GKlib, but still having issues in METIS when linking with this build of GKlib regarding undefined symbols for arm64 architecture.

Thanks for this fix. For now, I just turned off this part of the code on any non-x86 architectures.