configure.ac 46 KB

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