Revision: 54958
          http://brlcad.svn.sourceforge.net/brlcad/?rev=54958&view=rev
Author:   brlcad
Date:     2013-03-29 04:54:12 +0000 (Fri, 29 Mar 2013)
Log Message:
-----------
need to explore the portability of this, but go ahead and locally override the 
_GNU_SOURCE setting so that we can enable processor affinity for pthread 
systems.  after much headache, figured out that _GNU_SOURCE needs to be defined 
before the common.h header.  common includes some system headers and the 
features.h header is only going to get read once to set the necessary __USE_GNU 
define and declaring the CPU_* macros and pthread affinity funcs the 
implementation uses.  this is going to jack up linux benchmarks, but it's a 
nice 5-50% improvement on even small smp systems.

Modified Paths:
--------------
    brlcad/trunk/src/libbu/affinity.c

Modified: brlcad/trunk/src/libbu/affinity.c
===================================================================
--- brlcad/trunk/src/libbu/affinity.c   2013-03-29 03:28:44 UTC (rev 54957)
+++ brlcad/trunk/src/libbu/affinity.c   2013-03-29 04:54:12 UTC (rev 54958)
@@ -18,20 +18,27 @@
  * information.
  */
 
+#ifndef _GNU_SOURCE
+#  define _GNU_SOURCE /* must come before common.h */
+#endif
+
 #include "common.h"
 
-#include <stdio.h>
-#include <stdlib.h>
+#ifdef HAVE_SCHED_H
+#  include <sched.h>
+#endif
 
 #ifdef HAVE_PTHREAD_H
 #  include <pthread.h>
 #endif
 
+#include "bu.h"
 
+
 int
 parallel_set_affinity(void)
 {
-#if defined(_GNU_SOURCE) && defined(HAVE_PTHREAD_H)
+#if defined(HAVE_PTHREAD_H)
 
     int cpulim = bu_avail_cpus();    /* Max number of CPUs available for the 
process */
     int status;                      /* Status of thread setting/getting */

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.


------------------------------------------------------------------------------
Own the Future-Intel(R) Level Up Game Demo Contest 2013
Rise to greatness in Intel's independent game demo contest. Compete 
for recognition, cash, and the chance to get your game on Steam. 
$5K grand prize plus 10 genre and skill prizes. Submit your demo 
by 6/6/13. http://altfarm.mediaplex.com/ad/ck/12124-176961-30367-2
_______________________________________________
BRL-CAD Source Commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-commits

Reply via email to