diff --git a/CMakeLists.txt b/CMakeLists.txt index b443eff..87c7b35 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -43,11 +43,26 @@ set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O3") if(ENABLE_PROFILE) message(STATUS "Enabling profile flags.") string (REPLACE "-DNDEBUG" "" CMAKE_C_FLAGS_RELEASE ${CMAKE_C_FLAGS_RELEASE}) - string (REPLACE "-O3" "" CMAKE_C_FLAGS_RELEASE ${CMAKE_C_FLAGS_RELEASE}) - string (REPLACE "-O3" "" CMAKE_CXX_FLAGS_RELEASE ${CMAKE_CXX_FLAGS_RELEASE}) string (REPLACE "-DNDEBUG" "" CMAKE_CXX_FLAGS_RELEASE ${CMAKE_CXX_FLAGS_RELEASE}) - set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -O2 -g -ggdb -fno-omit-frame-pointer") - set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O2 -g -ggdb -fno-omit-frame-pointer") + set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -g -ggdb -fno-omit-frame-pointer") + set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -g -ggdb -fno-omit-frame-pointer") + # enable vectorization report flags + # using Clang + if (CMAKE_C_COMPILER_ID MATCHES "Clang") + set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -Rpass-analysis=loop-vectorize -Rpass=loop-vectorize -Rpass-missed=loop-vectorize") + + # using GCC + elseif (CMAKE_C_COMPILER_ID STREQUAL "GNU") + set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -ftree-vectorize -fopt-info-vec-all") + + # using Intel C++ + elseif (CMAKE_C_COMPILER_ID STREQUAL "Intel") + set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -qopt-report=5 -qopt-report-phase=vec") + + # using Visual Studio C++ + elseif (CMAKE_C_COMPILER_ID STREQUAL "MSVC") + # TBD + endif() endif(ENABLE_PROFILE) # --- System Libraries --- diff --git a/Makefile b/Makefile index aea45f4..b79b9af 100644 --- a/Makefile +++ b/Makefile @@ -119,6 +119,9 @@ clean: distclean distclean: rm -rf build/* +profile: clean + ( mkdir -p build; cd build ; cmake $(CMAKE_PROFILE_OPTIONS) .. ; $(MAKE) VERBOSE=1 2> $(basename $@).compiler_stedrr_output.txt ) + bench: clean ( mkdir -p build; cd build ; cmake $(CMAKE_PROFILE_OPTIONS) .. ; $(MAKE) VERBOSE=1 ) $(SHOW) build/tests/histogram_benchmark --benchmark_min_time=10