LevelS SHT library  3.50
sharp_core.c
Go to the documentation of this file.
1 /*
2  * This file is part of libsharp.
3  *
4  * libsharp 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  * libsharp 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 libsharp; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17  */
18 
19 /*
20  * libsharp is being developed at the Max-Planck-Institut fuer Astrophysik
21  * and financially supported by the Deutsches Zentrum fuer Luft- und Raumfahrt
22  * (DLR).
23  */
24 
25 /*! \file sharp_core.c
26  * Computational core
27  *
28  * Copyright (C) 2012-2013 Max-Planck-Society
29  * \author Martin Reinecke
30  */
31 
32 #define ARCH _default
33 #include "sharp_core_inc0.c"
34 #undef ARCH
35 
36 #if (!defined(__AVX__)) && defined(__GNUC__) && defined (__x86_64__) && (__GNUC__>=6)
37 
38 static int have_avx(void)
39  {
40  static int res=-1;
41  if (res<0)
42  {
43  __builtin_cpu_init();
44  res = __builtin_cpu_supports("avx");
45  }
46  return res;
47  }
48 
49 void inner_loop_avx (sharp_job *job, const int *ispair,const double *cth,
50  const double *sth, int llim, int ulim, sharp_Ylmgen_C *gen, int mi,
51  const int *mlim);
52 #endif
53 
54 void inner_loop (sharp_job *job, const int *ispair,const double *cth,
55  const double *sth, int llim, int ulim, sharp_Ylmgen_C *gen, int mi,
56  const int *mlim)
57  {
58 #if (!defined(__AVX__)) && defined(__GNUC__) && defined (__x86_64__) && (__GNUC__>=6)
59  if (have_avx())
60  inner_loop_avx (job, ispair, cth, sth, llim, ulim, gen, mi, mlim);
61  else
62 #endif
63  inner_loop_default (job, ispair, cth, sth, llim, ulim, gen, mi, mlim);
64  }
65 
66 int sharp_veclen(void)
67  {
68 #if (!defined(__AVX__)) && defined(__GNUC__) && defined (__x86_64__) && (__GNUC__>=6)
69  if (have_avx())
70  return 4;
71  else
72 #endif
73  return VLEN;
74  }

Generated on Mon Dec 10 2018 10:24:20 for LevelS SHT library