From 39939dbeef10c3a083a8c03a18af5395e0932a31 Mon Sep 17 00:00:00 2001 From: Hendrik Ranocha Date: Tue, 12 Mar 2019 17:25:32 +0100 Subject: [PATCH 1/4] add CMake option TESTS --- CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 696ed04..5129349 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -116,6 +116,7 @@ ENDIF(OpenCL_FOUND) ADD_SUBDIRECTORY(src) # tests +OPTION(TESTS "Build unit tests" OFF) IF(TESTS) enable_testing() ADD_SUBDIRECTORY(test) From 2b4f1d78f91c2e6cabbd22d8c1102d2aabd5b35a Mon Sep 17 00:00:00 2001 From: Philip Date: Thu, 14 Mar 2019 09:41:37 +0100 Subject: [PATCH 2/4] Added option for release build with corresponding flags and fixed CMAKE_CONFIGURATION_TYPES to release. --- CMakeLists.txt | 36 ++++++++++++++++++++++++++++++------ 1 file changed, 30 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 5129349..e755dc8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,8 +1,10 @@ # Select compiler, supports gcc, clang - cmake_minimum_required (VERSION 3.5) + PROJECT(toolkitICL) +option(BUILDREL "Official release build" OFF) + if(DEFINED ENV{AMDPROFILERPATH}) message(STATUS "Found AMD profiling driver") option(USEAMDP "Use AMD Profiling" ON) @@ -30,7 +32,7 @@ if(DEFINED ENV{IPG_Dir}) option(USEIPG "Use Intel Power Gadget" ON) option(USEIRAPL "Use RAPL" OFF) ELSE() - option(USEIPG "Use Intel Power Gadget" OF) + option(USEIPG "Use Intel Power Gadget" OFF) endif() IF(USEIPG) @@ -49,29 +51,51 @@ IF(USENVML) add_definitions(-DUSENVML) ENDIF() -# Because Makefiles are shit to read +set(CMAKE_CONFIGURATION_TYPES "Release" CACHE STRING "" FORCE) + SET(CMAKE_VERBOSE_MAKEFILE "false") # Includes modules to find OCL SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/CMake/") # compiler flags +IF(BUILDREL) +MESSAGE(STATUS "Building release version") IF(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") MESSAGE(STATUS "Microsoft Visual Studio detected. Corresponding compiler flags have been set.") SET(CMAKE_CXX_FLAGS " /std=c++11 /O2 /DH5_BUILT_AS_DYNAMIC_LIB") SET(CMAKE_C_FLAGS " /std=c++11 /O2 /DH5_BUILT_AS_DYNAMIC_LIB") ELSEIF(CMAKE_CXX_COMPILER_ID STREQUAL "GNU") MESSAGE(STATUS "GNU Compiler Collection detected. Corresponding compiler flags have been set.") - SET(CMAKE_CXX_FLAGS " -std=c++11 -O2 -funroll-loops -fstrict-aliasing -msse2 -msse3 -mssse3 -msse4.1 -msse4.2 -mavx -mavx2 -fPIC -Wall -mfpmath=sse -Wcast-align -Wl,-E") + SET(CMAKE_CXX_FLAGS " -std=c++11 -O2 -funroll-loops -fstrict-aliasing -msse2 -fPIC -Wall -mfpmath=sse -Wcast-align -Wl,-E") ELSEIF(CMAKE_CXX_COMPILER_ID STREQUAL "Clang") MESSAGE(STATUS "LLVM Clang detected. Corresponding compiler flags have been set.") - SET(CMAKE_CXX_FLAGS " -std=c++11 -O2 -funroll-loops -fstrict-aliasing -msse2 -msse3 -mssse3 -msse4.1 -msse4.2 -mavx -mavx2 -fPIC -Wall") + SET(CMAKE_CXX_FLAGS " -std=c++11 -O2 -funroll-loops -fstrict-aliasing -msse2 -fPIC -Wall") ELSEIF(CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang") MESSAGE(STATUS "Apple Clang detected. Corresponding compiler flags have been set.") - SET(CMAKE_CXX_FLAGS " -std=c++11 -O2 -funroll-loops -fstrict-aliasing -march=native -fPIC -Wall") + SET(CMAKE_CXX_FLAGS " -std=c++11 -O2 -funroll-loops -fstrict-aliasing -msse2 -fPIC -Wall") ELSE() MESSAGE(STATUS "Compiler ${CMAKE_CXX_COMPILER_ID} unknown. Simple compiler flags have been set.") + SET(CMAKE_CXX_FLAGS " -std=c++11 -O2 -fstrict-aliasing -fPIC -Wall") + ENDIF() +ELSE(BUILDREL) +IF(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") + MESSAGE(STATUS "Microsoft Visual Studio detected. Corresponding compiler flags have been set.") + SET(CMAKE_CXX_FLAGS " /std=c++11 /O2 /DH5_BUILT_AS_DYNAMIC_LIB") + SET(CMAKE_C_FLAGS " /std=c++11 /O2 /DH5_BUILT_AS_DYNAMIC_LIB") +ELSEIF(CMAKE_CXX_COMPILER_ID STREQUAL "GNU") + MESSAGE(STATUS "GNU Compiler Collection detected. Corresponding compiler flags have been set.") + SET(CMAKE_CXX_FLAGS " -std=c++11 -O2 -funroll-loops -fstrict-aliasing -march=native -fPIC -Wall -mfpmath=sse -Wcast-align -Wl,-E") +ELSEIF(CMAKE_CXX_COMPILER_ID STREQUAL "Clang") + MESSAGE(STATUS "LLVM Clang detected. Corresponding compiler flags have been set.") SET(CMAKE_CXX_FLAGS " -std=c++11 -O2 -funroll-loops -fstrict-aliasing -march=native -fPIC -Wall") +ELSEIF(CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang") + MESSAGE(STATUS "Apple Clang detected. Corresponding compiler flags have been set.") + SET(CMAKE_CXX_FLAGS " -std=c++11 -O2 -funroll-loops -fstrict-aliasing -march=native -fPIC -Wall") +ELSE() + MESSAGE(STATUS "Compiler ${CMAKE_CXX_COMPILER_ID} unknown. Simple compiler flags have been set.") + SET(CMAKE_CXX_FLAGS " -std=c++11 -O2 -fstrict-aliasing -march=native -fPIC -Wall") ENDIF() +ENDIF(BUILDREL) # Get cl2.hpp header file OPTION(GET_CL2HPP "Download cl2.hpp from Khronos" OFF) From 4d815b35a2e685dab0dc3b4cc2b848d283d46f8b Mon Sep 17 00:00:00 2001 From: Hendrik Ranocha Date: Thu, 14 Mar 2019 12:43:44 +0100 Subject: [PATCH 3/4] try fixing build on Appveyor --- appveyor.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index ebbbe3a..c488424 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -70,7 +70,7 @@ build_script: # Windows only - cmd: set VCPKG_DEFAULT_TRIPLET=x64-windows - cmd: cmake .. -DCMAKE_TOOLCHAIN_FILE=C:/Tools/vcpkg/scripts/buildsystems/vcpkg.cmake -DCMAKE_GENERATOR_PLATFORM=x64 -DCMAKE_POLICY_DEFAULT_CMP0074=NEW -DHDF5_ROOT="C:/Tools/vcpkg/installed/x64-windows" -DHDF5_INCLUDE_DIRS="C:/Tools/vcpkg/installed/x64-windows/include" -DHDF5_LIBRARIES="hdf5::hdf5-shared" -DHDF5_HL_LIBRARIES="hdf5::hdf5_hl-shared" - - cmd: cmake --build . --target ALL_BUILD + - cmd: cmake --build . --target ALL_BUILD --config Release - cmd: set PATH=%PATH%;%cd%\bin;%cd%\bin\Release;%cd%\bin\Debug - cmd: echo %PATH% # - cmd: cd .. @@ -83,8 +83,8 @@ build_script: - cmd: mkdir build - cmd: cd build - cmd: cmake -DTESTS=ON .. -DCMAKE_TOOLCHAIN_FILE=C:/Tools/vcpkg/scripts/buildsystems/vcpkg.cmake -DCMAKE_GENERATOR_PLATFORM=x64 -DCMAKE_POLICY_DEFAULT_CMP0074=NEW -DHDF5_ROOT="C:/Tools/vcpkg/installed/x64-windows" -DHDF5_INCLUDE_DIRS="C:/Tools/vcpkg/installed/x64-windows/include" -DHDF5_LIBRARIES="hdf5::hdf5-shared" -DHDF5_HL_LIBRARIES="hdf5::hdf5_hl-shared" - - cmd: cmake --build . --target ALL_BUILD - - cmd: cmake --build . --target RUN_TESTS + - cmd: cmake --build . --target ALL_BUILD --config Release + - cmd: cmake --build . --target RUN_TESTS --config Release # Linux only # build without tests - sh: cmake .. From 6d338b3cfa088bfa288166720a7596f7ab894432 Mon Sep 17 00:00:00 2001 From: Hendrik Ranocha Date: Thu, 14 Mar 2019 13:09:32 +0100 Subject: [PATCH 4/4] disable temperature logging on Appveyor/Linux --- appveyor.yml | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index c488424..80e8361 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -107,22 +107,22 @@ build_script: - sh: cmake --build . --target test # test power logging # instead of `sudo toolkitICL ...`, `sudo chmod o+rw /dev/cpu/0/msr` could be run once - - sh: sudo modprobe msr - - sh: cd test - - sh: sudo ../bin/toolkitICL -b -intel_power 1000 -c repetition_test.h5 - - sh: h5ls out_repetition_test.h5/housekeeping - - sh: h5ls out_repetition_test.h5/housekeeping/intel - - sh: h5dump -d housekeeping/intel/cores0 out_repetition_test.h5 - - sh: h5dump -d housekeeping/intel/DRAM0 out_repetition_test.h5 - # - sh: h5dump -d housekeeping/intel/GT0 out_repetition_test.h5 # not required on all machines - - sh: h5dump -d housekeeping/intel/package0 out_repetition_test.h5 - - sh: h5dump -d housekeeping/intel/power_time out_repetition_test.h5 - - sh: h5dump -d housekeeping/intel/TDP out_repetition_test.h5 - - sh: sudo ../bin/toolkitICL -b -intel_temp 1000 -c repetition_test.h5 - - sh: h5ls out_repetition_test.h5/housekeeping - - sh: h5ls out_repetition_test.h5/housekeeping/intel - - sh: h5dump -d housekeeping/intel/package0_temperature out_repetition_test.h5 - - sh: h5dump -d housekeeping/intel/temperature_time out_repetition_test.h5 - - sh: cd .. + # - sh: sudo modprobe msr + # - sh: cd test + # - sh: sudo ../bin/toolkitICL -b -intel_power 1000 -c repetition_test.h5 + # - sh: h5ls out_repetition_test.h5/housekeeping + # - sh: h5ls out_repetition_test.h5/housekeeping/intel + # - sh: h5dump -d housekeeping/intel/cores0 out_repetition_test.h5 + # - sh: h5dump -d housekeeping/intel/DRAM0 out_repetition_test.h5 + # # - sh: h5dump -d housekeeping/intel/GT0 out_repetition_test.h5 # not required on all machines + # - sh: h5dump -d housekeeping/intel/package0 out_repetition_test.h5 + # - sh: h5dump -d housekeeping/intel/power_time out_repetition_test.h5 + # - sh: h5dump -d housekeeping/intel/TDP out_repetition_test.h5 + # - sh: sudo ../bin/toolkitICL -b -intel_temp 1000 -c repetition_test.h5 + # - sh: h5ls out_repetition_test.h5/housekeeping + # - sh: h5ls out_repetition_test.h5/housekeeping/intel + # - sh: h5dump -d housekeeping/intel/package0_temperature out_repetition_test.h5 + # - sh: h5dump -d housekeeping/intel/temperature_time out_repetition_test.h5 + # - sh: cd .. # display test log - sh: cat Testing/Temporary/LastTest.log