From: maier Date: Wed, 27 Feb 2013 18:27:06 +0000 (+0000) Subject: Add DEAL_II_ALLOW_PLATFORM_INTROSPECTION X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=90e5a7ec510fcfbe24f987ccaad73c91c0a6b88d;p=dealii-svn.git Add DEAL_II_ALLOW_PLATFORM_INTROSPECTION git-svn-id: https://svn.dealii.org/branches/branch_cmake@28620 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/CMakeLists.txt b/deal.II/CMakeLists.txt index 2fe926b748..5cb5f29368 100644 --- a/deal.II/CMakeLists.txt +++ b/deal.II/CMakeLists.txt @@ -44,11 +44,11 @@ LIST(APPEND CMAKE_MODULE_PATH # # Load all macros: # +INCLUDE(setup_external_macros) FILE(GLOB _macro_files "cmake/macros/*.cmake") FOREACH(_file ${_macro_files}) INCLUDE(${_file}) ENDFOREACH() -INCLUDE(setup_external_macros) # # Check whether the doc and bundled folders are available: diff --git a/deal.II/cmake/checks/check_01_cpu_features.cmake b/deal.II/cmake/checks/check_01_cpu_features.cmake index 056758c64e..805ab22797 100644 --- a/deal.II/cmake/checks/check_01_cpu_features.cmake +++ b/deal.II/cmake/checks/check_01_cpu_features.cmake @@ -40,66 +40,35 @@ INCLUDE(TestBigEndian) TEST_BIG_ENDIAN(DEAL_II_WORDS_BIGENDIAN) -# -# Check whether the compiler allows for vectorization and that -# vectorization actually works on the given CPU. For this test, we use -# compiler intrinsics similar to what is used in the deal.II library and -# check whether the arithmetic operations are correctly performed on -# examples where all numbers are exactly represented as floating point -# numbers. -# -# - Matthias Maier, rewritten 2012 -# -CHECK_CXX_SOURCE_RUNS( - " - #include - #include - int main() - { - __m128d a, b; - const unsigned int vector_bytes = sizeof(__m128d); - const int n_vectors = vector_bytes/sizeof(double); - __m128d * data = - reinterpret_cast<__m128d*>(_mm_malloc (2*vector_bytes, vector_bytes)); - double * ptr = reinterpret_cast(&a); - ptr[0] = (volatile double)(1.0); - for (int i=1; i(&data[1]); - unsigned int return_value = 0; - if (ptr[0] != 7.3125) - return_value = 1; - for (int i=1; i - #include - int main() - { - __m256d a, b; - const unsigned int vector_bytes = sizeof(__m256d); +IF(DEAL_II_ALLOW_PLATFORM_INTROSPECTION) + # + # Check whether the compiler allows for vectorization and that + # vectorization actually works on the given CPU. For this test, we use + # compiler intrinsics similar to what is used in the deal.II library and + # check whether the arithmetic operations are correctly performed on + # examples where all numbers are exactly represented as floating point + # numbers. + # + # - Matthias Maier, rewritten 2012 + # + CHECK_CXX_SOURCE_RUNS( + " + #include + #include + int main() + { + __m128d a, b; + const unsigned int vector_bytes = sizeof(__m128d); const int n_vectors = vector_bytes/sizeof(double); - __m256d * data = - reinterpret_cast<__m256d*>(_mm_malloc (2*vector_bytes, vector_bytes)); + __m128d * data = + reinterpret_cast<__m128d*>(_mm_malloc (2*vector_bytes, vector_bytes)); double * ptr = reinterpret_cast(&a); ptr[0] = (volatile double)(1.0); for (int i=1; i(&data[1]); unsigned int return_value = 0; if (ptr[0] != 7.3125) @@ -109,9 +78,42 @@ CHECK_CXX_SOURCE_RUNS( return_value = 1; _mm_free (data); return return_value; - } - " - DEAL_II_HAVE_AVX) + } + " + DEAL_II_HAVE_SSE2) + + + CHECK_CXX_SOURCE_RUNS( + " + #include + #include + int main() + { + __m256d a, b; + const unsigned int vector_bytes = sizeof(__m256d); + const int n_vectors = vector_bytes/sizeof(double); + __m256d * data = + reinterpret_cast<__m256d*>(_mm_malloc (2*vector_bytes, vector_bytes)); + double * ptr = reinterpret_cast(&a); + ptr[0] = (volatile double)(1.0); + for (int i=1; i(&data[1]); + unsigned int return_value = 0; + if (ptr[0] != 7.3125) + return_value = 1; + for (int i=1; i The build can be further controlled by the following variables:
    +
  • + DEAL_II_ALLOW_PLATFORM_INTROSPECTION: If set + (default), deal.II will do platform + introspection for the given CPU. +
  • BUILD_SHARED_LIBS: If set (default), deal.II will be linked as a shared library