Skip to content

Commit b60d668

Browse files
author
Kent Knox
committed
Fixes #47: Removing error log messages to stderr
in release builds
1 parent b6501db commit b60d668

File tree

2 files changed

+38
-14
lines changed

2 files changed

+38
-14
lines changed

src/CMakeLists.txt

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
# ########################################################################
22
# Copyright 2013 Advanced Micro Devices, Inc.
3-
#
3+
#
44
# Licensed under the Apache License, Version 2.0 (the "License");
55
# you may not use this file except in compliance with the License.
66
# You may obtain a copy of the License at
7-
#
7+
#
88
# http://www.apache.org/licenses/LICENSE-2.0
9-
#
9+
#
1010
# Unless required by applicable law or agreed to in writing, software
1111
# distributed under the License is distributed on an "AS IS" BASIS,
1212
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -72,7 +72,7 @@ option( BUILD_TEST "Build the library testing suite (dependency on google test,
7272
option( BUILD_LOADLIBRARIES "Build the optional dynamic load libraries that the FFT runtime will search for" ON )
7373
option( BUILD_SHARED_LIBRARY "Build shared libraries." ON)
7474

75-
# If BOOST_ROOT is defined as an environment value, use that value and cache it so it's visible in the cmake-gui.
75+
# If BOOST_ROOT is defined as an environment value, use that value and cache it so it's visible in the cmake-gui.
7676
# Otherwise, create a sensible default that the user can change
7777
if( DEFINED ENV{BOOST_ROOT} )
7878
set( BOOST_ROOT $ENV{BOOST_ROOT} CACHE PATH "Environment variable defining the root of the Boost installation" )
@@ -105,8 +105,8 @@ else()
105105
endif()
106106
endif()
107107

108-
# These variables are meant to contain string which should be appended to the installation paths
109-
# of library and executable binaries, respectively. They are meant to be user configurable/overridable.
108+
# These variables are meant to contain string which should be appended to the installation paths
109+
# of library and executable binaries, respectively. They are meant to be user configurable/overridable.
110110
set( SUFFIX_LIB_DEFAULT "" )
111111
set( SUFFIX_BIN_DEFAULT "" )
112112

@@ -155,7 +155,7 @@ find_package( OpenCL )
155155
# This will define FFTW_FOUND
156156
find_package( FFTW )
157157

158-
if( (${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} VERSION_LESS 2.8) )
158+
if( (${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} VERSION_LESS 2.8) )
159159
message( STATUS "Cmake version 2.8 or greater needed to use GTest" )
160160
else()
161161
# This will define GTEST_FOUND
@@ -195,7 +195,7 @@ if( MSVC )
195195
# CMake sets huge stack frames for windows, for whatever reason. We go with compiler default.
196196
string( REGEX REPLACE "/STACK:[0-9]+" "" CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS}" )
197197
string( REGEX REPLACE "/STACK:[0-9]+" "" CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS}" )
198-
string( REGEX REPLACE "/STACK:[0-9]+" "" CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS}" )
198+
string( REGEX REPLACE "/STACK:[0-9]+" "" CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS}" )
199199

200200
elseif( CMAKE_COMPILER_IS_GNUCXX )
201201
message( STATUS "Detected GNU fortran compiler." )
@@ -208,7 +208,12 @@ elseif( CMAKE_COMPILER_IS_GNUCXX )
208208

209209
set( CMAKE_CXX_FLAGS "-pthread ${CMAKE_CXX_FLAGS}" )
210210
set( CMAKE_C_FLAGS "-pthread ${CMAKE_C_FLAGS}" )
211-
211+
212+
# For linux debug builds, define the same preprocessing symbols as win to keep it simple
213+
if( CMAKE_BUILD_TYPE MATCHES "Debug" )
214+
add_definitions( "/D_DEBUG" )
215+
endif( )
216+
212217
if( BUILD64 )
213218
set( CMAKE_CXX_FLAGS "-m64 ${CMAKE_CXX_FLAGS}" )
214219
set( CMAKE_C_FLAGS "-m64 ${CMAKE_C_FLAGS}" )
@@ -237,12 +242,12 @@ message( STATUS "CMAKE_EXE_LINKER link flags: " ${CMAKE_EXE_LINKER_FLAGS} )
237242

238243
# configure a header file to pass the CMake version settings to the source, and package the header files in the output archive
239244
configure_file( "${PROJECT_SOURCE_DIR}/include/clFFT.version.h.in" "${PROJECT_BINARY_DIR}/include/clFFT.version.h" )
240-
install( FILES
241-
"${PROJECT_BINARY_DIR}/include/clFFT.version.h"
245+
install( FILES
246+
"${PROJECT_BINARY_DIR}/include/clFFT.version.h"
242247
"include/clFFT.h"
243248
"include/clAmdFft.h"
244-
"include/clAmdFft.version.h"
245-
DESTINATION
249+
"include/clAmdFft.version.h"
250+
DESTINATION
246251
"./include" )
247252

248253

@@ -278,7 +283,7 @@ else( )
278283
message( "GoogleTest unit tests will NOT be built" )
279284
endif( )
280285

281-
# The following code is setting variables to control the behavior of CPack to generate our
286+
# The following code is setting variables to control the behavior of CPack to generate our
282287
if( WIN32 )
283288
set( CPACK_SOURCE_GENERATOR "ZIP" )
284289
set( CPACK_GENERATOR "ZIP" )

src/library/private.h

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -270,6 +270,8 @@ inline tstring clfftErrorStatusAsString( const cl_int& status )
270270

271271
// This is used to either wrap an OpenCL function call, or to explicitly check a variable for an OpenCL error condition.
272272
// If an error occurs, we issue a return statement to exit the calling function.
273+
#if defined( _DEBUG )
274+
273275
#define OPENCL_V( fn, msg ) \
274276
{ \
275277
clfftStatus vclStatus = static_cast< clfftStatus >( fn ); \
@@ -288,6 +290,23 @@ inline tstring clfftErrorStatusAsString( const cl_int& status )
288290
} \
289291
}
290292

293+
#else
294+
295+
#define OPENCL_V( fn, msg ) \
296+
{ \
297+
clfftStatus vclStatus = static_cast< clfftStatus >( fn ); \
298+
switch( vclStatus ) \
299+
{ \
300+
case CL_SUCCESS: /**< No error */ \
301+
break; \
302+
default: \
303+
{ \
304+
return vclStatus; \
305+
} \
306+
} \
307+
}
308+
#endif
309+
291310
static inline bool IsPo2 (size_t u) {
292311
return (u != 0) && (0 == (u & (u-1)));
293312
}

0 commit comments

Comments
 (0)