Skip to content

Commit f08b08d

Browse files
committed
update makefile for linux
1 parent 51c8418 commit f08b08d

File tree

3 files changed

+19
-33
lines changed

3 files changed

+19
-33
lines changed

Makefile

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -16,23 +16,22 @@ ONEAPI_OMP5 := $(ONEAPI_COMPILER)/lib/libiomp5.a
1616

1717
# for MacOS use accelerate framework in default
1818
# install openblas lapack on mac with brew install openblas lapack
19-
OPENBLAS_ROOT =
20-
LAPACK_ROOT := ${OPENBLAS_ROOT}
19+
OPENBLAS =
2120

2221

2322
STATIC = 0 # by default dynamical linking
2423
IOMP5 = 1 # use libiomp5 for mkl
25-
AVX = 1 # enable avx2 fma
2624
DEBUG = 0 # debug
25+
AVX = # 1: enable avx2 fma, 0: do nothing
2726

2827
########################### end ###########################
2928

3029

3130
####### INC, LPATHS, LIBS, MYFLAGS
3231
program = PCAone
3332
CXX ?= g++ # use default g++ only if not set in env
34-
CXXSTD = c++17 # default c++17 if not set by the user
35-
CXXFLAGS += -O3 -Wall -std=$(CXXSTD) -m64 -fPIC
33+
CXXSTD = c++17
34+
CXXFLAGS += -O3 -Wall -std=$(CXXSTD) -m64
3635
MYFLAGS = -DVERSION=\"$(VERSION)\"
3736
# CURRENT_DIR = $(shell pwd)
3837
INC = -I./external -I./external/zstd/lib
@@ -41,15 +40,15 @@ PCALIB = libpcaone.a
4140
ifeq ($(Platform), Darwin)
4241
CXXFLAGS += -march=native
4342
else
44-
ifeq ($(strip $(AVX)),1)
45-
$(info "use -mavx2 for PCAone")
43+
ifeq ($(strip $(AVX)),)
44+
CXXFLAGS += -march=native
45+
else ifeq ($(strip $(AVX)),1)
4646
CXXFLAGS += -mavx2 -mfma
4747
endif
4848
endif
4949

5050
ifeq ($(strip $(DEBUG)),1)
51-
$(info "use -mavx2 for PCAone")
52-
MYFLAGS += -DDEBUG
51+
MYFLAGS += -DDEBUG
5352
endif
5453

5554

@@ -69,10 +68,8 @@ ifeq ($(Platform),Linux)
6968
DLIBS += -Wl,--no-as-needed -Wl,-rpath,${ONEAPI_COMPILER}/lib,-rpath,${MKLROOT}/lib/intel64 -L${ONEAPI_COMPILER}/lib -L${MKLROOT}/lib/intel64 -lmkl_intel_lp64 -lmkl_intel_thread -lmkl_core -liomp5
7069
endif
7170

72-
else ifneq ($(strip $(OPENBLAS_ROOT)),)
71+
else ifneq ($(strip $(OPENBLAS)),)
7372
MYFLAGS += -DWITH_OPENBLAS -DEIGEN_USE_BLAS -DEIGEN_USE_LAPACKE
74-
INC += -I${OPENBLAS_ROOT}/include -I${LAPACK_ROOT}/include
75-
LPATHS += -L${OPENBLAS_ROOT}/lib -L${LAPACK_ROOT}/lib
7673
DLIBS += -llapack -llapacke -lopenblas -lgfortran -lgomp
7774

7875
else
@@ -83,7 +80,7 @@ else ifeq ($(Platform),Darwin)
8380
###### for mac
8481
MYFLAGS += -Xpreprocessor -fopenmp
8582

86-
ifneq ($(strip $(OPENBLAS_ROOT)),)
83+
ifneq ($(strip $(OPENBLAS)),)
8784
MYFLAGS += -DWITH_OPENBLAS -DEIGEN_USE_BLAS -DEIGEN_USE_LAPACKE
8885
ifeq ($(strip $(STATIC)),1)
8986
# SLIBS += /usr/local/opt/gcc/lib/gcc/11/libgomp.a # gcc need libgomp.a
@@ -110,7 +107,7 @@ ifeq ($(strip $(STATIC)),1)
110107
SLIBS += /opt/homebrew/opt/zlib/lib/libz.a
111108
# CXXFLAGS += -stdlib=libc++
112109
else
113-
SLIBS += /usr/lib64/libz.a # /usr/lib/x86_64-linux-gnu/libz.a
110+
SLIBS += /usr/lib/x86_64-linux-gnu/libz.a # /usr/lib64/libz.a #
114111
CXXFLAGS += -static
115112
# CXXFLAGS += -static-libgcc -static-libstdc++
116113
endif

README.org

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -208,8 +208,6 @@ make -j4
208208
./PCAone -h
209209
#+end_src
210210

211-
If this doesn't work because the server is too outdated, run =make clean && make -j4 AVX=0= instead.
212-
213211
*** For MacOS users, check out the [[https://github.com/Zilong-Li/PCAone/blob/dev/.github/workflows/mac.yml#L21][mac workflow]].
214212

215213
#+begin_src shell

publish.sh

Lines changed: 8 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -11,25 +11,16 @@ mkdir -p $dir
1111
platform=$(uname -s)
1212

1313
if [ $platform == "Darwin" ];then
14-
echo "Publishing releases on MacOS avx2";
15-
echo "Publishing PCAone without libiomp5 threading";
16-
export CC="gcc"
17-
export CXX="g++"
18-
make clean && make -j6 MKLROOT=/opt/intel/oneapi/mkl/latest STATIC=1 && zip PCAone-avx2-Mac.zip PCAone PCAone.pdf && mv PCAone-avx2-Mac.zip $dir && echo "Publishing PCAone-avx2-Mac.zip done";
19-
20-
# echo "Publishing PCAone with libiomp5 threading";
21-
# export CC=$(find $(brew --prefix)/bin/ -name "gcc-[0-9]*" | tail -1)
22-
# export CXX=$(find $(brew --prefix)/bin/ -name "g++-[0-9]*" | tail -1)
23-
# export LDFLAGS="-L/usr/local/lib/"
24-
25-
# awk ' NR==7 {$0="#"$0}; NR==6 {sub("# ", "")}; NR==16 || NR==18 {sub("0", "1")}; 1' Makefile >mac2.makefile
14+
15+
echo "Publishing releases on MacOS Silicon";
16+
export LDFLAGS="-L"$(brew --prefix libomp)/lib
17+
export CPPFLAGS="-I"$(brew --prefix libomp)/include
18+
make clean && make -j6 STATIC=1 && zip PCAone-Mac.zip PCAone PCAone.pdf && mv PCAone-Mac.zip $dir && echo "Publishing PCAone-Mac.zip done";
2619

2720
elif [ $platform == "Linux" ];then
28-
echo "Publishing releases on Linux x86_x64";
29-
make clean && make -j6 MKLROOT=$HOME/intel/oneapi/mkl/latest STATIC=1 AVX=0 && zip PCAone-x64-Linux.zip PCAone PCAone.pdf && mv PCAone-x64-Linux.zip $dir && echo "Publishing PCAone_Linux.zip PCAone-x64-Linux.zip done";
30-
make clean && make -j6 MKLROOT=$HOME/intel/oneapi/mkl/latest STATIC=1 AVX=1 && zip PCAone-avx2-Linux.zip PCAone PCAone.pdf && mv PCAone-avx2-Linux.zip $dir && echo "Publishing PCAone_Linux.zip PCAone-avx2-Linux.zip done";
31-
# awk ' NR==7 {$0="#"$0}; NR==5 {sub("# ", "")}; NR==16 {sub("0", "1")}; 1' Makefile >linux.makefile
32-
# awk 'NR==7 {$0="#"$0}; NR==5 {sub("# ", "")}; NR==16 || NR==18 {sub("0", "1")}; 1' Makefile >linux2.makefile
21+
22+
echo "Publishing releases on Linux ";
23+
make clean && make -j6 MKLROOT=/opt/intel/oneapi/mkl/latest ONEAPI_COMPILER=/opt/intel/oneapi/compiler/latest STATIC=1 && zip PCAone-Linux.zip PCAone PCAone.pdf && mv PCAone-Linux.zip $dir && echo "Publishing PCAone-Linux.zip done";
3324

3425
fi
3526

0 commit comments

Comments
 (0)