The Gaudi Framework
v32r2 (46d42edc)
instructionsetLevel.cpp
Go to the documentation of this file.
1
/*
2
* instructionsetLevel.cpp
3
*
4
* Created on: Feb 3, 2015
5
* Author: Marco Clemencic
6
*/
7
8
#include <
GaudiKernel/System.h
>
9
10
#include <iostream>
11
#include <string>
12
#include <vector>
13
14
int
main
(
int
argc
,
char
*
argv
[] ) {
15
16
// These names are those reported in flags field of /proc/cpuinfo on Linux
17
// See arch/x86/include/asm/cpufeature.h
18
const
std::vector<std::string>
sets{
// "80386",
19
"sse"
,
"sse2"
,
20
"sse3"
,
// Note: This is reported by Linux as 'pni'
21
"ssse3"
,
"sse4_1"
,
"sse4_2"
,
"avx"
,
"avx2"
,
"avx512f"
,
"avx512vl"
,
"avx512bw"
};
22
23
if
(
argc
== 1 ) {
24
const
std::size_t
level
=
System::instructionsetLevel
() - 1;
25
if
(
level
< sets.size() ) {
26
for
(
int
i =
level
; i >= 0; --i ) {
std::cout
<< sets[i] <<
std::endl
; }
27
}
else
{
28
std::cout
<<
"unknown instruction set level: "
<<
level
<<
std::endl
;
29
return
2;
30
}
31
}
else
if
( (
argc
== 2 ) && (
std::string
{
"all"
} ==
std::string
{
argv
[1]} ) ) {
32
for
(
auto
&
s
: sets )
std::cout
<<
s
<<
std::endl
;
33
}
else
{
34
std::cout
<<
"Error: wrong arguments\nUsage:\n\t"
<<
argv
[0] <<
" [all]"
<<
std::endl
;
35
return
1;
36
}
37
38
return
0;
39
}
System.h
gaudirun.argv
list argv
Definition:
gaudirun.py:300
System::instructionsetLevel
GAUDI_API int instructionsetLevel()
Instruction Set "Level".
Definition:
System.cpp:326
std::endl
T endl(T... args)
std::size_t
std::string
STL class.
plotBacklogPyRoot.argc
argc
Definition:
plotBacklogPyRoot.py:143
main
int main(int argc, char *argv[])
Definition:
instructionsetLevel.cpp:14
std::vector< std::string >
gaudirun.s
string s
Definition:
gaudirun.py:318
gaudirun.level
level
Definition:
gaudirun.py:336
std::cout
GaudiKernel
src
Util
instructionsetLevel.cpp
Generated on Sat Sep 28 2019 18:06:52 for The Gaudi Framework by
1.8.15