Skip to content

Commit

Permalink
[Mode] Compiler flags default to optimized rather than debug flags
Browse files Browse the repository at this point in the history
  • Loading branch information
dmed256 committed Apr 2, 2019
1 parent cb09c03 commit 897f600
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 16 deletions.
25 changes: 13 additions & 12 deletions src/mode/cuda/device.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,22 +39,23 @@ namespace occa {

p2pEnabled = false;

std::string compiler = properties["kernel/compiler"];
std::string compilerFlags = properties["kernel/compiler_flags"];

if (!compiler.size()) {
if (env::var("OCCA_CUDA_COMPILER").size()) {
compiler = env::var("OCCA_CUDA_COMPILER");
} else {
compiler = "nvcc";
}
std::string compiler, compilerFlags;

if (properties.get<std::string>("kernel/compiler").size()) {
compiler = (std::string) properties["kernel/compiler"];
} else if (env::var("OCCA_CUDA_COMPILER").size()) {
compiler = env::var("OCCA_CUDA_COMPILER");
} else {
compiler = "nvcc";
}

if (!compilerFlags.size()) {
compilerFlags = env::var("OCCA_CUDA_COMPILER_FLAGS");
if (properties.get<std::string>("kernel/compiler_flags").size()) {
compilerFlags = (std::string) properties["kernel/compiler_flags"];
} else {
compilerFlags = "-O3";
}

properties["kernel/compiler"] = compiler;
properties["kernel/compiler"] = compiler;
properties["kernel/compiler_flags"] = compilerFlags;

OCCA_CUDA_ERROR("Device: Getting CUDA Device Arch",
Expand Down
3 changes: 1 addition & 2 deletions src/mode/opencl/device.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,11 @@ namespace occa {

std::string compilerFlags;

// Use "-cl-opt-disable" for debug-mode
if (properties.has("kernel/compiler_flags")) {
compilerFlags = (std::string) properties["kernel/compiler_flags"];
} else if (env::var("OCCA_OPENCL_COMPILER_FLAGS").size()) {
compilerFlags = env::var("OCCA_OPENCL_COMPILER_FLAGS");
} else {
compilerFlags = "-cl-opt-disable";
}

properties["kernel/compiler_flags"] = compilerFlags;
Expand Down
4 changes: 2 additions & 2 deletions src/mode/serial/device.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@ namespace occa {
compilerFlags = env::var("CXXFLAGS");
} else {
#if (OCCA_OS & (OCCA_LINUX_OS | OCCA_MACOS_OS))
compilerFlags = "-g";
compilerFlags = "-O3";
#else
compilerFlags = " /Od";
compilerFlags = " /Ox";
#endif
}

Expand Down

0 comments on commit 897f600

Please sign in to comment.