Skip to content

Commit

Permalink
Merge pull request #259 from willowec/cat-platform-detect
Browse files Browse the repository at this point in the history
counter_analysis_toolkit: Automatically detect platform in Makefile
  • Loading branch information
adanalis authored Oct 24, 2024
2 parents e3b2104 + ebb84b2 commit 4c63af6
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion src/counter_analysis_toolkit/Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
ARCH?=X86
PAPIDIR?=${PAPI_DIR}
USEMPI?=false
LDFLAGS=-L$(PAPIDIR)/lib -lpapi -lm -lpthread -ldl -lrt
Expand All @@ -16,6 +15,21 @@ ifeq ($(USEMPI),true)
CFLAGS+=-DUSE_MPI
endif

## Try to auto-detect architecture if it is not set.
ifndef ARCH
UNAME_M:=$(shell uname -m)

ARCH=POWER
ifeq ($(UNAME_M),x86_64)
ARCH=X86
endif
ifeq ($(UNAME_M),aarch64)
ARCH=ARM
endif

$(info Detected ARCH=$(ARCH))
endif

## Architecture determines vector instruction set.
ifeq ($(ARCH),X86)
FLOP+=-mfma -DX86
Expand Down

0 comments on commit 4c63af6

Please sign in to comment.