From 493b1e3c650c35acedd3e3d9f33d23cba14e8fb9 Mon Sep 17 00:00:00 2001 From: Zeno Gantner Date: Tue, 19 Dec 2017 16:09:04 +0100 Subject: [PATCH] option to compile with -march=native to speed up CPU performance On my laptop without GPU this gives me a significant improvement. From about 26 seconds (9 with OpenMP) down to (still) 12 seconds (5 with OpenMP). Intel(R) Core(TM) i5-6500T CPU @ 2.50GHz (4 cores) gcc (Ubuntu 5.4.0-6ubuntu1~16.04.5) 5.4.0 20160609 Deactivated by default to not break e.g. distributed compilation and cross compilation. --- Makefile | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Makefile b/Makefile index 5f6f6e2d..560160b2 100644 --- a/Makefile +++ b/Makefile @@ -2,6 +2,7 @@ GPU=0 CUDNN=0 OPENCV=0 OPENMP=0 +NATIVECPU=0 DEBUG=0 ARCH= -gencode arch=compute_30,code=sm_30 \ @@ -32,6 +33,10 @@ ifeq ($(OPENMP), 1) CFLAGS+= -fopenmp endif +ifeq ($(NATIVECPU), 1) +CFLAGS+= -march=native +endif + ifeq ($(DEBUG), 1) OPTS=-O0 -g endif