Skip to content

Commit

Permalink
update makefile for accelerate on mac
Browse files Browse the repository at this point in the history
  • Loading branch information
Zilong-Li committed Oct 15, 2024
1 parent 64df6c3 commit 9f8add7
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ on:
jobs:
build:

runs-on: ubuntu-latest
runs-on: ubuntu-22.04

steps:
- uses: actions/checkout@v3
Expand Down
17 changes: 14 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ MKLROOT =
OPENBLAS_ROOT =
LAPACK_ROOT =

# for MacOS
# use accelerate framework as blas lib
ACCELERATE_ROOT =

# by default dynamical linking
STATIC = 0
# only if static = 1, IOMP5 works
Expand All @@ -34,6 +38,8 @@ CXXSTD = c++17 # default c++17 if not set by the user
CXXFLAGS += -O3 -Wall -std=$(CXXSTD) -m64 -fPIC
MYFLAGS = -DVERSION=\"$(VERSION)\"
# CURRENT_DIR = $(shell pwd)
INC_PATH = /usr/local/include
LIB_PATH = /usr/local/lib
INC = -I./external -I./external/zstd/lib
PCALIB = libpcaone.a
AVX = 1
Expand All @@ -50,7 +56,6 @@ ifeq ($(strip $(DEBUG)),1)
endif

ifeq ($(strip $(STATIC)),1)
INC += -I./external/zstd/lib
ifeq ($(Platform), Darwin)
SLIBS += /usr/local/opt/zlib/lib/libz.a
ifeq ($(strip $(IOMP5)), 1)
Expand Down Expand Up @@ -105,7 +110,7 @@ ifeq ($(Platform),Linux)
else ifeq ($(Platform),Darwin)
###### for mac
MYFLAGS += -Xpreprocessor -fopenmp
INC += -I/usr/local/include
INC += -I$(INC_PATH)
ifneq ($(strip $(MKLROOT)),)
MYFLAGS += -DWITH_MKL -DEIGEN_USE_MKL_ALL
INC += -I${MKLROOT}/include/
Expand All @@ -126,8 +131,14 @@ else ifeq ($(Platform),Darwin)
LPATHS += -L${OPENBLAS_ROOT}/lib -L${LAPACK_ROOT}/lib
DLIBS += -llapack -llapacke -lopenblas -lgfortran -lgomp -lpthread

else ifneq ($(strip $(ACCELERATE_ROOT)),)
MYFLAGS += -DEIGEN_USE_BLAS
INC += -I${ACCELERATE_ROOT}/include
LPATHS += -L${ACCELERATE_ROOT}/lib
DLIBS += -llapack -lblas -lgomp -lpthread

else
DLIBS += -lomp -lpthread -L/usr/local/lib
DLIBS += -lomp -lpthread -L$(LIB_PATH)
endif

endif
Expand Down

0 comments on commit 9f8add7

Please sign in to comment.