1
0
mirror of https://github.com/TREX-CoE/qmckl.git synced 2024-12-22 20:36:01 +01:00

Added IVDEP and ALIGNED in configure.ac

This commit is contained in:
Anthony Scemama 2023-09-14 09:41:15 +02:00
parent 7bec8b7984
commit fd2addb370
2 changed files with 121 additions and 54 deletions

View File

@ -246,6 +246,94 @@ int simd=1;
AC_MSG_RESULT([$SIMD_LENGTH]) AC_MSG_RESULT([$SIMD_LENGTH])
AC_DEFINE_UNQUOTED([SIMD_LENGTH], [$SIMD_LENGTH], [Length of SIMD vectors]) AC_DEFINE_UNQUOTED([SIMD_LENGTH], [$SIMD_LENGTH], [Length of SIMD vectors])
# Checking IVDEP
ivdep=""
AC_MSG_CHECKING([for ivdep pragma])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#include <stdio.h>
]], [[
int main() {
#pragma ivdep
for (int i = 0; i < 10; ++i) {
printf("Testing: %d\n", i);
}
return 0;
}
]])],
[ivdep='_Pragma("ivdep")'], [
])
AS_IF([test "x$ivdep" = "x"], [
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#include <stdio.h>
]], [[
int main() {
#pragma clang loop vectorize(enable)
for (int i = 0; i < 10; ++i) {
printf("Testing: %d\n", i);
}
return 0;
}
]])],
[ivdep='_Pragma("clang loop vectorize(enable)")'], [
])
])
AS_IF([test "x$ivdep" = "x"], [
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#include <stdio.h>
]], [[
int main() {
#pragma GCC ivdep
for (int i = 0; i < 10; ++i) {
printf("Testing: %d\n", i);
}
return 0;
}
]])],
[ivdep='_Pragma("GCC ivdep")'], [
])
])
AC_DEFINE_UNQUOTED([IVDEP], [$ivdep], [IVDEP pragma])
AS_IF([test "x$ivdep" = "x"], [
ivdep="no"
])
AC_MSG_RESULT([$ivdep])
# Checking ALIGNED
AC_CHECK_FUNCS([aligned_alloc], [have_aligned_alloc=yes], [have_aligned_alloc=no])
AS_IF([test "x$have_aligned_alloc" = "xyes"], [
AC_DEFINE([HAVE_ALIGNED_ALLOC], [1], [Define to 1 if you have the aligned_alloc function.])
])
aligned=""
AC_MSG_CHECKING([for vector aligned pragma])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
]], [[
int main() {
double __attribute__((aligned(8))) a[10] ;
#pragma vector aligned
for (int i = 0; i < 10; ++i) {
a[i] = (double) i;
}
return 0;
}
]])],
[aligned='_Pragma("vector aligned")'], [
])
AS_IF([test "x$have_aligned_alloc" = "xno"], [
aligned=""
])
AC_DEFINE_UNQUOTED([ALIGNED], [$aligned], [VECTOR ALIGNED pragma])
AS_IF([test "x$aligned" = "x"], [
aligned="no"
])
AC_MSG_RESULT([$aligned])
# QMCKLDGEMM # QMCKLDGEMM

View File

@ -345,22 +345,6 @@ Common includes and macros used by all the Sherman-Morrison-Woodbury kernels.
#include "assert.h" #include "assert.h"
#include "stdio.h" #include "stdio.h"
// Order important because
// __GNUC__ also set in ICC, ICX and CLANG
// __clang__ also set in ICX
#if defined(__INTEL_COMPILER)
#define IVDEP _Pragma("ivdep")
#define ALIGNED _Pragma("vector aligned")
#elif defined(__INTEL_LLVM_COMPILER)
#define IVDEP _Pragma("ivdep")
#define ALIGNED _Pragma("vector aligned")
#elif defined(__clang__)
#define IVDEP _Pragma("clang loop vectorize(enable)")
#define ALIGNED
#elif defined(__GNUC__)
#define IVDEP _Pragma("GCC ivdep")
#define ALIGNED
#endif
#+end_src #+end_src
~qmckl_sm_naive_hpc~ is a high performance variation of ~qmckl_sm_naive_hpc~ is a high performance variation of
@ -1242,7 +1226,6 @@ case {Dim}: {
later_index, later_index,
later, later,
determinant); determinant);
break;
}""" }"""
result = [] result = []
for Dim in <<kernel_generator_range>>: for Dim in <<kernel_generator_range>>:
@ -1723,8 +1706,6 @@ qmckl_exit_code qmckl_sm_splitting(
double* Slater_inv, double* Slater_inv,
double* determinant) { double* determinant) {
printf("Entering 'qmckl_sm_splitting'\n");
if (qmckl_context_check(context) == QMCKL_NULL_CONTEXT) { if (qmckl_context_check(context) == QMCKL_NULL_CONTEXT) {
return qmckl_failwith( return qmckl_failwith(
context, context,
@ -1756,8 +1737,6 @@ qmckl_exit_code qmckl_sm_splitting(
determinant); determinant);
#endif #endif
printf("Leaving 'qmckl_sm_splitting'\n");
return QMCKL_SUCCESS; return QMCKL_SUCCESS;
} }
#+end_src #+end_src