The Gaudi Framework  master (902e3694)
instructionsetLevel.cpp
Go to the documentation of this file.
1 /***********************************************************************************\
2 * (c) Copyright 1998-2019 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  * instructionsetLevel.cpp
13  *
14  * Created on: Feb 3, 2015
15  * Author: Marco Clemencic
16  */
17 
18 #include <GaudiKernel/System.h>
19 
20 #include <iostream>
21 #include <string>
22 #include <vector>
23 
24 int main( int argc, char* argv[] ) {
25 
26  // These names are those reported in flags field of /proc/cpuinfo on Linux
27  // See arch/x86/include/asm/cpufeature.h
28  const std::vector<std::string> sets{ // "80386",
29  "sse", "sse2",
30  "sse3", // Note: This is reported by Linux as 'pni'
31  "ssse3", "sse4_1", "sse4_2", "avx", "avx2", "avx512f", "avx512vl" };
32 
33  if ( argc == 1 ) {
35  if ( level < sets.size() ) {
36  for ( int i = level; i >= 0; --i ) { std::cout << sets[i] << std::endl; }
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 ) std::cout << s << std::endl;
43  } else {
44  std::cout << "Error: wrong arguments\nUsage:\n\t" << argv[0] << " [all]" << std::endl;
45  return 1;
46  }
47 
48  return 0;
49 }
std::string
STL class.
System.h
plotBacklogPyRoot.argc
argc
Definition: plotBacklogPyRoot.py:173
main
int main(int argc, char *argv[])
Definition: instructionsetLevel.cpp:24
gaudirun.s
string s
Definition: gaudirun.py:346
std::vector< std::string >
System::instructionsetLevel
GAUDI_API int instructionsetLevel()
Instruction Set "Level".
Definition: System.cpp:343
std::cout
gaudirun.level
level
Definition: gaudirun.py:364
std::endl
T endl(T... args)
std::size_t
gaudirun.argv
list argv
Definition: gaudirun.py:327