| The Gaudi Framework v27r1

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

- File List
- File Members

Functions
instructionsetLevel.cpp File Reference
`#include <GaudiKernel/System.h>`
`#include <iostream>`
`#include <string>`
`#include <vector>`
Include dependency graph for instructionsetLevel.cpp:

Go to the source code of this file.

## Functions
int | main (int argc, char *argv[])

## Function Documentation

int main | ( | int | argc,
|  | char * | argv[]
| ) |  |

Definition at line 14 of file instructionsetLevel.cpp.

14 {
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 }
gaudirun.argv
list argv
Definition: gaudirun.py:227
System::instructionsetLevel
GAUDI_API int instructionsetLevel()
Instruction Set "Level".
Definition: System.cpp:501
std::endl
T endl(T...args)
std::string
STL class.
std::vector< std::string >
gaudirun.s
string s
Definition: gaudirun.py:245
gaudirun.level
level
Definition: gaudirun.py:261
plotBacklogPyRoot.argc
tuple argc
Definition: plotBacklogPyRoot.py:128
ana.i
list i
Definition: ana.py:128
std::cout