|
Boost : |
Subject: [boost] [Boost.Thread] Patch for Intel on Darwin
From: Belcourt, Kenneth (kbelco_at_[hidden])
Date: 2010-05-14 15:33:25
Hi,
The thread library is failing to build with Intel on Darwin with this
error.
"/opt/intel/Compiler/11.1/067/bin/intel64/icpc" -xc++ -w1 -O0 -g -
inline-level=0 -vec-report0 -DBOOST_ALL_NO_LIB=1 -
DBOOST_THREAD_BUILD_DLL=1 -DBOOST_THREAD_POSIX -I".." -c -o "/Volumes/
Scratch/kbelco/boost/results/boost/bin.v2/libs/thread/build/intel-
darwin-11.1/debug/threading-multi/pthread/thread.o" "../libs/thread/
src/pthread/thread.cpp"
../libs/thread/src/pthread/thread.cpp(385): error: identifier
"get_nprocs" is undefined
return get_nprocs();
^
The fix is to test for Apple and Intel before the GNU test.
Index: libs/thread/src/pthread/thread.cpp
===================================================================
--- libs/thread/src/pthread/thread.cpp (revision 61969)
+++ libs/thread/src/pthread/thread.cpp (working copy)
@@ -381,6 +381,10 @@
{
#if defined(PTW32_VERSION) || defined(__hpux)
return pthread_num_processors_np();
+#elif defined(__APPLE__) && defined (__INTEL_COMPILER)
+ int count;
+ size_t size=sizeof(count);
+ return sysctlbyname("hw.ncpu",&count,&size,NULL,0)?0:count;
#elif defined(_GNU_SOURCE)
return get_nprocs();
#elif defined(__APPLE__) || defined(__FreeBSD__)
This has been tested on Darwin and Linux. Okay to commit?
-- Noel
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk