Skip to content
Snippets Groups Projects
Commit 90d2444b authored by Martin Reinecke's avatar Martin Reinecke
Browse files

multiarch experiment

parent 1871f850
No related branches found
No related tags found
1 merge request!17Multiarch
...@@ -2,7 +2,7 @@ ACLOCAL_AMFLAGS = -I m4 ...@@ -2,7 +2,7 @@ ACLOCAL_AMFLAGS = -I m4
lib_LTLIBRARIES = libsharp.la lib_LTLIBRARIES = libsharp.la
src_sharp = \ libsharp_la_SOURCES = \
c_utils/c_utils.c \ c_utils/c_utils.c \
c_utils/c_utils.h \ c_utils/c_utils.h \
pocketfft/pocketfft.c \ pocketfft/pocketfft.c \
...@@ -10,11 +10,6 @@ src_sharp = \ ...@@ -10,11 +10,6 @@ src_sharp = \
libsharp/sharp.c \ libsharp/sharp.c \
libsharp/sharp_almhelpers.c \ libsharp/sharp_almhelpers.c \
libsharp/sharp_core.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_geomhelpers.c \
libsharp/sharp_legendre_roots.c \ libsharp/sharp_legendre_roots.c \
libsharp/sharp_ylmgen_c.c \ libsharp/sharp_ylmgen_c.c \
...@@ -23,6 +18,16 @@ src_sharp = \ ...@@ -23,6 +18,16 @@ src_sharp = \
libsharp/sharp_vecsupport.h \ libsharp/sharp_vecsupport.h \
libsharp/sharp_ylmgen_c.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 = \ include_HEADERS = \
libsharp/sharp.h \ libsharp/sharp.h \
libsharp/sharp_geomhelpers.h \ libsharp/sharp_geomhelpers.h \
...@@ -33,8 +38,6 @@ EXTRA_DIST = \ ...@@ -33,8 +38,6 @@ EXTRA_DIST = \
libsharp/sharp_core_inc.c \ libsharp/sharp_core_inc.c \
runtest.sh runtest.sh
libsharp_la_SOURCES = $(src_sharp)
check_PROGRAMS = sharp_testsuite 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_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 sharp_testsuite_LDADD = libsharp.la
...@@ -43,6 +46,12 @@ TESTS = runtest.sh ...@@ -43,6 +46,12 @@ TESTS = runtest.sh
AM_CFLAGS = -I$(top_srcdir)/c_utils -I$(top_srcdir)/libsharp @AM_CFLAGS@ 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 pkgconfigdir = $(libdir)/pkgconfig
nodist_pkgconfig_DATA = @PACKAGE_NAME@.pc nodist_pkgconfig_DATA = @PACKAGE_NAME@.pc
......
...@@ -18,7 +18,7 @@ static t_veclen veclen_ = NULL; ...@@ -18,7 +18,7 @@ static t_veclen veclen_ = NULL;
static t_max_nvec max_nvec_ = NULL; static t_max_nvec max_nvec_ = NULL;
static t_architecture architecture_ = NULL; static t_architecture architecture_ = NULL;
#if defined(__GNUC__) && defined (__x86_64__) && (__GNUC__>=6) #ifdef MULTIARCH
#define DECL(arch) \ #define DECL(arch) \
static int XCONCATX2(have,arch)(void) \ static int XCONCATX2(have,arch)(void) \
...@@ -59,7 +59,7 @@ DECL(avx) ...@@ -59,7 +59,7 @@ DECL(avx)
static void assign_funcs(void) static void assign_funcs(void)
{ {
#if defined(__GNUC__) && defined (__x86_64__) && (__GNUC__>=6) #ifdef MULTIARCH
#define DECL2(arch) \ #define DECL2(arch) \
if (XCONCATX2(have,arch)()) \ if (XCONCATX2(have,arch)()) \
{ \ { \
......
#if (!defined(__AVX__)) && defined(__GNUC__) && defined (__x86_64__) && (__GNUC__>=6) #ifdef MULTIARCH
#define XCONCATX(a,b) a##_##b #define XCONCATX(a,b) a##_##b
#define XCONCATX2(a,b) XCONCATX(a,b) #define XCONCATX2(a,b) XCONCATX(a,b)
#define XARCH(a) XCONCATX2(a,ARCH) #define XARCH(a) XCONCATX2(a,ARCH)
#define ARCH avx #define ARCH avx
#pragma GCC target("avx")
#include "sharp_core_inc.c" #include "sharp_core_inc.c"
#endif #endif
#if (!defined(__AVX2__)) && defined(__GNUC__) && defined (__x86_64__) && (__GNUC__>=6) #ifdef MULTIARCH
#define XCONCATX(a,b) a##_##b #define XCONCATX(a,b) a##_##b
#define XCONCATX2(a,b) XCONCATX(a,b) #define XCONCATX2(a,b) XCONCATX(a,b)
#define XARCH(a) XCONCATX2(a,ARCH) #define XARCH(a) XCONCATX2(a,ARCH)
#define ARCH avx2 #define ARCH avx2
#pragma GCC target("avx2")
#include "sharp_core_inc.c" #include "sharp_core_inc.c"
#endif #endif
#if (!defined(__AVX512F__)) && defined(__GNUC__) && defined (__x86_64__) && (__GNUC__>=6) #ifdef MULTIARCH
#define XCONCATX(a,b) a##_##b #define XCONCATX(a,b) a##_##b
#define XCONCATX2(a,b) XCONCATX(a,b) #define XCONCATX2(a,b) XCONCATX(a,b)
#define XARCH(a) XCONCATX2(a,ARCH) #define XARCH(a) XCONCATX2(a,ARCH)
#define ARCH avx512f #define ARCH avx512f
#pragma GCC target("avx512f")
#include "sharp_core_inc.c" #include "sharp_core_inc.c"
#endif #endif
#if (!defined(__FMA__)) && defined(__GNUC__) && defined (__x86_64__) && (__GNUC__>=6) #ifdef MULTIARCH
#define XCONCATX(a,b) a##_##b #define XCONCATX(a,b) a##_##b
#define XCONCATX2(a,b) XCONCATX(a,b) #define XCONCATX2(a,b) XCONCATX(a,b)
#define XARCH(a) XCONCATX2(a,ARCH) #define XARCH(a) XCONCATX2(a,ARCH)
#define ARCH fma #define ARCH fma
#pragma GCC target("fma")
#include "sharp_core_inc.c" #include "sharp_core_inc.c"
#endif #endif
#if (!defined(__FMA4__)) && defined(__GNUC__) && defined (__x86_64__) && (__GNUC__>=6) #ifdef MULTIARCH
#define XCONCATX(a,b) a##_##b #define XCONCATX(a,b) a##_##b
#define XCONCATX2(a,b) XCONCATX(a,b) #define XCONCATX2(a,b) XCONCATX(a,b)
#define XARCH(a) XCONCATX2(a,ARCH) #define XARCH(a) XCONCATX2(a,ARCH)
#define ARCH fma4 #define ARCH fma4
#pragma GCC target("fma4")
#include "sharp_core_inc.c" #include "sharp_core_inc.c"
#endif #endif
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment