RRZE-HPC / likwid

Performance monitoring and benchmarking suite
https://hpc.fau.de/research/tools/likwid/
GNU General Public License v3.0
1.67k stars 227 forks source link

ARMV8-make error #298

Open mengshanfeng opened 4 years ago

mengshanfeng commented 4 years ago

./src/access_x86_msr.c:83:5: error: impossible constraint in "asm" asm voliate("rdpmc": "=a" (low), "=d" (high): "c" (counter))

i try to make likwid on armv8 machine with gcc, the above error occurs, looking forward to ypur help!

TomTheBear commented 4 years ago

It seems you found the problem before I was able to answer.

Just for anybody searching for anything similar: you have switch the COMPILER setting in config.mkto GCCARMv8 and do a make distclean && make. There is no automatic detection of the build architecture.

mengshanfeng commented 4 years ago

@TomTheBear yes, i just have gcc on my arm architecture machine, so i modify #Line 83 in the Makefile:

ifeq ($(COMPILER), GCCARMv8) OBJ := $(filter-out $(BUILD_DIR)/topology_cpuid.o,$(OBJ)) OBJ := $(filter-out $(BUILD_DIR)/loadData.o,$(OBJ)) OBJ := $(filter-out $(BUILD_DIR)/access_x86.o,$(OBJ)) OBJ := $(filter-out $(BUILD_DIR)/access_x86_msr.o,$(OBJ)) OBJ := $(filter-out $(BUILD_DIR)/access_x86_pci.o,$(OBJ)) else OBJ := $(filter-out $(BUILD_DIR)/loadDataARM.o,$(OBJ)) endif

to "GCC" however, another architecture alike error occures: ./include/private/cpuid-x86.h:81:2: error: #error unknown architecture

should i just replace all the "GCCARMv8" to "GCC"?

TomTheBear commented 4 years ago

You don't need to modify anything in the Makefile. The only setting is in config.mk: COMPILER=GCC to COMPILER=GCCARMv8

Your change includes files with x86 assembly which are not compilable on ARM (unknown architecture error).

TomTheBear commented 4 years ago

Did changing only the COMPILER setting do the trick? If yes, can we close this issue? If no, please post the output of Q= make.

Binsoma commented 4 years ago

Hi there, I think I am having a similar problem. My cpu is ARMv7l so I modified config.mk as COMPILER = GCCARMv7. I am still getting the following:

Info: Compiling for ARMv7 architecture. Changing accessmode to perf_event. Info: Compiling for perf_event interface. Measurements of thermal information is disabled ===> COMPILE GCCARMv7/frequency_uncore.o In file included from ./src/includes/frequency.h:41, from ./src/frequency_uncore.c:42: ./src/frequency_uncore.c: In function ‘freq_setUncoreFreqMin’: ./src/includes/cpuid.h:48:5: error: impossible constraint in ‘asm’ asm volatile(".ifnc %%ebx,%3 ; movl %%ebx,%3 ; .endif \n\t" \ ^~~ ./src/includes/frequency.h:49:5: note: in expansion of macro ‘CPUID’ CPUID(eax,ebx,ecx,edx); ^~~~~ make: *** [Makefile:262: GCCARMv7/frequency_uncore.o] Error 1

when I change to GCCARMv8 I get the following:

Info: Compiling for ARMv8 architecture. Changing accessmode to perf_event. Info: Compiling for perf_event interface. Measurements of thermal information is disabled ===> COMPILE GCCARMv8/calculator.o gcc: error: unrecognized argument in option ‘-mabi=lp64’ gcc: note: valid arguments to ‘-mabi=’ are: aapcs aapcs-linux apcs-gnu atpcs iwmmxt make: *** [Makefile:262: GCCARMv8/calculator.o] Error 1

Thanks in advance.

TomTheBear commented 4 years ago

There is an #ifdef around it to compile only for x86_64 but it does not seem to work (using ARM_ARCH_7A). Could you post the output of gcc -dM -E - < /dev/null | grep -i arm, so I can see which architecture is defined on your system.

Binsoma commented 4 years ago

certainly, here is the output:

 $ gcc -dM -E - < /dev/null | grep -i arm
#define __ARM_SIZEOF_WCHAR_T 4
#define __ARM_FEATURE_SAT 1
#define __ARM_ARCH_ISA_ARM 1
#define __ARMEL__ 1
#define __ARM_FEATURE_UNALIGNED 1
#define __ARM_FP 12
#define __ARM_SIZEOF_MINIMAL_ENUM 4
#define __ARM_PCS_VFP 1
#define __ARM_FEATURE_LDREX 4
#define __ARM_FEATURE_QBIT 1
#define __ARM_ARCH_6__ 1
#define __ARM_32BIT_STATE 1
#define __ARM_FEATURE_CLZ 1
#define __ARM_ARCH_ISA_THUMB 1
#define __ARM_ARCH 6
#define __arm__ 1
#define __ARM_FEATURE_SIMD32 1
#define __ARM_FEATURE_COPROC 15
#define __ARM_EABI__ 1
#define __ARM_FEATURE_DSP 1
TomTheBear commented 4 years ago

As you see, your compiler says it runs on an ARM 6. Not sure whether it's the OS installation or some other setting (compiler flag?) but that won't work. You can try by replacing the #ifdefs:

From: #if !defined(__ARM_ARCH_7A__) && !defined(__ARM_ARCH_8A) && !defined(_ARCH_PPC) To: #if defined(__x86_64) || defined(__i386__)

But you have to adjust it everywhere in the code.

If it's just an compiler flag, put the flag in make/include_GCCARMv7. Don't forget to do a make distclean after changing anything in the build system.

Binsoma commented 4 years ago

Hi, could you please clarify which files I have to edit, I want to try your suggestions thanks.

TomTheBear commented 4 years ago

So, have you checked that it's not just a compiler flag? -march?

The file list is too long to list it here. It's not only the #if !defined(__ARM_ARCH_7A__) && !defined(__ARM_ARCH_8A) && !defined(_ARCH_PPC) lines, there are also other #ifdefs that probably need adjustments. I wouldn't do that before checking simpler fixes like the compiler flags. Have you checked the ARMv6 documentation whether the architecture provides any hardware performance counters? Does perf list show any hardware events?

If you really want to try it: grep -rn --exclude-dir=ext "ARM_ARCH_7A" LIKWID_SRC_DIR The exclude-dir removes the included lua and hwloc.