]> https://gitweb.dealii.org/ - dealii.git/commitdiff
add test_affinity program, refactor slightly
authorMatthias Maier <tamiko@kyomu.43-1.org>
Sat, 20 Jul 2013 08:25:44 +0000 (08:25 +0000)
committerMatthias Maier <tamiko@kyomu.43-1.org>
Sat, 20 Jul 2013 08:25:44 +0000 (08:25 +0000)
git-svn-id: https://svn.dealii.org/trunk@30073 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/CMakeLists.txt
deal.II/cmake/scripts/CMakeLists.txt
deal.II/cmake/setup_custom_targets.cmake [deleted file]
deal.II/contrib/CMakeLists.txt
deal.II/contrib/test_affinity/CMakeLists.txt [new file with mode: 0644]
deal.II/contrib/test_affinity/test_affinity.cc [new file with mode: 0644]
deal.II/doc/CMakeLists.txt
deal.II/source/CMakeLists.txt

index dfb99c96a4f654fed7e7c181f20f7fdb8663f582..70f155cec6103663d5cf6945292f89079201c99c 100644 (file)
@@ -133,11 +133,6 @@ ADD_SUBDIRECTORY(cmake/config) # has to be included after source
 ADD_SUBDIRECTORY(contrib) # has to be included after source
 ADD_SUBDIRECTORY(examples)
 
-#
-# Define some custom targets for convenience
-#
-INCLUDE(setup_custom_targets)
-
 #
 # And finally, print the configuration:
 #
index c1be97fb3fd78c5cfc02640d1c724b229dcde279..5ac93c43cc2bb55b93e560efbad9b899558550d4 100644 (file)
@@ -67,6 +67,16 @@ IF(DEAL_II_COMPONENT_COMPAT_FILES)
       )
   ENDIF()
 
+  #
+  # A custom target with the same name as the component:
+  #
+  ADD_CUSTOM_TARGET(compat_files
+    DEPENDS
+      expand_instantiations
+      make_dependencies
+      report_features
+    )
+
   IF(NOT CMAKE_CROSSCOMPILING)
     ADD_CUSTOM_TARGET(run_report_features COMMAND report_features)
   ENDIF()
diff --git a/deal.II/cmake/setup_custom_targets.cmake b/deal.II/cmake/setup_custom_targets.cmake
deleted file mode 100644 (file)
index 10bcb7d..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-## ---------------------------------------------------------------------
-## $Id$
-##
-## Copyright (C) 2012 - 2013 by the deal.II authors
-##
-## This file is part of the deal.II library.
-##
-## The deal.II library is free software; you can use it, redistribute
-## it, and/or modify it under the terms of the GNU Lesser General
-## Public License as published by the Free Software Foundation; either
-## version 2.1 of the License, or (at your option) any later version.
-## The full text of the license can be found in the file LICENSE at
-## the top level of the deal.II distribution.
-##
-## ---------------------------------------------------------------------
-
-#
-# Setup some convenience custom targets for the build system:
-#
-
-
-########################################################################
-#                                                                      #
-#   Custom targets for library, documentation and compat_files comp.:  #
-#                                                                      #
-########################################################################
-
-ADD_CUSTOM_TARGET(library)
-FOREACH(_build ${DEAL_II_BUILD_TYPES})
-  ADD_DEPENDENCIES(library ${DEAL_II_BASE_NAME}${DEAL_II_${_build}_SUFFIX})
-ENDFOREACH()
-
-IF(DEAL_II_COMPONENT_DOCUMENTATION)
-  ADD_CUSTOM_TARGET(documentation
-    DEPENDS doxygen
-    )
-ENDIF()
-
-IF(DEAL_II_COMPONENT_COMPAT_FILES)
-  ADD_CUSTOM_TARGET(compat_files
-    DEPENDS
-      expand_instantiations
-      make_dependencies
-      report_features
-    )
-ENDIF()
index 75fe3224930f6e252d5a2355af73c3baed71348c..045394df87b0d5bc696a313cbdb9e82e81933b78 100644 (file)
@@ -19,6 +19,8 @@ IF(DEAL_II_COMPONENT_MESH_CONVERTER)
 ENDIF()
 
 IF(DEAL_II_COMPONENT_PARAMETER_GUI)
-  ADD_SUBDIRECTorY(parameter_gui)
+  ADD_SUBDIRECTORY(parameter_gui)
 ENDIF()
 
+ADD_SUBDIRECTORY(test_affinity)
+
diff --git a/deal.II/contrib/test_affinity/CMakeLists.txt b/deal.II/contrib/test_affinity/CMakeLists.txt
new file mode 100644 (file)
index 0000000..0a737d4
--- /dev/null
@@ -0,0 +1,55 @@
+## ---------------------------------------------------------------------
+## $Id$
+##
+## Copyright (C) 2013 by the deal.II authors
+##
+## This file is part of the deal.II library.
+##
+## The deal.II library is free software; you can use it, redistribute
+## it, and/or modify it under the terms of the GNU Lesser General
+## Public License as published by the Free Software Foundation; either
+## version 2.1 of the License, or (at your option) any later version.
+## The full text of the license can be found in the file LICENSE at
+## the top level of the deal.II distribution.
+##
+## ---------------------------------------------------------------------
+
+CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
+
+# FIND_PACKAGE(deal.II 8.0 REQUIRED)
+# DEAL_II_SETUP_CACHED_VARIABLES()
+# PROJECT(test_affinity)
+ADD_EXECUTABLE(test_affinity
+  test_affinity.cc
+  )
+#DEAL_II_SETUP_TARGET()
+
+IF(CMAKE_BUILD_TYPE MATCHES "Debug")
+  SET(_build "DEBUG")
+ELSE()
+  SET(_build "RELEASE")
+ENDIF()
+
+SET_TARGET_PROPERTIES(test_affinity PROPERTIES
+  LINK_FLAGS "${DEAL_II_LINKER_FLAGS} ${DEAL_II_LINKER_FLAGS_${_build}}"
+  COMPILE_DEFINITIONS "${DEAL_II_DEFINITIONS};${DEAL_II_DEFINITIONS_${_build}}"
+  COMPILE_FLAGS "${DEAL_II_CXX_FLAGS_${_build}}"
+  LINKER_LANGUAGE "CXX"
+  )
+
+TARGET_LINK_LIBRARIES(test_affinity ${DEAL_II_BASE_NAME}${DEAL_II_${_build}_SUFFIX})
+
+IF(NOT CMAKE_CROSSCOMPILING)
+  ADD_CUSTOM_TARGET(run_test_affinity COMMAND test_affinity)
+ENDIF()
+
+# IF("${DEAL_II_EXECUTABLE_RELDIR}" STREQUAL "")
+#   SET(DEAL_II_EXECUTABLE_RELDIR "bin")
+# ENDIF()
+
+# INSTALL(TARGETS test_affinity
+#   RUNTIME
+#   DESTINATION ${DEAL_II_EXECUTABLE_RELDIR}
+#   COMPONENT mesh_converter
+#   )
+
diff --git a/deal.II/contrib/test_affinity/test_affinity.cc b/deal.II/contrib/test_affinity/test_affinity.cc
new file mode 100644 (file)
index 0000000..6e326b6
--- /dev/null
@@ -0,0 +1,28 @@
+#include <deal.II/grid/tria.h>
+
+int main ()
+{
+  // we need this, otherwise gcc will not link against deal.II
+  dealii::Triangulation<2> test;
+
+  cpu_set_t my_set;
+  CPU_ZERO(&my_set);
+
+  unsigned int len = sizeof(my_set);
+  int   ret = sched_getaffinity(0, len, &my_set);
+
+  if (ret!=0)
+    {
+      printf("sched_getaffinity() failed, return value: %d\n", ret);
+      return -1;
+    }
+
+  unsigned int bits_set = CPU_COUNT(&my_set);
+
+  if (bits_set==1)
+    {
+      printf("Warning: sched_getaffinity() returns that we can only use one CPU.\n");
+      return 1;
+    }
+  printf("ncpus=%d, mask=%08X\n", bits_set, *(unsigned int*)(&my_set));
+}
index 14c195045a9eb185532024b66a9ce6fe11825cde..eeb706492875cbfde6809c350db429d41d02564e 100644 (file)
@@ -46,6 +46,11 @@ IF(DEAL_II_COMPONENT_DOCUMENTATION)
   #
   ADD_SUBDIRECTORY(doxygen)
 
+  #
+  # A custom target with the same name as the component:
+  #
+  ADD_CUSTOM_TARGET(documentation DEPENDS doxygen)
+
   #
   # Install the static elements of the html documentation:
   #
index fcd61d8a4611ed6230eb10f899efb0bf9ab2be3f..96c55ff3db97a9774b5796a2ac07f6eda84f7542 100644 (file)
@@ -50,6 +50,8 @@ ADD_SUBDIRECTORY(matrix_free)
 ADD_SUBDIRECTORY(meshworker)
 
 
+ADD_CUSTOM_TARGET(library)
+
 FOREACH(build ${DEAL_II_BUILD_TYPES})
   STRING(TOLOWER ${build} build_lowercase)
 
@@ -65,6 +67,8 @@ FOREACH(build ${DEAL_II_BUILD_TYPES})
     ${deal_ii_objects_${build_lowercase}}
     )
 
+  ADD_DEPENDENCIES(library ${DEAL_II_BASE_NAME}${DEAL_II_${_build}_SUFFIX})
+
   SET_TARGET_PROPERTIES(${DEAL_II_BASE_NAME}${DEAL_II_${build}_SUFFIX}
     PROPERTIES
     VERSION "${DEAL_II_PACKAGE_VERSION}"
@@ -74,7 +78,7 @@ FOREACH(build ${DEAL_II_BUILD_TYPES})
     # a C++ library is still ABI backwards compatible :-]
     #
     SOVERSION "${DEAL_II_PACKAGE_VERSION}"
-    LINK_FLAGS "${DEAL_II_SHARED_LINKER_FLAGS_${build}}"
+    LINK_FLAGS "${DEAL_II_LINKER_FLAGS} ${DEAL_II_LINKER_FLAGS_${build}}"
     COMPILE_DEFINITIONS "${DEAL_II_DEFINITIONS};${DEAL_II_DEFINITIONS_${build}}"
     COMPILE_FLAGS "${DEAL_II_CXX_FLAGS_${build}}"
     INSTALL_NAME_DIR "${CMAKE_INSTALL_PREFIX}/${DEAL_II_LIBRARY_RELDIR}"

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.