configure.ac 44 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321
  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.99, [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([1.10 -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
  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. if test "$__cuda_include_dir" = "no" -a "$__cuda_dir" != "no" ; then
  221. __cuda_include_dir="$__cuda_dir/include"
  222. fi
  223. if test "$__cuda_lib_dir" = "no" -a "$__cuda_dir" != "no" ; then
  224. __cuda_lib_dir="$__cuda_dir/lib"
  225. fi
  226. SAVED_CPPFLAGS="$CPPFLAGS"
  227. SAVED_LDFLAGS="${LDFLAGS}"
  228. SAVED_STARPU_CUDA_LDFLAGS=${STARPU_CUDA_LDFLAGS}
  229. if test "$__cuda_lib_dir" != "no" ; then
  230. STARPU_CUDA_LDFLAGS="${SAVED_STARPU_CUDA_LDFLAGS} -L$__cuda_lib_dir"
  231. fi
  232. if test "$__cuda_include_dir" != "no" ; then
  233. CPPFLAGS="${CPPFLAGS} -I$__cuda_include_dir"
  234. fi
  235. AC_CHECK_HEADER([cuda.h],[have_valid_cuda=yes],[have_valid_cuda=no])
  236. unset ac_cv_header_cuda_h
  237. if test "$have_valid_cuda" = "yes" ; then
  238. if test "$__cuda_lib_dir" != "no"; then
  239. LDFLAGS="${SAVED_LDFLAGS} -L$__cuda_lib_dir"
  240. fi
  241. AC_HAVE_LIBRARY([cudart],[have_valid_cuda=yes],[have_valid_cuda=no])
  242. unset ac_cv_lib_cudart_main
  243. if test "$have_valid_cuda" = "no" ; then
  244. if test "$3" = "no" -a "$__cuda_dir" != "no" ; then
  245. __cuda_lib_dir="$__cuda_dir/lib64"
  246. STARPU_CUDA_LDFLAGS="${SAVED_STARPU_CUDA_LDFLAGS} -L$__cuda_lib_dir"
  247. LDFLAGS="${SAVED_LDFLAGS} -L$__cuda_lib_dir"
  248. AC_HAVE_LIBRARY([cudart],[have_valid_cuda=yes],[have_valid_cuda=no])
  249. unset ac_cv_lib_cudart_main
  250. fi
  251. fi
  252. fi
  253. if test "$have_valid_cuda" = "yes" ; then
  254. STARPU_CUDA_LDFLAGS="$STARPU_CUDA_LDFLAGS -lcudart"
  255. # we also check that CUBLAS is available
  256. AC_HAVE_LIBRARY([cublas],[have_valid_cuda=yes],[have_valid_cuda=no])
  257. unset ac_cv_lib_cublas_main
  258. if test "$have_valid_cuda" = "yes" ; then
  259. STARPU_CUDA_LDFLAGS="$STARPU_CUDA_LDFLAGS -lcublas"
  260. fi
  261. fi
  262. CPPFLAGS="${SAVED_CPPFLAGS}"
  263. LDFLAGS="${SAVED_LDFLAGS}"
  264. if test "$have_valid_cuda" = "yes" -a "$__cuda_include_dir" != "no"; then
  265. STARPU_CUDA_CPPFLAGS="-I$__cuda_include_dir"
  266. NVCCFLAGS="${NVCCFLAGS} -I$__cuda_include_dir"
  267. fi
  268. ])
  269. if test x$enable_cuda = xyes -o x$enable_cuda = xmaybe; then
  270. STARPU_CHECK_CUDA($cuda_dir)
  271. if test "$have_valid_cuda" = "no" ; then
  272. for f in "/usr/local/cuda" "/c/cuda" "/cygdrive/c/cuda" "/opt/cuda" ; do
  273. STARPU_CHECK_CUDA($f)
  274. if test "$have_valid_cuda" = "yes" ; then
  275. break
  276. fi
  277. done
  278. fi
  279. if test "$have_valid_cuda" = "yes" ; then
  280. STARPU_CHECK_CUDA_RUNTIME($cuda_dir, $cuda_include_dir, $cuda_lib_dir)
  281. if test "$have_valid_cuda" = "no" ; then
  282. for f in "/usr/local/cuda" "/c/cuda" "/cygdrive/c/cuda" "/opt/cuda" ; do
  283. STARPU_CHECK_CUDA_RUNTIME($f, "no", "no")
  284. if test "$have_valid_cuda" = "yes" ; then
  285. break
  286. fi
  287. done
  288. fi
  289. fi
  290. # in case CUDA was explicitely required, but is not available, this is an error
  291. if test x$enable_cuda = xyes -a x$have_valid_cuda = no; then
  292. AC_MSG_ERROR([cannot find CUDA])
  293. fi
  294. # now we enable CUDA if and only if a proper setup is available
  295. enable_cuda=$have_valid_cuda
  296. fi
  297. AC_MSG_CHECKING(whether CUDA should be used)
  298. AC_MSG_RESULT($enable_cuda)
  299. AC_SUBST(STARPU_USE_CUDA, $enable_cuda)
  300. AM_CONDITIONAL(STARPU_USE_CUDA, test x$enable_cuda = xyes)
  301. if test x$enable_cuda = xyes; then
  302. AC_DEFINE(STARPU_USE_CUDA, [1], [CUDA support is activated])
  303. # On Darwin, the libstdc++ dependency is not automatically added by nvcc
  304. # case "$target" in
  305. # *-*darwin*) AC_HAVE_LIBRARY([stdc++], []) ;;
  306. # #*-*darwin*) AC_HAVE_LIBRARY([stdc++], [STARPU_CUDA_LDFLAGS="$STARPU_CUDA_LDFLAGS -lstdc++"]) ;;
  307. # esac
  308. STARPU_CUDA_LDFLAGS="$STARPU_CUDA_LDFLAGS -lcuda -lcufft"
  309. if test "$F77" = "gfortran" ; then
  310. STARPU_CUDA_LDFLAGS="$STARPU_CUDA_LDFLAGS -lgfortran"
  311. fi
  312. #in case this is a 64bit setup, we tell nvcc to use a -m64 flag
  313. AC_CHECK_SIZEOF([void *])
  314. if test x$SIZEOF_VOID_P = x8; then
  315. NVCCFLAGS="${NVCCFLAGS} -m64"
  316. AC_SUBST(NVCCFLAGS)
  317. fi
  318. AC_PATH_PROG([NVCC], [nvcc], [not-found],
  319. [$cuda_dir/bin:$PATH:/usr/local/cuda/bin:/usr/bin:/bin])
  320. if test "x$NVCC" = "xnot-found"; then
  321. AC_MSG_WARN([`nvcc' not found, disabling CUDA])
  322. enable_cuda=no
  323. fi
  324. fi
  325. enable_magma=no
  326. if test x$enable_cuda = xyes; then
  327. # Should we use the MAGMA library (instead or in addition to CUBLAS)
  328. magma_dir=/usr/local # default
  329. enable_magma=maybe
  330. AC_ARG_WITH(magma, [AS_HELP_STRING([--with-magma=<path>],
  331. [specify that MAGMA should be used and its installation directory])],
  332. [
  333. if test x$withval = xyes; then
  334. # No path was specified but MAGMA is explicitely enabled
  335. enable_magma=yes
  336. else
  337. if test x$withval = xno; then
  338. # MAGMA is explicitely disabled
  339. enable_magma=no
  340. else
  341. # MAGMA is enabled and the PATH is given in $withval
  342. enable_magma=yes
  343. magma_dir="$withval"
  344. fi
  345. fi
  346. ], [])
  347. # Do we have a valid MAGMA setup ?
  348. if test x$enable_magma = xyes -o x$enable_magma = xmaybe; then
  349. SAVED_LDFLAGS="${LDFLAGS}"
  350. SAVED_CPPFLAGS="${CPPFLAGS}"
  351. if test -d "$magma_dir/lib/"; then
  352. LDFLAGS="${SAVED_LDFLAGS} -L$magma_dir/lib/ "
  353. have_valid_magma=yes
  354. AC_CHECK_LIB(magmablas, main,,[have_valid_magma=no])
  355. AC_CHECK_LIB(magma, magmablas_sgemm,,[have_valid_magma=no])
  356. fi
  357. if test -d "$magma_dir/include/"; then
  358. CPPFLAGS="${SAVED_CPPFLAGS} -I$magma_dir/include/ "
  359. AC_CHECK_HEADER([magmablas.h],,[have_valid_magma=no])
  360. #AC_CHECK_HEADER([magma.h],,[have_valid_magma=no])
  361. fi
  362. if test x$have_valid_magma = xno; then
  363. # If MAGMA was explicitely required, this is an error
  364. if test x$enable_magma = xyes; then
  365. AC_MSG_ERROR([cannot find MAGMA])
  366. fi
  367. # Restore old flags and don't use MAGMA
  368. LDFLAGS="${SAVED_LDFLAGS}"
  369. CPPFLAGS="${SAVED_CPPFLAGS}"
  370. enable_magma=no
  371. else
  372. enable_magma=yes
  373. fi
  374. else
  375. have_valid_magma=no
  376. enable_magma=no
  377. fi
  378. fi
  379. AC_MSG_CHECKING(whether MAGMA should be used)
  380. AC_MSG_RESULT($enable_magma)
  381. if test x$enable_magma = xyes; then
  382. AC_DEFINE(STARPU_HAVE_MAGMA, [1], [use MAGMA library])
  383. fi
  384. # cufftDoubleComplex may not be available on an old CUDA setup
  385. AC_CHECK_TYPE(cufftDoubleComplex,
  386. [have_cufftdoublecomplex=yes],
  387. [have_cufftdoublecomplex=no], [#include <cufft.h>])
  388. AM_CONDITIONAL(STARPU_HAVE_CUFFTDOUBLECOMPLEX, test x$have_cufftdoublecomplex = xyes)
  389. if test x$have_cufftdoublecomplex = xyes; then
  390. AC_DEFINE(STARPU_HAVE_CUFFTDOUBLECOMPLEX, [1], [cufftDoubleComplex is available])
  391. fi
  392. # The CURAND library is only available since CUDA 3.2
  393. have_curand=$enable_cuda
  394. if test x$enable_cuda = xyes; then
  395. SAVED_LDFLAGS="${LDFLAGS}"
  396. LDFLAGS="${LDFLAGS} ${STARPU_CUDA_LDFLAGS}"
  397. AC_HAVE_LIBRARY([curand],[have_curand=yes],[have_curand=no])
  398. LDFLAGS="${SAVED_LDFLAGS}"
  399. fi
  400. AC_MSG_CHECKING(whether CURAND is available)
  401. AC_MSG_RESULT($have_curand)
  402. if test x$have_curand = xyes; then
  403. AC_DEFINE(STARPU_HAVE_CURAND,[1], [CURAND is available])
  404. STARPU_CUDA_LDFLAGS="$STARPU_CUDA_LDFLAGS -lcurand"
  405. fi
  406. # Peer transfers are only supported since CUDA 4.0
  407. have_cuda_memcpy_peer=no
  408. if test x$enable_cuda = xyes; then
  409. SAVED_LDFLAGS="${LDFLAGS}"
  410. LDFLAGS="${LDFLAGS} ${STARPU_CUDA_LDFLAGS}"
  411. AC_CHECK_FUNC([cudaMemcpyPeer], have_cuda_memcpy_peer=yes, have_cuda_memcpy_peer=no)
  412. LDFLAGS="${SAVED_LDFLAGS}"
  413. fi
  414. if test x$have_cuda_memcpy_peer = xyes; then
  415. AC_DEFINE(HAVE_CUDA_MEMCPY_PEER,[],[Peer transfers are supported in CUDA])
  416. fi
  417. if test x$enable_cuda = xyes; then
  418. STARPU_CUDA_LDFLAGS="$STARPU_CUDA_LDFLAGS -lstdc++"
  419. AC_SUBST(STARPU_CUDA_LDFLAGS)
  420. AC_SUBST(STARPU_CUDA_CPPFLAGS)
  421. fi
  422. ###############################################################################
  423. # #
  424. # OpenCL settings #
  425. # #
  426. ###############################################################################
  427. AC_MSG_CHECKING(maximum number of OpenCL devices)
  428. AC_ARG_ENABLE(maxopencldev, [AS_HELP_STRING([--enable-maxopencldev=<number>],
  429. [maximum number of OPENCL devices])],
  430. nmaxopencldev=$enableval, nmaxopencldev=8)
  431. AC_MSG_RESULT($nmaxopencldev)
  432. AC_DEFINE_UNQUOTED(STARPU_MAXOPENCLDEVS, [$nmaxopencldev],
  433. [maximum number of OPENCL devices])
  434. AC_ARG_ENABLE(opencl, [AS_HELP_STRING([--disable-opencl],
  435. [do not use OpenCL device(s)])],, [enable_opencl=maybe])
  436. AC_DEFUN([STARPU_CHECK_OPENCL],
  437. [
  438. __opencl_dir=$1
  439. __opencl_include_dir=$2
  440. __opencl_lib_dir=$3
  441. if test "$__opencl_dir" != "no" ; then
  442. AC_MSG_CHECKING(whether OpenCL is available in $__opencl_dir)
  443. else
  444. AC_MSG_CHECKING(whether OpenCL is available)
  445. fi
  446. AC_MSG_RESULT()
  447. if test "$__opencl_include_dir" = "no" -a "$__opencl_dir" != "no" ; then
  448. __opencl_include_dir="$__opencl_dir/include"
  449. fi
  450. if test "$__opencl_lib_dir" = "no" -a "$__opencl_dir" != "no" ; then
  451. __opencl_lib_dir="$__opencl_dir/lib"
  452. fi
  453. SAVED_CPPFLAGS="$CPPFLAGS"
  454. SAVED_LDFLAGS="${LDFLAGS}"
  455. if test "$__opencl_include_dir" != "no" ; then
  456. CPPFLAGS="${CPPFLAGS} -I$__opencl_include_dir"
  457. fi
  458. AC_CHECK_HEADER([CL/cl.h],[have_valid_opencl=yes],[have_valid_opencl=no])
  459. unset ac_cv_header_CL_cl_h
  460. if test "$have_valid_opencl" = "yes" ; then
  461. if test "$__opencl_lib_dir" != "no"; then
  462. LDFLAGS="${SAVED_LDFLAGS} -L$__opencl_lib_dir"
  463. fi
  464. AC_HAVE_LIBRARY([OpenCL],[have_valid_opencl=yes],[have_valid_opencl=no])
  465. unset ac_cv_lib_OpenCL_main
  466. if test "$have_valid_opencl" = "no" ; then
  467. if test "$3" = "no" -a "$__opencl_dir" != "no" ; then
  468. __opencl_lib_dir="$__opencl_dir/lib64"
  469. LDFLAGS="${SAVED_LDFLAGS} -L$__opencl_lib_dir"
  470. AC_HAVE_LIBRARY([OpenCL],[have_valid_opencl=yes],[have_valid_opencl=no])
  471. unset ac_cv_lib_OpenCL_main
  472. fi
  473. fi
  474. fi
  475. CPPFLAGS="${SAVED_CPPFLAGS}"
  476. LDFLAGS="${SAVED_LDFLAGS}"
  477. if test "$have_valid_opencl" = "yes" -a "$__opencl_include_dir" != "no"; then
  478. STARPU_OPENCL_CPPFLAGS="-I$__opencl_include_dir"
  479. fi
  480. if test "$have_valid_opencl" = "yes" ; then
  481. if test "$__opencl_lib_dir" != "no"; then
  482. STARPU_OPENCL_LDFLAGS="-L$__opencl_lib_dir"
  483. fi
  484. STARPU_OPENCL_LDFLAGS="${STARPU_OPENCL_LDFLAGS} -lOpenCL"
  485. fi
  486. ])
  487. #AC_MSG_CHECKING(whether OpenCL is available)
  488. AC_ARG_WITH(opencl-dir,
  489. [AS_HELP_STRING([--with-opencl-dir=<path>],
  490. [specify OpenCL installation directory])],
  491. [
  492. opencl_dir="$withval"
  493. # in case this was not explicit yet
  494. enable_opencl=yes
  495. ], opencl_dir=no)
  496. AC_ARG_WITH(opencl-include-dir,
  497. [AS_HELP_STRING([--with-opencl-include-dir=<path>],
  498. [specify where OpenCL headers are installed])],
  499. [
  500. opencl_include_dir="$withval"
  501. # in case this was not explicit yet
  502. enable_opencl=yes
  503. ], [opencl_include_dir=no])
  504. AC_ARG_WITH(opencl-lib-dir,
  505. [AS_HELP_STRING([--with-opencl-lib-dir=<path>],
  506. [specify where OpenCL libraries are installed])],
  507. [
  508. opencl_lib_dir="$withval"
  509. # in case this was not explicit yet
  510. enable_opencl=yes
  511. ], [opencl_lib_dir=no])
  512. if test x$enable_opencl = xyes -o x$enable_opencl = xmaybe; then
  513. STARPU_CHECK_OPENCL($opencl_dir, $opencl_include_dir, $opencl_lib_dir)
  514. if test "$have_valid_opencl" = "no" ; then
  515. for f in "/usr/local/cuda" "/c/cuda" "/cygdrive/c/cuda" "/opt/cuda" ; do
  516. STARPU_CHECK_OPENCL($f, "no", "no")
  517. if test "$have_valid_opencl" = "yes" ; then
  518. break
  519. fi
  520. done
  521. fi
  522. # in case OpenCL was explicitely required, but is not available, this is an error
  523. if test x$enable_opencl = xyes -a x$have_valid_opencl = no; then
  524. AC_MSG_ERROR([cannot find OpenCL])
  525. fi
  526. # now we enable OpenCL if and only if a proper setup is available
  527. enable_opencl=$have_valid_opencl
  528. fi
  529. AC_MSG_CHECKING(whether OpenCL should be used)
  530. AC_MSG_RESULT($enable_opencl)
  531. AC_SUBST(STARPU_USE_OPENCL, $enable_opencl)
  532. AM_CONDITIONAL(STARPU_USE_OPENCL, test x$enable_opencl = xyes)
  533. if test x$enable_opencl = xyes ; then
  534. AC_DEFINE(STARPU_USE_OPENCL, [1], [OpenCL support is activated])
  535. STARPU_OPENCL_CPPFLAGS="${STARPU_OPENCL_CPPFLAGS} -DSTARPU_OPENCL_DATADIR=${datarootdir}/starpu/opencl"
  536. AC_SUBST(STARPU_OPENCL_DATAdir, "$(eval echo ${datarootdir}/starpu/opencl/examples)")
  537. AC_SUBST(STARPU_OPENCL_CPPFLAGS)
  538. AC_SUBST(STARPU_OPENCL_LDFLAGS)
  539. fi
  540. ###############################################################################
  541. # #
  542. # Cell settings #
  543. # #
  544. ###############################################################################
  545. #TODO fix the default dir
  546. AC_ARG_ENABLE(gordon, [AS_HELP_STRING([--enable-gordon],
  547. [use Cell SPUs])],, enable_gordon=maybe)
  548. if test x$enable_gordon = xyes -o x$enable_gordon = xmaybe; then
  549. AC_ARG_WITH(gordon-dir, [AS_HELP_STRING([--with-gordon-dir=<path>],
  550. [specify Gordon installation directory (default is /usr/local/)])],
  551. [
  552. gordon_dir="$withval"
  553. enable_gordon=yes
  554. ], gordon_dir=/usr/local/)
  555. # do we have a valid Gordon setup ?
  556. have_valid_gordon=yes
  557. # can we use dynamic code loading facilities ?
  558. AC_CHECK_LIB(elf, elf_memory,, [have_valid_gordon=no])
  559. AC_CHECK_LIB(spe2, spe_context_create,,[have_valid_gordon=no])
  560. AC_CHECK_FUNC(spe_in_mbox_write, [], [have_valid_gordon=no])
  561. PKG_PROG_PKG_CONFIG
  562. if test -d "$gordon_dir"; then
  563. PKG_CONFIG_PATH="${PKG_CONFIG_PATH}:$gordon_dir"
  564. fi
  565. AC_SUBST(PKG_CONFIG_PATH)
  566. PKG_CHECK_MODULES([GORDON], [libgordon], [], have_valid_gordon=no)
  567. CPPFLAGS="${CPPFLAGS} ${GORDON_CFLAGS}"
  568. LIBS="${LIBS} ${GORDON_LIBS}"
  569. # AC_CHECK_FUNC(gordon_init, [gordon], [have_valid_gordon=no])
  570. # in case Gordon was explicitely required, but is not available, this is an error
  571. if test x$enable_gordon = xyes -a x$have_valid_gordon = no; then
  572. AC_MSG_ERROR([cannot find Gordon])
  573. fi
  574. # now we enable Gordon if and only if a proper setup is available
  575. enable_gordon=$have_valid_gordon
  576. fi
  577. AC_MSG_CHECKING(whether GORDON should be used)
  578. AC_MSG_RESULT($enable_gordon)
  579. AC_SUBST(STARPU_USE_GORDON, $enable_gordon)
  580. AM_CONDITIONAL(STARPU_USE_GORDON, test x$enable_gordon = xyes)
  581. if test x$enable_gordon = xyes; then
  582. AC_DEFINE(STARPU_USE_GORDON, [1], [Cell support is enabled])
  583. GORDON_REQUIRES=gordon
  584. fi
  585. AC_SUBST(GORDON_REQUIRES)
  586. AC_MSG_CHECKING(whether blocking drivers should be disabled)
  587. AC_ARG_ENABLE(blocking-drivers, [AS_HELP_STRING([--disable-blocking-drivers], [disable blocking drivers])],
  588. enable_blocking=$enableval, enable_blocking=$enable_gordon)
  589. AC_MSG_RESULT($enable_blocking)
  590. if test x$enable_blocking = xno; then
  591. AC_DEFINE(STARPU_NON_BLOCKING_DRIVERS, [1], [drivers must progress])
  592. fi
  593. ###############################################################################
  594. # #
  595. # Debug and Performance analysis tools #
  596. # #
  597. ###############################################################################
  598. AC_MSG_CHECKING(whether debug mode should be enabled)
  599. AC_ARG_ENABLE(debug, [AS_HELP_STRING([--enable-debug], [enable debug mode])],
  600. enable_debug=$enableval, enable_debug=no)
  601. AC_MSG_RESULT($enable_debug)
  602. if test x$enable_debug = xyes; then
  603. CFLAGS=" -O0 "
  604. else
  605. CFLAGS=" -O3 "
  606. fi
  607. CFLAGS+=" -gdwarf-2 -g3 "
  608. AC_MSG_CHECKING(whether extra checks should be performed)
  609. AC_ARG_ENABLE(fast, [AS_HELP_STRING([--enable-fast],
  610. [do not enforce assertions])],
  611. enable_fast=$enableval, enable_fast=no)
  612. AC_MSG_RESULT($enable_fast)
  613. if test x$enable_fast = xyes; then
  614. AC_DEFINE(STARPU_NO_ASSERT, [1], [disable assertions])
  615. fi
  616. AC_MSG_CHECKING(whether debug messages should be displayed)
  617. AC_ARG_ENABLE(verbose, [AS_HELP_STRING([--enable-verbose],
  618. [display verbose debug messages])],
  619. enable_verbose=$enableval, enable_verbose=no)
  620. AC_MSG_RESULT($enable_verbose)
  621. if test x$enable_verbose = xyes; then
  622. AC_DEFINE(STARPU_VERBOSE, [1], [display verbose debug messages])
  623. fi
  624. AC_MSG_CHECKING(whether coverage testing should be enabled)
  625. AC_ARG_ENABLE(coverage, [AS_HELP_STRING([--enable-coverage],
  626. [enable coverage checking])],
  627. enable_coverage=$enableval, enable_coverage=no)
  628. AC_MSG_RESULT($enable_coverage)
  629. AC_SUBST(COVERAGE, $enable_coverage)
  630. AM_CONDITIONAL(STARPU_COVERAGE_ENABLED, [test "x$enable_coverage" = "xyes"])
  631. if test x$enable_coverage = xyes; then
  632. CPPFLAGS="${CPPFLAGS} --coverage"
  633. LDFLAGS="${LDFLAGS} --coverage"
  634. fi
  635. # shall we use FxT to generate trace of the execution ?
  636. AC_MSG_CHECKING(whether fxt traces should be generated)
  637. AC_ARG_WITH(fxt, [AS_HELP_STRING([--with-fxt[=<dir>]], [generate fxt traces])],
  638. [
  639. if test x$withval != xno; then
  640. use_fxt=yes
  641. if test x$withval = xyes; then
  642. AC_MSG_RESULT(yes)
  643. use_fxt_from_system=yes
  644. else
  645. # use specified path
  646. # TODO check if the dir is actually containing FxT
  647. use_fxt_from_system=no
  648. fxtdir=$withval
  649. AC_MSG_RESULT(yes using $fxtdir)
  650. AC_SUBST(FXTDIR, $fxtdir)
  651. fi
  652. else
  653. use_fxt=no
  654. AC_MSG_RESULT(no)
  655. fi
  656. ],
  657. [
  658. use_fxt=no
  659. AC_MSG_RESULT(no)
  660. ])
  661. AC_SUBST(STARPU_USE_FXT, $use_fxt)
  662. AM_CONDITIONAL(STARPU_USE_FXT, test x$use_fxt = xyes)
  663. if test x$use_fxt = xyes; then
  664. AC_DEFINE(STARPU_USE_FXT, [1], [enable FxT traces])
  665. AC_DEFINE(CONFIG_FUT, [1], [enable FUT traces])
  666. AC_SUBST(USE_FXTDIR_FROM_USER,$use_fxt_from_system)
  667. if test x$use_fxt_from_system = xno; then
  668. CPPFLAGS="${CPPFLAGS} -I$fxtdir/include/ "
  669. LDFLAGS="${LDFLAGS} -L$fxtdir/lib/ "
  670. fi
  671. # if we use monotonic clocks, FxT uses -lrt
  672. AC_CHECK_LIB(rt, clock_gettime,,AC_MSG_ERROR([cannot find clock_gettime]))
  673. AC_CHECK_LIB(fxt, fut_setup,,AC_MSG_ERROR([cannot find fxt lib]))
  674. AC_CHECK_HEADER([fxt/fxt.h],,AC_MSG_ERROR([cannot find headers for fxt]))
  675. AC_CHECK_HEADER([fxt/fut.h],,AC_MSG_ERROR([cannot find headers for fxt]))
  676. fi
  677. AC_MSG_CHECKING(whether performance debugging should be enabled)
  678. AC_ARG_ENABLE(perf-debug, [AS_HELP_STRING([--enable-perf-debug],
  679. [enable performance debugging])],
  680. enable_perf_debug=$enableval, enable_perf_debug=no)
  681. AC_MSG_RESULT($enable_perf_debug)
  682. AC_SUBST(STARPU_PERF_DEBUG, $enable_perf_debug)
  683. if test x$enable_perf_debuf = xyes; then
  684. AC_DEFINE(STARPU_PERF_DEBUG, [1], [enable performance debug])
  685. CPPFLAGS="${CPPFLAGS} -pg "
  686. LDFLAGS="${LDFLAGS} -pg "
  687. fi
  688. AC_MSG_CHECKING(whether performance model debugging should be enabled)
  689. AC_ARG_ENABLE(model-debug, [AS_HELP_STRING([--enable-model-debug],
  690. [enable performance model debugging])],
  691. enable_model_debug=$enableval, enable_model_debug=no)
  692. AC_MSG_RESULT($enable_model_debug)
  693. if test x$enable_model_debug = xyes; then
  694. AC_DEFINE(STARPU_MODEL_DEBUG, [1], [enable performance model debug])
  695. fi
  696. AC_MSG_CHECKING(whether statistics should be generated)
  697. AC_ARG_ENABLE(stats, [AS_HELP_STRING([--enable-stats],
  698. [enable statistics])],
  699. enable_stats=$enableval, enable_stats=no)
  700. AC_MSG_RESULT($enable_stats)
  701. AC_SUBST(STATS, $enable_stats)
  702. AC_SUBST(STARPU_DATA_STATS, $enable_stats)
  703. if test x$enable_stats = xyes; then
  704. AC_DEFINE(STARPU_DATA_STATS, [1], [enable statistics])
  705. fi
  706. AC_CHECK_HEADERS([glpk.h])
  707. AC_HAVE_LIBRARY([glpk])
  708. ###############################################################################
  709. # #
  710. # Miscellaneous options for StarPU #
  711. # #
  712. ###############################################################################
  713. AC_MSG_CHECKING(how many buffers can be manipulated per task)
  714. AC_ARG_ENABLE(maxbuffers, [AS_HELP_STRING([--enable-maxbuffers=<nbuffers>],
  715. [maximum number of buffers per task])],
  716. nmaxbuffers=$enableval, nmaxbuffers=8)
  717. AC_MSG_RESULT($nmaxbuffers)
  718. AC_DEFINE_UNQUOTED(STARPU_NMAXBUFS, [$nmaxbuffers],
  719. [how many buffers can be manipulated per task])
  720. # We have one memory node shared by all CPU workers, one node per GPU, and
  721. # currently the Cell driver is using the same memory node as the CPU.
  722. maxnodes=1
  723. if test x$enable_cuda = xyes ; then
  724. # we could have used nmaxcudadev + 1, but this would certainly give an
  725. # odd number.
  726. maxnodes=`expr $maxnodes + $nmaxcudadev`
  727. fi
  728. if test x$enable_opencl = xyes ; then
  729. # we could have used nmaxcudadev + 1, but this would certainly give an
  730. # odd number.
  731. maxnodes=`expr $maxnodes + $nmaxopencldev`
  732. fi
  733. # todo: set maxnodes to the next power of 2 greater than maxnodes
  734. AC_MSG_CHECKING(maximum number of memory nodes)
  735. AC_MSG_RESULT($maxnodes)
  736. AC_DEFINE_UNQUOTED(STARPU_MAXNODES, [$maxnodes],
  737. [maximum number of memory nodes])
  738. AC_MSG_CHECKING(whether allocation cache should be used)
  739. AC_ARG_ENABLE(allocation-cache, [AS_HELP_STRING([--enable-allocation-cache],
  740. [enable data allocation cache])],
  741. enable_allocation_cache=$enableval, enable_allocation_cache=no)
  742. AC_MSG_RESULT($enable_allocation_cache)
  743. if test x$enable_allocation_cache = xyes; then
  744. AC_DEFINE(STARPU_USE_ALLOCATION_CACHE, [1], [enable data allocation cache])
  745. fi
  746. AC_ARG_WITH(perf-model-dir, [AS_HELP_STRING([--with-perf-model-dir=<dir>], [specify where performance models shoulds be stored])],
  747. [
  748. if test x$withval = xno; then
  749. AC_MSG_ERROR(--without-perf-model-dir is not a valid option)
  750. fi
  751. perf_model_dir="$withval"
  752. have_explicit_perf_model_dir=yes
  753. AC_DEFINE_UNQUOTED(STARPU_PERF_MODEL_DIR, ["$perf_model_dir"], [performance models location])
  754. ], [
  755. # by default, we put the performance models in
  756. # $HOME/.starpu/sampling/
  757. have_explicit_perf_model_dir=no
  758. perf_model_dir="\$HOME/.starpu/sampling/"
  759. ]
  760. )
  761. AC_MSG_CHECKING(using explicit performance model location)
  762. AC_MSG_RESULT($have_explicit_perf_model_dir)
  763. AC_MSG_CHECKING(performance models location)
  764. AC_MSG_RESULT($perf_model_dir)
  765. # On many multicore CPUs, clock cycles are not synchronized
  766. AC_CHECK_LIB([rt], [clock_gettime])
  767. AC_CHECK_FUNCS([clock_gettime])
  768. # Compute the maximum number of workers (we round it to 16 for alignment
  769. # purposes).
  770. nmaxworkers=`expr 16 \* \( \( $nmaxcpus + $nmaxcudadev + $nmaxopencldev + 15 \) / 16 \) `
  771. AC_MSG_CHECKING(Maximum number of workers)
  772. AC_MSG_RESULT($nmaxworkers)
  773. AC_DEFINE_UNQUOTED(STARPU_NMAXWORKERS, [$nmaxworkers], [Maximum number of workers])
  774. ###############################################################################
  775. # #
  776. # MPI #
  777. # #
  778. ###############################################################################
  779. AC_ARG_WITH(mpicc, [AS_HELP_STRING([--with-mpicc[=<path to mpicc>]],
  780. [Path of the mpicc compiler])],
  781. [
  782. if test x$withval = xyes; then
  783. AC_MSG_ERROR(--with-mpicc must be given a pathname)
  784. else
  785. mpicc_path=$withval
  786. fi
  787. ],
  788. [
  789. # nothing was specified: default value is used
  790. AC_PATH_PROG(mpicc_path, mpicc, [no], [])
  791. ])
  792. # We test if the MPICC compiler exists
  793. if test ! -x $mpicc_path; then
  794. #MPICC does not exists or is not executable
  795. AC_MSG_RESULT(The mpicc compiler is not valid)
  796. use_mpi=no
  797. else
  798. use_mpi=yes
  799. fi
  800. AC_MSG_CHECKING(mpicc path)
  801. AC_MSG_RESULT($mpicc_path)
  802. AC_SUBST(MPICC, $mpicc_path)
  803. if test x$use_mpi = xyes; then
  804. cc_or_mpicc=$mpicc_path
  805. else
  806. cc_or_mpicc=$CC
  807. fi
  808. AC_SUBST(CC_OR_MPICC, $cc_or_mpicc)
  809. # If the user specifically asks for it, or if we are in a developer checkout, we enable mpi check
  810. AC_ARG_ENABLE(mpi-check, AC_HELP_STRING([--enable-mpi-check], [Enable execution of MPI testcases]))
  811. running_mpi_check=0
  812. if test -d "$srcdir/.svn" ; then
  813. running_mpi_check=yes
  814. fi
  815. if test x$enable_mpi_check = xyes ; then
  816. running_mpi_check=yes
  817. fi
  818. if test x$enable_mpi_check = xno ; then
  819. running_mpi_check=no
  820. fi
  821. # Check if mpiexec is available
  822. AC_ARG_WITH(mpiexec, [AS_HELP_STRING([--with-mpiexec[=<path to mpiexec>]],
  823. [Path of mpiexec])],
  824. [
  825. if test x$withval = xyes; then
  826. AC_MSG_ERROR(--with-mpiexec must be given a pathname)
  827. else
  828. mpiexec_path=$withval
  829. fi
  830. ],
  831. [
  832. # nothing was specified: look in the path
  833. AC_PATH_PROG(mpiexec_path, mpiexec, [no], [$(dirname $mpicc_path):$PATH])
  834. ])
  835. AC_MSG_CHECKING(whether mpiexec is available)
  836. AC_MSG_RESULT($mpiexec_path)
  837. # We test if MPIEXEC exists
  838. if test ! -x $mpiexec_path; then
  839. #MPIEXEC does not exists or is not executable
  840. AC_MSG_RESULT(The mpiexec script is not valid)
  841. running_mpi_check=no
  842. mpiexec_path=""
  843. fi
  844. AM_CONDITIONAL(STARPU_MPI_CHECK, test x$running_mpi_check = xyes)
  845. if test x$use_mpi = xyes; then
  846. AC_MSG_CHECKING(whether MPI tests should be run)
  847. AC_MSG_RESULT($running_mpi_check)
  848. AC_SUBST(MPIEXEC,$mpiexec_path)
  849. fi
  850. AC_MSG_CHECKING(whether the StarPU MPI library should be generated)
  851. AC_MSG_RESULT($use_mpi)
  852. AC_SUBST(USE_MPI, $use_mpi)
  853. AM_CONDITIONAL(USE_MPI, test x$use_mpi = xyes)
  854. if test x$use_mpi = xyes; then
  855. AC_DEFINE(STARPU_USE_MPI,[],[whether the StarPU MPI library is available])
  856. fi
  857. ###############################################################################
  858. # #
  859. # Flags for C Compiler #
  860. # #
  861. ###############################################################################
  862. # IS_SUPPORTED_CFLAG(flag)
  863. # ------------------------
  864. # Check if the CFLAGS `flag' is supported by the compiler
  865. AC_DEFUN([IS_SUPPORTED_CFLAG],
  866. [
  867. AC_REQUIRE([AC_PROG_CC])
  868. AC_MSG_CHECKING([whether compiler support $1])
  869. SAVED_CFLAGS="$CFLAGS"
  870. CFLAGS="$1 -we10006"
  871. AC_COMPILE_IFELSE(
  872. AC_LANG_PROGRAM(
  873. [[]],
  874. [[
  875. AC_LANG_SOURCE([
  876. const char *hello = "Hello World";
  877. ])
  878. ]]
  879. ),
  880. [
  881. GLOBAL_AM_CFLAGS="$GLOBAL_AM_CFLAGS $1"
  882. AC_MSG_RESULT(yes)
  883. ],
  884. AC_MSG_RESULT(no)
  885. )
  886. CFLAGS="$SAVED_CFLAGS"
  887. ])
  888. IS_SUPPORTED_CFLAG(-W)
  889. IS_SUPPORTED_CFLAG(-Wall)
  890. IS_SUPPORTED_CFLAG(-Wextra)
  891. AC_SUBST(GLOBAL_AM_CFLAGS)
  892. ###############################################################################
  893. # #
  894. # GCC extensions #
  895. # #
  896. ###############################################################################
  897. AC_ARG_ENABLE([gcc-extensions],
  898. [AS_HELP_STRING([--enable-gcc-extensions],
  899. [build the GCC plug-in that provides C language extensions (experimental)])],
  900. [enable_gcc_plugin="$enableval"],
  901. [enable_gcc_plugin="no"])
  902. if test "x$enable_gcc_plugin" = "xyes"; then
  903. STARPU_GCC_PLUGIN_SUPPORT
  904. if test "x$ac_cv_have_gcc_plugins" != "xyes"; then
  905. AC_MSG_ERROR([This compiler lacks GCC plug-in support.])
  906. fi
  907. build_gcc_plugin="yes"
  908. else
  909. build_gcc_plugin="no"
  910. fi
  911. AM_CONDITIONAL([BUILD_GCC_PLUGIN], [test "x$build_gcc_plugin" = "xyes"])
  912. ###############################################################################
  913. # #
  914. # Examples #
  915. # #
  916. ###############################################################################
  917. AC_ARG_ENABLE(opengl-render, [AS_HELP_STRING([--enable-opengl-render],
  918. [enable OpenGL rendering of some examples])],
  919. enable_opengl_render=$enableval, enable_opengl_render=no)
  920. if test x$enable_opengl_render = xyes; then
  921. AC_CHECK_LIB(glut, glutInit,,AC_MSG_ERROR([cannot find glut]))
  922. AC_CHECK_LIB(GL, glXCreateContext,,AC_MSG_ERROR([cannot find GL]))
  923. AC_CHECK_LIB(GLU, gluLookAt,,AC_MSG_ERROR([cannot find GLU]))
  924. AC_DEFINE(STARPU_OPENGL_RENDER, [1], [enable OpenGL rendering of some examples])
  925. fi
  926. AC_MSG_CHECKING(whether OpenGL rendering is enabled)
  927. AC_SUBST(STARPU_OPENGL_RENDER, $enable_opengl_render)
  928. AC_MSG_RESULT($enable_opengl_render)
  929. AC_PATH_XTRA
  930. if test "x$x_includes" != "xNONE"; then
  931. AC_DEFINE(STARPU_HAVE_X11, [1], [enable X11])
  932. fi
  933. AM_CONDITIONAL([HAVE_X11], [test "x$x_includes" != "xNONE"])
  934. # In case there are BLAS kernels that are used by the example applications
  935. # we may specify which library to use. Note that this is not used for StarPU
  936. # itself.
  937. blas_lib=maybe
  938. AC_ARG_ENABLE(blas-lib,
  939. [ --enable-blas-lib[=blaslibname]:
  940. none [default]: no BLAS lib is used
  941. atlas: use ATLAS library
  942. goto: use GotoBLAS library],
  943. [
  944. if test "x$enableval" = "xatlas" ; then
  945. blas_lib=atlas
  946. elif test "x$enableval" = "xgoto" ; then
  947. blas_lib=goto
  948. elif test "x$enableval" = "xnone" ; then
  949. blas_lib=none
  950. elif test x$enableval = xno; then
  951. blas_lib=none
  952. else
  953. echo
  954. echo "Error!"
  955. echo "Unknown BLAS library"
  956. exit -1
  957. fi
  958. ])
  959. if test x$blas_lib = xmaybe -o x$blas_lib = xgoto; then
  960. AC_ARG_WITH(goto-dir, [AS_HELP_STRING([--with-goto-dir=<dir>], [specify GotoBLAS lib location])],
  961. [
  962. blas_lib=goto
  963. gotodir=$withval
  964. AC_SUBST(GOTODIR, $gotodir)
  965. CPPFLAGS="${CPPFLAGS} -I$gotodir/ "
  966. LDFLAGS="${LDFLAGS} -L$gotodir/ "
  967. ]
  968. )
  969. if test x$blas_lib = xgoto; then
  970. AC_CHECK_LIB(gfortran, main,,)
  971. # Perhaps that GotoBLAS2 is available instead (so that we have libgotoblas2.{so,a})
  972. AC_CHECK_LIB(goto2, sgemm_,, [havegoto2=no])
  973. if test x$havegoto2 = xno; then
  974. AC_CHECK_LIB(goto, sgemm_,,AC_MSG_ERROR([cannot find goto lib]))
  975. fi
  976. AC_DEFINE(STARPU_GOTO, [1], [use STARPU_GOTO library])
  977. fi
  978. fi
  979. if test x$blas_lib = xmaybe -o x$blas_lib = xatlas; then
  980. AC_ARG_WITH(atlas-dir, [AS_HELP_STRING([--with-atlas-dir=<dir>], [specify ATLAS lib location])],
  981. [
  982. AC_MSG_CHECKING(STARPU_ATLAS location)
  983. blas_lib=atlas
  984. atlasdir=$withval
  985. AC_MSG_RESULT($atlasdir)
  986. AC_SUBST(ATLASDIR, $atlasdir)
  987. CPPFLAGS="${CPPFLAGS} -I$atlasdir/include/ "
  988. LDFLAGS="${LDFLAGS} -L$atlasdir/lib/ "
  989. ]
  990. )
  991. if test x$blas_lib = xatlas; then
  992. # test whether STARPU_ATLAS is actually available
  993. AC_CHECK_HEADER([cblas.h],,AC_MSG_ERROR([cannot find atlas headers]))
  994. AC_CHECK_LIB(atlas, ATL_sgemm,,AC_MSG_ERROR([cannot find atlas lib]),)
  995. AC_CHECK_LIB(cblas, cblas_sgemm,,AC_MSG_ERROR([cannot find atlas lib]),[-latlas])
  996. AC_DEFINE(STARPU_ATLAS, [1], [use STARPU_ATLAS library])
  997. fi
  998. fi
  999. if test x$blas_lib = xmaybe; then
  1000. # Should we use MKL ?
  1001. AC_ARG_WITH(mkl-cflags, [AS_HELP_STRING([--with-mkl-cflags], [specify MKL compilation flags])],
  1002. [
  1003. CPPFLAGS="${CPPFLAGS} $withval"
  1004. blas_lib=mkl
  1005. ])
  1006. AC_ARG_WITH(mkl-ldflags, [AS_HELP_STRING([--with-mkl-ldflags], [specify MKL linking flags])],
  1007. [
  1008. LDFLAGS="${LDFLAGS} $withval"
  1009. blas_lib=mkl
  1010. ])
  1011. if test x$blas_lib=xmkl; then
  1012. AC_DEFINE(STARPU_MKL, [1], [use MKL library])
  1013. fi
  1014. fi
  1015. if test x$blas_lib = xmaybe; then
  1016. #perhaps it is possible to use some BLAS lib from the system
  1017. use_system_blas=no
  1018. AC_SEARCH_LIBS([sgemm_],[blas],use_system_blas=yes,,)
  1019. if test x$use_system_blas = xyes; then
  1020. AC_DEFINE(STARPU_SYSTEM_BLAS, [1], [use refblas library])
  1021. blas_lib=system
  1022. else
  1023. blas_lib=none
  1024. fi
  1025. fi
  1026. AM_CONDITIONAL(ATLAS_BLAS_LIB, test x$blas_lib = xatlas)
  1027. AM_CONDITIONAL(GOTO_BLAS_LIB, test x$blas_lib = xgoto)
  1028. AM_CONDITIONAL(MKL_BLAS_LIB, test x$blas_lib = xmkl)
  1029. AM_CONDITIONAL(SYSTEM_BLAS_LIB, test x$blas_lib = xsystem)
  1030. AM_CONDITIONAL(NO_BLAS_LIB, test x$blas_lib = xnone)
  1031. AC_MSG_CHECKING(which BLAS lib should be used)
  1032. AC_MSG_RESULT($blas_lib)
  1033. AC_SUBST(BLAS_LIB,$blas_lib)
  1034. have_fftw=no
  1035. have_fftwf=no
  1036. have_fftwl=no
  1037. PKG_CHECK_MODULES([FFTW], [fftw3], [
  1038. AC_DEFINE([STARPU_HAVE_FFTW], [1], [Define to 1 if you have the libfftw3 library.])
  1039. AC_SUBST([STARPU_HAVE_FFTW], [1])
  1040. have_fftw=yes
  1041. ], [:])
  1042. AM_CONDITIONAL(STARPU_HAVE_FFTW, [test x$have_fftw = xyes])
  1043. PKG_CHECK_MODULES([FFTWF], [fftw3f], [
  1044. AC_DEFINE([STARPU_HAVE_FFTWF], [1], [Define to 1 if you have the libfftw3f library.])
  1045. AC_SUBST([STARPU_HAVE_FFTWF], [1])
  1046. have_fftwf=yes
  1047. ], [:])
  1048. AM_CONDITIONAL(STARPU_HAVE_FFTWF, [test x$have_fftwf = xyes])
  1049. PKG_CHECK_MODULES([FFTWL], [fftw3l], [
  1050. AC_DEFINE([STARPU_HAVE_FFTWL], [1], [Define to 1 if you have the libfftw3l library.])
  1051. AC_SUBST([HAVE_FFTWFL], [1])
  1052. have_fftwl=yes
  1053. ], [:])
  1054. AM_CONDITIONAL(STARPU_HAVE_FFTWL, [test x$have_fftwl = xyes])
  1055. AC_ARG_WITH([hwloc], [AS_HELP_STRING([--without-hwloc], [Disable hwloc (enabled by default)])])
  1056. SAVED_LDFLAGS="${LDFLAGS}"
  1057. SAVED_CPPFLAGS="${CPPFLAGS}"
  1058. AS_IF([test "x$with_hwloc" != "xno"], [
  1059. PKG_CHECK_MODULES([HWLOC],[hwloc], [
  1060. have_valid_hwloc=yes
  1061. have_pkgconfig_hwloc=yes], [
  1062. have_valid_hwloc=no
  1063. have_pkgconfig_hwloc=no])
  1064. AS_IF([test "$have_valid_hwloc" = "no"], [
  1065. hwloc_dir="$withval"
  1066. CPPFLAGS="${SAVED_CPPFLAGS} -I$hwloc_dir/include"
  1067. AC_CHECK_HEADER([hwloc.h],[have_valid_hwloc=yes],[have_valid_hwloc=no])
  1068. LDFLAGS="${SAVED_LDFLAGS} -L$hwloc_dir/lib"
  1069. AC_HAVE_LIBRARY([hwloc],[have_valid_hwloc=yes],[have_valid_hwloc=no])
  1070. ])
  1071. ])
  1072. AS_IF([test "$have_valid_hwloc" = "yes"], [
  1073. AC_DEFINE([STARPU_HAVE_HWLOC], [1], [Define to 1 if you have the hwloc library.])
  1074. HWLOC_REQUIRES=hwloc
  1075. AC_SUBST([STARPU_HAVE_HWLOC], [1])
  1076. AS_IF([test "$have_pkgconfig_hwloc" = "no"], [
  1077. HWLOC_CFLAGS="-I$hwloc_dir/include"
  1078. HWLOC_LIBS="-L$hwloc_dir/lib -lhwloc"])
  1079. ])
  1080. LDFLAGS="${SAVED_LDFLAGS}"
  1081. CPPFLAGS="${SAVED_CPPFLAGS}"
  1082. AC_MSG_CHECKING(whether hwloc should be used)
  1083. AC_MSG_RESULT($have_valid_hwloc)
  1084. AC_SUBST(HWLOC_REQUIRES)
  1085. # is the header file f77.h available ?
  1086. have_f77_h=yes
  1087. AC_CHECK_HEADER([f77.h],,[have_f77_h=no])
  1088. AC_MSG_CHECKING(whether header file f77.h is available)
  1089. AC_MSG_RESULT($have_f77_h)
  1090. AC_SUBST(STARPU_HAVE_F77_H, $have_f77_h)
  1091. AM_CONDITIONAL(STARPU_HAVE_F77_H, test x$have_f77_h = xyes)
  1092. if test x$have_f77_h = xyes; then
  1093. AC_DEFINE([STARPU_HAVE_F77_H], [1], [Define to 1 if you have the <f77.h> header file.])
  1094. fi
  1095. # Do we want to run optional tests
  1096. AC_MSG_CHECKING(whether optional tests should be run)
  1097. AC_ARG_ENABLE(optional_tests, [AS_HELP_STRING([--optional-tests],
  1098. [run optional tests])],
  1099. want_optional_tests=$enableval, want_optional_tests=no)
  1100. AC_MSG_RESULT($want_optional_tests)
  1101. AM_CONDITIONAL([COND_OPT], [test "$want_optional_tests" = yes])
  1102. # File configuration
  1103. AC_CONFIG_COMMANDS([executable-scripts], [chmod +x ]tests/regression/regression.sh)
  1104. AC_CONFIG_FILES(tests/regression/regression.sh tests/regression/profiles tests/regression/profiles.build.only)
  1105. AC_CONFIG_HEADER(src/common/config.h include/starpu_config.h)
  1106. AC_CONFIG_HEADERS([gcc-plugin/src/starpu-gcc-config.h])
  1107. AC_OUTPUT([
  1108. Makefile
  1109. src/Makefile
  1110. tools/Makefile
  1111. gcc-plugin/Makefile
  1112. gcc-plugin/src/Makefile
  1113. gcc-plugin/tests/Makefile
  1114. libstarpu.pc
  1115. examples/Makefile
  1116. examples/opt/Makefile
  1117. examples/starpufft/Makefile
  1118. examples/stencil/Makefile
  1119. tests/Makefile
  1120. tests/opt/Makefile
  1121. doc/Makefile
  1122. mpi/Makefile
  1123. ])