2014-02-10 18:57:46 +00:00
|
|
|
//============================================================================
|
|
|
|
// Copyright (c) Kitware, Inc.
|
|
|
|
// All rights reserved.
|
|
|
|
// See LICENSE.txt for details.
|
|
|
|
// This software is distributed WITHOUT ANY WARRANTY; without even
|
|
|
|
// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
|
|
|
// PURPOSE. See the above copyright notice for more information.
|
|
|
|
//
|
|
|
|
// Copyright 2014 Sandia Corporation.
|
|
|
|
// Copyright 2014 UT-Battelle, LLC.
|
2015-05-21 12:09:22 +00:00
|
|
|
// Copyright 2014 Los Alamos National Security.
|
2014-02-10 18:57:46 +00:00
|
|
|
//
|
|
|
|
// Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
|
|
|
|
// the U.S. Government retains certain rights in this software.
|
|
|
|
//
|
|
|
|
// Under the terms of Contract DE-AC52-06NA25396 with Los Alamos National
|
|
|
|
// Laboratory (LANL), the U.S. Government retains certain rights in
|
|
|
|
// this software.
|
|
|
|
//============================================================================
|
2014-03-07 15:19:09 +00:00
|
|
|
#ifndef vtk_m_internal_Configure_h
|
|
|
|
#define vtk_m_internal_Configure_h
|
2014-02-10 18:57:46 +00:00
|
|
|
|
2015-07-06 14:51:39 +00:00
|
|
|
#ifdef __CUDACC__
|
|
|
|
#define VTKM_CUDA
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef _OPENMP
|
|
|
|
#define VTKM_OPENMP
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef _MSC_VER
|
|
|
|
#define VTKM_MSVC
|
|
|
|
#endif
|
|
|
|
|
2015-12-03 19:41:07 +00:00
|
|
|
#if defined(__clang__) && !defined(__INTEL_COMPILER)
|
|
|
|
//On OSX the intel compiler uses clang as the front end
|
2015-07-06 14:51:39 +00:00
|
|
|
#define VTKM_CLANG
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef __INTEL_COMPILER
|
|
|
|
#define VTKM_ICC
|
|
|
|
#endif
|
|
|
|
|
2015-08-12 19:15:03 +00:00
|
|
|
#ifdef __PGI
|
|
|
|
#define VTKM_PGI
|
|
|
|
#endif
|
|
|
|
|
2015-07-06 14:51:39 +00:00
|
|
|
// Several compilers pretend to be GCC but have minor differences. Try to
|
|
|
|
// compensate for that.
|
|
|
|
#if defined(__GNUC__) && !defined(VTKM_CLANG) && !defined(VTKM_ICC)
|
|
|
|
#define VTKM_GCC
|
|
|
|
#endif
|
2014-02-10 18:57:46 +00:00
|
|
|
|
2015-08-04 21:56:33 +00:00
|
|
|
#if defined(unix) || defined(__unix) || defined(__unix__) || (defined(__APPLE__) && defined(__MACH__))
|
|
|
|
#include <unistd.h>
|
|
|
|
# ifdef _POSIX_VERSION
|
|
|
|
# define VTKM_POSIX _POSIX_VERSION
|
|
|
|
# endif
|
|
|
|
#endif
|
|
|
|
|
2014-02-10 18:57:46 +00:00
|
|
|
#if !defined(VTKM_USE_DOUBLE_PRECISION) && !defined(VTKM_NO_DOUBLE_PRECISION)
|
|
|
|
#cmakedefine VTKM_USE_DOUBLE_PRECISION
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if defined(VTKM_USE_DOUBLE_PRECISION) && defined(VTKM_NO_DOUBLE_PRECISION)
|
|
|
|
# error Both VTKM_USE_DOUBLE_PRECISION and VTKM_NO_DOUBLE_PRECISION defined. Do not know what to do.
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if !defined(VTKM_USE_64BIT_IDS) && !defined(VTKM_NO_64BIT_IDS)
|
|
|
|
#cmakedefine VTKM_USE_64BIT_IDS
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if defined(VTKM_USE_64BIT_IDS) && defined(VTKM_NO_64BIT_IDS)
|
|
|
|
# error Both VTKM_USE_64BIT_IDS and VTKM_NO_64BIT_IDS defined. Do not know what to do.
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#define VTKM_SIZE_FLOAT @VTKm_SIZE_FLOAT@
|
|
|
|
#define VTKM_SIZE_DOUBLE @VTKm_SIZE_DOUBLE@
|
2014-10-07 16:59:34 +00:00
|
|
|
#define VTKM_SIZE_CHAR @VTKm_SIZE_CHAR@
|
|
|
|
#define VTKM_SIZE_SHORT @VTKm_SIZE_SHORT@
|
2014-02-10 18:57:46 +00:00
|
|
|
#define VTKM_SIZE_INT @VTKm_SIZE_INT@
|
|
|
|
#define VTKM_SIZE_LONG @VTKm_SIZE_LONG@
|
|
|
|
#define VTKM_SIZE_LONG_LONG @VTKm_SIZE_LONG_LONG@
|
|
|
|
|
|
|
|
#ifdef VTKM_USE_DOUBLE_PRECISION
|
|
|
|
# ifndef VTKM_SIZE_SCALAR
|
|
|
|
# define VTKM_SIZE_SCALAR VTKM_SIZE_DOUBLE
|
|
|
|
# endif
|
|
|
|
# ifndef VTKM_ALIGNMENT_TWO_SCALAR
|
|
|
|
# define VTKM_ALIGNMENT_TWO_SCALAR 16
|
|
|
|
# endif
|
|
|
|
# ifndef VTKM_ALIGNMENT_FOUR_SCALAR
|
|
|
|
# define VTKM_ALIGNMENT_FOUR_SCALAR 8
|
|
|
|
# endif
|
|
|
|
#else
|
|
|
|
# ifndef VTKM_SIZE_SCALAR
|
|
|
|
# define VTKM_SIZE_SCALAR VTKM_SIZE_FLOAT
|
|
|
|
# define VTKM_ALIGNMENT_SCALAR VTKM_SIZE_SCALAR
|
|
|
|
# endif
|
|
|
|
# ifndef VTKM_ALIGNMENT_TWO_SCALAR
|
|
|
|
# define VTKM_ALIGNMENT_TWO_SCALAR 8
|
|
|
|
# endif
|
|
|
|
# ifndef VTKM_ALIGNMENT_FOUR_SCALAR
|
|
|
|
# define VTKM_ALIGNMENT_FOUR_SCALAR 16
|
|
|
|
# endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef VTKM_USE_64BIT_IDS
|
|
|
|
# ifndef VTKM_SIZE_ID
|
|
|
|
# define VTKM_SIZE_ID 8
|
|
|
|
# endif
|
|
|
|
#else
|
|
|
|
# ifndef VTKM_SIZE_ID
|
|
|
|
# define VTKM_SIZE_ID 4
|
|
|
|
# endif
|
|
|
|
#endif
|
|
|
|
|
2015-08-12 19:08:45 +00:00
|
|
|
// Define a pair of macros, VTKM_THIRDPARTY_PRE_INCLUDE and VTKM_THIRDPARTY_POST_INCLUDE,
|
|
|
|
// that should be wrapped around any #include for a boost or thrust header file. Mostly
|
2015-07-30 22:02:21 +00:00
|
|
|
// this is used to set pragmas that dissable warnings that VTK-m checks for
|
2015-08-12 19:08:45 +00:00
|
|
|
// but boost and thrust does not.
|
2015-08-12 19:15:03 +00:00
|
|
|
#if (defined(VTKM_GCC) || defined(VTKM_CLANG)) && !defined(VTKM_PGI)
|
2015-09-17 13:44:56 +00:00
|
|
|
|
|
|
|
#define VTK_M_THIRDPARTY_GCC_WARNING_PRAGMAS \
|
2015-07-31 14:32:32 +00:00
|
|
|
_Pragma("GCC diagnostic ignored \"-Wconversion\"") \
|
2015-07-31 16:10:31 +00:00
|
|
|
_Pragma("GCC diagnostic ignored \"-Wshadow\"") \
|
|
|
|
_Pragma("GCC diagnostic ignored \"-Wunused-parameter\"")
|
2015-09-17 13:44:56 +00:00
|
|
|
|
|
|
|
// Newer versions of clang have an unused-local-typedef warning, but not older
|
|
|
|
// versions. This checks for the apple version of clang, which is different
|
|
|
|
// than other clang compiled versions. If using a non-apple version of clang,
|
|
|
|
// you might need to extend this condition.
|
|
|
|
#if defined(VTKM_CLANG) && (__apple_build_version__ >= 7000072)
|
|
|
|
#define VTK_M_THIRDPARTY_CLANG_WARNING_PRAGMAS \
|
2015-09-17 05:32:39 +00:00
|
|
|
_Pragma("GCC diagnostic ignored \"-Wunused-local-typedef\"")
|
2015-09-17 13:44:56 +00:00
|
|
|
#else
|
|
|
|
#define VTK_M_THIRDPARTY_CLANG_WARNING_PRAGMAS
|
|
|
|
#endif
|
|
|
|
|
2015-12-14 17:54:02 +00:00
|
|
|
// Older versions of GCC don't support the push/pop pragmas. Right now we are
|
|
|
|
// not checking for GCC 3 or earlier. I'm not sure we have a use case for that.
|
|
|
|
#if defined(VTKM_GCC) && (__GNUC__ == 4 && __GNUC_MINOR__ < 6)
|
|
|
|
#define VTK_M_THIRDPARTY_WARNINGS_PUSH
|
|
|
|
#define VTK_M_THRIDPARTY_WARNINGS_POP
|
|
|
|
#else
|
|
|
|
#define VTK_M_THIRDPARTY_WARNINGS_PUSH _Pragma("GCC diagnostic push")
|
|
|
|
#define VTK_M_THRIDPARTY_WARNINGS_POP _Pragma("GCC diagnostic pop")
|
|
|
|
#endif
|
|
|
|
|
2015-09-17 13:44:56 +00:00
|
|
|
#define VTKM_THIRDPARTY_PRE_INCLUDE \
|
2015-12-14 17:54:02 +00:00
|
|
|
VTK_M_THIRDPARTY_WARNINGS_PUSH \
|
2015-09-17 13:44:56 +00:00
|
|
|
VTK_M_THIRDPARTY_GCC_WARNING_PRAGMAS \
|
|
|
|
VTK_M_THIRDPARTY_CLANG_WARNING_PRAGMAS
|
2015-08-12 19:08:45 +00:00
|
|
|
#define VTKM_THIRDPARTY_POST_INCLUDE \
|
2015-12-14 17:54:02 +00:00
|
|
|
VTK_M_THRIDPARTY_WARNINGS_POP
|
2015-09-17 13:44:56 +00:00
|
|
|
|
2015-07-30 22:02:21 +00:00
|
|
|
#else
|
2015-08-12 19:08:45 +00:00
|
|
|
#define VTKM_THIRDPARTY_PRE_INCLUDE
|
|
|
|
#define VTKM_THIRDPARTY_POST_INCLUDE
|
2015-07-30 22:02:21 +00:00
|
|
|
#endif
|
|
|
|
|
2015-12-03 16:55:41 +00:00
|
|
|
//Determine if current compiler supports vectorization pragma's
|
|
|
|
//if so set the define VTKM_COMPILER_SUPPORTS_VECTOR_PRAGMAS
|
|
|
|
#if ( defined(VTKM_GCC) && ( __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 9) ) ) || \
|
|
|
|
( defined(VTKM_ICC) && (__INTEL_COMPILER >= 1400) ) || \
|
|
|
|
( defined(VTKM_CLANG) && defined(__apple_build_version__) && (__apple_build_version__ >= 7000000) ) || \
|
|
|
|
( defined(VTKM_CLANG) && !defined(__apple_build_version__) && (__clang_major__ > 3) ) || \
|
|
|
|
( defined(VTKM_CLANG) && !defined(__apple_build_version__) && (__clang_major__ == 3 && __clang_minor__ >= 5) )
|
|
|
|
#define VTKM_COMPILER_SUPPORTS_VECTOR_PRAGMAS 1
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
2015-12-01 15:09:46 +00:00
|
|
|
// Define a pair of macros, VTKM_VECTORIZATION_PRE_LOOP and VTKM_VECTORIZATION_IN_LOOP,
|
|
|
|
// that should be wrapped around any "for"/"while" that you want vectorized.
|
|
|
|
// This is used to set per compiler pragmas for vectorization, and to disable
|
|
|
|
// any warnings that about vectorization failures.
|
2015-12-03 16:55:41 +00:00
|
|
|
#if defined(VTKM_CLANG) && defined(VTKM_COMPILER_SUPPORTS_VECTOR_PRAGMAS)
|
2015-12-01 15:09:46 +00:00
|
|
|
//clang only needs pre loop
|
|
|
|
#define VTKM_VECTORIZATION_PRE_LOOP \
|
|
|
|
_Pragma("clang loop vectorize(enable) interleave(enable)")
|
|
|
|
#define VTKM_VECTORIZATION_IN_LOOP
|
2015-12-03 16:55:41 +00:00
|
|
|
#elif defined(VTKM_ICC) && defined(VTKM_COMPILER_SUPPORTS_VECTOR_PRAGMAS)
|
2015-12-01 15:09:46 +00:00
|
|
|
//icc needs pre and in loop
|
|
|
|
#define VTKM_VECTORIZATION_PRE_LOOP \
|
|
|
|
_Pragma("simd")
|
|
|
|
#define VTKM_VECTORIZATION_IN_LOOP \
|
|
|
|
_Pragma("forceinline recursive")
|
2015-12-03 16:55:41 +00:00
|
|
|
#elif defined(VTKM_GCC) && defined(VTKM_COMPILER_SUPPORTS_VECTOR_PRAGMAS)
|
2015-12-01 15:09:46 +00:00
|
|
|
//gcc only needs in loop
|
2016-01-11 19:52:41 +00:00
|
|
|
#define VTKM_VECTORIZATION_PRE_LOOP \
|
2016-01-12 16:10:20 +00:00
|
|
|
_Pragma("GCC ivdep")
|
2015-12-01 15:09:46 +00:00
|
|
|
#define VTKM_VECTORIZATION_IN_LOOP
|
|
|
|
#else
|
|
|
|
#define VTKM_VECTORIZATION_PRE_LOOP
|
|
|
|
#define VTKM_VECTORIZATION_IN_LOOP
|
2015-11-23 17:44:05 +00:00
|
|
|
#endif
|
|
|
|
|
2015-09-16 20:58:10 +00:00
|
|
|
//Mark if we are building with CUDA enabled
|
|
|
|
#ifndef VTKM_ENABLE_CUDA
|
|
|
|
#cmakedefine VTKM_ENABLE_CUDA
|
|
|
|
#endif
|
|
|
|
//Mark if we are building with TBB enabled
|
|
|
|
#ifndef VTKM_ENABLE_TBB
|
|
|
|
#cmakedefine VTKM_ENABLE_TBB
|
|
|
|
#endif
|
|
|
|
|
2015-08-11 21:48:30 +00:00
|
|
|
//Mark if we are building with interop enabled
|
2015-09-04 15:41:39 +00:00
|
|
|
#ifndef VTKM_ENABLE_OPENGL_INTEROP
|
|
|
|
#cmakedefine VTKM_ENABLE_OPENGL_INTEROP
|
2015-08-11 21:48:30 +00:00
|
|
|
#endif
|
|
|
|
|
2014-02-10 18:57:46 +00:00
|
|
|
// Determine whether we will use variadic templates (a new feature in C++11).
|
|
|
|
// Currently have VARIADIC_TEMPLATE support off.
|
|
|
|
#cmakedefine VTKM_NO_VARIADIC_TEMPLATE
|
|
|
|
#if !defined(VTKM_USE_VARIADIC_TEMPLATE) && !defined(VTKM_NO_VARIADIC_TEMPLATE)
|
|
|
|
// Currently using Boost to determine support.
|
2015-06-15 13:33:45 +00:00
|
|
|
|
2015-08-12 19:08:45 +00:00
|
|
|
VTKM_THIRDPARTY_PRE_INCLUDE
|
2014-02-10 18:57:46 +00:00
|
|
|
# include <boost/config.hpp>
|
2015-08-12 19:08:45 +00:00
|
|
|
VTKM_THIRDPARTY_POST_INCLUDE
|
2015-06-15 13:33:45 +00:00
|
|
|
|
|
|
|
|
2014-02-10 18:57:46 +00:00
|
|
|
# if defined(BOOST_HAS_VARIADIC_TMPL)
|
|
|
|
# define VTKM_USE_VARIADIC_TEMPLATE 1
|
|
|
|
# endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if defined(VTKM_USE_VARIADIC_TEMPLATE) && defined(VTKM_NO_VARIADIC_TEMPLATE)
|
|
|
|
# error Both VTKM_USE_VARIADIC_TEMPLATE and VTKM_NO_VARIADIC_TEMPLATE defined. Do not know what to do.
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif //vtkm_internal_Configure_h
|