configure.ac 42 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261
  1. # StarPU --- Runtime system for heterogeneous multicore architectures.
  2. #
  3. # Copyright (C) 2009, 2010, 2011 Université de Bordeaux 1
  4. # Copyright (C) 2010, 2011 Centre National de la Recherche Scientifique
  5. #
  6. # StarPU is free software; you can redistribute it and/or modify
  7. # it under the terms of the GNU Lesser General Public License as published by
  8. # the Free Software Foundation; either version 2.1 of the License, or (at
  9. # your option) any later version.
  10. #
  11. # StarPU is distributed in the hope that it will be useful, but
  12. # WITHOUT ANY WARRANTY; without even the implied warranty of
  13. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  14. #
  15. # See the GNU Lesser General Public License in COPYING.LGPL for more details.
  16. AC_INIT([StarPU],0.4, [starpu-bugs@lists.gforge.inria.fr], starpu)
  17. AC_CONFIG_SRCDIR(include/starpu.h)
  18. AC_CONFIG_AUX_DIR([build-aux])
  19. AC_CANONICAL_SYSTEM
  20. AM_INIT_AUTOMAKE([-Wall -Werror foreign])
  21. m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
  22. AC_PREREQ(2.60)
  23. AC_PROG_CC
  24. AC_PROG_CPP
  25. AC_PROG_SED
  26. AC_PROG_LN_S
  27. AC_PROG_F77
  28. AC_LIBTOOL_WIN32_DLL
  29. AC_PROG_LIBTOOL([win32-dll])
  30. AC_PROG_INSTALL
  31. AC_PROG_MKDIR_P
  32. AC_PROG_LN_S
  33. AC_HEADER_STDC
  34. AC_C_RESTRICT
  35. AC_PATH_PROGS([STARPU_MS_LIB], [lib])
  36. AC_ARG_VAR([STARPU_MS_LIB], [Path to Microsoft's Visual Studio `lib' tool])
  37. AM_CONDITIONAL([STARPU_HAVE_MS_LIB], [test "x$STARPU_MS_LIB" != "x"])
  38. case "$target" in
  39. *-*-mingw*|*-*-cygwin*)
  40. starpu_windows=yes
  41. libext=a
  42. AC_DEFINE(STARPU_HAVE_WINDOWS, [], [Define this on windows.])
  43. ;;
  44. esac
  45. AM_CONDITIONAL([STARPU_HAVE_WINDOWS], [test "x$starpu_windows" = "xyes"])
  46. # on Darwin, GCC targets i386 by default, so we don't have atomic ops
  47. AC_CHECK_SIZEOF([void *])
  48. if test x$SIZEOF_VOID_P = x4; then
  49. case "$target" in
  50. i386-*darwin*) CFLAGS+=" -march=i686 " ;;
  51. esac
  52. fi
  53. # This will be useful for program which use CUDA (and .cubin files) which need
  54. # some path to the CUDA code at runtime.
  55. AC_DEFINE_UNQUOTED(STARPU_BUILD_DIR, "$PWD", [location of StarPU build directory])
  56. AC_SUBST(STARPU_BUILD_DIR, $PWD)
  57. case "${srcdir}" in
  58. /*) AC_DEFINE_UNQUOTED(STARPU_SRC_DIR, "$(eval echo ${srcdir})", [location of StarPU sources])
  59. AC_SUBST(STARPU_SRC_DIR, "$(eval echo ${srcdir})") ;;
  60. *) AC_DEFINE_UNQUOTED(STARPU_SRC_DIR, "$(eval echo $PWD/${srcdir})", [location of StarPU sources])
  61. AC_SUBST(STARPU_SRC_DIR, "$(eval echo $PWD/${srcdir})") ;;
  62. esac
  63. AC_CHECK_LIB([pthread], [pthread_create])
  64. AC_COMPILE_IFELSE(
  65. AC_LANG_PROGRAM([[
  66. #include <pthread.h>
  67. ]], [[ pthread_t t; pthread_create(&t, NULL, NULL, NULL); ]]),,
  68. AC_MSG_ERROR([pthread_create unavailable]))
  69. AC_SEARCH_LIBS([sqrt],[m],,AC_MSG_ERROR([math library unavailable]))
  70. AC_HAVE_LIBRARY([wsock32])
  71. AC_CHECK_FUNCS([sysconf])
  72. AC_CHECK_FUNC([pthread_spin_lock], have_pthread_spin_lock=yes, have_pthread_spin_lock=no)
  73. if test x$have_pthread_spin_lock = xyes; then
  74. AC_DEFINE(HAVE_PTHREAD_SPIN_LOCK,[],[pthread_spin_lock is available])
  75. fi
  76. # yes, that's non portable, but it's still better than sched_setaffinity
  77. AC_CHECK_FUNCS(pthread_setaffinity_np)
  78. # There is no posix_memalign on Mac OS X, only memalign
  79. AC_CHECK_FUNCS([posix_memalign], [AC_DEFINE([STARPU_HAVE_POSIX_MEMALIGN], [1], [Define to 1 if you have the `posix_memalign' function.])])
  80. AC_CHECK_FUNCS([memalign], [AC_DEFINE([STARPU_HAVE_MEMALIGN], [1], [Define to 1 if you have the `memalign' function.])])
  81. # Some systems don't have drand48
  82. AC_CHECK_FUNC([drand48], have_drand48=yes, have_drand48=no)
  83. # Maybe the user still does not want to use the provided drand48
  84. AC_ARG_ENABLE(default-drand48, [AS_HELP_STRING([--disable-default-drand48],
  85. [Do not use the default version of drand48])],
  86. enable_default_drand48=$enableval, enable_default_drand48=yes)
  87. if test x$have_drand48 = xyes -a x$enable_default_drand48 = xyes ; then
  88. AC_DEFINE([starpu_srand48(seed)],[srand48(seed)],[srand48 equivalent function])
  89. AC_DEFINE([starpu_drand48()],[drand48()],[drand48 equivalent function])
  90. AC_DEFINE([starpu_erand48(xsubi)],[erand48(xsubi)],[erand48 equivalent function])
  91. else
  92. AC_DEFINE([starpu_srand48(seed)],[srand(seed)],[srand48 equivalent function])
  93. AC_DEFINE([starpu_drand48()],[((double)(rand()) / RAND_MAX)],[drand48 equivalent function])
  94. AC_DEFINE([starpu_erand48(xsubi)],[starpu_drand48()],[erand48 equivalent function])
  95. fi
  96. AC_CHECK_HEADERS([malloc.h], [AC_DEFINE([STARPU_HAVE_MALLOC_H], [1], [Define to 1 if you have the <malloc.h> header file.])])
  97. # This defines HAVE_SYNC_VAL_COMPARE_AND_SWAP
  98. STARPU_CHECK_SYNC_VAL_COMPARE_AND_SWAP
  99. # This defines HAVE_SYNC_BOOL_COMPARE_AND_SWAP
  100. STARPU_CHECK_SYNC_BOOL_COMPARE_AND_SWAP
  101. # This defines HAVE_SYNC_FETCH_AND_ADD
  102. STARPU_CHECK_SYNC_FETCH_AND_ADD
  103. # This defines HAVE_SYNC_FETCH_AND_OR
  104. STARPU_CHECK_SYNC_FETCH_AND_OR
  105. # This defines HAVE_SYNC_LOCK_TEST_AND_SET
  106. STARPU_CHECK_SYNC_LOCK_TEST_AND_SET
  107. # This defines HAVE_SYNC_SYNCHRONIZE
  108. STARPU_CHECK_SYNC_SYNCHRONIZE
  109. CPPFLAGS="${CPPFLAGS} -D_GNU_SOURCE "
  110. AC_SEARCH_LIBS([set_mempolicy],[numa],[enable_libnuma=yes],[enable_libnuma=no])
  111. AC_MSG_CHECKING(whether libnuma is available)
  112. AC_MSG_RESULT($enable_libnuma)
  113. if test x$enable_libnuma = xyes; then
  114. AC_DEFINE(STARPU_HAVE_LIBNUMA,[],[libnuma is available])
  115. fi
  116. ###############################################################################
  117. # #
  118. # CPUs settings #
  119. # #
  120. ###############################################################################
  121. AC_MSG_CHECKING(maximum number of CPUs)
  122. AC_ARG_ENABLE(nmaxcpus, [AS_HELP_STRING([--enable-nmaxcpus=<number>],
  123. [maximum number of CPUs])],
  124. nmaxcpus=$enableval, nmaxcpus=16)
  125. AC_MSG_RESULT($nmaxcpus)
  126. # TODO: rename to STARPU_MAXCPUS for coherency with CUDA/OpenCL?
  127. AC_DEFINE_UNQUOTED(STARPU_NMAXCPUS, [$nmaxcpus], [Maximum number of CPUs supported])
  128. AC_MSG_CHECKING(whether CPUs should be used)
  129. AC_ARG_ENABLE(cpu, [AS_HELP_STRING([--disable-cpu],
  130. [do not use the CPU(s)])],
  131. enable_cpu=$enableval, enable_cpu=yes)
  132. AC_MSG_RESULT($enable_cpu)
  133. AC_SUBST(STARPU_USE_CPU, $enable_cpu)
  134. AM_CONDITIONAL(STARPU_USE_CPU, test x$enable_cpu = xyes)
  135. if test x$enable_cpu = xyes; then
  136. AC_DEFINE(STARPU_USE_CPU, [1], [CPU driver is activated])
  137. fi
  138. # How many parallel worker can we support ?
  139. nmaxcombinedworkers=`expr 2 \* $nmaxcpus`
  140. AC_DEFINE_UNQUOTED(STARPU_NMAX_COMBINEDWORKERS,
  141. [$nmaxcombinedworkers], [Maximum number of worker combinations])
  142. ###############################################################################
  143. # #
  144. # CUDA settings #
  145. # #
  146. ###############################################################################
  147. AC_MSG_CHECKING(maximum number of CUDA devices)
  148. AC_ARG_ENABLE(maxcudadev, [AS_HELP_STRING([--enable-maxcudadev=<number>],
  149. [maximum number of CUDA devices])],
  150. nmaxcudadev=$enableval, nmaxcudadev=4)
  151. AC_MSG_RESULT($nmaxcudadev)
  152. AC_DEFINE_UNQUOTED(STARPU_MAXCUDADEVS, [$nmaxcudadev],
  153. [maximum number of CUDA devices])
  154. AC_ARG_ENABLE(cuda, [AS_HELP_STRING([--disable-cuda],
  155. [do not use CUDA device(s)])],, [enable_cuda=maybe])
  156. #AC_MSG_CHECKING(whether CUDA is available)
  157. AC_ARG_WITH(cuda-dir,
  158. [AS_HELP_STRING([--with-cuda-dir=<path>],
  159. [specify CUDA installation directory])],
  160. [
  161. cuda_dir="$withval"
  162. # in case this was not explicit yet
  163. enable_cuda=yes
  164. ], cuda_dir=no)
  165. AC_ARG_WITH(cuda-include-dir,
  166. [AS_HELP_STRING([--with-cuda-include-dir=<path>],
  167. [specify where CUDA headers are installed])],
  168. [
  169. cuda_include_dir="$withval"
  170. # in case this was not explicit yet
  171. enable_cuda=yes
  172. ], [cuda_include_dir=no])
  173. AC_ARG_WITH(cuda-lib-dir,
  174. [AS_HELP_STRING([--with-cuda-lib-dir=<path>],
  175. [specify where CUDA libraries are installed])],
  176. [
  177. cuda_lib_dir="$withval"
  178. # in case this was not explicit yet
  179. enable_cuda=yes
  180. ], [cuda_lib_dir=no])
  181. AC_DEFUN([STARPU_CHECK_CUDA],
  182. [
  183. __cuda_dir=$1
  184. if test "$__cuda_dir" != "no" ; then
  185. AC_MSG_CHECKING(whether CUDA is available in $__cuda_dir)
  186. else
  187. AC_MSG_CHECKING(whether CUDA is available)
  188. fi
  189. AC_MSG_RESULT()
  190. SAVED_LDFLAGS="${LDFLAGS}"
  191. if test "$__cuda_dir" != "no" ; then
  192. STARPU_CUDA_LDFLAGS="-L${__cuda_dir}/lib"
  193. LDFLAGS="${SAVED_LDFLAGS} -L${__cuda_dir}/lib"
  194. fi
  195. AC_HAVE_LIBRARY([cuda],[have_valid_cuda=yes],[have_valid_cuda=no])
  196. unset ac_cv_lib_cuda_main
  197. if test "$have_valid_cuda" = "no" ; then
  198. if test "$__cuda_dir" != "no" ; then
  199. STARPU_CUDA_LDFLAGS="-L${__cuda_dir}/lib64"
  200. LDFLAGS="${SAVED_LDFLAGS} -L${__cuda_dir}/lib64"
  201. AC_HAVE_LIBRARY([cuda],[have_valid_cuda=yes],[have_valid_cuda=no])
  202. unset ac_cv_lib_cuda_main
  203. fi
  204. fi
  205. if test "$have_valid_cuda" = "no" ; then
  206. LDFLAGS="${SAVED_LDFLAGS}"
  207. fi
  208. ])
  209. AC_DEFUN([STARPU_CHECK_CUDA_RUNTIME],
  210. [
  211. __cuda_dir=$1
  212. __cuda_include_dir=$2
  213. __cuda_lib_dir=$3
  214. if test "$__cuda_dir" != "no" ; then
  215. AC_MSG_CHECKING(whether CUDA RT is available in $__cuda_dir)
  216. else
  217. AC_MSG_CHECKING(whether CUDA RT is available)
  218. fi
  219. AC_MSG_RESULT()
  220. SAVED_STARPU_CUDA_LDFLAGS=${STARPU_CUDA_LDFLAGS}
  221. if test "$__cuda_include_dir" = "no" -a "$__cuda_dir" != "no" ; then
  222. __cuda_include_dir="$__cuda_dir/include"
  223. fi
  224. if test "$__cuda_lib_dir" = "no" -a "$__cuda_dir" != "no" ; then
  225. __cuda_lib_dir="$__cuda_dir/lib"
  226. STARPU_CUDA_LDFLAGS="${SAVED_STARPU_CUDA_LDFLAGS} -L$__cuda_lib_dir"
  227. fi
  228. SAVED_CPPFLAGS="$CPPFLAGS"
  229. SAVED_LDFLAGS="${LDFLAGS}"
  230. if test "$__cuda_include_dir" != "no" ; then
  231. CPPFLAGS="${CPPFLAGS} -I$__cuda_include_dir"
  232. fi
  233. AC_CHECK_HEADER([cuda.h],[have_valid_cuda=yes],[have_valid_cuda=no])
  234. unset ac_cv_header_cuda_h
  235. if test "$have_valid_cuda" = "yes" ; then
  236. if test "$__cuda_lib_dir" != "no"; then
  237. LDFLAGS="${SAVED_LDFLAGS} -L$__cuda_lib_dir"
  238. fi
  239. AC_HAVE_LIBRARY([cudart],[have_valid_cuda=yes],[have_valid_cuda=no])
  240. unset ac_cv_lib_cudart_main
  241. if test "$have_valid_cuda" = "no" ; then
  242. if test "$3" = "no" -a "$__cuda_dir" != "no" ; then
  243. __cuda_lib_dir="$__cuda_dir/lib64"
  244. STARPU_CUDA_LDFLAGS="${SAVED_STARPU_CUDA_LDFLAGS} -L$__cuda_lib_dir"
  245. LDFLAGS="${SAVED_LDFLAGS} -L$__cuda_lib_dir"
  246. AC_HAVE_LIBRARY([cudart],[have_valid_cuda=yes],[have_valid_cuda=no])
  247. unset ac_cv_lib_cudart_main
  248. fi
  249. fi
  250. fi
  251. if test "$have_valid_cuda" = "yes" ; then
  252. STARPU_CUDA_LDFLAGS="$STARPU_CUDA_LDFLAGS -lcudart"
  253. # we also check that CUBLAS is available
  254. AC_HAVE_LIBRARY([cublas],[have_valid_cuda=yes],[have_valid_cuda=no])
  255. unset ac_cv_lib_cublas_main
  256. if test "$have_valid_cuda" = "yes" ; then
  257. STARPU_CUDA_LDFLAGS="$STARPU_CUDA_LDFLAGS -lcublas"
  258. fi
  259. fi
  260. CPPFLAGS="${SAVED_CPPFLAGS}"
  261. LDFLAGS="${SAVED_LDFLAGS}"
  262. if test "$have_valid_cuda" = "yes" -a "$__cuda_include_dir" != "no"; then
  263. STARPU_CUDA_CPPFLAGS="-I$__cuda_include_dir"
  264. NVCCFLAGS="${NVCCFLAGS} -I$__cuda_include_dir"
  265. fi
  266. ])
  267. if test x$enable_cuda = xyes -o x$enable_cuda = xmaybe; then
  268. STARPU_CHECK_CUDA($cuda_dir)
  269. if test "$have_valid_cuda" = "no" ; then
  270. for f in "/usr/local/cuda" "/c/cuda" "/cygdrive/c/cuda" "/opt/cuda" ; do
  271. STARPU_CHECK_CUDA($f)
  272. if test "$have_valid_cuda" = "yes" ; then
  273. break
  274. fi
  275. done
  276. fi
  277. if test "$have_valid_cuda" = "yes" ; then
  278. STARPU_CHECK_CUDA_RUNTIME($cuda_dir, $cuda_include_dir, $cuda_lib_dir)
  279. if test "$have_valid_cuda" = "no" ; then
  280. for f in "/usr/local/cuda" "/c/cuda" "/cygdrive/c/cuda" "/opt/cuda" ; do
  281. STARPU_CHECK_CUDA_RUNTIME($f, "no", "no")
  282. if test "$have_valid_cuda" = "yes" ; then
  283. break
  284. fi
  285. done
  286. fi
  287. fi
  288. # in case CUDA was explicitely required, but is not available, this is an error
  289. if test x$enable_cuda = xyes -a x$have_valid_cuda = no; then
  290. AC_MSG_ERROR([cannot find CUDA])
  291. fi
  292. # now we enable CUDA if and only if a proper setup is available
  293. enable_cuda=$have_valid_cuda
  294. fi
  295. AC_MSG_CHECKING(whether CUDA should be used)
  296. AC_MSG_RESULT($enable_cuda)
  297. AC_SUBST(STARPU_USE_CUDA, $enable_cuda)
  298. AM_CONDITIONAL(STARPU_USE_CUDA, test x$enable_cuda = xyes)
  299. if test x$enable_cuda = xyes; then
  300. AC_DEFINE(STARPU_USE_CUDA, [1], [CUDA support is activated])
  301. # On Darwin, the libstdc++ dependency is not automatically added by nvcc
  302. # case "$target" in
  303. # *-*darwin*) AC_HAVE_LIBRARY([stdc++], []) ;;
  304. # #*-*darwin*) AC_HAVE_LIBRARY([stdc++], [STARPU_CUDA_LDFLAGS="$STARPU_CUDA_LDFLAGS -lstdc++"]) ;;
  305. # esac
  306. STARPU_CUDA_LDFLAGS="$STARPU_CUDA_LDFLAGS -lcuda -lcufft"
  307. if test "$F77" = "gfortran" ; then
  308. STARPU_CUDA_LDFLAGS="$STARPU_CUDA_LDFLAGS -lgfortran"
  309. fi
  310. #in case this is a 64bit setup, we tell nvcc to use a -m64 flag
  311. AC_CHECK_SIZEOF([void *])
  312. if test x$SIZEOF_VOID_P = x8; then
  313. NVCCFLAGS="${NVCCFLAGS} -m64"
  314. AC_SUBST(NVCCFLAGS)
  315. fi
  316. AC_PATH_PROG([NVCC], [nvcc], [nvcc], [$cuda_dir/bin:$PATH:/usr/local/bin:/usr/bin:/bin], [AC_MSG_WARN(Cannot find nvcc.)])
  317. fi
  318. enable_magma=no
  319. if test x$enable_cuda = xyes; then
  320. # Should we use the MAGMA library (instead or in addition to CUBLAS)
  321. magma_dir=/usr/local # default
  322. enable_magma=maybe
  323. AC_ARG_WITH(magma, [AS_HELP_STRING([--with-magma=<path>],
  324. [specify that MAGMA should be used and its installation directory])],
  325. [
  326. if test x$withval = xyes; then
  327. # No path was specified but MAGMA is explicitely enabled
  328. enable_magma=yes
  329. else
  330. if test x$withval = xno; then
  331. # MAGMA is explicitely disabled
  332. enable_magma=no
  333. else
  334. # MAGMA is enabled and the PATH is given in $withval
  335. enable_magma=yes
  336. magma_dir="$withval"
  337. fi
  338. fi
  339. ], [])
  340. # Do we have a valid MAGMA setup ?
  341. if test x$enable_magma = xyes -o x$enable_magma = xmaybe; then
  342. SAVED_LDFLAGS="${LDFLAGS}"
  343. SAVED_CPPFLAGS="${CPPFLAGS}"
  344. if test -d "$magma_dir/lib/"; then
  345. LDFLAGS="${SAVED_LDFLAGS} -L$magma_dir/lib/ "
  346. have_valid_magma=yes
  347. AC_CHECK_LIB(magmablas, main,,[have_valid_magma=no])
  348. AC_CHECK_LIB(magma, magmablas_sgemm,,[have_valid_magma=no])
  349. fi
  350. if test -d "$magma_dir/include/"; then
  351. CPPFLAGS="${SAVED_CPPFLAGS} -I$magma_dir/include/ "
  352. AC_CHECK_HEADER([magmablas.h],,[have_valid_magma=no])
  353. #AC_CHECK_HEADER([magma.h],,[have_valid_magma=no])
  354. fi
  355. if test x$have_valid_magma = xno; then
  356. # If MAGMA was explicitely required, this is an error
  357. if test x$enable_magma = xyes; then
  358. AC_MSG_ERROR([cannot find MAGMA])
  359. fi
  360. # Restore old flags and don't use MAGMA
  361. LDFLAGS="${SAVED_LDFLAGS}"
  362. CPPFLAGS="${SAVED_CPPFLAGS}"
  363. enable_magma=no
  364. else
  365. enable_magma=yes
  366. fi
  367. else
  368. have_valid_magma=no
  369. enable_magma=no
  370. fi
  371. fi
  372. AC_MSG_CHECKING(whether MAGMA should be used)
  373. AC_MSG_RESULT($enable_magma)
  374. if test x$enable_magma = xyes; then
  375. AC_DEFINE(STARPU_HAVE_MAGMA, [1], [use MAGMA library])
  376. fi
  377. # cufftDoubleComplex may not be available on an old CUDA setup
  378. AC_CHECK_TYPE(cufftDoubleComplex,
  379. [have_cufftdoublecomplex=yes],
  380. [have_cufftdoublecomplex=no], [#include <cufft.h>])
  381. AM_CONDITIONAL(STARPU_HAVE_CUFFTDOUBLECOMPLEX, test x$have_cufftdoublecomplex = xyes)
  382. if test x$have_cufftdoublecomplex = xyes; then
  383. AC_DEFINE(STARPU_HAVE_CUFFTDOUBLECOMPLEX, [1], [cufftDoubleComplex is available])
  384. fi
  385. # The CURAND library is only available since CUDA 3.2
  386. have_curand=$enable_cuda
  387. if test x$enable_cuda = xyes; then
  388. SAVED_LDFLAGS="${LDFLAGS}"
  389. LDFLAGS="${LDFLAGS} ${STARPU_CUDA_LDFLAGS}"
  390. AC_HAVE_LIBRARY([curand],[have_curand=yes],[have_curand=no])
  391. LDFLAGS="${SAVED_LDFLAGS}"
  392. fi
  393. AC_MSG_CHECKING(whether CURAND is available)
  394. AC_MSG_RESULT($have_curand)
  395. if test x$have_curand = xyes; then
  396. AC_DEFINE(STARPU_HAVE_CURAND,[1], [CURAND is available])
  397. STARPU_CUDA_LDFLAGS="$STARPU_CUDA_LDFLAGS -lcurand"
  398. fi
  399. if test x$enable_cuda = xyes; then
  400. STARPU_CUDA_LDFLAGS="$STARPU_CUDA_LDFLAGS -lstdc++"
  401. AC_SUBST(STARPU_CUDA_LDFLAGS)
  402. AC_SUBST(STARPU_CUDA_CPPFLAGS)
  403. fi
  404. ###############################################################################
  405. # #
  406. # OpenCL settings #
  407. # #
  408. ###############################################################################
  409. AC_MSG_CHECKING(maximum number of OpenCL devices)
  410. AC_ARG_ENABLE(maxopencldev, [AS_HELP_STRING([--enable-maxopencldev=<number>],
  411. [maximum number of OPENCL devices])],
  412. nmaxopencldev=$enableval, nmaxopencldev=8)
  413. AC_MSG_RESULT($nmaxopencldev)
  414. AC_DEFINE_UNQUOTED(STARPU_MAXOPENCLDEVS, [$nmaxopencldev],
  415. [maximum number of OPENCL devices])
  416. AC_ARG_ENABLE(opencl, [AS_HELP_STRING([--disable-opencl],
  417. [do not use OpenCL device(s)])],, [enable_opencl=maybe])
  418. AC_DEFUN([STARPU_CHECK_OPENCL],
  419. [
  420. __opencl_dir=$1
  421. __opencl_include_dir=$2
  422. __opencl_lib_dir=$3
  423. if test "$__opencl_dir" != "no" ; then
  424. AC_MSG_CHECKING(whether OpenCL is available in $__opencl_dir)
  425. else
  426. AC_MSG_CHECKING(whether OpenCL is available)
  427. fi
  428. AC_MSG_RESULT()
  429. if test "$__opencl_include_dir" = "no" -a "$__opencl_dir" != "no" ; then
  430. __opencl_include_dir="$__opencl_dir/include"
  431. fi
  432. if test "$__opencl_lib_dir" = "no" -a "$__opencl_dir" != "no" ; then
  433. __opencl_lib_dir="$__opencl_dir/lib"
  434. fi
  435. SAVED_CPPFLAGS="$CPPFLAGS"
  436. SAVED_LDFLAGS="${LDFLAGS}"
  437. if test "$__opencl_include_dir" != "no" ; then
  438. CPPFLAGS="${CPPFLAGS} -I$__opencl_include_dir"
  439. fi
  440. AC_CHECK_HEADER([CL/cl.h],[have_valid_opencl=yes],[have_valid_opencl=no])
  441. unset ac_cv_header_CL_cl_h
  442. if test "$have_valid_opencl" = "yes" ; then
  443. if test "$__opencl_lib_dir" != "no"; then
  444. LDFLAGS="${SAVED_LDFLAGS} -L$__opencl_lib_dir"
  445. fi
  446. AC_HAVE_LIBRARY([OpenCL],[have_valid_opencl=yes],[have_valid_opencl=no])
  447. unset ac_cv_lib_OpenCL_main
  448. if test "$have_valid_opencl" = "no" ; then
  449. if test "$3" = "no" -a "$__opencl_dir" != "no" ; then
  450. __opencl_lib_dir="$__opencl_dir/lib64"
  451. LDFLAGS="${SAVED_LDFLAGS} -L$__opencl_lib_dir"
  452. AC_HAVE_LIBRARY([OpenCL],[have_valid_opencl=yes],[have_valid_opencl=no])
  453. unset ac_cv_lib_OpenCL_main
  454. fi
  455. fi
  456. fi
  457. CPPFLAGS="${SAVED_CPPFLAGS}"
  458. LDFLAGS="${SAVED_LDFLAGS}"
  459. if test "$have_valid_opencl" = "yes" -a "$__opencl_include_dir" != "no"; then
  460. STARPU_OPENCL_CPPFLAGS="-I$__opencl_include_dir"
  461. fi
  462. if test "$have_valid_opencl" = "yes" ; then
  463. if test "$__opencl_lib_dir" != "no"; then
  464. STARPU_OPENCL_LDFLAGS="-L$__opencl_lib_dir"
  465. fi
  466. STARPU_OPENCL_LDFLAGS="${STARPU_OPENCL_LDFLAGS} -lOpenCL"
  467. fi
  468. ])
  469. #AC_MSG_CHECKING(whether OpenCL is available)
  470. AC_ARG_WITH(opencl-dir,
  471. [AS_HELP_STRING([--with-opencl-dir=<path>],
  472. [specify OpenCL installation directory])],
  473. [
  474. opencl_dir="$withval"
  475. # in case this was not explicit yet
  476. enable_opencl=yes
  477. ], opencl_dir=no)
  478. AC_ARG_WITH(opencl-include-dir,
  479. [AS_HELP_STRING([--with-opencl-include-dir=<path>],
  480. [specify where OpenCL headers are installed])],
  481. [
  482. opencl_include_dir="$withval"
  483. # in case this was not explicit yet
  484. enable_opencl=yes
  485. ], [opencl_include_dir=no])
  486. AC_ARG_WITH(opencl-lib-dir,
  487. [AS_HELP_STRING([--with-opencl-lib-dir=<path>],
  488. [specify where OpenCL libraries are installed])],
  489. [
  490. opencl_lib_dir="$withval"
  491. # in case this was not explicit yet
  492. enable_opencl=yes
  493. ], [opencl_lib_dir=no])
  494. if test x$enable_opencl = xyes -o x$enable_opencl = xmaybe; then
  495. STARPU_CHECK_OPENCL($opencl_dir, $opencl_include_dir, $opencl_lib_dir)
  496. if test "$have_valid_opencl" = "no" ; then
  497. for f in "/usr/local/cuda" "/c/cuda" "/cygdrive/c/cuda" "/opt/cuda" ; do
  498. STARPU_CHECK_OPENCL($f, "no", "no")
  499. if test "$have_valid_opencl" = "yes" ; then
  500. break
  501. fi
  502. done
  503. fi
  504. # in case OpenCL was explicitely required, but is not available, this is an error
  505. if test x$enable_opencl = xyes -a x$have_valid_opencl = no; then
  506. AC_MSG_ERROR([cannot find OpenCL])
  507. fi
  508. # now we enable OpenCL if and only if a proper setup is available
  509. enable_opencl=$have_valid_opencl
  510. fi
  511. AC_MSG_CHECKING(whether OpenCL should be used)
  512. AC_MSG_RESULT($enable_opencl)
  513. AC_SUBST(STARPU_USE_OPENCL, $enable_opencl)
  514. AM_CONDITIONAL(STARPU_USE_OPENCL, test x$enable_opencl = xyes)
  515. if test x$enable_opencl = xyes ; then
  516. AC_DEFINE(STARPU_USE_OPENCL, [1], [OpenCL support is activated])
  517. STARPU_OPENCL_CPPFLAGS="${STARPU_OPENCL_CPPFLAGS} -DSTARPU_OPENCL_DATADIR=${datarootdir}/starpu/opencl"
  518. AC_SUBST(STARPU_OPENCL_DATAdir, "$(eval echo ${datarootdir}/starpu/opencl/examples)")
  519. AC_SUBST(STARPU_OPENCL_CPPFLAGS)
  520. AC_SUBST(STARPU_OPENCL_LDFLAGS)
  521. fi
  522. ###############################################################################
  523. # #
  524. # Cell settings #
  525. # #
  526. ###############################################################################
  527. #TODO fix the default dir
  528. AC_ARG_ENABLE(gordon, [AS_HELP_STRING([--enable-gordon],
  529. [use Cell SPUs])],, enable_gordon=maybe)
  530. if test x$enable_gordon = xyes -o x$enable_gordon = xmaybe; then
  531. AC_ARG_WITH(gordon-dir, [AS_HELP_STRING([--with-gordon-dir=<path>],
  532. [specify Gordon installation directory (default is /usr/local/)])],
  533. [
  534. gordon_dir="$withval"
  535. enable_gordon=yes
  536. ], gordon_dir=/usr/local/)
  537. # do we have a valid Gordon setup ?
  538. have_valid_gordon=yes
  539. # can we use dynamic code loading facilities ?
  540. AC_CHECK_LIB(elf, elf_memory,, [have_valid_gordon=no])
  541. AC_CHECK_LIB(spe2, spe_context_create,,[have_valid_gordon=no])
  542. AC_CHECK_FUNC(spe_in_mbox_write, [], [have_valid_gordon=no])
  543. PKG_PROG_PKG_CONFIG
  544. if test -d "$gordon_dir"; then
  545. PKG_CONFIG_PATH="${PKG_CONFIG_PATH}:$gordon_dir"
  546. fi
  547. AC_SUBST(PKG_CONFIG_PATH)
  548. PKG_CHECK_MODULES([GORDON], [libgordon], [], have_valid_gordon=no)
  549. CPPFLAGS="${CPPFLAGS} ${GORDON_CFLAGS}"
  550. LIBS="${LIBS} ${GORDON_LIBS}"
  551. # AC_CHECK_FUNC(gordon_init, [gordon], [have_valid_gordon=no])
  552. # in case Gordon was explicitely required, but is not available, this is an error
  553. if test x$enable_gordon = xyes -a x$have_valid_gordon = no; then
  554. AC_MSG_ERROR([cannot find Gordon])
  555. fi
  556. # now we enable Gordon if and only if a proper setup is available
  557. enable_gordon=$have_valid_gordon
  558. fi
  559. AC_MSG_CHECKING(whether GORDON should be used)
  560. AC_MSG_RESULT($enable_gordon)
  561. AC_SUBST(STARPU_USE_GORDON, $enable_gordon)
  562. AM_CONDITIONAL(STARPU_USE_GORDON, test x$enable_gordon = xyes)
  563. if test x$enable_gordon = xyes; then
  564. AC_DEFINE(STARPU_USE_GORDON, [1], [Cell support is enabled])
  565. GORDON_REQUIRES=gordon
  566. fi
  567. AC_SUBST(GORDON_REQUIRES)
  568. AC_MSG_CHECKING(whether blocking drivers should be disabled)
  569. AC_ARG_ENABLE(blocking-drivers, [AS_HELP_STRING([--disable-blocking-drivers], [disable blocking drivers])],
  570. enable_blocking=$enableval, enable_blocking=$enable_gordon)
  571. AC_MSG_RESULT($enable_blocking)
  572. if test x$enable_blocking = xno; then
  573. AC_DEFINE(STARPU_NON_BLOCKING_DRIVERS, [1], [drivers must progress])
  574. fi
  575. ###############################################################################
  576. # #
  577. # Debug and Performance analysis tools #
  578. # #
  579. ###############################################################################
  580. AC_MSG_CHECKING(whether debug mode should be enabled)
  581. AC_ARG_ENABLE(debug, [AS_HELP_STRING([--enable-debug], [enable debug mode])],
  582. enable_debug=$enableval, enable_debug=no)
  583. AC_MSG_RESULT($enable_debug)
  584. if test x$enable_debug = xyes; then
  585. CFLAGS=" -O0 "
  586. else
  587. CFLAGS=" -O3 "
  588. fi
  589. CFLAGS+=" -gdwarf-2 -g3 "
  590. AC_MSG_CHECKING(whether extra checks should be performed)
  591. AC_ARG_ENABLE(fast, [AS_HELP_STRING([--enable-fast],
  592. [do not enforce assertions])],
  593. enable_fast=$enableval, enable_fast=no)
  594. AC_MSG_RESULT($enable_fast)
  595. if test x$enable_fast = xyes; then
  596. AC_DEFINE(STARPU_NO_ASSERT, [1], [disable assertions])
  597. fi
  598. AC_MSG_CHECKING(whether debug messages should be displayed)
  599. AC_ARG_ENABLE(verbose, [AS_HELP_STRING([--enable-verbose],
  600. [display verbose debug messages])],
  601. enable_verbose=$enableval, enable_verbose=no)
  602. AC_MSG_RESULT($enable_verbose)
  603. if test x$enable_verbose = xyes; then
  604. AC_DEFINE(STARPU_VERBOSE, [1], [display verbose debug messages])
  605. fi
  606. AC_MSG_CHECKING(whether coverage testing should be enabled)
  607. AC_ARG_ENABLE(coverage, [AS_HELP_STRING([--enable-coverage],
  608. [enable coverage checking])],
  609. enable_coverage=$enableval, enable_coverage=no)
  610. AC_MSG_RESULT($enable_coverage)
  611. AC_SUBST(COVERAGE, $enable_coverage)
  612. AM_CONDITIONAL(STARPU_COVERAGE_ENABLED, [test "x$enable_coverage" = "xyes"])
  613. if test x$enable_coverage = xyes; then
  614. CPPFLAGS="${CPPFLAGS} --coverage"
  615. LDFLAGS="${LDFLAGS} --coverage"
  616. fi
  617. # shall we use FxT to generate trace of the execution ?
  618. AC_MSG_CHECKING(whether fxt traces should be generated)
  619. AC_ARG_WITH(fxt, [AS_HELP_STRING([--with-fxt[=<dir>]], [generate fxt traces])],
  620. [
  621. if test x$withval != xno; then
  622. use_fxt=yes
  623. if test x$withval = xyes; then
  624. AC_MSG_RESULT(yes)
  625. use_fxt_from_system=yes
  626. else
  627. # use specified path
  628. # TODO check if the dir is actually containing FxT
  629. use_fxt_from_system=no
  630. fxtdir=$withval
  631. AC_MSG_RESULT(yes using $fxtdir)
  632. AC_SUBST(FXTDIR, $fxtdir)
  633. fi
  634. else
  635. use_fxt=no
  636. AC_MSG_RESULT(no)
  637. fi
  638. ],
  639. [
  640. use_fxt=no
  641. AC_MSG_RESULT(no)
  642. ])
  643. AC_SUBST(STARPU_USE_FXT, $use_fxt)
  644. AM_CONDITIONAL(STARPU_USE_FXT, test x$use_fxt = xyes)
  645. if test x$use_fxt = xyes; then
  646. AC_DEFINE(STARPU_USE_FXT, [1], [enable FxT traces])
  647. AC_DEFINE(CONFIG_FUT, [1], [enable FUT traces])
  648. AC_SUBST(USE_FXTDIR_FROM_USER,$use_fxt_from_system)
  649. if test x$use_fxt_from_system = xno; then
  650. CPPFLAGS="${CPPFLAGS} -I$fxtdir/include/ "
  651. LDFLAGS="${LDFLAGS} -L$fxtdir/lib/ "
  652. fi
  653. # if we use monotonic clocks, FxT uses -lrt
  654. AC_CHECK_LIB(rt, clock_gettime,,AC_MSG_ERROR([cannot find clock_gettime]))
  655. AC_CHECK_LIB(fxt, fut_setup,,AC_MSG_ERROR([cannot find fxt lib]))
  656. AC_CHECK_HEADER([fxt/fxt.h],,AC_MSG_ERROR([cannot find headers for fxt]))
  657. AC_CHECK_HEADER([fxt/fut.h],,AC_MSG_ERROR([cannot find headers for fxt]))
  658. fi
  659. AC_MSG_CHECKING(whether performance debugging should be enabled)
  660. AC_ARG_ENABLE(perf-debug, [AS_HELP_STRING([--enable-perf-debug],
  661. [enable performance debugging])],
  662. enable_perf_debug=$enableval, enable_perf_debug=no)
  663. AC_MSG_RESULT($enable_perf_debug)
  664. AC_SUBST(STARPU_PERF_DEBUG, $enable_perf_debug)
  665. if test x$enable_perf_debuf = xyes; then
  666. AC_DEFINE(STARPU_PERF_DEBUG, [1], [enable performance debug])
  667. CPPFLAGS="${CPPFLAGS} -pg "
  668. LDFLAGS="${LDFLAGS} -pg "
  669. fi
  670. AC_MSG_CHECKING(whether performance model debugging should be enabled)
  671. AC_ARG_ENABLE(model-debug, [AS_HELP_STRING([--enable-model-debug],
  672. [enable performance model debugging])],
  673. enable_model_debug=$enableval, enable_model_debug=no)
  674. AC_MSG_RESULT($enable_model_debug)
  675. if test x$enable_model_debug = xyes; then
  676. AC_DEFINE(STARPU_MODEL_DEBUG, [1], [enable performance model debug])
  677. fi
  678. AC_MSG_CHECKING(whether statistics should be generated)
  679. AC_ARG_ENABLE(stats, [AS_HELP_STRING([--enable-stats],
  680. [enable statistics])],
  681. enable_stats=$enableval, enable_stats=no)
  682. AC_MSG_RESULT($enable_stats)
  683. AC_SUBST(STATS, $enable_stats)
  684. AC_SUBST(STARPU_DATA_STATS, $enable_stats)
  685. if test x$enable_stats = xyes; then
  686. AC_DEFINE(STARPU_DATA_STATS, [1], [enable statistics])
  687. fi
  688. AC_CHECK_HEADERS([glpk.h])
  689. AC_HAVE_LIBRARY([glpk])
  690. ###############################################################################
  691. # #
  692. # Miscellaneous options for StarPU #
  693. # #
  694. ###############################################################################
  695. AC_MSG_CHECKING(how many buffers can be manipulated per task)
  696. AC_ARG_ENABLE(maxbuffers, [AS_HELP_STRING([--enable-maxbuffers=<nbuffers>],
  697. [maximum number of buffers per task])],
  698. nmaxbuffers=$enableval, nmaxbuffers=8)
  699. AC_MSG_RESULT($nmaxbuffers)
  700. AC_DEFINE_UNQUOTED(STARPU_NMAXBUFS, [$nmaxbuffers],
  701. [how many buffers can be manipulated per task])
  702. # We have one memory node shared by all CPU workers, one node per GPU, and
  703. # currently the Cell driver is using the same memory node as the CPU.
  704. maxnodes=1
  705. if test x$enable_cuda = xyes ; then
  706. # we could have used nmaxcudadev + 1, but this would certainly give an
  707. # odd number.
  708. maxnodes=`expr $maxnodes + $nmaxcudadev`
  709. fi
  710. if test x$enable_opencl = xyes ; then
  711. # we could have used nmaxcudadev + 1, but this would certainly give an
  712. # odd number.
  713. maxnodes=`expr $maxnodes + $nmaxopencldev`
  714. fi
  715. # todo: set maxnodes to the next power of 2 greater than maxnodes
  716. AC_MSG_CHECKING(maximum number of memory nodes)
  717. AC_MSG_RESULT($maxnodes)
  718. AC_DEFINE_UNQUOTED(STARPU_MAXNODES, [$maxnodes],
  719. [maximum number of memory nodes])
  720. AC_MSG_CHECKING(whether allocation cache should be used)
  721. AC_ARG_ENABLE(allocation-cache, [AS_HELP_STRING([--enable-allocation-cache],
  722. [enable data allocation cache])],
  723. enable_allocation_cache=$enableval, enable_allocation_cache=no)
  724. AC_MSG_RESULT($enable_allocation_cache)
  725. if test x$enable_allocation_cache = xyes; then
  726. AC_DEFINE(STARPU_USE_ALLOCATION_CACHE, [1], [enable data allocation cache])
  727. fi
  728. AC_ARG_WITH(perf-model-dir, [AS_HELP_STRING([--with-perf-model-dir=<dir>], [specify where performance models shoulds be stored])],
  729. [
  730. if test x$withval = xno; then
  731. AC_MSG_ERROR(--without-perf-model-dir is not a valid option)
  732. fi
  733. perf_model_dir="$withval"
  734. have_explicit_perf_model_dir=yes
  735. AC_DEFINE_UNQUOTED(STARPU_PERF_MODEL_DIR, ["$perf_model_dir"], [performance models location])
  736. ], [
  737. # by default, we put the performance models in
  738. # $HOME/.starpu/sampling/
  739. have_explicit_perf_model_dir=no
  740. perf_model_dir="\$HOME/.starpu/sampling/"
  741. ]
  742. )
  743. AC_MSG_CHECKING(using explicit performance model location)
  744. AC_MSG_RESULT($have_explicit_perf_model_dir)
  745. AC_MSG_CHECKING(performance models location)
  746. AC_MSG_RESULT($perf_model_dir)
  747. # On many multicore CPUs, clock cycles are not synchronized
  748. AC_CHECK_LIB([rt], [clock_gettime])
  749. AC_CHECK_FUNCS([clock_gettime])
  750. # Compute the maximum number of workers (we round it to 16 for alignment
  751. # purposes).
  752. nmaxworkers=`expr 16 \* \( \( $nmaxcpus + $nmaxcudadev + $nmaxopencldev + 15 \) / 16 \) `
  753. AC_MSG_CHECKING(Maximum number of workers)
  754. AC_MSG_RESULT($nmaxworkers)
  755. AC_DEFINE_UNQUOTED(STARPU_NMAXWORKERS, [$nmaxworkers], [Maximum number of workers])
  756. ###############################################################################
  757. # #
  758. # MPI #
  759. # #
  760. ###############################################################################
  761. AC_ARG_WITH(mpicc, [AS_HELP_STRING([--with-mpicc[=<path to mpicc>]],
  762. [Path of the mpicc compiler])],
  763. [
  764. if test x$withval = xyes; then
  765. AC_MSG_ERROR(--with-mpicc must be given a pathname)
  766. else
  767. mpicc_path=$withval
  768. fi
  769. ],
  770. [
  771. # nothing was specified: default value is used
  772. AC_PATH_PROG(mpicc_path, mpicc, [no], [])
  773. ])
  774. # We test if the MPICC compiler exists
  775. if test ! -x $mpicc_path; then
  776. #MPICC does not exists or is not executable
  777. AC_MSG_RESULT(The mpicc compiler is not valid)
  778. use_mpi=no
  779. else
  780. use_mpi=yes
  781. fi
  782. AC_MSG_CHECKING(mpicc path)
  783. AC_MSG_RESULT($mpicc_path)
  784. AC_SUBST(MPICC, $mpicc_path)
  785. if test x$use_mpi = xyes; then
  786. cc_or_mpicc=$mpicc_path
  787. else
  788. cc_or_mpicc=$CC
  789. fi
  790. AC_SUBST(CC_OR_MPICC, $cc_or_mpicc)
  791. # If the user specifically asks for it, or if we are in a developer checkout, we enable mpi check
  792. AC_ARG_ENABLE(mpi-check, AC_HELP_STRING([--enable-mpi-check], [Enable execution of MPI testcases]))
  793. running_mpi_check=0
  794. if test -d "$srcdir/.svn" ; then
  795. running_mpi_check=yes
  796. fi
  797. if test x$enable_mpi_check = xyes ; then
  798. running_mpi_check=yes
  799. fi
  800. if test x$enable_mpi_check = xno ; then
  801. running_mpi_check=no
  802. fi
  803. # Check if mpiexec is available
  804. AC_ARG_WITH(mpiexec, [AS_HELP_STRING([--with-mpiexec[=<path to mpiexec>]],
  805. [Path of mpiexec])],
  806. [
  807. if test x$withval = xyes; then
  808. AC_MSG_ERROR(--with-mpiexec must be given a pathname)
  809. else
  810. mpiexec_path=$withval
  811. fi
  812. ],
  813. [
  814. # nothing was specified: look in the path
  815. AC_PATH_PROG(mpiexec_path, mpiexec, [no], [$(dirname $mpicc_path):$PATH])
  816. ])
  817. AC_MSG_CHECKING(whether mpiexec is available)
  818. AC_MSG_RESULT($mpiexec_path)
  819. # We test if MPIEXEC exists
  820. if test ! -x $mpiexec_path; then
  821. #MPIEXEC does not exists or is not executable
  822. AC_MSG_RESULT(The mpiexec script is not valid)
  823. running_mpi_check=no
  824. mpiexec_path=""
  825. fi
  826. AM_CONDITIONAL(STARPU_MPI_CHECK, test x$running_mpi_check = xyes)
  827. if test x$use_mpi = xyes; then
  828. AC_MSG_CHECKING(whether MPI tests should be run)
  829. AC_MSG_RESULT($running_mpi_check)
  830. AC_SUBST(MPIEXEC,$mpiexec_path)
  831. fi
  832. AC_MSG_CHECKING(whether the StarPU MPI library should be generated)
  833. AC_MSG_RESULT($use_mpi)
  834. AC_SUBST(USE_MPI, $use_mpi)
  835. AM_CONDITIONAL(USE_MPI, test x$use_mpi = xyes)
  836. if test x$use_mpi = xyes; then
  837. AC_DEFINE(STARPU_USE_MPI,[],[whether the StarPU MPI library is available])
  838. fi
  839. ###############################################################################
  840. # #
  841. # GCC extensions #
  842. # #
  843. ###############################################################################
  844. AC_ARG_ENABLE([gcc-extensions],
  845. [AS_HELP_STRING([--enable-gcc-extensions],
  846. [build the GCC plug-in that provides C language extensions (experimental)])],
  847. [enable_gcc_plugin="$enableval"],
  848. [enable_gcc_plugin="no"])
  849. if test "x$enable_gcc_plugin" = "xyes"; then
  850. STARPU_GCC_PLUGIN_SUPPORT
  851. if test "x$ac_cv_have_gcc_plugins" != "xyes"; then
  852. AC_MSG_ERROR([This compiler lacks GCC plug-in support.])
  853. fi
  854. build_gcc_plugin="yes"
  855. else
  856. build_gcc_plugin="no"
  857. fi
  858. AM_CONDITIONAL([BUILD_GCC_PLUGIN], [test "x$build_gcc_plugin" = "xyes"])
  859. ###############################################################################
  860. # #
  861. # Examples #
  862. # #
  863. ###############################################################################
  864. AC_ARG_ENABLE(opengl-render, [AS_HELP_STRING([--enable-opengl-render],
  865. [enable OpenGL rendering of some examples])],
  866. enable_opengl_render=$enableval, enable_opengl_render=no)
  867. if test x$enable_opengl_render = xyes; then
  868. AC_CHECK_LIB(glut, glutInit,,AC_MSG_ERROR([cannot find glut]))
  869. AC_CHECK_LIB(GL, glXCreateContext,,AC_MSG_ERROR([cannot find GL]))
  870. AC_CHECK_LIB(GLU, gluLookAt,,AC_MSG_ERROR([cannot find GLU]))
  871. AC_DEFINE(STARPU_OPENGL_RENDER, [1], [enable OpenGL rendering of some examples])
  872. fi
  873. AC_MSG_CHECKING(whether OpenGL rendering is enabled)
  874. AC_SUBST(STARPU_OPENGL_RENDER, $enable_opengl_render)
  875. AC_MSG_RESULT($enable_opengl_render)
  876. AC_PATH_XTRA
  877. if test "x$x_includes" != "xNONE"; then
  878. AC_DEFINE(STARPU_HAVE_X11, [1], [enable X11])
  879. fi
  880. AM_CONDITIONAL([HAVE_X11], [test "x$x_includes" != "xNONE"])
  881. # In case there are BLAS kernels that are used by the example applications
  882. # we may specify which library to use. Note that this is not used for StarPU
  883. # itself.
  884. blas_lib=maybe
  885. AC_ARG_ENABLE(blas-lib,
  886. [ --enable-blas-lib[=blaslibname]:
  887. none [default]: no BLAS lib is used
  888. atlas: use ATLAS library
  889. goto: use GotoBLAS library],
  890. [
  891. if test "x$enableval" = "xatlas" ; then
  892. blas_lib=atlas
  893. elif test "x$enableval" = "xgoto" ; then
  894. blas_lib=goto
  895. elif test "x$enableval" = "xnone" ; then
  896. blas_lib=none
  897. elif test x$enableval = xno; then
  898. blas_lib=none
  899. else
  900. echo
  901. echo "Error!"
  902. echo "Unknown BLAS library"
  903. exit -1
  904. fi
  905. ])
  906. if test x$blas_lib = xmaybe -o x$blas_lib = xgoto; then
  907. AC_ARG_WITH(goto-dir, [AS_HELP_STRING([--with-goto-dir=<dir>], [specify GotoBLAS lib location])],
  908. [
  909. blas_lib=goto
  910. gotodir=$withval
  911. AC_SUBST(GOTODIR, $gotodir)
  912. CPPFLAGS="${CPPFLAGS} -I$gotodir/ "
  913. LDFLAGS="${LDFLAGS} -L$gotodir/ "
  914. ]
  915. )
  916. if test x$blas_lib = xgoto; then
  917. AC_CHECK_LIB(gfortran, main,,)
  918. # Perhaps that GotoBLAS2 is available instead (so that we have libgotoblas2.{so,a})
  919. AC_CHECK_LIB(goto2, sgemm_,, [havegoto2=no])
  920. if test x$havegoto2 = xno; then
  921. AC_CHECK_LIB(goto, sgemm_,,AC_MSG_ERROR([cannot find goto lib]))
  922. fi
  923. AC_DEFINE(STARPU_GOTO, [1], [use STARPU_GOTO library])
  924. fi
  925. fi
  926. if test x$blas_lib = xmaybe -o x$blas_lib = xatlas; then
  927. AC_ARG_WITH(atlas-dir, [AS_HELP_STRING([--with-atlas-dir=<dir>], [specify ATLAS lib location])],
  928. [
  929. AC_MSG_CHECKING(STARPU_ATLAS location)
  930. blas_lib=atlas
  931. atlasdir=$withval
  932. AC_MSG_RESULT($atlasdir)
  933. AC_SUBST(ATLASDIR, $atlasdir)
  934. CPPFLAGS="${CPPFLAGS} -I$atlasdir/include/ "
  935. LDFLAGS="${LDFLAGS} -L$atlasdir/lib/ "
  936. ]
  937. )
  938. if test x$blas_lib = xatlas; then
  939. # test whether STARPU_ATLAS is actually available
  940. AC_CHECK_HEADER([cblas.h],,AC_MSG_ERROR([cannot find atlas headers]))
  941. AC_CHECK_LIB(atlas, ATL_sgemm,,AC_MSG_ERROR([cannot find atlas lib]),)
  942. AC_CHECK_LIB(cblas, cblas_sgemm,,AC_MSG_ERROR([cannot find atlas lib]),[-latlas])
  943. AC_DEFINE(STARPU_ATLAS, [1], [use STARPU_ATLAS library])
  944. fi
  945. fi
  946. if test x$blas_lib = xmaybe; then
  947. # Should we use MKL ?
  948. AC_ARG_WITH(mkl-cflags, [AS_HELP_STRING([--with-mkl-cflags], [specify MKL compilation flags])],
  949. [
  950. CPPFLAGS="${CPPFLAGS} $withval"
  951. blas_lib=mkl
  952. ])
  953. AC_ARG_WITH(mkl-ldflags, [AS_HELP_STRING([--with-mkl-ldflags], [specify MKL linking flags])],
  954. [
  955. LDFLAGS="${LDFLAGS} $withval"
  956. blas_lib=mkl
  957. ])
  958. if test x$blas_lib=xmkl; then
  959. AC_DEFINE(STARPU_MKL, [1], [use MKL library])
  960. fi
  961. fi
  962. if test x$blas_lib = xmaybe; then
  963. #perhaps it is possible to use some BLAS lib from the system
  964. use_system_blas=no
  965. AC_SEARCH_LIBS([sgemm_],[blas],use_system_blas=yes,,)
  966. if test x$use_system_blas = xyes; then
  967. AC_DEFINE(STARPU_SYSTEM_BLAS, [1], [use refblas library])
  968. blas_lib=system
  969. else
  970. blas_lib=none
  971. fi
  972. fi
  973. AM_CONDITIONAL(ATLAS_BLAS_LIB, test x$blas_lib = xatlas)
  974. AM_CONDITIONAL(GOTO_BLAS_LIB, test x$blas_lib = xgoto)
  975. AM_CONDITIONAL(MKL_BLAS_LIB, test x$blas_lib = xmkl)
  976. AM_CONDITIONAL(SYSTEM_BLAS_LIB, test x$blas_lib = xsystem)
  977. AM_CONDITIONAL(NO_BLAS_LIB, test x$blas_lib = xnone)
  978. AC_MSG_CHECKING(which BLAS lib should be used)
  979. AC_MSG_RESULT($blas_lib)
  980. AC_SUBST(BLAS_LIB,$blas_lib)
  981. have_fftw=no
  982. have_fftwf=no
  983. have_fftwl=no
  984. PKG_CHECK_MODULES([FFTW], [fftw3], [
  985. AC_DEFINE([STARPU_HAVE_FFTW], [1], [Define to 1 if you have the libfftw3 library.])
  986. AC_SUBST([STARPU_HAVE_FFTW], [1])
  987. have_fftw=yes
  988. ], [:])
  989. AM_CONDITIONAL(STARPU_HAVE_FFTW, [test x$have_fftw = xyes])
  990. PKG_CHECK_MODULES([FFTWF], [fftw3f], [
  991. AC_DEFINE([STARPU_HAVE_FFTWF], [1], [Define to 1 if you have the libfftw3f library.])
  992. AC_SUBST([STARPU_HAVE_FFTWF], [1])
  993. have_fftwf=yes
  994. ], [:])
  995. AM_CONDITIONAL(STARPU_HAVE_FFTWF, [test x$have_fftwf = xyes])
  996. PKG_CHECK_MODULES([FFTWL], [fftw3l], [
  997. AC_DEFINE([STARPU_HAVE_FFTWL], [1], [Define to 1 if you have the libfftw3l library.])
  998. AC_SUBST([HAVE_FFTWFL], [1])
  999. have_fftwl=yes
  1000. ], [:])
  1001. AM_CONDITIONAL(STARPU_HAVE_FFTWL, [test x$have_fftwl = xyes])
  1002. AC_ARG_WITH([hwloc], [AS_HELP_STRING([--without-hwloc], [Disable hwloc (enabled by default)])])
  1003. SAVED_LDFLAGS="${LDFLAGS}"
  1004. SAVED_CPPFLAGS="${CPPFLAGS}"
  1005. AS_IF([test "x$with_hwloc" != "xno"], [
  1006. PKG_CHECK_MODULES([HWLOC],[hwloc], [
  1007. have_valid_hwloc=yes
  1008. have_pkgconfig_hwloc=yes], [
  1009. have_valid_hwloc=no
  1010. have_pkgconfig_hwloc=no])
  1011. AS_IF([test "$have_valid_hwloc" = "no"], [
  1012. hwloc_dir="$withval"
  1013. CPPFLAGS="${SAVED_CPPFLAGS} -I$hwloc_dir/include"
  1014. AC_CHECK_HEADER([hwloc.h],[have_valid_hwloc=yes],[have_valid_hwloc=no])
  1015. LDFLAGS="${SAVED_LDFLAGS} -L$hwloc_dir/lib"
  1016. AC_HAVE_LIBRARY([hwloc],[have_valid_hwloc=yes],[have_valid_hwloc=no])
  1017. ])
  1018. ])
  1019. AS_IF([test "$have_valid_hwloc" = "yes"], [
  1020. AC_DEFINE([STARPU_HAVE_HWLOC], [1], [Define to 1 if you have the hwloc library.])
  1021. HWLOC_REQUIRES=hwloc
  1022. AC_SUBST([STARPU_HAVE_HWLOC], [1])
  1023. AS_IF([test "$have_pkgconfig_hwloc" = "no"], [
  1024. HWLOC_CFLAGS="-I$hwloc_dir/include"
  1025. HWLOC_LIBS="-L$hwloc_dir/lib -lhwloc"])
  1026. ])
  1027. LDFLAGS="${SAVED_LDFLAGS}"
  1028. CPPFLAGS="${SAVED_CPPFLAGS}"
  1029. AC_MSG_CHECKING(whether hwloc should be used)
  1030. AC_MSG_RESULT($have_valid_hwloc)
  1031. AC_SUBST(HWLOC_REQUIRES)
  1032. # is the header file f77.h available ?
  1033. have_f77_h=yes
  1034. AC_CHECK_HEADER([f77.h],,[have_f77_h=no])
  1035. AC_MSG_CHECKING(whether header file f77.h is available)
  1036. AC_MSG_RESULT($have_f77_h)
  1037. AC_SUBST(STARPU_HAVE_F77_H, $have_f77_h)
  1038. AM_CONDITIONAL(STARPU_HAVE_F77_H, test x$have_f77_h = xyes)
  1039. if test x$have_f77_h = xyes; then
  1040. AC_DEFINE([STARPU_HAVE_F77_H], [1], [Define to 1 if you have the <f77.h> header file.])
  1041. fi
  1042. # Do we want to run optional tests
  1043. AC_MSG_CHECKING(whether optional tests should be run)
  1044. AC_ARG_ENABLE(optional_tests, [AS_HELP_STRING([--optional-tests],
  1045. [run optional tests])],
  1046. want_optional_tests=$enableval, want_optional_tests=no)
  1047. AC_MSG_RESULT($want_optional_tests)
  1048. AM_CONDITIONAL([COND_OPT], [test "$want_optional_tests" = yes])
  1049. # File configuration
  1050. AC_CONFIG_COMMANDS([executable-scripts], [chmod +x ]tests/regression/regression.sh)
  1051. AC_CONFIG_FILES(tests/regression/regression.sh tests/regression/profiles tests/regression/profiles.build.only)
  1052. AC_CONFIG_HEADER(src/common/config.h include/starpu_config.h)
  1053. AC_CONFIG_HEADERS([gcc-plugin/src/starpu-gcc-config.h])
  1054. AC_OUTPUT([
  1055. Makefile
  1056. src/Makefile
  1057. tools/Makefile
  1058. gcc-plugin/Makefile
  1059. gcc-plugin/src/Makefile
  1060. gcc-plugin/tests/Makefile
  1061. libstarpu.pc
  1062. examples/Makefile
  1063. examples/opt/Makefile
  1064. examples/starpufft/Makefile
  1065. examples/stencil/Makefile
  1066. tests/Makefile
  1067. tests/opt/Makefile
  1068. doc/Makefile
  1069. mpi/Makefile
  1070. ])