ax_elpa_specific_kernels.m4 5.42 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18

dnl macro for testing whether the user wanted to compile only with one
dnl specific real kernel

dnl usage: DEFINE_OPTION([real-generic-kernel-only],[generic-kernel],[with_real_generic_kernel],[install_real_generic])

AC_DEFUN([DEFINE_OPTION_SPECIFIC_REAL_KERNEL],[
  AC_ARG_WITH([$1],
               AS_HELP_STRING([--with-$1],
                              [only compile $2 for real case]),
              [with_option=yes],[with_option=no])

   if test x"${with_option}" = x"yes" ; then
    if test x"${use_specific_real_kernel}" = x"no" ; then

    dnl make sure that all the other kernels are unset
    install_real_generic=no
    install_real_generic_simple=no
19
    install_real_sse_assembly=no
20 21
    install_real_bgp=no
    install_real_bgq=no
22 23 24
    install_real_sse_block2=no
    install_real_sse_block4=no
    install_real_sse_block6=no
25 26 27
    install_real_avx_block2=no
    install_real_avx_block4=no
    install_real_avx_block6=no
28
    want_sse=no
Andreas Marek's avatar
Andreas Marek committed
29
    want_avx=no
30 31
    want_avx2=no
#    install_gpu=no
32 33 34 35 36 37

    use_specific_real_kernel=yes
    dnl now set the specific kernel
    $3=yes

    dnl in case of SSE or AVX make sure that we can compile the choosen kernel
38 39
    if test x"${install_real_sse_assembly}" = x"yes" ; then
     if test x"${can_compile_sse_assembly}" = x"no" ; then
40 41 42 43
       AC_MSG_ERROR([$2 kernel was set, but cannot be compiled!])
     fi
    fi

44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67
    if test x"${install_real_sse_block2}" = x"yes" ; then
     if test x"${can_compile_sse_intrinsics}" = x"no" ; then
       AC_MSG_ERROR([$2 kernel was set, but cannot be compiled!])
     else
       want_sse=yes
     fi
    fi

    if test x"${install_real_sse_block4}" = x"yes" ; then
     if test x"${can_compile_sse_intrinsics}" = x"no" ; then
       AC_MSG_ERROR([$2 kernel was set, but cannot be compiled!])
     else
       want_sse=yes
     fi
    fi

    if test x"${install_real_sse_block6}" = x"yes" ; then
     if test x"${can_compile_sse_inrinsics}" = x"no" ; then
       AC_MSG_ERROR([$2 kernel was set, but cannot be compiled!])
     else
       want_sse=yes
     fi
    fi

68 69 70
    if test x"${install_real_avx_block2}" = x"yes" ; then
     if test x"${can_compile_avx}" = x"no" ; then
       AC_MSG_ERROR([$2 kernel was set, but cannot be compiled!])
Andreas Marek's avatar
Andreas Marek committed
71 72
     else
       want_avx=yes
73 74 75 76 77 78
     fi
    fi

    if test x"${install_real_avx_block4}" = x"yes" ; then
     if test x"${can_compile_avx}" = x"no" ; then
       AC_MSG_ERROR([$2 kernel was set, but cannot be compiled!])
Andreas Marek's avatar
Andreas Marek committed
79 80
     else
       want_avx=yes
81 82 83 84 85 86
     fi
    fi

    if test x"${install_real_avx_block6}" = x"yes" ; then
     if test x"${can_compile_avx}" = x"no" ; then
       AC_MSG_ERROR([$2 kernel was set, but cannot be compiled!])
Andreas Marek's avatar
Andreas Marek committed
87 88
     else
       want_avx=yes
89 90 91 92
     fi
    fi

    AC_MSG_NOTICE([$1 will be the only compiled kernel for real case])
93 94 95 96 97
#    if test x"${want_gpu}" = x"yes" ; then
#      AC_MSG_WARN([At the moment this disables GPU support!])
#      AC_MSG_WARN([IF GPU support is wanted do NOT specify a specific real kernel])
#    fi
#   else
98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115
    AC_MSG_FAILURE([$1 failed; A specific kernel for real case has already been defined before!])
   fi
  fi
])


AC_DEFUN([DEFINE_OPTION_SPECIFIC_COMPLEX_KERNEL],[
  AC_ARG_WITH([$1],
                 AS_HELP_STRING([--with-$1],
                                [only compile $2 for complex case]),
              [with_option=yes],[with_option=no])

   if test x"${with_option}" = x"yes" ; then
    if test x"${use_specific_complex_kernel}" = x"no" ; then

    dnl make sure that all the other kernels are unset
    install_complex_generic=no
    install_complex_generic_simple=no
116
    install_complex_sse_assembly=no
117 118
    install_complex_bgp=no
    install_complex_bgq=no
119 120
    install_complex_sse_block1=no
    install_complex_sse_block2=no
121 122
    install_complex_avx_block1=no
    install_complex_avx_block2=no
123
    want_sse=no
Andreas Marek's avatar
Andreas Marek committed
124
    want_avx=no
125
    want_avx2=no
126

127
#    install_gpu=no
128 129 130 131 132
    use_specific_complex_kernel=yes
    dnl now set the specific kernel
    $3=yes

    dnl in case of SSE or AVX make sure that we can compile the choosen kernel
133 134
    if test x"${install_complex_sse_assembly}" = x"yes" ; then
     if test x"${can_compile_sse_assembly}" = x"no" ; then
135 136 137 138
       AC_MSG_ERROR([$2 kernel was set, but cannot be compiled!])
     fi
    fi

139 140 141 142 143 144 145 146 147 148 149 150 151 152 153
    if test x"${install_complex_sse_block1}" = x"yes" ; then
     if test x"${can_compile_sse_intrinsics}" = x"no" ; then
       AC_MSG_ERROR([$2 kernel was set, but cannot be compiled!])
     else
       want_sse=yes
     fi
    fi

    if test x"${install_complex_sse_block2}" = x"yes" ; then
     if test x"${can_compile_sse_intrinsics}" = x"no" ; then
       AC_MSG_ERROR([$2 kernel was set, but cannot be compiled!])
     else
       want_sse=yes
     fi
    fi
154 155 156
    if test x"${install_complex_avx_block1}" = x"yes" ; then
     if test x"${can_compile_avx}" = x"no" ; then
       AC_MSG_ERROR([$2 kernel was set, but cannot be compiled!])
Andreas Marek's avatar
Andreas Marek committed
157 158
     else
       want_avx=yes
159 160 161 162 163 164
     fi
    fi

    if test x"${install_complex_avx_block2}" = x"yes" ; then
     if test x"${can_compile_avx}" = x"no" ; then
       AC_MSG_ERROR([$2 kernel was set, but cannot be compiled!])
Andreas Marek's avatar
Andreas Marek committed
165 166
     else
       want_avx=yes
167 168 169 170
     fi
    fi

    AC_MSG_NOTICE([$1 will be the only compiled kernel for real case])
171 172 173 174
#    if test x"${want_gpu}" = x"yes" ; then
#      AC_MSG_WARN([At the moment this disables GPU support!])
#      AC_MSG_WARN([IF GPU support is wanted do NOT specify a specific complex kernel])
#    fi
175 176 177 178 179 180
   else
    AC_MSG_FAILURE([$1 failed; A specific kernel for real case has already been defined before!])
   fi
  fi
])