The Gaudi Framework
v26r1
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Groups
Pages
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
std::vector<std::string> sets{
19
// "80386",
20
"sse"
,
21
"sse2"
,
22
"sse3"
,
// FIXME: This is not reported by Linux (?)
23
"ssse3"
,
24
"sse4_1"
,
25
"sse4_2"
,
26
"avx"
,
27
"avx2"
,
28
"avx512f"
// FIXME: This is not reported by Linux (?)
29
};
30
31
if
(argc == 1) {
32
size_t
level
=
System::instructionsetLevel
() - 1;
33
if
(level < sets.size())
34
for
(
int
i
=
System::instructionsetLevel
() - 1;
i
>= 0; --
i
){
35
std::cout << sets[
i
] << std::endl;
36
}
37
else
{
38
std::cout <<
"unknown instruction set level: "
<< level << std::endl;
39
return
2;
40
}
41
}
else
if
((argc == 2) && (std::string{
"all"
} == std::string{argv[1]})) {
42
for
(
auto
&
s
: sets)
43
std::cout <<
s
<< std::endl;
44
}
else
{
45
std::cout <<
"Error: wrong arguments\nUsage:\n\t"
<< argv[0] <<
" [all]"
46
<< std::endl;
47
return
1;
48
}
49
50
return
0;
51
}
GaudiKernel
src
Util
instructionsetLevel.cpp
Generated on Mon Feb 16 2015 11:56:56 for The Gaudi Framework by
1.8.2