The Gaudi Framework  v29r0 (ff2e7097)
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.

15 {
16 
17  // These names are those reported in flags field of /proc/cpuinfo on Linux
18  // See arch/x86/include/asm/cpufeature.h
20  // "80386",
21  "sse", "sse2",
22  "sse3", // FIXME: This is not reported by Linux (?)
23  "ssse3", "sse4_1", "sse4_2", "avx", "avx2",
24  "avx512f" // FIXME: This is not reported by Linux (?)
25  };
26 
27  if ( argc == 1 ) {
28  size_t level = System::instructionsetLevel() - 1;
29  if ( level < sets.size() )
30  for ( int i = System::instructionsetLevel() - 1; i >= 0; --i ) {
31  std::cout << sets[i] << std::endl;
32  }
33  else {
34  std::cout << "unknown instruction set level: " << level << std::endl;
35  return 2;
36  }
37  } else if ( ( argc == 2 ) && ( std::string{"all"} == std::string{argv[1]} ) ) {
38  for ( auto& s : sets ) std::cout << s << std::endl;
39  } else {
40  std::cout << "Error: wrong arguments\nUsage:\n\t" << argv[0] << " [all]" << std::endl;
41  return 1;
42  }
43 
44  return 0;
45 }
list argv
Definition: gaudirun.py:235
GAUDI_API int instructionsetLevel()
Instruction Set "Level".
Definition: System.cpp:469
T endl(T...args)
STL class.
string s
Definition: gaudirun.py:253