oneapi-src / oneAPI-samples

Samples for Intel® oneAPI Toolkits
https://oneapi-src.github.io/oneAPI-samples/
MIT License
945 stars 690 forks source link

Cannot override optimization level set for particle-diffusion sample #670

Open ghost opened 3 years ago

ghost commented 3 years ago

Summary

particle-diffusion/src/CMakeLists.txt sets default optimization level to -O3, regardless of the CMAKE_BUILD_TYPE

Version

oneAPI Base Tookit 2021.4

Environment

Ubuntu 20.04 Coffee Lake / GEN9 graphics

Steps to reproduce

from particle-diffusion sample directory run: mkdir build cd build cmake -DCMAKE_BUILD_TYPE=DEBUG ..

Observed behavior

Running "cmake -DCMAKE_BUILD_TYPE=DEBUG .." results in both -O0 and -O3 specified in flags.make: CMakeFiles/motionsim.exe.dir/flags.make:CXX_FLAGS = -g -O0 -O3 -std=c++17 -g As the result, dpcpp seem to performs -O3 optimization, defeating the purpose of DEBUG build

Expected behavior

cmake uses -O0 -g compiler flags when CMAKE_BUILD_TYPE=DEBUG is set

JoeOster commented 3 years ago

@Alberto-Villarreal -can you loo into this please

JoeOster commented 3 years ago

@Alberto-Villarreal -Please comment on this

troy818 commented 1 year ago

OneSmpl_Team1 working on this.

troy818 commented 1 year ago

(OneSmpl_Team1)

Now only use O3 for cmake.