From 897f60043f3ed75d7e643ed0e1ff54f00b8f0efb Mon Sep 17 00:00:00 2001 From: dmed256 Date: Tue, 2 Apr 2019 14:26:24 -0700 Subject: [PATCH] [Mode] Compiler flags default to optimized rather than debug flags --- src/mode/cuda/device.cpp | 25 +++++++++++++------------ src/mode/opencl/device.cpp | 3 +-- src/mode/serial/device.cpp | 4 ++-- 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/src/mode/cuda/device.cpp b/src/mode/cuda/device.cpp index b6257e380..d5f8b426d 100644 --- a/src/mode/cuda/device.cpp +++ b/src/mode/cuda/device.cpp @@ -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("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("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", diff --git a/src/mode/opencl/device.cpp b/src/mode/opencl/device.cpp index 9d1e85c5d..548a4e47d 100644 --- a/src/mode/opencl/device.cpp +++ b/src/mode/opencl/device.cpp @@ -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; diff --git a/src/mode/serial/device.cpp b/src/mode/serial/device.cpp index f67c20e0c..123891487 100644 --- a/src/mode/serial/device.cpp +++ b/src/mode/serial/device.cpp @@ -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 }