oneapi-src / oneapi-src/oneAPI-samples

Cannot override optimization level set for particle-diffusion sample

Open
#670 4 comments 0 reactions 1 assignee View on GitHub

@JoeOster is already working on this.

Since Sep 21, 2021.

bug
Dominant language
C++
Stars
1.2k
Forks
745
PR merge metrics
No merged PRs in 30d

Description

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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.