| The Gaudi Framework v27r1

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

CPUFamily.cpp
Go to the documentation of this file.
1 /*
2 * CPUFamily.cpp
3 *
4 * Created on: Sep 23, 2010
5 */
6
13 #include <boost/python.hpp>
14
15 #define cpuid(func,ax,bx,cx,dx) __asm__ __volatile__ ("cpuid": "=a" (ax), "=b" (bx), "=c" (cx), "=d" (dx) : "a" (func));
16
17 bool is_nehalem() {
18 int a,b,c,d;
19 cpuid(1,a,b,c,d);
20 int sse4_2_mask = 1 << 20;
21 return (c & sse4_2_mask);
22 }
23
24 const char* CPUFamily() {
25 if (is_nehalem()) {
26 return "nehalem";
27 } else {
28 return "core";
29 }
30 }
31
32 BOOST_PYTHON_MODULE(PyCPUFamily)
33 {
34 using namespace boost::python;
35 def("CPUFamily", CPUFamily);
36 }
gaudirun.c
tuple c
Definition: gaudirun.py:391
BOOST_PYTHON_MODULE
BOOST_PYTHON_MODULE(PyCPUFamily)
Definition: CPUFamily.cpp:32
cpuid
#define cpuid(func, ax, bx, cx, dx)
Definition: CPUFamily.cpp:15
is_nehalem
bool is_nehalem()
Definition: CPUFamily.cpp:17
CPUFamily
const char * CPUFamily()
Definition: CPUFamily.cpp:24
python