The Gaudi Framework  master (37c0b60a)
CPUFamily.cpp File Reference
#include <boost/python.hpp>
Include dependency graph for CPUFamily.cpp:

Go to the source code of this file.

Macros

#define cpuid(func, ax, bx, cx, dx)   __asm__ __volatile__( "cpuid" : "=a"( ax ), "=b"( bx ), "=c"( cx ), "=d"( dx ) : "a"( func ) );
 

Functions

bool is_nehalem ()
 
const char * CPUFamily ()
 
 BOOST_PYTHON_MODULE (PyCPUFamily)
 

Detailed Description

Python module to be able to check the processor family (Core/Nehalem)

Definition in file CPUFamily.cpp.

Macro Definition Documentation

◆ cpuid

#define cpuid (   func,
  ax,
  bx,
  cx,
  dx 
)    __asm__ __volatile__( "cpuid" : "=a"( ax ), "=b"( bx ), "=c"( cx ), "=d"( dx ) : "a"( func ) );

Definition at line 26 of file CPUFamily.cpp.

Function Documentation

◆ BOOST_PYTHON_MODULE()

BOOST_PYTHON_MODULE ( PyCPUFamily  )

Definition at line 47 of file CPUFamily.cpp.

47  {
48  using namespace boost::python;
49  def( "CPUFamily", CPUFamily );
50 }

◆ CPUFamily()

const char* CPUFamily ( )

Definition at line 39 of file CPUFamily.cpp.

39  {
40  if ( is_nehalem() ) {
41  return "nehalem";
42  } else {
43  return "core";
44  }
45 }

◆ is_nehalem()

bool is_nehalem ( )

Definition at line 28 of file CPUFamily.cpp.

28  {
29 #ifdef __x86_64__
30  int a, b, c, d;
31  cpuid( 1, a, b, c, d );
32  int sse4_2_mask = 1 << 20;
33  return ( c & sse4_2_mask );
34 #else
35  return false;
36 #endif // __x86_64__
37 }
CPUFamily
const char * CPUFamily()
Definition: CPUFamily.cpp:39
gaudirun.c
c
Definition: gaudirun.py:525
is_nehalem
bool is_nehalem()
Definition: CPUFamily.cpp:28
cpuid
#define cpuid(func, ax, bx, cx, dx)
Definition: CPUFamily.cpp:25