The Gaudi Framework
master (37c0b60a)
CPUFamily.cpp
Go to the documentation of this file.
1
/***********************************************************************************\
2
* (c) Copyright 1998-2020 CERN for the benefit of the LHCb and ATLAS collaborations *
3
* *
4
* This software is distributed under the terms of the Apache version 2 licence, *
5
* copied verbatim in the file "LICENSE". *
6
* *
7
* In applying this licence, CERN does not waive the privileges and immunities *
8
* granted to it by virtue of its status as an Intergovernmental Organization *
9
* or submit itself to any jurisdiction. *
10
\***********************************************************************************/
11
/*
12
* CPUFamily.cpp
13
*
14
* Created on: Sep 23, 2010
15
*/
16
23
#include <boost/python.hpp>
24
25
#define cpuid( func, ax, bx, cx, dx ) \
26
__asm__ __volatile__( "cpuid" : "=a"( ax ), "=b"( bx ), "=c"( cx ), "=d"( dx ) : "a"( func ) );
27
28
bool
is_nehalem
() {
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
}
38
39
const
char
*
CPUFamily
() {
40
if
(
is_nehalem
() ) {
41
return
"nehalem"
;
42
}
else
{
43
return
"core"
;
44
}
45
}
46
47
BOOST_PYTHON_MODULE
( PyCPUFamily ) {
48
using namespace
boost::python;
49
def(
"CPUFamily"
,
CPUFamily
);
50
}
CPUFamily
const char * CPUFamily()
Definition:
CPUFamily.cpp:39
gaudirun.c
c
Definition:
gaudirun.py:525
BOOST_PYTHON_MODULE
BOOST_PYTHON_MODULE(PyCPUFamily)
Definition:
CPUFamily.cpp:47
is_nehalem
bool is_nehalem()
Definition:
CPUFamily.cpp:28
cpuid
#define cpuid(func, ax, bx, cx, dx)
Definition:
CPUFamily.cpp:25
GaudiProfiling
src
python
CPUFamily.cpp
Generated on Thu Dec 19 2024 15:35:05 for The Gaudi Framework by
1.8.18