compile for multiple target platforms

This commit is contained in:
Martin Reinecke 2019-01-11 14:37:27 +01:00
parent 976dfb6174
commit b4298be6ab
11 changed files with 1359 additions and 1164 deletions

24
.gitignore vendored
View file

@ -6,14 +6,24 @@
**~
**.pyc
**.pyo
.libs
**/.deps
**/.dirstamp
/auto
/autom4te.cache
/config.log
/config.status
/config/config.auto
/m4
config.log
config.guess
config.sub
ltmain.sh
compile
missing
/comp
/configure
/sharp_oracle.inc
/python/libsharp/libsharp.c
/python/libsharp/libsharp_mpi.c
/Makefile
/Makefile.in
/aclocal.m4
/ar-lib
/depcomp
/install-sh

View file

@ -10,6 +10,11 @@ src_sharp = \
libsharp/sharp.c \
libsharp/sharp_almhelpers.c \
libsharp/sharp_core.c \
libsharp/sharp_core_avx.c \
libsharp/sharp_core_avx2.c \
libsharp/sharp_core_fma.c \
libsharp/sharp_core_fma4.c \
libsharp/sharp_core_avx512f.c \
libsharp/sharp_geomhelpers.c \
libsharp/sharp_legendre_roots.c \
libsharp/sharp_ylmgen_c.c \
@ -24,6 +29,9 @@ include_HEADERS = \
libsharp/sharp_almhelpers.h \
libsharp/sharp_cxx.h
EXTRA_DIST = \
libsharp/sharp_core_inc.c
libsharp_la_SOURCES = $(src_sharp)
check_PROGRAMS = sharp_testsuite

File diff suppressed because it is too large Load diff

11
libsharp/sharp_core_avx.c Normal file
View file

@ -0,0 +1,11 @@
#if (!defined(__AVX__)) && defined(__GNUC__) && defined (__x86_64__) && (__GNUC__>=6)
#define XCONCATX(a,b) a##_##b
#define XCONCATX2(a,b) XCONCATX(a,b)
#define XARCH(a) XCONCATX2(a,ARCH)
#define ARCH avx
#pragma GCC target("avx")
#include "sharp_core_inc.c"
#endif

View file

@ -0,0 +1,11 @@
#if (!defined(__AVX2__)) && defined(__GNUC__) && defined (__x86_64__) && (__GNUC__>=6)
#define XCONCATX(a,b) a##_##b
#define XCONCATX2(a,b) XCONCATX(a,b)
#define XARCH(a) XCONCATX2(a,ARCH)
#define ARCH avx2
#pragma GCC target("avx2")
#include "sharp_core_inc.c"
#endif

View file

@ -0,0 +1,11 @@
#if (!defined(__AVX512F__)) && defined(__GNUC__) && defined (__x86_64__) && (__GNUC__>=6)
#define XCONCATX(a,b) a##_##b
#define XCONCATX2(a,b) XCONCATX(a,b)
#define XARCH(a) XCONCATX2(a,ARCH)
#define ARCH avx512f
#pragma GCC target("avx512f")
#include "sharp_core_inc.c"
#endif

11
libsharp/sharp_core_fma.c Normal file
View file

@ -0,0 +1,11 @@
#if (!defined(__FMA__)) && defined(__GNUC__) && defined (__x86_64__) && (__GNUC__>=6)
#define XCONCATX(a,b) a##_##b
#define XCONCATX2(a,b) XCONCATX(a,b)
#define XARCH(a) XCONCATX2(a,ARCH)
#define ARCH fma
#pragma GCC target("fma")
#include "sharp_core_inc.c"
#endif

View file

@ -0,0 +1,11 @@
#if (!defined(__FMA4__)) && defined(__GNUC__) && defined (__x86_64__) && (__GNUC__>=6)
#define XCONCATX(a,b) a##_##b
#define XCONCATX2(a,b) XCONCATX(a,b)
#define XARCH(a) XCONCATX2(a,ARCH)
#define ARCH fma4
#pragma GCC target("fma4")
#include "sharp_core_inc.c"
#endif

1175
libsharp/sharp_core_inc.c Normal file

File diff suppressed because it is too large Load diff

View file

@ -68,5 +68,6 @@ void inner_loop (sharp_job *job, const int *ispair,const double *cth,
int sharp_veclen(void);
int sharp_max_nvec(int spin);
const char *sharp_architecture(void);
#endif

View file

@ -71,9 +71,6 @@ static void MPI_status(void)
#endif
}
static void vecmath_status(void)
{ printf("Supported vector length: %d\n",sharp_veclen()); }
static void sharp_announce (const char *name)
{
size_t m, nlen=strlen(name);
@ -84,7 +81,8 @@ static void sharp_announce (const char *name)
printf("+-");
for (m=0; m<nlen; ++m) printf("-");
printf("-+\n\n");
vecmath_status();
printf("Detected hardware architecture: %s\n", sharp_architecture());
printf("Supported vector length: %d\n", sharp_veclen());
OpenMP_status();
MPI_status();
printf("\n");