[Cmake-commits] CMake branch, next, updated. v2.8.4-1222-g6c78fb1

David Cole david.cole at kitware.com
Fri Mar 18 14:30:28 EDT 2011


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "CMake".

The branch, next has been updated
       via  6c78fb12aa6b361002131d4590bec7a68992972c (commit)
       via  e6c2701002a1c4620cbc58083698bd961e1ab999 (commit)
      from  9ef9cbfa56fa6dc2b03d9d2f494f2bf1e02d3d52 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=6c78fb12aa6b361002131d4590bec7a68992972c
commit 6c78fb12aa6b361002131d4590bec7a68992972c
Merge: 9ef9cbf e6c2701
Author:     David Cole <david.cole at kitware.com>
AuthorDate: Fri Mar 18 14:30:27 2011 -0400
Commit:     CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Fri Mar 18 14:30:27 2011 -0400

    Merge topic 'add-ProcessorCount-module' into next
    
    e6c2701 ProcessorCount: Use ERROR_QUIET with execute_process (#11302)


http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=e6c2701002a1c4620cbc58083698bd961e1ab999
commit e6c2701002a1c4620cbc58083698bd961e1ab999
Author:     David Cole <david.cole at kitware.com>
AuthorDate: Fri Mar 18 14:28:24 2011 -0400
Commit:     David Cole <david.cole at kitware.com>
CommitDate: Fri Mar 18 14:28:24 2011 -0400

    ProcessorCount: Use ERROR_QUIET with execute_process (#11302)
    
    Also, comment out all "debugging" calls to message() that helped
    us interpret the output on other platforms when running on the
    dashboard clients.
    
    Using ERROR_QUIET avoids unnecessary stderr output while calling
    external tools to determine the processor count. If there's an
    error parsing the output, we set the count to 0 anyhow.
    
    Also, the test will fail on a CMake dashboard run if the count
    comes back equal to 0.
    
    Now that the code is "done"-ish, remove the debugging output.
    Expect no output on stdout or stderr when calling the
    ProcessorCount function from now on.

diff --git a/Modules/ProcessorCount.cmake b/Modules/ProcessorCount.cmake
index 001f928..eff4766 100644
--- a/Modules/ProcessorCount.cmake
+++ b/Modules/ProcessorCount.cmake
@@ -17,6 +17,14 @@
 #     set(CTEST_BUILD_FLAGS -j${N})
 #     set(ctest_test_args ${ctest_test_args} PARALLEL_LEVEL ${N})
 #   endif()
+#
+# This function is intended to offer an approximation of the value of the
+# number of compute cores available on the current machine, such that you
+# may use that value for parallel building and parallel testing. It is meant
+# to help utilize as much of the machine as seems reasonable. Of course,
+# knowledge of what else might be running on the machine simultaneously
+# should be used when deciding whether to request a machine's full capacity
+# all for yourself.
 
 # A more reliable way might be to compile a small C program that uses the CPUID
 # instruction, but that again requires compiler support or compiling assembler
@@ -42,7 +50,7 @@ function(ProcessorCount var)
   if(WIN32)
     # Windows:
     set(count "$ENV{NUMBER_OF_PROCESSORS}")
-    message("ProcessorCount: WIN32, trying environment variable")
+    #message("ProcessorCount: WIN32, trying environment variable")
   endif()
 
   if(NOT count)
@@ -51,9 +59,10 @@ function(ProcessorCount var)
       PATHS /usr/sbin /sbin)
     if(ProcessorCount_cmd_sysctl)
       execute_process(COMMAND ${ProcessorCount_cmd_sysctl} -n hw.ncpu
+        ERROR_QUIET
         OUTPUT_STRIP_TRAILING_WHITESPACE
         OUTPUT_VARIABLE count)
-      message("ProcessorCount: trying sysctl '${ProcessorCount_cmd_sysctl}'")
+      #message("ProcessorCount: trying sysctl '${ProcessorCount_cmd_sysctl}'")
     endif()
   endif()
 
@@ -62,9 +71,10 @@ function(ProcessorCount var)
     find_program(ProcessorCount_cmd_getconf getconf)
     if(ProcessorCount_cmd_getconf)
       execute_process(COMMAND ${ProcessorCount_cmd_getconf} _NPROCESSORS_ONLN
+        ERROR_QUIET
         OUTPUT_STRIP_TRAILING_WHITESPACE
         OUTPUT_VARIABLE count)
-      message("ProcessorCount: trying getconf '${ProcessorCount_cmd_getconf}'")
+      #message("ProcessorCount: trying getconf '${ProcessorCount_cmd_getconf}'")
     endif()
   endif()
 
@@ -74,11 +84,12 @@ function(ProcessorCount var)
       PATHS /usr/contrib/bin)
     if(ProcessorCount_cmd_machinfo)
       execute_process(COMMAND ${ProcessorCount_cmd_machinfo}
+        ERROR_QUIET
         OUTPUT_STRIP_TRAILING_WHITESPACE
         OUTPUT_VARIABLE machinfo_output)
       string(REGEX MATCHALL "Number of CPUs = ([0-9]+)" procs "${machinfo_output}")
       set(count "${CMAKE_MATCH_1}")
-      message("ProcessorCount: trying machinfo '${ProcessorCount_cmd_machinfo}'")
+      #message("ProcessorCount: trying machinfo '${ProcessorCount_cmd_machinfo}'")
     endif()
   endif()
 
@@ -88,11 +99,12 @@ function(ProcessorCount var)
       PATHS /sbin)
     if(ProcessorCount_cmd_hinv)
       execute_process(COMMAND ${ProcessorCount_cmd_hinv}
+        ERROR_QUIET
         OUTPUT_STRIP_TRAILING_WHITESPACE
         OUTPUT_VARIABLE hinv_output)
       string(REGEX MATCHALL "([0-9]+) .* Processors" procs "${hinv_output}")
       set(count "${CMAKE_MATCH_1}")
-      message("ProcessorCount: trying hinv '${ProcessorCount_cmd_hinv}'")
+      #message("ProcessorCount: trying hinv '${ProcessorCount_cmd_hinv}'")
     endif()
   endif()
 
@@ -102,11 +114,12 @@ function(ProcessorCount var)
       PATHS /usr/sbin)
     if(ProcessorCount_cmd_lsconf)
       execute_process(COMMAND ${ProcessorCount_cmd_lsconf}
+        ERROR_QUIET
         OUTPUT_STRIP_TRAILING_WHITESPACE
         OUTPUT_VARIABLE lsconf_output)
       string(REGEX MATCHALL "Number Of Processors: ([0-9]+)" procs "${lsconf_output}")
       set(count "${CMAKE_MATCH_1}")
-      message("ProcessorCount: trying lsconf '${ProcessorCount_cmd_lsconf}'")
+      #message("ProcessorCount: trying lsconf '${ProcessorCount_cmd_lsconf}'")
     endif()
   endif()
 
@@ -115,11 +128,12 @@ function(ProcessorCount var)
     find_program(ProcessorCount_cmd_pidin pidin)
     if(ProcessorCount_cmd_pidin)
       execute_process(COMMAND ${ProcessorCount_cmd_pidin} info
+        ERROR_QUIET
         OUTPUT_STRIP_TRAILING_WHITESPACE
         OUTPUT_VARIABLE pidin_output)
       string(REGEX MATCHALL "Processor[0-9]+: " procs "${pidin_output}")
       list(LENGTH procs count)
-      message("ProcessorCount: trying pidin '${ProcessorCount_cmd_pidin}'")
+      #message("ProcessorCount: trying pidin '${ProcessorCount_cmd_pidin}'")
     endif()
   endif()
 
@@ -128,11 +142,12 @@ function(ProcessorCount var)
     find_program(ProcessorCount_cmd_uname uname)
     if(ProcessorCount_cmd_uname)
       execute_process(COMMAND ${ProcessorCount_cmd_uname} -X
+        ERROR_QUIET
         OUTPUT_STRIP_TRAILING_WHITESPACE
         OUTPUT_VARIABLE uname_X_output)
       string(REGEX MATCHALL "NumCPU = ([0-9]+)" procs "${uname_X_output}")
       set(count "${CMAKE_MATCH_1}")
-      message("ProcessorCount: trying uname -X '${ProcessorCount_cmd_uname}'")
+      #message("ProcessorCount: trying uname -X '${ProcessorCount_cmd_uname}'")
     endif()
   endif()
 
@@ -145,7 +160,7 @@ function(ProcessorCount var)
     if(EXISTS "${cpuinfo_file}")
       file(STRINGS "${cpuinfo_file}" procs REGEX "^processor.: [0-9]+$")
       list(LENGTH procs count)
-      message("ProcessorCount: trying cpuinfo '${cpuinfo_file}'")
+      #message("ProcessorCount: trying cpuinfo '${cpuinfo_file}'")
     endif()
   endif()
 
@@ -154,7 +169,7 @@ function(ProcessorCount var)
   #
   if(NOT count)
     set(count "$ENV{NUMBER_OF_PROCESSORS}")
-    message("ProcessorCount: last fallback, trying environment variable")
+    #message("ProcessorCount: last fallback, trying environment variable")
   endif()
 
   # Ensure an integer return (avoid inadvertently returning an empty string
diff --git a/Tests/CMakeTests/ProcessorCountTest.cmake.in b/Tests/CMakeTests/ProcessorCountTest.cmake.in
index c5feb31..98f6ab1 100644
--- a/Tests/CMakeTests/ProcessorCountTest.cmake.in
+++ b/Tests/CMakeTests/ProcessorCountTest.cmake.in
@@ -1,14 +1,20 @@
 include(ProcessorCount)
 
 ProcessorCount(processor_count)
+
+message("### 1. This line should be the first line of text in the test output.")
+message("### 2. If there was output from this test before line #1, then the")
+message("### 3. ProcessorCount(...) function call is emitting output that it shouldn't...")
+
 message("processor_count='${processor_count}'")
 
 execute_process(
   COMMAND "@CMAKE_BINARY_DIR@/Source/kwsys/$ENV{CMAKE_CONFIG_TYPE}/cmsysTestsCxx"
   testSystemInformation
-  OUTPUT_VARIABLE out)
+  OUTPUT_VARIABLE tsi_out
+  ERROR_VARIABLE tsi_err)
 string(REGEX REPLACE "(.*)GetNumberOfPhysicalCPU:.([0-9]*)(.*)" "\\2"
-  system_info_processor_count "${out}")
+  system_info_processor_count "${tsi_out}")
 
 message("system_info_processor_count='${system_info_processor_count}'")
 
@@ -19,7 +25,8 @@ endif()
 message("")
 message("CTEST_FULL_OUTPUT (Avoid ctest truncation of output)")
 message("")
-message("out='${out}'")
+message("tsi_out='${tsi_out}'")
+message("tsi_err='${tsi_err}'")
 message("")
 
 # Evaluate possible error conditions:

-----------------------------------------------------------------------

Summary of changes:
 Modules/ProcessorCount.cmake                 |   35 ++++++++++++++++++-------
 Tests/CMakeTests/ProcessorCountTest.cmake.in |   13 +++++++--
 2 files changed, 35 insertions(+), 13 deletions(-)


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list