LAL  7.5.0.1-bede9b2
simd_detect.c
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2015 Reinhard Prix, Karl Wette
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with with program; see the file COPYING. If not, write to the
16  * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
17  * MA 02110-1301 USA
18  */
19 
20 /*
21  * Utility for printing out detected SIMD extensions
22  */
23 
24 #include <stdio.h>
25 #include <config.h>
26 
27 #include <lal/LALStdlib.h>
28 #include <lal/LALSIMD.h>
29 
30 int main(int argc, char **argv) {
31 
32  /* Parse command line */
33  if ( argc > 1 ) {
34  fprintf(stderr,
35  "Usage: %s [-h|--help]\n\n"
36  "Print compiled and detected SIMD extensions\n\n"
37  "Options:\n"
38  " --help display this message and exit\n",
39  argv[0]
40  );
41  if ( strcmp( argv[1], "-h" ) == 0 || strcmp( argv[1], "-help" ) == 0 || strcmp( argv[1], "--help" ) == 0 ) {
42  return EXIT_SUCCESS;
43  } else {
44  return EXIT_FAILURE;
45  }
46  }
47 
48  printf("%s was compiled with support for the following instruction sets:\n %s %s\n",
49  PACKAGE_STRING, XLALSIMDInstructionSetName(0), HAVE_SIMD_COMPILER);
50 
51  printf("This machine supports executing the following instruction sets:\n ");
52  for (LAL_SIMD_ISET iset = 0; XLALHaveSIMDInstructionSet(iset); ++iset) {
53  printf(" %s", XLALSIMDInstructionSetName(iset));
54  }
55  printf("\n");
56 
57  return 0;
58 
59 }
#define fprintf
const char * XLALSIMDInstructionSetName(LAL_SIMD_ISET iset)
Return the name of a given instruction set as a string.
Definition: LALSIMD.c:289
int XLALHaveSIMDInstructionSet(LAL_SIMD_ISET iset)
Return true if the executing machine supports the given instruction set.
Definition: LALSIMD.c:284
LAL_SIMD_ISET
SIMD instruction sets this module can detect.
Definition: LALSIMD.h:47
int main(int argc, char **argv)
Definition: simd_detect.c:30