multiarch experiment

This commit is contained in:
Martin Reinecke 2019-01-18 15:19:45 +01:00
parent 1871f8500c
commit 90d2444bf1
7 changed files with 24 additions and 30 deletions

View file

@ -2,7 +2,7 @@ ACLOCAL_AMFLAGS = -I m4
lib_LTLIBRARIES = libsharp.la
src_sharp = \
libsharp_la_SOURCES = \
c_utils/c_utils.c \
c_utils/c_utils.h \
pocketfft/pocketfft.c \
@ -10,11 +10,6 @@ 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 \
@ -23,6 +18,16 @@ src_sharp = \
libsharp/sharp_vecsupport.h \
libsharp/sharp_ylmgen_c.h
libavx_la_SOURCES = libsharp/sharp_core_avx.c
libavx2_la_SOURCES = libsharp/sharp_core_avx2.c
libfma_la_SOURCES = libsharp/sharp_core_fma.c
libfma4_la_SOURCES = libsharp/sharp_core_fma4.c
libavx512f_la_SOURCES = libsharp/sharp_core_avx512f.c
noinst_LTLIBRARIES = libavx.la libavx2.la libfma.la libfma4.la libavx512f.la
libsharp_la_LIBADD = libavx.la libavx2.la libfma.la libfma4.la libavx512f.la
include_HEADERS = \
libsharp/sharp.h \
libsharp/sharp_geomhelpers.h \
@ -33,8 +38,6 @@ EXTRA_DIST = \
libsharp/sharp_core_inc.c \
runtest.sh
libsharp_la_SOURCES = $(src_sharp)
check_PROGRAMS = sharp_testsuite
sharp_testsuite_SOURCES = libsharp/sharp_testsuite.c c_utils/memusage.c c_utils/memusage.h c_utils/walltime_c.c c_utils/walltime_c.h
sharp_testsuite_LDADD = libsharp.la
@ -43,6 +46,12 @@ TESTS = runtest.sh
AM_CFLAGS = -I$(top_srcdir)/c_utils -I$(top_srcdir)/libsharp @AM_CFLAGS@
libavx_la_CFLAGS = ${AM_CFLAGS} -mavx
libavx2_la_CFLAGS = ${AM_CFLAGS} -mavx2
libfma_la_CFLAGS = ${AM_CFLAGS} -mfma
libfma4_la_CFLAGS = ${AM_CFLAGS} -mfma4
libavx512f_la_CFLAGS = ${AM_CFLAGS} -mavx512f
pkgconfigdir = $(libdir)/pkgconfig
nodist_pkgconfig_DATA = @PACKAGE_NAME@.pc

View file

@ -18,7 +18,7 @@ static t_veclen veclen_ = NULL;
static t_max_nvec max_nvec_ = NULL;
static t_architecture architecture_ = NULL;
#if defined(__GNUC__) && defined (__x86_64__) && (__GNUC__>=6)
#ifdef MULTIARCH
#define DECL(arch) \
static int XCONCATX2(have,arch)(void) \
@ -59,7 +59,7 @@ DECL(avx)
static void assign_funcs(void)
{
#if defined(__GNUC__) && defined (__x86_64__) && (__GNUC__>=6)
#ifdef MULTIARCH
#define DECL2(arch) \
if (XCONCATX2(have,arch)()) \
{ \

View file

@ -1,11 +1,8 @@
#if (!defined(__AVX__)) && defined(__GNUC__) && defined (__x86_64__) && (__GNUC__>=6)
#ifdef MULTIARCH
#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

@ -1,11 +1,8 @@
#if (!defined(__AVX2__)) && defined(__GNUC__) && defined (__x86_64__) && (__GNUC__>=6)
#ifdef MULTIARCH
#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

@ -1,11 +1,8 @@
#if (!defined(__AVX512F__)) && defined(__GNUC__) && defined (__x86_64__) && (__GNUC__>=6)
#ifdef MULTIARCH
#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

View file

@ -1,11 +1,8 @@
#if (!defined(__FMA__)) && defined(__GNUC__) && defined (__x86_64__) && (__GNUC__>=6)
#ifdef MULTIARCH
#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

@ -1,11 +1,8 @@
#if (!defined(__FMA4__)) && defined(__GNUC__) && defined (__x86_64__) && (__GNUC__>=6)
#ifdef MULTIARCH
#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