configure.ac 86 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473
  1. # StarPU --- Runtime system for heterogeneous multicore architectures.
  2. #
  3. # Copyright (C) 2009-2013 Université de Bordeaux 1
  4. # Copyright (C) 2010, 2011, 2012, 2013 Centre National de la Recherche Scientifique
  5. # Copyright (C) 2011 Télécom-SudParis
  6. # Copyright (C) 2011, 2012 Institut National de Recherche en Informatique et Automatique
  7. #
  8. # StarPU is free software; you can redistribute it and/or modify
  9. # it under the terms of the GNU Lesser General Public License as published by
  10. # the Free Software Foundation; either version 2.1 of the License, or (at
  11. # your option) any later version.
  12. #
  13. # StarPU is distributed in the hope that it will be useful, but
  14. # WITHOUT ANY WARRANTY; without even the implied warranty of
  15. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  16. #
  17. # See the GNU Lesser General Public License in COPYING.LGPL for more details.
  18. AC_INIT([StarPU], [1.2.0], [starpu-devel@lists.gforge.inria.fr], [starpu], [http://runtime.bordeaux.inria.fr/StarPU/])
  19. AC_CONFIG_SRCDIR(include/starpu.h)
  20. AC_CONFIG_AUX_DIR([build-aux])
  21. dnl Versioning.
  22. STARPU_MAJOR_VERSION="`echo $PACKAGE_VERSION | cut -d . -f 1`"
  23. STARPU_MINOR_VERSION="`echo $PACKAGE_VERSION | cut -d . -f 2`"
  24. STARPU_RELEASE_VERSION="`echo $PACKAGE_VERSION | cut -d . -f 3`"
  25. STARPU_RELEASE_VERSION="`echo $PACKAGE_VERSION | cut -d . -f 3| sed 's/rc.*//'`"
  26. dnl we do not want the rcXX in the release version. we would like to use sed -r 's/[a-z]+.*//' to remove any string but the -r option is not portable
  27. AC_SUBST([STARPU_MAJOR_VERSION])
  28. AC_SUBST([STARPU_MINOR_VERSION])
  29. AC_SUBST([STARPU_RELEASE_VERSION])
  30. AC_SUBST([STARPU_EFFECTIVE_VERSION])
  31. AC_DEFINE_UNQUOTED([STARPU_MAJOR_VERSION], [$STARPU_MAJOR_VERSION], [Major version number of StarPU.])
  32. AC_DEFINE_UNQUOTED([STARPU_MINOR_VERSION], [$STARPU_MINOR_VERSION], [Minor version number of StarPU.])
  33. AC_DEFINE_UNQUOTED([STARPU_RELEASE_VERSION], [$STARPU_RELEASE_VERSION], [Release version number of StarPU.])
  34. . "$srcdir/STARPU-VERSION"
  35. AC_SUBST([LIBSTARPU_INTERFACE_CURRENT])
  36. AC_SUBST([LIBSTARPU_INTERFACE_REVISION])
  37. AC_SUBST([LIBSTARPU_INTERFACE_AGE])
  38. AC_SUBST([LIBSTARPUMPI_INTERFACE_CURRENT])
  39. AC_SUBST([LIBSTARPUMPI_INTERFACE_REVISION])
  40. AC_SUBST([LIBSTARPUMPI_INTERFACE_AGE])
  41. AC_SUBST([LIBSTARPUFFT_INTERFACE_CURRENT])
  42. AC_SUBST([LIBSTARPUFFT_INTERFACE_REVISION])
  43. AC_SUBST([LIBSTARPUFFT_INTERFACE_AGE])
  44. AC_SUBST([LIBSOCL_INTERFACE_CURRENT])
  45. AC_SUBST([LIBSOCL_INTERFACE_REVISION])
  46. AC_SUBST([LIBSOCL_INTERFACE_AGE])
  47. AC_CANONICAL_SYSTEM
  48. dnl Automake 1.11 introduced `silent-rules' and `color-tests'. Use them
  49. dnl when they're available.
  50. m4_ifdef([AM_SILENT_RULES],
  51. [AM_INIT_AUTOMAKE([1.11 -Wall foreign silent-rules color-tests parallel-tests])],
  52. [AM_INIT_AUTOMAKE([1.10 -Wall foreign])])
  53. m4_ifdef([AM_SILENT_RULES],
  54. [AM_SILENT_RULES(yes)])
  55. AC_PREREQ(2.60)
  56. m4_ifdef([AM_PROG_AR], [AM_PROG_AR])
  57. AC_PROG_CC
  58. AM_PROG_CC_C_O
  59. AC_PROG_CXX
  60. AC_PROG_CPP
  61. AC_PROG_SED
  62. AC_PROG_LN_S
  63. AC_PROG_F77
  64. LT_PREREQ([2.2])
  65. LT_INIT([win32-dll])
  66. AC_PROG_INSTALL
  67. AC_PROG_MKDIR_P
  68. AC_PROG_LN_S
  69. AC_HEADER_STDC
  70. AC_C_RESTRICT
  71. # Check if bash is available
  72. AC_CHECK_PROGS([BASH], [bash])
  73. # Check whether subversion is installed
  74. AC_PATH_PROG(svnversioncommand, svnversion)
  75. # use svnversion to record the current repository revision only if
  76. # subversion is installed and we are in a working copy
  77. if test "$svnversioncommand" = "" || test `LC_ALL=C $svnversioncommand -n $srcdir` = "exported" ; then
  78. if test -f $srcdir/STARPU-REVISION ; then
  79. cp $srcdir/STARPU-REVISION .
  80. else
  81. echo "unknown" > ./STARPU-REVISION
  82. fi
  83. else
  84. LC_ALL=C svnversion $srcdir > ./STARPU-REVISION
  85. fi
  86. AM_CONDITIONAL([STARPU_CROSS_COMPILING], [test "x$cross_compiling" = "xyes"])
  87. ###############################################################################
  88. # #
  89. # MIC device compilation #
  90. # (Must be done in beginning to change prefix in the whole configuration) #
  91. # #
  92. ###############################################################################
  93. AC_ARG_ENABLE(mic, [AS_HELP_STRING([--enable-mic],
  94. [use MIC device(s)])], [enable_mic=yes], [enable_mic=no])
  95. AC_ARG_ENABLE(mic-rma, [AS_HELP_STRING([--disable-mic-rma],
  96. [use MIC RMA transfer])], [], [enable_mic_rma=yes])
  97. if test x$enable_mic = xyes ; then
  98. AC_DEFINE(STARPU_USE_MIC, [1], [MIC workers support is enabled])
  99. fi
  100. if test x$enable_mic_rma = xyes ; then
  101. AC_DEFINE([STARPU_MIC_USE_RMA], [1], [MIC RMA transfer is enable])
  102. fi
  103. AM_CONDITIONAL([STARPU_USE_MIC], [test "x$enable_mic" = "xyes"])
  104. ###############################################################################
  105. AC_PATH_PROGS([STARPU_MS_LIB], [lib])
  106. AC_ARG_VAR([STARPU_MS_LIB], [Path to Microsoft's Visual Studio `lib' tool])
  107. AM_CONDITIONAL([STARPU_HAVE_MS_LIB], [test "x$STARPU_MS_LIB" != "x"])
  108. case "$target" in
  109. *-*-mingw*|*-*-cygwin*)
  110. starpu_windows=yes
  111. libext=a
  112. AC_DEFINE(STARPU_HAVE_WINDOWS, [], [Define this on windows.])
  113. ;;
  114. *-*-linux*)
  115. starpu_linux=yes
  116. AC_DEFINE(STARPU_LINUX_SYS, 1, [Define to 1 on Linux])
  117. ;;
  118. esac
  119. AM_CONDITIONAL([STARPU_HAVE_WINDOWS], [test "x$starpu_windows" = "xyes"])
  120. AM_CONDITIONAL([STARPU_LINUX_SYS], [test "x$starpu_linux" = "xyes"])
  121. # on Darwin, GCC targets i386 by default, so we don't have atomic ops
  122. AC_CHECK_SIZEOF([void *])
  123. SIZEOF_VOID_P=$ac_cv_sizeof_void_p
  124. case $SIZEOF_VOID_P in
  125. 4)
  126. case "$target" in
  127. i386-*darwin*) CFLAGS+=" -march=i686 " ;;
  128. esac
  129. STARPU_MS_LIB_ARCH=X86
  130. ;;
  131. 8)
  132. STARPU_MS_LIB_ARCH=X64
  133. ;;
  134. esac
  135. AC_SUBST(STARPU_MS_LIB_ARCH)
  136. # This will be useful for program which use CUDA (and .cubin files) which need
  137. # some path to the CUDA code at runtime.
  138. AC_DEFINE_UNQUOTED(STARPU_BUILD_DIR, "$PWD", [location of StarPU build directory])
  139. AC_SUBST(STARPU_BUILD_DIR, $PWD)
  140. case "${srcdir}" in
  141. /*) AC_DEFINE_UNQUOTED(STARPU_SRC_DIR, "$(eval echo ${srcdir})", [location of StarPU sources])
  142. AC_SUBST(STARPU_SRC_DIR, "$(eval echo ${srcdir})") ;;
  143. *) AC_DEFINE_UNQUOTED(STARPU_SRC_DIR, "$(eval echo $PWD/${srcdir})", [location of StarPU sources])
  144. AC_SUBST(STARPU_SRC_DIR, "$(eval echo $PWD/${srcdir})") ;;
  145. esac
  146. case "$target" in
  147. *-*-mingw*|*-*-cygwin*)
  148. AC_ARG_ENABLE(native-winthreads, [AS_HELP_STRING([--enable-native-winthreads],
  149. [Use native windows threads instead of pthread])],
  150. enable_native_winthreads=$enableval, enable_native_winthreads=no)
  151. ;;
  152. esac
  153. if test x"$enable_native_winthreads" = xyes
  154. then
  155. CPPFLAGS+=" -I$STARPU_SRC_DIR/include/pthread_win32 "
  156. AC_COMPILE_IFELSE(
  157. [AC_LANG_PROGRAM([[
  158. #include <pthread.h>
  159. ]],
  160. [[ pthread_t t; pthread_create(&t, NULL, NULL, NULL); ]])]
  161. ,,AC_MSG_ERROR([pthread_create unavailable]))
  162. else
  163. AC_CHECK_LIB([pthread], [pthread_create])
  164. fi
  165. AC_SEARCH_LIBS([sqrt],[m],,AC_MSG_ERROR([math library unavailable]))
  166. AC_HAVE_LIBRARY([ws2_32])
  167. AC_CHECK_FUNCS([sysconf])
  168. AC_CHECK_FUNC([pthread_spin_lock], have_pthread_spin_lock=yes, have_pthread_spin_lock=no)
  169. if test x$have_pthread_spin_lock = xyes; then
  170. AC_DEFINE(HAVE_PTHREAD_SPIN_LOCK,[],[pthread_spin_lock is available])
  171. fi
  172. # yes, that's non portable, but it's still better than sched_setaffinity
  173. AC_CHECK_FUNCS(pthread_setaffinity_np)
  174. # There is no posix_memalign on Mac OS X, only memalign
  175. AC_CHECK_FUNCS([posix_memalign], [AC_DEFINE([STARPU_HAVE_POSIX_MEMALIGN], [1], [Define to 1 if you have the `posix_memalign' function.])])
  176. AC_CHECK_FUNCS([memalign], [AC_DEFINE([STARPU_HAVE_MEMALIGN], [1], [Define to 1 if you have the `memalign' function.])])
  177. # Some systems don't have drand48
  178. AC_CHECK_FUNC([drand48], have_drand48=yes, have_drand48=no)
  179. AC_CHECK_FUNC([erand48_r], have_erand48_r=yes, have_erand48_r=no)
  180. # Maybe the user still does not want to use the provided drand48
  181. AC_ARG_ENABLE(default-drand48, [AS_HELP_STRING([--disable-default-drand48],
  182. [Do not use the default version of drand48])],
  183. enable_default_drand48=$enableval, enable_default_drand48=yes)
  184. if test x$have_drand48 = xyes -a x$enable_default_drand48 = xyes ; then
  185. AC_DEFINE([STARPU_USE_DRAND48], [1], [Define to 1 if drandr48 is available and should be used])
  186. fi
  187. if test x$have_erand48_r = xyes ; then
  188. AC_DEFINE([STARPU_USE_ERAND48_R], [1], [Define to 1 if erandr48_r is available])
  189. fi
  190. # Some systems do not define strerror_r
  191. AC_CHECK_FUNC([strerror_r], [AC_DEFINE([STARPU_HAVE_STRERROR_R], [1], [Define to 1 if the function strerro_r is available.])])
  192. # Some systems may not define setenv
  193. AC_CHECK_FUNC([setenv], [AC_DEFINE([STARPU_HAVE_SETENV], [1], [Define to 1 if the function setenv is available.])])
  194. # Some systems do not define unsetenv
  195. AC_CHECK_FUNC([unsetenv], [AC_DEFINE([STARPU_HAVE_UNSETENV], [1], [Define to 1 if the function unsetenv is available.])])
  196. # Some systems do not define nearbyintf...
  197. AC_CHECK_FUNC([nearbyintf], [AC_DEFINE([STARPU_HAVE_NEARBYINTF], [1], [Define to 1 if the function nearbyintf is available.])])
  198. # ... but they may define rintf.
  199. AC_CHECK_FUNC([rintf], [AC_DEFINE([STARPU_HAVE_RINTF], [1], [Define to 1 if the function rintf is available.])])
  200. # Define quick check
  201. AC_ARG_ENABLE(quick-check, [AS_HELP_STRING([--enable-quick-check],
  202. [Lower default values for the testcases run by make check to allow a faster execution])],
  203. enable_quick_check=$enableval, enable_quick_check=no)
  204. if test x$enable_quick_check = xyes; then
  205. AC_DEFINE(STARPU_QUICK_CHECK, [1], [enable quick check])
  206. fi
  207. AM_CONDITIONAL([STARPU_QUICK_CHECK], [test "x$enable_quick_check" = "xyes"])
  208. # Define long check
  209. AC_ARG_ENABLE(long-check, [AS_HELP_STRING([--enable-long-check],
  210. [Enable some exhaustive checks which take a really long time])],
  211. enable_long_check=$enableval, enable_long_check=no)
  212. if test x$enable_long_check = xyes; then
  213. AC_DEFINE(STARPU_LONG_CHECK, [1], [enable long check])
  214. fi
  215. AM_CONDITIONAL([STARPU_LONG_CHECK], [test "x$enable_long_check" = "xyes"])
  216. AC_CHECK_HEADERS([malloc.h], [AC_DEFINE([STARPU_HAVE_MALLOC_H], [1], [Define to 1 if you have the <malloc.h> header file.])])
  217. AC_ARG_ENABLE(valgrind, [AS_HELP_STRING([--disable-valgrind],
  218. [Do not check the availability of valgrind.h and helgrind.h])],
  219. enable_valgrind=$enableval, enable_valgrind=yes)
  220. if test "$enable_valgrind" != "no" ; then
  221. AC_CHECK_HEADERS([valgrind/valgrind.h], [AC_DEFINE([STARPU_HAVE_VALGRIND_H], [1], [Define to 1 if you have the <valgrind/valgrind.h> header file.])])
  222. AC_CHECK_HEADERS([valgrind/helgrind.h], [AC_DEFINE([STARPU_HAVE_HELGRIND_H], [1], [Define to 1 if you have the <valgrind/helgrind.h> header file.])])
  223. fi
  224. if test "$enable_valgrind" = "full" ; then
  225. AC_DEFINE([STARPU_VALGRIND_FULL], [1], [Define to 1 to disable STARPU_SKIP_IF_VALGRIND when running tests.])
  226. fi
  227. AC_CHECK_FUNC([sched_yield], [AC_DEFINE([STARPU_HAVE_SCHED_YIELD], [1], [Define to 1 if the function sched_yield is available.])])
  228. AC_CHECK_HEADERS([aio.h])
  229. # This defines HAVE_SYNC_VAL_COMPARE_AND_SWAP
  230. STARPU_CHECK_SYNC_VAL_COMPARE_AND_SWAP
  231. # This defines HAVE_SYNC_BOOL_COMPARE_AND_SWAP
  232. STARPU_CHECK_SYNC_BOOL_COMPARE_AND_SWAP
  233. # This defines HAVE_SYNC_FETCH_AND_ADD
  234. STARPU_CHECK_SYNC_FETCH_AND_ADD
  235. # This defines HAVE_SYNC_FETCH_AND_OR
  236. STARPU_CHECK_SYNC_FETCH_AND_OR
  237. # This defines HAVE_SYNC_LOCK_TEST_AND_SET
  238. STARPU_CHECK_SYNC_LOCK_TEST_AND_SET
  239. # This defines HAVE_SYNC_SYNCHRONIZE
  240. STARPU_CHECK_SYNC_SYNCHRONIZE
  241. CPPFLAGS="${CPPFLAGS} -D_GNU_SOURCE "
  242. STARPU_SEARCH_LIBS([LIBNUMA],[set_mempolicy],[numa],[enable_libnuma=yes],[enable_libnuma=no])
  243. AC_MSG_CHECKING(whether libnuma is available)
  244. AC_MSG_RESULT($enable_libnuma)
  245. if test x$enable_libnuma = xyes; then
  246. AC_DEFINE(STARPU_HAVE_LIBNUMA,[],[libnuma is available])
  247. fi
  248. ###############################################################################
  249. # #
  250. # SCHED_CTX settings #
  251. # #
  252. ###############################################################################
  253. AC_MSG_CHECKING(maximum number of sched_ctxs)
  254. AC_ARG_ENABLE(max_sched_ctxs, [AS_HELP_STRING([--enable-max-sched-ctxs=<number>],
  255. [maximum number of sched_ctxs])],
  256. max_sched_ctxs=$enableval, max_sched_ctxs=10)
  257. AC_MSG_RESULT($max_sched_ctxs)
  258. AC_DEFINE_UNQUOTED(STARPU_NMAX_SCHED_CTXS, [$max_sched_ctxs], [Maximum number of sched_ctxs supported])
  259. AC_ARG_ENABLE([sc_hypervisor],
  260. [AS_HELP_STRING([--enable-sc-hypervisor],
  261. [enable resizing contexts (experimental)])],
  262. [enable_sc_hypervisor="yes"],
  263. [enable_sc_hypervisor="no"])
  264. #for pkgconfig
  265. AC_SUBST(STARPU_SC_HYPERVISOR)
  266. if test "x$enable_sc_hypervisor" = "xyes"; then
  267. AC_DEFINE(STARPU_USE_SC_HYPERVISOR, [1], [enable sc_hypervisor lib])
  268. # PKG_CHECK_MODULES([SC_HYPERVISOR], [libsc_hypervisor], [], build_sc_hypervisor="yes")
  269. STARPU_SC_HYPERVISOR="-lsc_hypervisor"
  270. build_sc_hypervisor="yes"
  271. else
  272. build_sc_hypervisor="no"
  273. fi
  274. AM_CONDITIONAL([STARPU_BUILD_SC_HYPERVISOR], [test "x$build_sc_hypervisor" = "xyes"])
  275. AM_CONDITIONAL([STARPU_USE_SC_HYPERVISOR], [test "x$build_sc_hypervisor" = "xyes"])
  276. ###############################################################################
  277. # #
  278. # CPUs settings #
  279. # #
  280. ###############################################################################
  281. AC_MSG_CHECKING(maximum number of CPUs)
  282. AC_ARG_ENABLE(maxcpus, [AS_HELP_STRING([--enable-maxcpus=<number>],
  283. [maximum number of CPUs])],
  284. maxcpus=$enableval, maxcpus=64)
  285. AC_MSG_RESULT($maxcpus)
  286. AC_DEFINE_UNQUOTED(STARPU_MAXCPUS, [$maxcpus], [Maximum number of CPUs supported])
  287. AC_MSG_CHECKING(whether CPUs should be used)
  288. AC_ARG_ENABLE(cpu, [AS_HELP_STRING([--disable-cpu],
  289. [do not use the CPU(s)])],
  290. enable_cpu=$enableval, enable_cpu=yes)
  291. AC_MSG_RESULT($enable_cpu)
  292. AC_SUBST(STARPU_USE_CPU, $enable_cpu)
  293. AM_CONDITIONAL(STARPU_USE_CPU, test x$enable_cpu = xyes)
  294. if test x$enable_cpu = xyes; then
  295. AC_DEFINE(STARPU_USE_CPU, [1], [CPU driver is activated])
  296. fi
  297. ###############################################################################
  298. # #
  299. # CUDA settings #
  300. # #
  301. ###############################################################################
  302. AC_MSG_CHECKING(maximum number of CUDA devices)
  303. AC_ARG_ENABLE(maxcudadev, [AS_HELP_STRING([--enable-maxcudadev=<number>],
  304. [maximum number of CUDA devices])],
  305. nmaxcudadev=$enableval, nmaxcudadev=4)
  306. AC_MSG_RESULT($nmaxcudadev)
  307. AC_DEFINE_UNQUOTED(STARPU_MAXCUDADEVS, [$nmaxcudadev],
  308. [maximum number of CUDA devices])
  309. AC_ARG_ENABLE(cuda, [AS_HELP_STRING([--disable-cuda],
  310. [do not use CUDA device(s)])],, [enable_cuda=maybe])
  311. #AC_MSG_CHECKING(whether CUDA is available)
  312. AC_ARG_WITH(cuda-dir,
  313. [AS_HELP_STRING([--with-cuda-dir=<path>],
  314. [specify CUDA installation directory])],
  315. [
  316. cuda_dir="$withval"
  317. # in case this was not explicit yet
  318. enable_cuda=yes
  319. ], cuda_dir=no)
  320. AC_ARG_WITH(cuda-include-dir,
  321. [AS_HELP_STRING([--with-cuda-include-dir=<path>],
  322. [specify where CUDA headers are installed])],
  323. [
  324. cuda_include_dir="$withval"
  325. # in case this was not explicit yet
  326. enable_cuda=yes
  327. ], [cuda_include_dir=no])
  328. AC_ARG_WITH(cuda-lib-dir,
  329. [AS_HELP_STRING([--with-cuda-lib-dir=<path>],
  330. [specify where CUDA libraries are installed])],
  331. [
  332. cuda_lib_dir="$withval"
  333. # in case this was not explicit yet
  334. enable_cuda=yes
  335. ], [cuda_lib_dir=no])
  336. AC_DEFUN([STARPU_CHECK_CUDA_L],
  337. [
  338. __cuda_L=$1
  339. SAVED_LDFLAGS="${LDFLAGS}"
  340. STARPU_CUDA_LDFLAGS="${__cuda_L}"
  341. AC_MSG_CHECKING(whether CUDA is available with: $__cuda_L)
  342. AC_MSG_RESULT()
  343. LDFLAGS="${SAVED_LDFLAGS} ${__cuda_L}"
  344. AC_HAVE_LIBRARY([cuda],[have_valid_cuda=yes],[have_valid_cuda=no])
  345. unset ac_cv_lib_cuda_main
  346. if test "$have_valid_cuda" = "yes" ; then
  347. AC_HAVE_LIBRARY([cudart],[have_valid_cuda=yes],[have_valid_cuda=no])
  348. unset ac_cv_lib_cudart_main
  349. if test "$have_valid_cuda" = yes ; then
  350. STARPU_CUDA_LDFLAGS="$STARPU_CUDA_LDFLAGS -lcudart"
  351. LDFLAGS="${SAVED_LDFLAGS} ${STARPU_CUDA_LDFLAGS}"
  352. # we also check that CUBLAS is available
  353. AC_HAVE_LIBRARY([cublas],[have_valid_cuda=yes],[have_valid_cuda=no])
  354. unset ac_cv_lib_cublas_main
  355. if test "$have_valid_cuda" = "yes" ; then
  356. STARPU_CUDA_LDFLAGS="$STARPU_CUDA_LDFLAGS -lcublas"
  357. fi
  358. fi
  359. fi
  360. LDFLAGS="${SAVED_LDFLAGS}"
  361. ])
  362. AC_DEFUN([STARPU_CHECK_CUDA],
  363. [
  364. __cuda_dir=$1
  365. __cuda_include_dir=$2
  366. __cuda_lib_dir=$3
  367. if test -z "$__cuda_lib_dir" ; then
  368. __cuda_lib_dir=no
  369. fi
  370. if test -z "$__cuda_include_dir" ; then
  371. __cuda_include_dir=no
  372. fi
  373. if test -z "$__cuda_dir" ; then
  374. __cuda_dir=no
  375. fi
  376. if test "$__cuda_dir" != "no" ; then
  377. AC_MSG_CHECKING(whether CUDA is available in $__cuda_dir, $__cuda_include_dir and $__cuda_lib_dir)
  378. else
  379. AC_MSG_CHECKING(whether CUDA is available)
  380. fi
  381. AC_MSG_RESULT()
  382. if test "$__cuda_include_dir" = "no" -a "$__cuda_dir" != "no" ; then
  383. __cuda_include_dir="$__cuda_dir/include"
  384. fi
  385. SAVED_CPPFLAGS="$CPPFLAGS"
  386. have_valid_cuda=no
  387. if test "$__cuda_include_dir" != "no" ; then
  388. CPPFLAGS="${CPPFLAGS} -I$__cuda_include_dir"
  389. fi
  390. AC_CHECK_HEADER([cuda.h],[have_valid_cuda=yes],[have_valid_cuda=no])
  391. unset ac_cv_header_cuda_h
  392. if test "$have_valid_cuda" = "yes" ; then
  393. if test "$__cuda_lib_dir" != "no" ; then
  394. STARPU_CHECK_CUDA_L("-L${__cuda_lib_dir}")
  395. else
  396. if test "$__cuda_dir" != "no" ; then
  397. for __cuda_libdir in lib64 lib lib/x64 lib/Win32 ; do
  398. STARPU_CHECK_CUDA_L("-L${__cuda_dir}/${__cuda_libdir}")
  399. if test "$have_valid_cuda" = yes ; then
  400. break
  401. fi
  402. done
  403. else
  404. STARPU_CHECK_CUDA_L("")
  405. fi
  406. fi
  407. fi
  408. if test "$have_valid_cuda" = "no" ; then
  409. CPPFLAGS="${SAVED_CPPFLAGS}"
  410. unset STARPU_CUDA_LDFLAGS
  411. else
  412. # nvcc is a wrapper around GCC, and calls it with the -dumpspecs
  413. # option, which is GCC specific. If $CC does not support -dumpspecs, we
  414. # should let nvcc choose another compiler (by default, gcc, if it is
  415. # installed). If gcc is not installed, the build will probably fail.
  416. $CC -dumpspecs >/dev/null 2>&1
  417. if test $? -eq 0 -a x$starpu_windows != xyes; then
  418. NVCCFLAGS="${NVCCFLAGS} -ccbin \${CC}"
  419. fi
  420. if test "$__cuda_include_dir" != "no"; then
  421. STARPU_CUDA_CPPFLAGS="-I$__cuda_include_dir"
  422. NVCCFLAGS="${NVCCFLAGS} -I$__cuda_include_dir"
  423. fi
  424. fi
  425. ])
  426. if test x$enable_cuda = xyes -o x$enable_cuda = xmaybe; then
  427. STARPU_CHECK_CUDA("$cuda_dir", "$cuda_include_dir", "$cuda_lib_dir")
  428. if test "$have_valid_cuda" = "no" ; then
  429. STARPU_CHECK_CUDA("$CUDA_ROOT", "$CUDA_PATH", "$CUDA_INC_PATH", "$CUDA_LIB_PATH")
  430. fi
  431. if test "$have_valid_cuda" = "no" ; then
  432. for f in "/usr/local/cuda" "/c/cuda" "/cygdrive/c/cuda" "/opt/cuda" "$CUDA_ROOT" "$CUDA_PATH" "$CUDA_INC_PATH/.." "$CUDA_INC/.." "$CUDA_BIN/.." "$CUDA_SDK/.." "$CUDA_INSTALL_PATH" "$CUDA_TOOLKIT"; do
  433. if test -n "$f" ; then
  434. STARPU_CHECK_CUDA("$f", "no", "no")
  435. if test "$have_valid_cuda" = "yes" ; then
  436. break
  437. fi
  438. fi
  439. done
  440. fi
  441. # Check cuda is compatible with the C compiler
  442. AC_MSG_CHECKING(whether CUDA is working)
  443. if test "$have_valid_cuda" = "yes" ; then
  444. SAVED_CPPFLAGS="${CPPFLAGS}"
  445. CPPFLAGS="${CPPFLAGS} ${STARPU_CUDA_CPPFLAGS}"
  446. SAVED_LDFLAGS="${LDFLAGS}"
  447. LDFLAGS="${LDFLAGS} ${STARPU_CUDA_LDFLAGS} -lcuda"
  448. AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
  449. [[#include <cuda.h>]],
  450. [[]]
  451. )],
  452. [
  453. AC_RUN_IFELSE([AC_LANG_PROGRAM(
  454. [[#include <cuda.h>]],
  455. [[]]
  456. )],
  457. [have_valid_cuda="yes"],
  458. [
  459. AC_MSG_RESULT([CUDA found and can be compiled, but compiled application can not be run, is the CUDA path missing in LD_LIBRARY_PATH?])
  460. have_valid_cuda="no"
  461. ])
  462. ],
  463. [
  464. AC_MSG_ERROR([CUDA found, but cuda.h could not be compiled])
  465. have_valid_cuda="no"
  466. ]
  467. )
  468. CPPFLAGS="${SAVED_CPPFLAGS}"
  469. LDFLAGS="${SAVED_LDFLAGS}"
  470. fi
  471. AC_MSG_RESULT($have_valid_cuda)
  472. # in case CUDA was explicitely required, but is not available, this is an error
  473. if test x$enable_cuda = xyes -a x$have_valid_cuda = xno; then
  474. AC_MSG_ERROR([cannot find CUDA])
  475. fi
  476. # now we enable CUDA if and only if a proper setup is available
  477. enable_cuda=$have_valid_cuda
  478. fi
  479. if test x$enable_cuda = xyes; then
  480. if test "$NVCC" = "" ; then
  481. AC_PATH_PROG([NVCC], [nvcc], [not-found],
  482. [$cuda_dir/bin:$PATH:/usr/local/cuda/bin:/usr/bin:/bin])
  483. fi
  484. if test "x$NVCC" = "xnot-found"; then
  485. AC_MSG_WARN(['nvcc' not found, disabling CUDA])
  486. enable_cuda=no
  487. fi
  488. fi
  489. AC_MSG_CHECKING(whether CUDA should be used)
  490. AC_MSG_RESULT($enable_cuda)
  491. AC_SUBST(STARPU_USE_CUDA, $enable_cuda)
  492. AM_CONDITIONAL(STARPU_USE_CUDA, test x$enable_cuda = xyes)
  493. if test x$enable_cuda = xyes; then
  494. AC_DEFINE(STARPU_USE_CUDA, [1], [CUDA support is activated])
  495. # On Darwin, the libstdc++ dependency is not automatically added by nvcc
  496. # case "$target" in
  497. # *-*darwin*) AC_HAVE_LIBRARY([stdc++], []) ;;
  498. # #*-*darwin*) AC_HAVE_LIBRARY([stdc++], [STARPU_CUDA_LDFLAGS="$STARPU_CUDA_LDFLAGS -lstdc++"]) ;;
  499. # esac
  500. STARPU_CUDA_LDFLAGS="$STARPU_CUDA_LDFLAGS -lcuda"
  501. STARPU_CUFFT_LDFLAGS="-lcufft"
  502. if test "$F77" = "gfortran" ; then
  503. STARPU_CUDA_FORTRAN_LDFLAGS="-lgfortran"
  504. AC_SUBST(STARPU_CUDA_FORTRAN_LDFLAGS)
  505. fi
  506. #in case this is a 64bit setup, we tell nvcc to use a -m64 flag
  507. if test x$SIZEOF_VOID_P = x8; then
  508. NVCCFLAGS="${NVCCFLAGS} -m64"
  509. AC_SUBST(NVCCFLAGS)
  510. fi
  511. AC_CHECK_HEADERS([cuda_gl_interop.h])
  512. fi
  513. dnl Hey dude, are you around?
  514. PKG_PROG_PKG_CONFIG
  515. have_magma=no
  516. if test x$enable_cuda = xyes; then
  517. PKG_CHECK_MODULES([MAGMA], [magma], [
  518. AC_DEFINE([STARPU_HAVE_MAGMA], [1], [Define to 1 if you have the MAGMA library.])
  519. AC_SUBST([STARPU_HAVE_MAGMA], [1])
  520. have_magma=yes
  521. ], [:])
  522. fi
  523. AM_CONDITIONAL(STARPU_HAVE_MAGMA, [test x$have_magma = xyes])
  524. AC_MSG_CHECKING(whether MAGMA should be used)
  525. AC_MSG_RESULT($have_magma)
  526. # cufftDoubleComplex may not be available on an old CUDA setup
  527. AC_CHECK_TYPE(cufftDoubleComplex,
  528. [have_cufftdoublecomplex=yes],
  529. [have_cufftdoublecomplex=no], [#include <cufft.h>])
  530. AM_CONDITIONAL(STARPU_HAVE_CUFFTDOUBLECOMPLEX, test x$have_cufftdoublecomplex = xyes)
  531. if test x$have_cufftdoublecomplex = xyes; then
  532. AC_DEFINE(STARPU_HAVE_CUFFTDOUBLECOMPLEX, [1], [cufftDoubleComplex is available])
  533. fi
  534. # The CURAND library is only available since CUDA 3.2
  535. have_curand=$enable_cuda
  536. if test x$enable_cuda = xyes; then
  537. SAVED_LDFLAGS="${LDFLAGS}"
  538. LDFLAGS="${LDFLAGS} ${STARPU_CUDA_LDFLAGS}"
  539. AC_HAVE_LIBRARY([curand],[have_curand=yes],[have_curand=no])
  540. LDFLAGS="${SAVED_LDFLAGS}"
  541. fi
  542. AC_MSG_CHECKING(whether CURAND is available)
  543. AC_MSG_RESULT($have_curand)
  544. if test x$have_curand = xyes; then
  545. AC_DEFINE(STARPU_HAVE_CURAND,[1], [CURAND is available])
  546. STARPU_CURAND_LDFLAGS="$STARPU_CURAND_LDFLAGS -lcurand"
  547. AC_SUBST(STARPU_CURAND_LDFLAGS)
  548. fi
  549. # Peer transfers are only supported since CUDA 4.0
  550. # Disable them if user explicity wants to disable them
  551. AC_ARG_ENABLE(cuda_memcpy_peer, [AS_HELP_STRING([--disable-cuda-memcpy-peer], [do not allow peer transfers when using CUDA 4.0])],, [enable_cuda_memcpy_peer=yes])
  552. have_cuda_memcpy_peer=no
  553. if test x$enable_cuda_memcpy_peer = xyes -a x$enable_cuda = xyes ; then
  554. SAVED_LDFLAGS="${LDFLAGS}"
  555. LDFLAGS="${LDFLAGS} ${STARPU_CUDA_LDFLAGS}"
  556. AC_CHECK_FUNC([cudaMemcpyPeer], have_cuda_memcpy_peer=yes, have_cuda_memcpy_peer=no)
  557. LDFLAGS="${SAVED_LDFLAGS}"
  558. fi
  559. if test x$have_cuda_memcpy_peer = xyes; then
  560. AC_DEFINE(HAVE_CUDA_MEMCPY_PEER,[],[Peer transfers are supported in CUDA])
  561. fi
  562. if test x$enable_cuda = xyes; then
  563. if test x$starpu_windows != xyes ; then
  564. STARPU_CUDA_LDFLAGS="$STARPU_CUDA_LDFLAGS -lstdc++"
  565. fi
  566. AC_SUBST(STARPU_CUDA_LDFLAGS)
  567. AC_SUBST(STARPU_CUFFT_LDFLAGS)
  568. AC_SUBST(STARPU_CUDA_CPPFLAGS)
  569. fi
  570. AC_ARG_VAR([NVCC], [CUDA compiler])
  571. AC_ARG_VAR([NVCCFLAGS], [CUDA compiler flags])
  572. ###############################################################################
  573. # #
  574. # OpenCL settings #
  575. # #
  576. ###############################################################################
  577. AC_MSG_CHECKING(maximum number of OpenCL devices)
  578. AC_ARG_ENABLE(maxopencldev, [AS_HELP_STRING([--enable-maxopencldev=<number>],
  579. [maximum number of OPENCL devices])],
  580. nmaxopencldev=$enableval, nmaxopencldev=8)
  581. AC_MSG_RESULT($nmaxopencldev)
  582. AC_DEFINE_UNQUOTED(STARPU_MAXOPENCLDEVS, [$nmaxopencldev],
  583. [maximum number of OPENCL devices])
  584. AC_ARG_ENABLE(opencl, [AS_HELP_STRING([--disable-opencl],
  585. [do not use OpenCL device(s)])],, [enable_opencl=maybe])
  586. have_valid_opencl=no
  587. AC_DEFUN([STARPU_CHECK_OPENCL],
  588. [
  589. __opencl_dir=$1
  590. __opencl_include_dir=$2
  591. __opencl_lib_dir=$3
  592. if test "$__opencl_dir" != "no" ; then
  593. AC_MSG_CHECKING(whether OpenCL is available in $__opencl_dir $__opencl_include_dir and $__opencl_lib_dir)
  594. else
  595. AC_MSG_CHECKING(whether OpenCL is available)
  596. fi
  597. AC_MSG_RESULT()
  598. if test "$__opencl_include_dir" = "no" -a "$__opencl_dir" != "no" ; then
  599. __opencl_include_dir="$__opencl_dir/include"
  600. fi
  601. SAVED_CPPFLAGS="$CPPFLAGS"
  602. SAVED_LDFLAGS="${LDFLAGS}"
  603. if test "$__opencl_include_dir" != "no" ; then
  604. CPPFLAGS="${CPPFLAGS} -I$__opencl_include_dir"
  605. fi
  606. AC_CHECK_HEADER([CL/cl.h],[have_valid_opencl=yes],[have_valid_opencl=no])
  607. unset ac_cv_header_CL_cl_h
  608. if test "$have_valid_opencl" = "yes" ; then
  609. if test "$__opencl_lib_dir" != "no"; then
  610. LDFLAGS="${SAVED_LDFLAGS} -L$__opencl_lib_dir"
  611. AC_HAVE_LIBRARY([OpenCL],[have_valid_opencl=yes],[have_valid_opencl=no])
  612. unset ac_cv_lib_OpenCL_main
  613. else
  614. AC_MSG_CHECKING(whether OpenCL is available in $__opencl_dir)
  615. AC_MSG_RESULT()
  616. AC_HAVE_LIBRARY([OpenCL],[have_valid_opencl=yes],[have_valid_opencl=no])
  617. unset ac_cv_lib_OpenCL_main
  618. if test "$have_valid_opencl" = "no" -a "$__opencl_dir" != "no" ; then
  619. for __cuda_libdir in lib64 lib lib/x86 lib/Win32 ; do
  620. __opencl_lib_dir="$__opencl_dir/$__cuda_libdir"
  621. AC_MSG_CHECKING(whether OpenCL is available in $__opencl_dir and $__opencl_lib_dir)
  622. AC_MSG_RESULT()
  623. LDFLAGS="${SAVED_LDFLAGS} -L$__opencl_lib_dir"
  624. AC_HAVE_LIBRARY([OpenCL],[have_valid_opencl=yes],[have_valid_opencl=no])
  625. unset ac_cv_lib_OpenCL_main
  626. if test "$have_valid_opencl" = yes ; then
  627. break
  628. fi
  629. done
  630. else
  631. LDFLAGS="${SAVED_LDFLAGS}"
  632. AC_HAVE_LIBRARY([OpenCL],[have_valid_opencl=yes],[have_valid_opencl=no])
  633. unset ac_cv_lib_OpenCL_main
  634. fi
  635. fi
  636. fi
  637. if test "$have_valid_opencl" = "yes" -a "$__opencl_include_dir" != "no"; then
  638. STARPU_OPENCL_CPPFLAGS="-I$__opencl_include_dir"
  639. AC_CHECK_HEADERS([CL/cl_ext.h])
  640. fi
  641. CPPFLAGS="${SAVED_CPPFLAGS}"
  642. LDFLAGS="${SAVED_LDFLAGS}"
  643. if test "$have_valid_opencl" = "yes" ; then
  644. if test "$__opencl_lib_dir" != "no"; then
  645. STARPU_OPENCL_LDFLAGS="-L$__opencl_lib_dir"
  646. fi
  647. STARPU_OPENCL_LDFLAGS="${STARPU_OPENCL_LDFLAGS} -lOpenCL"
  648. fi
  649. ])
  650. #AC_MSG_CHECKING(whether OpenCL is available)
  651. AC_ARG_WITH(opencl-dir,
  652. [AS_HELP_STRING([--with-opencl-dir=<path>],
  653. [specify OpenCL installation directory])],
  654. [
  655. opencl_dir="$withval"
  656. # in case this was not explicit yet
  657. enable_opencl=yes
  658. ], opencl_dir=no)
  659. AC_ARG_WITH(opencl-include-dir,
  660. [AS_HELP_STRING([--with-opencl-include-dir=<path>],
  661. [specify where OpenCL headers are installed])],
  662. [
  663. opencl_include_dir="$withval"
  664. # in case this was not explicit yet
  665. enable_opencl=yes
  666. ], [opencl_include_dir=no])
  667. AC_ARG_WITH(opencl-lib-dir,
  668. [AS_HELP_STRING([--with-opencl-lib-dir=<path>],
  669. [specify where OpenCL libraries are installed])],
  670. [
  671. opencl_lib_dir="$withval"
  672. # in case this was not explicit yet
  673. enable_opencl=yes
  674. ], [opencl_lib_dir=no])
  675. AC_DEFUN([STARPU_LOOK_FOR_OPENCL],
  676. [
  677. if test "x$has_opencl_being_checked" != "xyes" ; then
  678. STARPU_CHECK_OPENCL("$opencl_dir", "$opencl_include_dir", "$opencl_lib_dir")
  679. if test "$have_valid_opencl" = "no" ; then
  680. for f in "/usr/local/cuda" "/c/cuda" "/cygdrive/c/cuda" "/opt/cuda" "$CUDA_ROOT" "$CUDA_PATH" "$CUDA_INC_PATH/.." "$CUDA_INSTALL_PATH" "$CUDA_TOOLKIT"; do
  681. if test -n "$f" ; then
  682. STARPU_CHECK_OPENCL("$f", "no", "no")
  683. if test "$have_valid_opencl" = "yes" ; then
  684. break
  685. fi
  686. fi
  687. done
  688. fi
  689. has_opencl_being_checked=yes
  690. fi
  691. ])
  692. if test x$enable_opencl = xyes -o x$enable_opencl = xmaybe; then
  693. case $target in
  694. *-*-darwin*)
  695. AC_MSG_CHECKING(whether OpenCL is available)
  696. SAVED_LIBS=$LIBS
  697. LIBS="$LIBS -framework OpenCL"
  698. AC_LINK_IFELSE(
  699. [AC_LANG_PROGRAM([[
  700. #ifdef __APPLE_CC__
  701. #include <OpenCL/opencl.h>
  702. #else
  703. #include <CL/cl.h>
  704. #endif
  705. ]],
  706. [[return clSetKernelArg(0, 0, 0, 0); ]])],
  707. [AC_MSG_RESULT(yes)
  708. enable_opencl=yes
  709. have_valid_opencl=yes
  710. STARPU_OPENCL_CPPFLAGS=
  711. STARPU_OPENCL_LDFLAGS="-framework OpenCL"],
  712. [AC_MSG_RESULT(no)
  713. enable_opencl=no])
  714. LIBS=$SAVED_LIBS
  715. ;;
  716. *)
  717. STARPU_LOOK_FOR_OPENCL()
  718. # in case OpenCL was explicitely required, but is not available, this is an error
  719. if test x$enable_opencl = xyes -a x$have_valid_opencl = xno; then
  720. AC_MSG_ERROR([cannot find OpenCL])
  721. fi
  722. # now we enable OpenCL if and only if a proper setup is available
  723. enable_opencl=$have_valid_opencl
  724. ;;
  725. esac
  726. fi
  727. AC_MSG_CHECKING(whether OpenCL should be used)
  728. AC_MSG_RESULT($enable_opencl)
  729. AC_SUBST(STARPU_USE_OPENCL, $enable_opencl)
  730. AM_CONDITIONAL(STARPU_USE_OPENCL, test x$enable_opencl = xyes)
  731. if test x$enable_opencl = xyes ; then
  732. AC_DEFINE(STARPU_USE_OPENCL, [1], [OpenCL support is activated])
  733. STARPU_OPENCL_CPPFLAGS="${STARPU_OPENCL_CPPFLAGS} -DSTARPU_OPENCL_DATADIR=${datarootdir}/starpu/opencl"
  734. AC_SUBST(STARPU_OPENCL_DATAdir, "$(eval echo ${datarootdir}/starpu/opencl/examples)")
  735. AC_SUBST(STARPU_OPENCL_CPPFLAGS)
  736. AC_SUBST(STARPU_OPENCL_LDFLAGS)
  737. fi
  738. ###############################################################################
  739. # #
  740. # General GPU settings #
  741. # #
  742. ###############################################################################
  743. AC_MSG_CHECKING(whether asynchronous copy should be disabled)
  744. AC_ARG_ENABLE(asynchronous-copy, [AS_HELP_STRING([--disable-asynchronous-copy],
  745. [disable asynchronous copy between CPU and GPU])],
  746. enable_asynchronous_copy=$enableval, enable_asynchronous_copy=yes)
  747. disable_asynchronous_copy=no
  748. if test x$enable_asynchronous_copy = xno ; then
  749. disable_asynchronous_copy=yes
  750. fi
  751. AC_MSG_RESULT($disable_asynchronous_copy)
  752. if test x$disable_asynchronous_copy = xyes ; then
  753. AC_DEFINE([STARPU_DISABLE_ASYNCHRONOUS_COPY], [1], [Define to 1 to disable asynchronous copy between CPU and GPU devices])
  754. fi
  755. AC_MSG_CHECKING(whether asynchronous CUDA copy should be disabled)
  756. AC_ARG_ENABLE(asynchronous-cuda-copy, [AS_HELP_STRING([--disable-asynchronous-cuda-copy],
  757. [disable asynchronous copy between CPU and CUDA devices])],
  758. enable_asynchronous_cuda_copy=$enableval, enable_asynchronous_cuda_copy=yes)
  759. disable_asynchronous_cuda_copy=no
  760. if test x$enable_asynchronous_cuda_copy = xno ; then
  761. disable_asynchronous_cuda_copy=yes
  762. fi
  763. AC_MSG_RESULT($disable_asynchronous_cuda_copy)
  764. if test x$disable_asynchronous_cuda_copy = xyes ; then
  765. AC_DEFINE([STARPU_DISABLE_ASYNCHRONOUS_CUDA_COPY], [1], [Define to 1 to disable asynchronous copy between CPU and CUDA devices])
  766. fi
  767. AC_MSG_CHECKING(whether asynchronous OpenCL copy should be disabled)
  768. AC_ARG_ENABLE(asynchronous-opencl-copy, [AS_HELP_STRING([--disable-asynchronous-opencl-copy],
  769. [disable asynchronous copy between CPU and OPENCL devices])],
  770. enable_asynchronous_opencl_copy=$enableval, enable_asynchronous_opencl_copy=yes)
  771. disable_asynchronous_opencl_copy=no
  772. if test x$enable_asynchronous_opencl_copy = xno ; then
  773. disable_asynchronous_opencl_copy=yes
  774. fi
  775. AC_MSG_RESULT($disable_asynchronous_opencl_copy)
  776. if test x$disable_asynchronous_opencl_copy = xyes ; then
  777. AC_DEFINE([STARPU_DISABLE_ASYNCHRONOUS_OPENCL_COPY], [1], [Define to 1 to disable asynchronous copy between CPU and OpenCL devices])
  778. fi
  779. AC_MSG_CHECKING(whether asynchronous MIC copy should be disabled)
  780. AC_ARG_ENABLE(asynchronous-mic-copy, [AS_HELP_STRING([--disable-asynchronous-mic-copy],
  781. [disable asynchronous copy between CPU and MIC devices])],
  782. enable_asynchronous_mic_copy=$enableval, enable_asynchronous_mic_copy=yes)
  783. disable_asynchronous_mic_copy=no
  784. if test x$enable_asynchronous_mic_copy = xno ; then
  785. disable_asynchronous_mic_copy=yes
  786. fi
  787. AC_MSG_RESULT($disable_asynchronous_mic_copy)
  788. if test x$disable_asynchronous_mic_copy = xyes ; then
  789. AC_DEFINE([STARPU_DISABLE_ASYNCHRONOUS_MIC_COPY], [1], [Define to 1 to disable asynchronous copy between CPU and MIC devices])
  790. fi
  791. ###############################################################################
  792. # #
  793. # Drivers #
  794. # #
  795. ###############################################################################
  796. AC_ARG_ENABLE(opencl-simulator, [AS_HELP_STRING([--enable-opencl-simulator],
  797. [Enable the use of an OpenCL simulator])],
  798. enable_opencl_simulator=$enableval, enable_opencl_simulator=no)
  799. if test x$enable_opencl_simulator = xyes; then
  800. enable_simgrid=yes
  801. AC_DEFINE(STARPU_OPENCL_SIMULATOR, 1, [Define this to enable using an OpenCL simulator])
  802. fi
  803. AC_ARG_ENABLE(simgrid, [AS_HELP_STRING([--enable-simgrid],
  804. [Enable simulating execution in simgrid])],
  805. enable_simgrid=$enableval, enable_simgrid=no)
  806. if test x$enable_simgrid = xyes ; then
  807. if test -n "$SIMGRID_CFLAGS" ; then
  808. CFLAGS="$SIMGRID_CFLAGS $CFLAGS"
  809. fi
  810. if test -n "$SIMGRID_LIBS" ; then
  811. LDFLAGS="$SIMGRID_LIBS $LDFLAGS"
  812. fi
  813. AC_HAVE_LIBRARY([simgrid], [],
  814. [
  815. AC_MSG_ERROR(Simgrid support needs simgrid installed)
  816. ]
  817. )
  818. AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
  819. [[#include <msg/msg.h>]],
  820. [[msg_host_t foo; ]]
  821. )],
  822. [],
  823. [
  824. AC_MSG_ERROR(StarPU needs a version of Simgrid which defines the type msg_host_t (should be any version >= 3.8.1))
  825. ])
  826. AC_DEFINE(STARPU_SIMGRID, 1, [Define this to enable simgrid execution])
  827. # We won't bind or detect anything
  828. with_hwloc=no
  829. fi
  830. AM_CONDITIONAL(STARPU_SIMGRID, test x$enable_simgrid = xyes)
  831. AC_SUBST(SIMGRID_CFLAGS)
  832. AC_SUBST(SIMGRID_LIBS)
  833. AC_MSG_CHECKING(whether blocking drivers should be disabled)
  834. AC_ARG_ENABLE(blocking-drivers, [AS_HELP_STRING([--enable-blocking-drivers], [enable blocking drivers])],
  835. enable_blocking=$enableval, enable_blocking=no)
  836. AC_MSG_RESULT($enable_blocking)
  837. if test x$enable_blocking = xno ; then
  838. AC_DEFINE(STARPU_NON_BLOCKING_DRIVERS, [1], [drivers must progress])
  839. fi
  840. ###############################################################################
  841. # #
  842. # MIC settings #
  843. # #
  844. ###############################################################################
  845. AC_MSG_CHECKING(maximum number of MIC devices)
  846. AC_ARG_ENABLE(maxmicdev, [AS_HELP_STRING([--enable-maxmicdev=<number>],
  847. [maximum number of MIC devices])],
  848. nmaxmicdev=$enableval, nmaxmicdev=4)
  849. AC_MSG_RESULT($nmaxmicdev)
  850. AC_DEFINE_UNQUOTED(STARPU_MAXMICDEVS, [$nmaxmicdev],
  851. [maximum number of MIC devices])
  852. AC_MSG_CHECKING(maximum number of MIC threads)
  853. AC_ARG_ENABLE(maxmicthreads, [AS_HELP_STRING([--enable-maxmicthreads=<number>],
  854. [maximum number of MIC threads])],
  855. nmaxmicthreads=$enableval, nmaxmicthreads=940)
  856. AC_MSG_RESULT($nmaxmicthread)
  857. AC_DEFINE_UNQUOTED(STARPU_MAXMICCORES, [$nmaxmicthreads],
  858. [maximum number of MIC cores])
  859. AC_ARG_WITH(coi-dir,
  860. [AS_HELP_STRING([--with-coi-dir=<path>],
  861. [specify the MIC's COI installation directory])],
  862. [coi_dir="$withval"],
  863. [coi_dir=no])
  864. AC_ARG_WITH(coi-include-dir,
  865. [AS_HELP_STRING([--with-coi-include-dir=<path>],
  866. [specify where the MIC's COI headers are installed])],
  867. [coi_include_dir="$withval"],
  868. [coi_include_dir=no])
  869. AC_ARG_WITH(coi-lib-dir,
  870. [AS_HELP_STRING([--with-coi-lib-dir=<path>],
  871. [specify where the MIC's COI libraries are installed])],
  872. [coi_lib_dir="$withval"],
  873. [coi_lib_dir=no])
  874. AC_DEFUN([STARPU_CHECK_COI_RUNTIME],
  875. [
  876. __coi_dir=$1
  877. __coi_include_dir=$2
  878. __coi_lib_dir=$3
  879. if test "$__coi_dir" != "no" -a "$__coi_dir" != "" ; then
  880. AC_MSG_CHECKING(whether MIC's COI runtime is available in $__coi_dir)
  881. else
  882. AC_MSG_CHECKING(whether MIC's COI runtime is available)
  883. fi
  884. AC_MSG_RESULT()
  885. if test "$__coi_include_dir" = "no" -a "$__coi_dir" != "no" ; then
  886. __coi_include_dir="${__coi_dir}/include"
  887. fi
  888. if test "$__coi_lib_dir" = "no" -a "$__coi_dir" != "no" ; then
  889. __coi_lib_dir="${__coi_dir}/lib"
  890. fi
  891. SAVED_CPPFLAGS="$CPPFLAGS"
  892. SAVED_LDFLAGS="$LDFLAGS"
  893. if test "$__coi_include_dir" != "no" ; then
  894. CPPFLAGS="${CPPFLAGS} -I$__coi_include_dir"
  895. fi
  896. if test "$__coi_lib_dir" != "no" ; then
  897. LDFLAGS="${LDFLAGS} -L$__coi_lib_dir"
  898. fi
  899. AC_CHECK_HEADER([source/COIEngine_source.h],[have_valid_coi=yes],[have_valid_coi=no])
  900. if test "$have_valid_coi" = "yes" ; then
  901. AC_HAVE_LIBRARY([$4],[have_valid_coi=yes],[have_valid_coi=no])
  902. if test "$have_valid_coi" = "no" ; then
  903. if test "$3" = "no" -a "$__coi_dir" != "no" ; then
  904. # ${__coi_dir}/lib didn't work, let's try with lib64
  905. __coi_lib_dir="$__coi_dir/lib64"
  906. LDFLAGS="${SAVED_LDFLAGS} -L$__coi_lib_dir"
  907. AC_HAVE_LIBRARY([$4],[have_valid_coi=yes],[have_valid_coi=no])
  908. fi
  909. fi
  910. fi
  911. if test "$have_valid_coi" = "yes" -a "$__coi_include_dir" != "no"; then
  912. STARPU_COI_CPPFLAGS="-I$__coi_include_dir"
  913. fi
  914. if test "$have_valid_coi" = "yes" ; then
  915. if test "$__coi_lib_dir" != "no"; then
  916. STARPU_COI_LDFLAGS="-L$__coi_lib_dir"
  917. fi
  918. STARPU_COI_LDFLAGS="${STARPU_COI_LDFLAGS} -l$4"
  919. fi
  920. CPPFLAGS="${SAVED_CPPFLAGS}"
  921. LDFLAGS="${SAVED_LDFLAGS}"
  922. ])
  923. AC_ARG_WITH(scif-dir,
  924. [AS_HELP_STRING([--with-scif-dir=<path>],
  925. [specify the MIC's SCIF installation directory])],
  926. [scif_dir="$withval"],
  927. [scif_dir=no])
  928. AC_ARG_WITH(scif-include-dir,
  929. [AS_HELP_STRING([--with-scif-include-dir=<path>],
  930. [specify where the MIC's SCIF headers are installed])],
  931. [scif_include_dir="$withval"],
  932. [scif_include_dir=no])
  933. AC_ARG_WITH(scif-lib-dir,
  934. [AS_HELP_STRING([--with-scif-lib-dir=<path>],
  935. [specify where the MIC's SCIF libraries are installed])],
  936. [scif_lib_dir="$withval"],
  937. [scif_lib_dir=no])
  938. AC_DEFUN([STARPU_CHECK_SCIF_RUNTIME],
  939. [
  940. __scif_dir=$1
  941. __scif_include_dir=$2
  942. __scif_lib_dir=$3
  943. if test "$__scif_dir" != "no" -a "$__scif_dir" != "" ; then
  944. AC_MSG_CHECKING(whether MIC's SCIF runtime is available in $__scif_dir)
  945. else
  946. AC_MSG_CHECKING(whether MIC's SCIF runtime is available)
  947. fi
  948. AC_MSG_RESULT()
  949. if test "$__scif_include_dir" = "no" -a "$__scif_dir" != "no" ; then
  950. __scif_include_dir="${__scif_dir}/include"
  951. fi
  952. if test "$__scif_lib_dir" = "no" -a "$__scif_dir" != "no" ; then
  953. __scif_lib_dir="${__scif_dir}/lib"
  954. fi
  955. SAVED_CPPFLAGS="$CPPFLAGS"
  956. SAVED_LDFLAGS="$LDFLAGS"
  957. if test "$__scif_include_dir" != "no" ; then
  958. CPPFLAGS="${CPPFLAGS} -I$__scif_include_dir"
  959. fi
  960. if test "$__scif_lib_dir" != "no" ; then
  961. LDFLAGS="${LDFLAGS} -L$__scif_lib_dir"
  962. fi
  963. # AC_CHECK_HEADER([source/SCIFEngine_source.h],[have_valid_scif=yes],[have_valid_scif=no])
  964. # if test "$have_valid_scif" = "yes" ; then
  965. AC_HAVE_LIBRARY([scif],[have_valid_scif=yes],[have_valid_scif=no])
  966. if test "$have_valid_scif" = "no" ; then
  967. if test "$3" = "no" -a "$__scif_dir" != "no" ; then
  968. # ${__scif_dir}/lib didn't work, let's try with lib64
  969. __scif_lib_dir="$__scif_dir/lib64"
  970. LDFLAGS="${SAVED_LDFLAGS} -L$__scif_lib_dir"
  971. AC_HAVE_LIBRARY([scif],[have_valid_scif=yes],[have_valid_scif=no])
  972. fi
  973. fi
  974. # fi
  975. if test "$have_valid_scif" = "yes" -a "$__scif_include_dir" != "no"; then
  976. STARPU_SCIF_CPPFLAGS="-I$__scif_include_dir"
  977. fi
  978. if test "$have_valid_scif" = "yes" ; then
  979. if test "$__scif_lib_dir" != "no"; then
  980. STARPU_SCIF_LDFLAGS="-L$__scif_lib_dir"
  981. fi
  982. STARPU_SCIF_LDFLAGS="${STARPU_SCIF_LDFLAGS} -lscif"
  983. fi
  984. CPPFLAGS="${SAVED_CPPFLAGS}"
  985. LDFLAGS="${SAVED_LDFLAGS}"
  986. ])
  987. if test x$enable_mic = xyes ; then
  988. STARPU_CHECK_COI_RUNTIME($coi_dir, $coi_include_dir, $coi_lib_dir, coi_host)
  989. # Host runtime is not compatible, we are probably cross-compiling
  990. # Let's have a look for the device runtime which lib has a different name
  991. if test "$have_valid_coi" = "no" ; then
  992. STARPU_CHECK_COI_RUNTIME($coi_dir, $coi_include_dir, $coi_lib_dir, coi_device)
  993. fi
  994. STARPU_CHECK_SCIF_RUNTIME($scif_dir, $scif_include_dir, $scif_lib_dir)
  995. if test "$have_valid_coi" = "no" ; then
  996. AC_MSG_ERROR([cannot find MIC's COI runtime])
  997. fi
  998. if test "$have_valid_scif" = "no" ; then
  999. AC_MSG_ERROR([cannot find MIC's SCIF runtime])
  1000. fi
  1001. AC_SUBST(STARPU_COI_CPPFLAGS)
  1002. AC_SUBST(STARPU_COI_LDFLAGS)
  1003. AC_SUBST(STARPU_SCIF_CPPFLAGS)
  1004. AC_SUBST(STARPU_SCIF_LDFLAGS)
  1005. fi
  1006. ###############################################################################
  1007. # #
  1008. # SCC settings #
  1009. # #
  1010. ###############################################################################
  1011. AC_ARG_ENABLE([rcce], [AS_HELP_STRING([--disable-rcce],
  1012. [do not use SCC device(s)])], [], enable_rcce=maybe)
  1013. nmaxsccdev=47
  1014. AC_DEFINE_UNQUOTED(STARPU_MAXSCCDEVS, [$nmaxsccdev], [maximum number of SCC devices])
  1015. AC_ARG_WITH(rcce-dir,
  1016. [AS_HELP_STRING([--with-rcce-dir=<path>],
  1017. [specify RCCE installation directory])],
  1018. [
  1019. rcce_dir="$withval"
  1020. enable_rcce=yes
  1021. ],
  1022. rcce_dir=no)
  1023. AC_ARG_WITH(rcce-include-dir,
  1024. [AS_HELP_STRING([--with-rcce-include-dir=<path>],
  1025. [specify where RCCE headers are installed])],
  1026. [
  1027. rcce_include_dir="$withval"
  1028. enable_rcce=yes
  1029. ],
  1030. rcce_include_dir=no)
  1031. AC_ARG_WITH(rcce-lib-dir,
  1032. [AS_HELP_STRING([--with-rcce-lib-dir=<path>],
  1033. [specify where RCCE libraries are installed])],
  1034. [
  1035. rcce_lib_dir="$withval"
  1036. enable_rcce=yes
  1037. ],
  1038. rcce_lib_dir=no)
  1039. if test x$enable_rcce = xyes -o x$enable_rcce = xmaybe ; then
  1040. have_valid_rcce=yes
  1041. SAVED_LDFLAGS="${LDFLAGS}"
  1042. SAVED_CPPFLAGS="${CPPFLAGS}"
  1043. SAVED_LIBS="${LIBS}"
  1044. if test x$rcce_include_dir != xno ; then
  1045. STARPU_RCCE_CPPFLAGS="-I${rcce_include_dir}"
  1046. elif test x$rcce_dir != xno ; then
  1047. STARPU_RCCE_CPPFLAGS="-I${rcce_dir}/include"
  1048. fi
  1049. CPPFLAGS="${CPPFLAGS} ${STARPU_RCCE_CPPFLAGS}"
  1050. AC_CHECK_HEADER([RCCE.h], [], [have_valid_rcce=no])
  1051. if test x$rcce_lib_dir != xno ; then
  1052. STARPU_RCCE_LDFLAGS="-L${rcce_lib_dir}"
  1053. elif test x$rcce_dir != xno ; then
  1054. STARPU_RCCE_LDFLAGS="-L${rcce_lib}/lib"
  1055. fi
  1056. LDFLAGS="${LDFLAGS} ${STARPU_RCCE_LDFLAGS}"
  1057. AC_CHECK_LIB([RCCE_bigflags_nongory_nopwrmgmt], [RCCE_init], [], [have_valid_rcce=no])
  1058. # in case RCCE was explicitely required, but is not available, this is an error
  1059. if test x$enable_rcce = xyes -a x$have_valid_rcce = xno ; then
  1060. AC_MSG_ERROR([cannot find RCCE library])
  1061. fi
  1062. if test x$have_valid_rcce = xyes ; then
  1063. STARPU_RCCE_CPPFLAGS="${STARPU_RCCE_CPPFLAGS} -DSCC"
  1064. STARPU_RCCE_LDFLAGS="${STARPU_RCCE_LDFLAGS} -lRCCE_bigflags_nongory_nopwrmgmt -ldl"
  1065. AC_DEFINE(STARPU_USE_SCC, [1], [SCC support is enabled])
  1066. AC_SUBST(STARPU_RCCE_CFLAGS)
  1067. AC_SUBST(STARPU_RCCE_CPPFLAGS)
  1068. AC_SUBST(STARPU_RCCE_LDFLAGS)
  1069. fi
  1070. LDFLAGS="${SAVED_LDFLAGS}"
  1071. CPPFLAGS="${SAVED_CPPFLAGS}"
  1072. LIBS="${SAVED_LIBS}"
  1073. enable_rcce=$have_valid_rcce
  1074. fi
  1075. AM_CONDITIONAL(STARPU_USE_SCC, test x$enable_rcce = xyes)
  1076. AC_MSG_CHECKING(whether RCCE should be used)
  1077. AC_MSG_RESULT($enable_rcce)
  1078. ###############################################################################
  1079. # #
  1080. # MP Common settings #
  1081. # #
  1082. ###############################################################################
  1083. AM_CONDITIONAL([STARPU_USE_MP], [test "x$enable_mic" = "xyes" -o "x$enable_mpi" = "xyes" -o "x$enable_rcce" = "xyes"])
  1084. AC_ARG_ENABLE([export-dynamic], [AS_HELP_STRING([--disable-export-dynamic],
  1085. [Prevent the linker from adding all symbols to the dynamic symbol table])], [], [])
  1086. if test x$enable_mic = xyes -o x$enable_mpi = xyes -o x$enable_rcce = xyes ; then
  1087. AC_DEFINE(STARPU_USE_MP, [1], [Message-passing SINKs support
  1088. is enabled])
  1089. if test x$enable_export_dynamic != xno ; then
  1090. STARPU_EXPORT_DYNAMIC="-rdynamic"
  1091. fi
  1092. fi
  1093. AC_SUBST(STARPU_EXPORT_DYNAMIC)
  1094. # Computes the maximum number of different kernels a message-passing sink
  1095. # can lookup for and launch.
  1096. AC_MSG_CHECKING(Maximum number of message-passing kernels)
  1097. AC_ARG_ENABLE(maxmpkernels, [AS_HELP_STRING([
  1098. -enable-maxmpkernels=<number>],
  1099. [maximum number of kernels a message-passing sink can lookup
  1100. for and execute])],
  1101. maxmpkernels=$enableval, maxmpkernels=10)
  1102. AC_MSG_RESULT($maxmpkernels)
  1103. AC_DEFINE_UNQUOTED(STARPU_MAXMPKERNELS, [$maxmpkernels],
  1104. [maximum number of message-passing kernels])
  1105. ###############################################################################
  1106. ###############################################################################
  1107. # #
  1108. # Debug and Performance analysis tools #
  1109. # #
  1110. ###############################################################################
  1111. AC_MSG_CHECKING(whether debug mode should be enabled)
  1112. AC_ARG_ENABLE(debug, [AS_HELP_STRING([--enable-debug], [enable debug mode])],
  1113. enable_debug=$enableval, enable_debug=no)
  1114. AC_MSG_RESULT($enable_debug)
  1115. AC_ARG_ENABLE(spinlock_check, [AS_HELP_STRING([--enable-spinlock-check], [enable spinlock check])], enable_spinlock_check=$enableval, enable_spinlock_check=no)
  1116. if test x$enable_debug = xyes; then
  1117. CFLAGS="$CFLAGS -O0"
  1118. enable_spinlock_check=yes
  1119. else
  1120. CFLAGS="-O3 $CFLAGS"
  1121. fi
  1122. CFLAGS+=" -gdwarf-2 -g3 "
  1123. if test x$enable_spinlock_check = xyes; then
  1124. AC_DEFINE(STARPU_SPINLOCK_CHECK, [1], [check spinlock use])
  1125. fi
  1126. AC_MSG_CHECKING(whether extra checks should be performed)
  1127. AC_ARG_ENABLE(fast, [AS_HELP_STRING([--enable-fast],
  1128. [do not enforce assertions])],
  1129. enable_fast=$enableval, enable_fast=no)
  1130. AC_MSG_RESULT($enable_fast)
  1131. if test x$enable_fast = xyes; then
  1132. AC_DEFINE(STARPU_NO_ASSERT, [1], [disable assertions])
  1133. fi
  1134. AC_MSG_CHECKING(whether debug messages should be displayed)
  1135. AC_ARG_ENABLE(verbose, [AS_HELP_STRING([--enable-verbose],
  1136. [display verbose debug messages])],
  1137. enable_verbose=$enableval, enable_verbose=no)
  1138. AC_MSG_RESULT($enable_verbose)
  1139. if test x$enable_verbose = xyes; then
  1140. AC_DEFINE(STARPU_VERBOSE, [1], [display verbose debug messages])
  1141. fi
  1142. AC_MSG_CHECKING(whether coverage testing should be enabled)
  1143. AC_ARG_ENABLE(coverage, [AS_HELP_STRING([--enable-coverage],
  1144. [enable coverage checking])],
  1145. enable_coverage=$enableval, enable_coverage=no)
  1146. AC_MSG_RESULT($enable_coverage)
  1147. AC_SUBST(COVERAGE, $enable_coverage)
  1148. AM_CONDITIONAL(STARPU_COVERAGE_ENABLED, [test "x$enable_coverage" = "xyes"])
  1149. if test x$enable_coverage = xyes; then
  1150. CFLAGS="${CFLAGS} --coverage"
  1151. CXXFLAGS="${CXXFLAGS} --coverage"
  1152. LDFLAGS="${LDFLAGS} --coverage"
  1153. fi
  1154. # shall we use FxT to generate trace of the execution ?
  1155. AC_MSG_CHECKING(whether FxT traces should be generated)
  1156. AC_ARG_WITH(fxt, [AS_HELP_STRING([--with-fxt[=<dir>]], [generate fxt traces])],
  1157. [
  1158. if test x$withval != xno; then
  1159. use_fxt=yes
  1160. if test x$withval = xyes; then
  1161. AC_MSG_RESULT(yes)
  1162. use_fxt_from_system=yes
  1163. else
  1164. # use specified path
  1165. # TODO check if the dir is actually containing FxT
  1166. use_fxt_from_system=no
  1167. fxtdir=$withval
  1168. AC_MSG_RESULT(yes using $fxtdir)
  1169. AC_SUBST(FXTDIR, $fxtdir)
  1170. fi
  1171. else
  1172. use_fxt=no
  1173. AC_MSG_RESULT(no)
  1174. fi
  1175. ],
  1176. [
  1177. use_fxt=no
  1178. AC_MSG_RESULT(no)
  1179. ])
  1180. AC_SUBST(STARPU_USE_FXT, $use_fxt)
  1181. AM_CONDITIONAL(STARPU_USE_FXT, test x$use_fxt = xyes)
  1182. if test x$use_fxt = xyes; then
  1183. AC_DEFINE(STARPU_USE_FXT, [1], [enable FxT traces])
  1184. AC_DEFINE(CONFIG_FUT, [1], [enable FUT traces])
  1185. if test x$use_fxt_from_system = xno; then
  1186. save_PKG_CONFIG_PATH="$PKG_CONFIG_PATH"
  1187. PKG_CONFIG_PATH="$fxtdir/lib/pkgconfig:$PKG_CONFIG_PATH"
  1188. PKG_CHECK_MODULES([FXT], [fxt], , [
  1189. AC_MSG_WARN([Old FxT without fxt.pc file, hoping link will succeed])
  1190. FXT_CFLAGS="-I$fxtdir/include/ "
  1191. FXT_LDFLAGS="-L$fxtdir/lib/"
  1192. AC_ARG_VAR(FXT_LDFLAGS)
  1193. FXT_LIBS="-lfxt"
  1194. ])
  1195. PKG_CONFIG_PATH="$save_PKG_CONFIG_PATH"
  1196. else
  1197. PKG_CHECK_MODULES([FXT], [fxt])
  1198. fi
  1199. save_LIBS="$LIBS"
  1200. LIBS="$LIBS $FXT_LIBS"
  1201. save_LDFLAGS="$LDFLAGS"
  1202. LDFLAGS="$LDFLAGS $FXT_LDFLAGS"
  1203. AC_CHECK_FUNCS([enable_fut_flush])
  1204. AC_CHECK_FUNCS([fut_set_filename])
  1205. LDFLAGS="$save_LDFLAGS"
  1206. LIBS="$save_LIBS"
  1207. save_CFLAGS="$CFLAGS"
  1208. CFLAGS="$CFLAGS $FXT_CFLAGS"
  1209. AC_CHECK_DECLS([enable_fut_flush])
  1210. AC_CHECK_DECLS([fut_set_filename])
  1211. CFLAGS="$save_CFLAGS"
  1212. ##########################################
  1213. # Poti is a library to generate paje trace files
  1214. ##########################################
  1215. PKG_CHECK_MODULES([POTI], [poti], [
  1216. AC_DEFINE(STARPU_HAVE_POTI, [1], [Define to 1 if you have libpoti])
  1217. ], [:])
  1218. FXT_CFLAGS="$FXT_CFLAGS $POTI_CFLAGS"
  1219. FXT_LIBS="$FXT_LIBS $POTI_LIBS"
  1220. fi
  1221. AC_MSG_CHECKING(whether additional locking systems FxT traces should be enabled)
  1222. AC_ARG_ENABLE(fxt-lock, [AS_HELP_STRING([--enable-fxt-lock],
  1223. [enable additional locking systems FxT traces])],
  1224. enable_fxt_lock=$enableval, enable_fxt_lock=no)
  1225. AC_MSG_RESULT($enable_fxt_lock)
  1226. if test x$enable_fxt_lock = xyes; then
  1227. AC_DEFINE(STARPU_FXT_LOCK_TRACES, [1], [enable additional locking systems FxT traces])
  1228. fi
  1229. AC_MSG_CHECKING(whether performance debugging should be enabled)
  1230. AC_ARG_ENABLE(perf-debug, [AS_HELP_STRING([--enable-perf-debug],
  1231. [enable performance debugging through gprof])],
  1232. enable_perf_debug=$enableval, enable_perf_debug=no)
  1233. AC_MSG_RESULT($enable_perf_debug)
  1234. AC_SUBST(STARPU_PERF_DEBUG, $enable_perf_debug)
  1235. if test x$enable_perf_debug = xyes; then
  1236. AC_DEFINE(STARPU_PERF_DEBUG, [1], [enable performance debug])
  1237. CPPFLAGS="${CPPFLAGS} -pg -fprofile-arcs "
  1238. LDFLAGS="${LDFLAGS} -pg -fprofile-arcs "
  1239. fi
  1240. AC_MSG_CHECKING(whether performance model debugging should be enabled)
  1241. AC_ARG_ENABLE(model-debug, [AS_HELP_STRING([--enable-model-debug],
  1242. [enable performance model debugging])],
  1243. enable_model_debug=$enableval, enable_model_debug=no)
  1244. AC_MSG_RESULT($enable_model_debug)
  1245. if test x$enable_model_debug = xyes; then
  1246. AC_DEFINE(STARPU_MODEL_DEBUG, [1], [enable performance model debug])
  1247. fi
  1248. AC_MSG_CHECKING(whether statistics should be generated)
  1249. AC_ARG_ENABLE(stats, [AS_HELP_STRING([--enable-stats],
  1250. [enable statistics])],
  1251. enable_stats=$enableval, enable_stats=no)
  1252. AC_MSG_RESULT($enable_stats)
  1253. AC_SUBST(STATS, $enable_stats)
  1254. AC_SUBST(STARPU_ENABLE_STATS, $enable_stats)
  1255. if test x$enable_stats = xyes; then
  1256. AC_DEFINE(STARPU_ENABLE_STATS, [1], [enable statistics])
  1257. fi
  1258. AC_MSG_CHECKING(whether memory stats should be displayed)
  1259. AC_ARG_ENABLE(memory-stats, [AS_HELP_STRING([--enable-memory-stats],
  1260. [enable memory stats])],
  1261. enable_memory_stats=$enableval, enable_memory_stats=no)
  1262. AC_MSG_RESULT($enable_memory_stats)
  1263. if test x$enable_memory_stats = xyes; then
  1264. AC_DEFINE(STARPU_MEMORY_STATS, [1], [enable memory stats])
  1265. fi
  1266. AC_CHECK_HEADERS([glpk.h], [AC_DEFINE([STARPU_HAVE_GLPK_H], [1], [Define to 1 if you have the <glpk.h> header file.])])
  1267. STARPU_HAVE_LIBRARY(GLPK, [glpk])
  1268. AC_CHECK_HEADERS([Ayudame.h])
  1269. ###############################################################################
  1270. # #
  1271. # Miscellaneous options for StarPU #
  1272. # #
  1273. ###############################################################################
  1274. AC_MSG_CHECKING(how many buffers can be manipulated per task)
  1275. AC_ARG_ENABLE(maxbuffers, [AS_HELP_STRING([--enable-maxbuffers=<nbuffers>],
  1276. [maximum number of buffers per task])],
  1277. nmaxbuffers=$enableval, nmaxbuffers=8)
  1278. AC_MSG_RESULT($nmaxbuffers)
  1279. AC_DEFINE_UNQUOTED(STARPU_NMAXBUFS, [$nmaxbuffers],
  1280. [how many buffers can be manipulated per task])
  1281. AC_MSG_CHECKING(maximum number of nodes to use)
  1282. AC_ARG_ENABLE(maxnodes, [AS_HELP_STRING([--enable-maxnodes=<nnodes>],
  1283. [maximum number of nodes])],
  1284. maxnodes=$enableval, maxnodes=0)
  1285. if test x$maxnodes = x0 ; then
  1286. if test x$enable_simgrid = xyes ; then
  1287. # We still need the room for the virtual CUDA/OpenCL devices
  1288. maxnodes=16
  1289. else
  1290. # We have one memory node shared by all CPU workers, one node per GPU
  1291. # and per MIC device
  1292. # we add nodes to use 4 memory disks
  1293. nodes=5
  1294. if test x$enable_cuda = xyes ; then
  1295. # we could have used nmaxcudadev + 1, but this would certainly give an
  1296. # odd number.
  1297. nodes=`expr $nodes + $nmaxcudadev`
  1298. fi
  1299. if test x$enable_opencl = xyes ; then
  1300. # we could have used nmaxcudadev + 1, but this would certainly give an
  1301. # odd number.
  1302. nodes=`expr $nodes + $nmaxopencldev`
  1303. fi
  1304. if test x$enable_mic = xyes ; then
  1305. nodes=`expr $nodes + $nmaxmicdev`
  1306. fi
  1307. if test x$enable_rcce = xyes ; then
  1308. # Only 1 memory node for the shared memory.
  1309. nodes=`expr $nodes + 1`
  1310. fi
  1311. # set maxnodes to the next power of 2 greater than nodes
  1312. maxnodes=1
  1313. while test "$maxnodes" -lt "$nodes"
  1314. do
  1315. maxnodes=`expr $maxnodes \* 2`
  1316. done
  1317. fi
  1318. fi
  1319. if test $maxnodes -gt 32 ; then
  1320. AC_MSG_ERROR([selected number of nodes ($maxnodes) can not be greater than 32])
  1321. fi
  1322. AC_MSG_CHECKING(maximum number of memory nodes)
  1323. AC_MSG_RESULT($maxnodes)
  1324. AC_DEFINE_UNQUOTED(STARPU_MAXNODES, [$maxnodes],
  1325. [maximum number of memory nodes])
  1326. AC_MSG_CHECKING(whether allocation cache should be used)
  1327. AC_ARG_ENABLE(allocation-cache, [AS_HELP_STRING([--enable-allocation-cache],
  1328. [enable data allocation cache])],
  1329. enable_allocation_cache=$enableval, enable_allocation_cache=yes)
  1330. AC_MSG_RESULT($enable_allocation_cache)
  1331. if test x$enable_allocation_cache = xyes; then
  1332. AC_DEFINE(STARPU_USE_ALLOCATION_CACHE, [1], [enable data allocation cache])
  1333. fi
  1334. AC_ARG_WITH(perf-model-dir, [AS_HELP_STRING([--with-perf-model-dir=<dir>], [specify where performance models shoulds be stored])],
  1335. [
  1336. if test x$withval = xno; then
  1337. AC_MSG_ERROR(--without-perf-model-dir is not a valid option)
  1338. fi
  1339. perf_model_dir="$withval"
  1340. have_explicit_perf_model_dir=yes
  1341. AC_DEFINE_UNQUOTED(STARPU_PERF_MODEL_DIR, ["$perf_model_dir"], [performance models location])
  1342. ], [
  1343. # by default, we put the performance models in
  1344. # $HOME/.starpu/sampling/
  1345. have_explicit_perf_model_dir=no
  1346. perf_model_dir="\$HOME/.starpu/sampling/"
  1347. ]
  1348. )
  1349. AC_MSG_CHECKING(using explicit performance model location)
  1350. AC_MSG_RESULT($have_explicit_perf_model_dir)
  1351. AC_MSG_CHECKING(performance models location)
  1352. AC_MSG_RESULT($perf_model_dir)
  1353. # On many multicore CPUs, clock cycles are not synchronized
  1354. AC_CHECK_LIB([rt], [clock_gettime])
  1355. AC_CHECK_FUNCS([clock_gettime])
  1356. # Compute the maximum number of workers (we round it to 16 for alignment
  1357. # purposes).
  1358. nmaxworkers=`expr 16 \* \( \( $maxcpus + $nmaxcudadev + $nmaxopencldev + $nmaxmicthreads + $nmaxsccdev + 15 \) / 16 \) `
  1359. AC_MSG_CHECKING(Maximum number of workers)
  1360. AC_MSG_RESULT($nmaxworkers)
  1361. AC_DEFINE_UNQUOTED(STARPU_NMAXWORKERS, [$nmaxworkers], [Maximum number of workers])
  1362. # Computes the maximun number of combined worker
  1363. nmaxcombinedworkers=`expr $maxcpus + $nmaxmicthreads`
  1364. AC_MSG_CHECKING(Maximum number of workers combinations)
  1365. AC_MSG_RESULT($nmaxcombinedworkers)
  1366. AC_DEFINE_UNQUOTED(STARPU_NMAX_COMBINEDWORKERS,
  1367. [$nmaxcombinedworkers], [Maximum number of worker combinations])
  1368. # Computes the maximum number of implementations per arch
  1369. AC_MSG_CHECKING(maximum number of implementations)
  1370. AC_ARG_ENABLE(maximplementations, [AS_HELP_STRING([--enable-maximplementations=<number>],
  1371. [maximum number of implementations])],
  1372. maximplementations=$enableval, maximplementations=8)
  1373. AC_MSG_RESULT($maximplementations)
  1374. AC_DEFINE_UNQUOTED(STARPU_MAXIMPLEMENTATIONS, [$maximplementations],
  1375. [maximum number of implementations])
  1376. AC_LANG_PUSH([C++])
  1377. AC_CHECK_HEADERS([leveldb/db.h], [AC_DEFINE([STARPU_HAVE_LEVELDB], [1], [Define to 1 if you have the <leveldb/db.h> header file.])])
  1378. STARPU_HAVE_LIBRARY(LEVELDB, [leveldb])
  1379. AM_CONDITIONAL(STARPU_HAVE_LEVELDB, test "x$ac_cv_lib_leveldb_main" = "xyes")
  1380. AC_LANG_POP([C++])
  1381. ###############################################################################
  1382. # #
  1383. # MPI #
  1384. # #
  1385. ###############################################################################
  1386. AC_ARG_WITH(mpicc, [AS_HELP_STRING([--with-mpicc[=<path to mpicc>]],
  1387. [Path of the mpicc compiler])],
  1388. [
  1389. if test x$withval = xyes; then
  1390. AC_MSG_ERROR(--with-mpicc must be given a pathname)
  1391. else
  1392. mpicc_path=$withval
  1393. fi
  1394. ],
  1395. [
  1396. # nothing was specified: default value is used
  1397. AC_PATH_PROG(mpicc_path, mpicc, [no], [])
  1398. ])
  1399. # We test if the MPICC compiler exists
  1400. if test ! -x $mpicc_path; then
  1401. #MPICC does not exists or is not executable
  1402. AC_MSG_RESULT(The mpicc compiler is not valid)
  1403. use_mpi=no
  1404. else
  1405. use_mpi=yes
  1406. fi
  1407. AC_MSG_CHECKING(mpicc path)
  1408. AC_MSG_RESULT($mpicc_path)
  1409. AC_SUBST(MPICC, $mpicc_path)
  1410. if test x$use_mpi = xyes; then
  1411. cc_or_mpicc=$mpicc_path
  1412. # For some reason, libtool uses gcc instead of mpicc when linking
  1413. # libstarpumpi.
  1414. # On Darwin (and maybe other systems ?) the linker will fail (undefined
  1415. # references to MPI_*). We manually add the required flags to fix this
  1416. # issue.
  1417. AC_SUBST(MPICC_LDFLAGS, `$mpicc_path --showme:link`)
  1418. else
  1419. cc_or_mpicc=$CC
  1420. fi
  1421. AC_SUBST(CC_OR_MPICC, $cc_or_mpicc)
  1422. # If the user specifically asks for it, or if we are in a developer checkout, we enable mpi check
  1423. AC_ARG_ENABLE(mpi-check, AC_HELP_STRING([--enable-mpi-check], [Enable execution of MPI testcases]))
  1424. running_mpi_check=no
  1425. if test -d "$srcdir/.svn" -o -d "$srcdir/.git" ; then
  1426. running_mpi_check=yes
  1427. fi
  1428. if test x$enable_mpi_check = xyes ; then
  1429. running_mpi_check=yes
  1430. fi
  1431. if test x$enable_mpi_check = xno ; then
  1432. running_mpi_check=no
  1433. fi
  1434. # Check if mpiexec is available
  1435. AC_ARG_WITH(mpiexec, [AS_HELP_STRING([--with-mpiexec[=<path to mpiexec>]],
  1436. [Path of mpiexec])],
  1437. [
  1438. if test x$withval = xyes; then
  1439. AC_MSG_ERROR(--with-mpiexec must be given a pathname)
  1440. else
  1441. mpiexec_path=$withval
  1442. fi
  1443. ],
  1444. [
  1445. # nothing was specified: look in the path
  1446. AC_PATH_PROG(mpiexec_path, mpiexec, [no], [$(dirname $mpicc_path):$PATH])
  1447. ])
  1448. AC_MSG_CHECKING(whether mpiexec is available)
  1449. AC_MSG_RESULT($mpiexec_path)
  1450. # We test if MPIEXEC exists
  1451. if test ! -x $mpiexec_path; then
  1452. #MPIEXEC does not exists or is not executable
  1453. AC_MSG_RESULT(The mpiexec script is not valid)
  1454. running_mpi_check=no
  1455. mpiexec_path=""
  1456. fi
  1457. AM_CONDITIONAL(STARPU_MPI_CHECK, test x$running_mpi_check = xyes)
  1458. if test x$use_mpi = xyes; then
  1459. AC_MSG_CHECKING(whether MPI tests should be run)
  1460. AC_MSG_RESULT($running_mpi_check)
  1461. AC_SUBST(MPIEXEC,$mpiexec_path)
  1462. fi
  1463. AC_MSG_CHECKING(whether the StarPU MPI library should be generated)
  1464. AC_MSG_RESULT($use_mpi)
  1465. AC_SUBST(USE_MPI, $use_mpi)
  1466. AM_CONDITIONAL(USE_MPI, test x$use_mpi = xyes)
  1467. if test x$use_mpi = xyes; then
  1468. AC_DEFINE(STARPU_USE_MPI,[],[whether the StarPU MPI library is available])
  1469. fi
  1470. AC_ARG_ENABLE(mpi-progression-hook, [AS_HELP_STRING([--enable-mpi-progression-hook],
  1471. [Enable StarPU MPI activity polling method])],
  1472. enable_mpi_progression_hook=$enableval, enable_mpi_progression_hook=no)
  1473. if test x$enable_mpi_progression_hook = xyes; then
  1474. AC_DEFINE(STARPU_MPI_ACTIVITY, [1], [enable StarPU MPI activity polling method])
  1475. fi
  1476. ###############################################################################
  1477. # #
  1478. # StarPU-Top #
  1479. # #
  1480. ###############################################################################
  1481. AC_ARG_ENABLE([starpu-top],
  1482. [AS_HELP_STRING([--disable-starpu-top],
  1483. [build StarPU-Top])],
  1484. [enable_starpu_top="$enableval"],
  1485. [enable_starpu_top="maybe"])
  1486. # Check whether StarPU-Top can be built
  1487. AC_MSG_CHECKING(for StarPU-Top)
  1488. if test "x$enable_starpu_top" != "xno" ; then
  1489. can_build_starpu_top=no
  1490. AC_PATH_PROGS([QMAKE], [qmake-qt4 qmake], [not-found])
  1491. if test x$QMAKE != xnot-found; then
  1492. QMAKE_VERSION=`$QMAKE --version 2>&1 | head -n 1 | cut -d '.' -f 1 | cut -d ' ' -f 3`
  1493. if test $QMAKE_VERSION -ge 2 ; then
  1494. PKG_CHECK_EXISTS([QtGui QtNetwork QtOpenGL QtSql], [
  1495. QT_MAJVERSION=`$PKG_CONFIG --modversion QtGui | cut -d '.' -f 1`
  1496. QT_MINVERSION=`$PKG_CONFIG --modversion QtGui | cut -d '.' -f 2`
  1497. if test $QT_MAJVERSION -gt 4 -o \( $QT_MAJVERSION -eq 4 -a $QT_MINVERSION -ge 7 \) ; then
  1498. can_build_starpu_top=yes
  1499. fi
  1500. QWT_PRI=embed
  1501. AC_ARG_WITH(qwt-include-dir,
  1502. [AS_HELP_STRING([--with-qwt-include-dir=<path>],
  1503. [specify installed libqwt include path])],
  1504. [
  1505. STARPU_QWT_INCLUDE="$withval"
  1506. AC_SUBST(STARPU_QWT_INCLUDE)
  1507. QWT_PRI=system
  1508. ])
  1509. AC_ARG_WITH(qwt-lib-dir,
  1510. [AS_HELP_STRING([--with-qwt-lib-dir=<path>],
  1511. [specify installed libqwt library path])],
  1512. [
  1513. STARPU_QWT_LDFLAGS="-L$withval"
  1514. QWT_PRI=system
  1515. ])
  1516. AC_ARG_WITH(qwt-lib,
  1517. [AS_HELP_STRING([--with-qwt-lib=<name>],
  1518. [specify installed libqwt library name])],
  1519. [
  1520. STARPU_QWT_LDFLAGS="${STARPU_QWT_LDFLAGS} -l$withval"
  1521. QWT_PRI=system
  1522. ])
  1523. AC_SUBST(STARPU_QWT_LDFLAGS)
  1524. AC_SUBST(QWT_PRI)
  1525. ])
  1526. fi
  1527. fi
  1528. fi
  1529. if test "x$enable_starpu_top" != "xno" ; then
  1530. build_starpu_top=$can_build_starpu_top
  1531. else
  1532. build_starpu_top=no
  1533. fi
  1534. AC_SUBST(STARPU_USE_TOP, $build_starpu_top)
  1535. AM_CONDITIONAL(BUILD_STARPU_TOP, test "x$build_starpu_top" = "xyes")
  1536. if test "x$build_starpu_top" = "xyes"; then
  1537. AC_DEFINE(STARPU_USE_TOP, [1], [StarPU-Top is activated])
  1538. fi
  1539. ###############################################################################
  1540. # #
  1541. # Flags for C Compiler #
  1542. # #
  1543. ###############################################################################
  1544. # IS_SUPPORTED_CFLAG(flag)
  1545. # ------------------------
  1546. # Check if the CFLAGS `flag' is supported by the compiler
  1547. AC_DEFUN([IS_SUPPORTED_CFLAG],
  1548. [
  1549. AC_REQUIRE([AC_PROG_CC])
  1550. AC_MSG_CHECKING([whether compiler support $1])
  1551. SAVED_CFLAGS="$CFLAGS"
  1552. CFLAGS="$1" # -we10006"
  1553. AC_COMPILE_IFELSE(
  1554. AC_LANG_PROGRAM(
  1555. [[]],
  1556. [[
  1557. AC_LANG_SOURCE([
  1558. const char *hello = "Hello World";
  1559. ])
  1560. ]]
  1561. ),
  1562. [
  1563. GLOBAL_AM_CFLAGS="$GLOBAL_AM_CFLAGS $1"
  1564. AC_MSG_RESULT(yes)
  1565. ],
  1566. AC_MSG_RESULT(no)
  1567. )
  1568. CFLAGS="$SAVED_CFLAGS"
  1569. ])
  1570. IS_SUPPORTED_CFLAG(-W)
  1571. IS_SUPPORTED_CFLAG(-Wall)
  1572. IS_SUPPORTED_CFLAG(-Wextra)
  1573. IS_SUPPORTED_CFLAG(-Werror=implicit)
  1574. if test "x$STARPU_DEVEL" != x; then
  1575. AC_DEFINE(STARPU_DEVEL, [1], [enable developer warnings])
  1576. IS_SUPPORTED_CFLAG(-Wunused)
  1577. IS_SUPPORTED_CFLAG(-Wundef)
  1578. IS_SUPPORTED_CFLAG(-Wshadow)
  1579. fi
  1580. AC_SUBST(GLOBAL_AM_CFLAGS)
  1581. # Same value as Automake's, for use in other places.
  1582. pkglibdir="\${libdir}/$PACKAGE"
  1583. AC_SUBST([pkglibdir])
  1584. ###############################################################################
  1585. # #
  1586. # GCC extensions #
  1587. # #
  1588. ###############################################################################
  1589. AC_ARG_ENABLE([gcc-extensions],
  1590. [AS_HELP_STRING([--enable-gcc-extensions],
  1591. [build the GCC plug-in that provides C language extensions (experimental)])],
  1592. [enable_gcc_plugin="$enableval"],
  1593. [enable_gcc_plugin="maybe"])
  1594. if test "x$enable_gcc_plugin" = "xyes" -o "x$enable_gcc_plugin" = "xmaybe" ; then
  1595. STARPU_GCC_PLUGIN_SUPPORT
  1596. if test "x$ac_cv_have_gcc_plugins" = "xno" ; then
  1597. if test "x$enable_gcc_plugin" = "xyes" ; then
  1598. # Since this was explicitly asked for, error out.
  1599. AC_MSG_ERROR([This compiler lacks GCC plug-in support.])
  1600. else
  1601. AC_MSG_WARN([GCC plug-ins not supported; StarPU's GCC plug-in will not be built])
  1602. fi
  1603. else
  1604. # What GCC version are we using?
  1605. STARPU_GCC_VERSION
  1606. # The `.so' itself cannot be called `starpu-gcc.so' (because
  1607. # `-fplugin-arg-' option names and such must match the `.so'
  1608. # name), so use a meaningful directory name.
  1609. gccplugindir="\${pkglibdir}/${STARPU_EFFECTIVE_VERSION}/gcc/${STARPU_GCC_VERSION_MAJOR}.${STARPU_GCC_VERSION_MINOR}"
  1610. AC_SUBST([gccplugindir])
  1611. # Lines to be inserted in the `.pc' file.
  1612. GCC_PLUGIN_DIR_PKGCONFIG="gccplugindir=$gccplugindir"
  1613. GCC_PLUGIN_PKGCONFIG="gccplugin=\${gccplugindir}/starpu.so"
  1614. AC_SUBST([GCC_PLUGIN_DIR_PKGCONFIG])
  1615. AC_SUBST([GCC_PLUGIN_PKGCONFIG])
  1616. fi
  1617. fi
  1618. AM_CONDITIONAL([HAVE_PTR_DEREFS_MAY_ALIAS_P],
  1619. [test "x$ac_cv_have_decl_ptr_derefs_may_alias_p" = "xyes"])
  1620. if test "x$ac_cv_have_gcc_plugins" = "xyes" ; then
  1621. build_gcc_plugin="yes"
  1622. # GNU Guile 1.8/2.0 is used to run the test suite.
  1623. AC_PATH_PROG([GUILE], [guile])
  1624. if test "x$GUILE" != "x"; then
  1625. if test "x$enable_cpu" = "xyes"; then
  1626. run_gcc_plugin_test_suite="yes"
  1627. else
  1628. AC_MSG_WARN([CPU back-end disabled; GCC plug-in test suite will not be run])
  1629. run_gcc_plugin_test_suite="no"
  1630. fi
  1631. else
  1632. run_gcc_plugin_test_suite="no"
  1633. fi
  1634. else
  1635. build_gcc_plugin="no"
  1636. run_gcc_plugin_test_suite="no"
  1637. fi
  1638. # Bison is used to generate the C expression parser. The generated
  1639. # parser is part of the distribution, though.
  1640. AM_MISSING_PROG([YACC], [bison])
  1641. AM_CONDITIONAL([BUILD_GCC_PLUGIN], [test "x$build_gcc_plugin" = "xyes"])
  1642. AM_CONDITIONAL([RUN_GCC_PLUGIN_TESTS],
  1643. [test "x$run_gcc_plugin_test_suite" = "xyes"])
  1644. ###############################################################################
  1645. # #
  1646. # SOCL interface #
  1647. # #
  1648. ###############################################################################
  1649. AC_ARG_ENABLE([socl],
  1650. [AS_HELP_STRING([--enable-socl],
  1651. [build the OpenCL interface (experimental)])],
  1652. [enable_socl="$enableval"],
  1653. [enable_socl="maybe"])
  1654. AC_MSG_CHECKING(for SOCL)
  1655. # in case SOCL was explicitely required, but is not available, this is an error
  1656. if test "x$enable_socl" = "xyes" -a "$have_valid_opencl" = "no" ; then
  1657. AC_MSG_ERROR([SOCL cannot be enabled without OpenCL])
  1658. fi
  1659. # now we enable SOCL if and only if a proper setup is available
  1660. if test "x$enable_socl" = "xyes" -o "x$enable_socl" = "xmaybe" ; then
  1661. build_socl=$have_valid_opencl
  1662. else
  1663. build_socl=no
  1664. fi
  1665. AC_MSG_RESULT($build_socl)
  1666. AM_CONDITIONAL([BUILD_SOCL], [test "x$build_socl" = "xyes"])
  1667. AM_CONDITIONAL([STARPU_USE_SOCL], [test "x$build_socl" = "xyes"])
  1668. if test "$build_socl" = "yes" ; then
  1669. AC_CHECK_FUNCS([clGetExtensionFunctionAddressForPlatform])
  1670. if test -z "$SOCL_OCL_LIB_OPENCL" ; then
  1671. run_socl_check=no
  1672. else
  1673. run_socl_check=yes
  1674. AC_SUBST(SOCL_OCL_LIB_OPENCL)
  1675. fi
  1676. else
  1677. run_socl_check=no
  1678. fi
  1679. ###############################################################################
  1680. # #
  1681. # Debugging #
  1682. # #
  1683. ###############################################################################
  1684. AC_PATH_PROG([GDB], [gdb], [not-found])
  1685. if test "x$GDB" != "xnot-found"; then
  1686. AC_DEFINE_UNQUOTED([STARPU_GDB_PATH], ["$GDB"],
  1687. [Path to the GNU debugger.])
  1688. fi
  1689. ###############################################################################
  1690. # #
  1691. # Examples #
  1692. # #
  1693. ###############################################################################
  1694. AC_ARG_ENABLE(build-examples, [AS_HELP_STRING([--disable-build-examples],
  1695. [disable building of examples])],
  1696. enable_build_examples=$enableval, enable_build_examples=yes)
  1697. # check stuff for examples (todo)
  1698. AM_CONDITIONAL(BUILD_EXAMPLES, [test x$enable_build_examples != xno])
  1699. AC_ARG_ENABLE(opengl-render, [AS_HELP_STRING([--enable-opengl-render],
  1700. [enable OpenGL rendering of some examples])],
  1701. enable_opengl_render=$enableval, enable_opengl_render=no)
  1702. if test x$enable_opengl_render = xyes; then
  1703. STARPU_CHECK_LIB(OPENGL_RENDER, glut, glutInit,,AC_MSG_ERROR([cannot find glut]))
  1704. STARPU_CHECK_LIB(OPENGL_RENDER, GL, glXCreateContext,,AC_MSG_ERROR([cannot find GL]))
  1705. STARPU_CHECK_LIB(OPENGL_RENDER, GLU, gluLookAt,,AC_MSG_ERROR([cannot find GLU]))
  1706. AC_DEFINE(STARPU_OPENGL_RENDER, [1], [enable OpenGL rendering of some examples])
  1707. fi
  1708. AC_MSG_CHECKING(whether OpenGL rendering is enabled)
  1709. AC_SUBST(STARPU_OPENGL_RENDER, $enable_opengl_render)
  1710. AC_MSG_RESULT($enable_opengl_render)
  1711. AM_CONDITIONAL([HAVE_OPENGL], [test "x$enable_opengl_render" = xyes])
  1712. AC_PATH_XTRA
  1713. if test "x$no_x" != "xyes"; then
  1714. AC_DEFINE(STARPU_HAVE_X11, [1], [enable X11])
  1715. fi
  1716. AM_CONDITIONAL([HAVE_X11], [test "x$no_x" != "xyes"])
  1717. # In case there are BLAS kernels that are used by the example applications
  1718. # we may specify which library to use. Note that this is not used for StarPU
  1719. # itself.
  1720. blas_lib=maybe
  1721. AC_ARG_ENABLE(blas-lib,
  1722. [ --enable-blas-lib[=blaslibname]:
  1723. none [default]: no BLAS lib is used
  1724. atlas: use ATLAS library
  1725. goto: use GotoBLAS library],
  1726. [
  1727. if test "x$enableval" = "xatlas" ; then
  1728. blas_lib=atlas
  1729. elif test "x$enableval" = "xgoto" ; then
  1730. blas_lib=goto
  1731. elif test "x$enableval" = "xnone" ; then
  1732. blas_lib=none
  1733. elif test x$enableval = xno; then
  1734. blas_lib=none
  1735. else
  1736. echo
  1737. echo "Error!"
  1738. echo "Unknown BLAS library"
  1739. exit -1
  1740. fi
  1741. ])
  1742. if test x$blas_lib = xmaybe -o x$blas_lib = xgoto; then
  1743. AC_ARG_WITH(goto-dir, [AS_HELP_STRING([--with-goto-dir=<dir>], [specify GotoBLAS lib location])],
  1744. [
  1745. blas_lib=goto
  1746. gotodir=$withval
  1747. AC_SUBST(GOTODIR, $gotodir)
  1748. CPPFLAGS="${CPPFLAGS} -I$gotodir/ "
  1749. LDFLAGS="${LDFLAGS} -L$gotodir/ "
  1750. ]
  1751. )
  1752. if test x$blas_lib = xgoto; then
  1753. STARPU_CHECK_LIB(BLAS, gfortran, main,,)
  1754. STARPU_CHECK_LIB(BLAS, ifcore, main,,)
  1755. # Perhaps that GotoBLAS2 is available instead (so that we have libgotoblas2.{so,a})
  1756. STARPU_CHECK_LIB(BLAS, goto2, sgemm_,, [havegoto2=no], [$STARPU_BLAS_LDFLAGS])
  1757. if test x$havegoto2 = xno; then
  1758. STARPU_CHECK_LIB(BLAS, goto, sgemm_,,AC_MSG_ERROR([cannot find goto lib]), [$STARPU_BLAS_LDFLAGS])
  1759. fi
  1760. AC_DEFINE(STARPU_GOTO, [1], [use STARPU_GOTO library])
  1761. fi
  1762. fi
  1763. if test x$blas_lib = xmaybe -o x$blas_lib = xatlas; then
  1764. AC_ARG_WITH(atlas-dir, [AS_HELP_STRING([--with-atlas-dir=<dir>], [specify ATLAS lib location])],
  1765. [
  1766. AC_MSG_CHECKING(STARPU_ATLAS location)
  1767. blas_lib=atlas
  1768. atlasdir=$withval
  1769. AC_MSG_RESULT($atlasdir)
  1770. AC_SUBST(ATLASDIR, $atlasdir)
  1771. CPPFLAGS="${CPPFLAGS} -I$atlasdir/include/ "
  1772. LDFLAGS="${LDFLAGS} -L$atlasdir/lib/ "
  1773. ]
  1774. )
  1775. if test x$blas_lib = xatlas; then
  1776. # test whether STARPU_ATLAS is actually available
  1777. AC_CHECK_HEADER([cblas.h],,AC_MSG_ERROR([cannot find atlas headers]))
  1778. STARPU_CHECK_LIB(BLAS, atlas, ATL_sgemm,,AC_MSG_ERROR([cannot find atlas lib]),)
  1779. STARPU_CHECK_LIB(BLAS, cblas, cblas_sgemm,,AC_MSG_ERROR([cannot find atlas lib]),[-latlas])
  1780. AC_DEFINE(STARPU_ATLAS, [1], [use STARPU_ATLAS library])
  1781. fi
  1782. fi
  1783. if test x$blas_lib = xmaybe; then
  1784. # Should we use MKL ?
  1785. AC_ARG_WITH(mkl-cflags, [AS_HELP_STRING([--with-mkl-cflags], [specify MKL compilation flags])],
  1786. [
  1787. CPPFLAGS="${CPPFLAGS} $withval"
  1788. blas_lib=mkl
  1789. ])
  1790. AC_ARG_WITH(mkl-ldflags, [AS_HELP_STRING([--with-mkl-ldflags], [specify MKL linking flags])],
  1791. [
  1792. LDFLAGS="${LDFLAGS} $withval"
  1793. blas_lib=mkl
  1794. ])
  1795. if test x$blas_lib = xmkl; then
  1796. AC_DEFINE(STARPU_MKL, [1], [use MKL library])
  1797. fi
  1798. fi
  1799. if test x$blas_lib = xmaybe; then
  1800. #perhaps it is possible to use some BLAS lib from the system
  1801. use_system_blas=no
  1802. STARPU_SEARCH_LIBS(BLAS,[sgemm_],[blas],use_system_blas=yes,,)
  1803. if test x$use_system_blas = xyes; then
  1804. AC_DEFINE(STARPU_SYSTEM_BLAS, [1], [use refblas library])
  1805. blas_lib=system
  1806. elif test x"$BLAS_LIBS" != x; then
  1807. AC_DEFINE(STARPU_SYSTEM_BLAS, [1], [use user defined library])
  1808. STARPU_BLAS_LDFLAGS="$BLAS_LIBS"
  1809. AC_SUBST(STARPU_BLAS_LDFLAGS)
  1810. blas_lib=system
  1811. AC_ARG_VAR([BLAS_LIBS], [linker flags for blas])
  1812. else
  1813. blas_lib=none
  1814. fi
  1815. fi
  1816. AM_CONDITIONAL(ATLAS_BLAS_LIB, test x$blas_lib = xatlas)
  1817. AM_CONDITIONAL(GOTO_BLAS_LIB, test x$blas_lib = xgoto)
  1818. AM_CONDITIONAL(MKL_BLAS_LIB, test x$blas_lib = xmkl)
  1819. AM_CONDITIONAL(SYSTEM_BLAS_LIB, test x$blas_lib = xsystem)
  1820. AM_CONDITIONAL(NO_BLAS_LIB, test x$blas_lib = xnone)
  1821. AC_MSG_CHECKING(which BLAS lib should be used)
  1822. AC_MSG_RESULT($blas_lib)
  1823. AC_SUBST(BLAS_LIB,$blas_lib)
  1824. ##########################################
  1825. # FFT #
  1826. ##########################################
  1827. have_fftw=no
  1828. have_fftwf=no
  1829. have_fftwl=no
  1830. fft_support=no
  1831. AC_ARG_ENABLE(starpufft, [AS_HELP_STRING([--disable-starpufft],
  1832. [Disable build of StarPU-FFT])],
  1833. enable_starpufft=$enableval,enable_starpufft=yes)
  1834. PKG_CHECK_MODULES([FFTW], [fftw3], [
  1835. AC_DEFINE([STARPU_HAVE_FFTW], [1], [Define to 1 if you have the libfftw3 library.])
  1836. AC_SUBST([STARPU_HAVE_FFTW], [1])
  1837. have_fftw=yes
  1838. ], [:])
  1839. AM_CONDITIONAL(STARPU_HAVE_FFTW, [test x$have_fftw = xyes])
  1840. PKG_CHECK_MODULES([FFTWF], [fftw3f], [
  1841. AC_DEFINE([STARPU_HAVE_FFTWF], [1], [Define to 1 if you have the libfftw3f library.])
  1842. AC_SUBST([STARPU_HAVE_FFTWF], [1])
  1843. have_fftwf=yes
  1844. ], [:])
  1845. AM_CONDITIONAL(STARPU_HAVE_FFTWF, [test x$have_fftwf = xyes])
  1846. PKG_CHECK_MODULES([FFTWL], [fftw3l], [
  1847. AC_DEFINE([STARPU_HAVE_FFTWL], [1], [Define to 1 if you have the libfftw3l library.])
  1848. AC_SUBST([HAVE_FFTWFL], [1])
  1849. have_fftwl=yes
  1850. ], [:])
  1851. AM_CONDITIONAL(STARPU_HAVE_FFTWL, [test x$have_fftwl = xyes])
  1852. if test x$enable_starpufft = xyes -a \( \( x$enable_cpu = xyes -a x$have_fftw = xyes -a x$have_fftwf = xyes \) -o x$have_cufftdoublecomplex = xyes \); then
  1853. fft_support=yes
  1854. fi
  1855. AM_CONDITIONAL(BUILD_STARPUFFT, [test x$fft_support = xyes])
  1856. ##########################################
  1857. # hwloc #
  1858. ##########################################
  1859. AC_ARG_WITH([hwloc],
  1860. [AS_HELP_STRING([--without-hwloc], [Disable hwloc (enabled by default)])],
  1861. [
  1862. if test x$withval != xno; then
  1863. if test "$withval" = "yes" ; then
  1864. use_hwloc_from_system=yes
  1865. use_hwloc=yes
  1866. else
  1867. # use specified path
  1868. use_hwloc_from_system=no
  1869. if test ! -d "$withval" ; then
  1870. AC_MSG_ERROR("Directory specified for hwloc <$withval> does not exist")
  1871. fi
  1872. hwloc_dir=$withval
  1873. use_hwloc=yes
  1874. fi
  1875. else
  1876. use_hwloc=no
  1877. fi
  1878. ],
  1879. [
  1880. use_hwloc=maybe
  1881. use_hwloc_from_system=yes
  1882. ])
  1883. SAVED_LDFLAGS="${LDFLAGS}"
  1884. SAVED_CPPFLAGS="${CPPFLAGS}"
  1885. AS_IF([test "$use_hwloc" = "no"],
  1886. [have_valid_hwloc=no],
  1887. [AS_IF([test "$use_hwloc_from_system" = "yes"],
  1888. [PKG_CHECK_MODULES([HWLOC],[hwloc], [
  1889. have_valid_hwloc=yes
  1890. have_pkgconfig_hwloc=yes], [
  1891. have_valid_hwloc=no
  1892. have_pkgconfig_hwloc=no])
  1893. ],
  1894. #else
  1895. [have_pkgconfig_hwloc=no
  1896. CPPFLAGS="${SAVED_CPPFLAGS} -I$hwloc_dir/include"
  1897. AC_CHECK_HEADER([hwloc.h],[have_valid_hwloc=yes],[have_valid_hwloc=no])
  1898. LDFLAGS="${SAVED_LDFLAGS} -L$hwloc_dir/lib"
  1899. AC_HAVE_LIBRARY([hwloc],[have_valid_hwloc=yes],[have_valid_hwloc=no])
  1900. ])
  1901. ])
  1902. # in case hwloc was explicitely required, but is not available, this is an error
  1903. AS_IF([test "$use_hwloc" = "yes" -a "$have_valid_hwloc" = "no"],
  1904. [AC_MSG_ERROR([cannot find hwloc])]
  1905. )
  1906. # in case hwloc is not available but was not explicitely disabled, this is an error
  1907. AS_IF([test "$have_valid_hwloc" = "no" -a "$use_hwloc" != "no"],
  1908. [AC_MSG_ERROR([hwloc was not found on your system. If the target machine is hyperthreaded the performance may be impacted a lot. It is strongly recommended to install hwloc. However, if you really want to use StarPU without enabling hwloc, please restart configure by specifying the option '--without-hwloc'.])]
  1909. )
  1910. AS_IF([test "$have_valid_hwloc" = "yes"],
  1911. [AC_DEFINE([STARPU_HAVE_HWLOC], [1], [Define to 1 if you have the hwloc library.])
  1912. HWLOC_REQUIRES=hwloc
  1913. AC_SUBST([STARPU_HAVE_HWLOC], [1])
  1914. AS_IF([test "$have_pkgconfig_hwloc" = "no"],
  1915. [HWLOC_CFLAGS="-I$hwloc_dir/include"
  1916. HWLOC_LIBS="-L$hwloc_dir/lib -lhwloc"]
  1917. )
  1918. ])
  1919. LDFLAGS="${SAVED_LDFLAGS}"
  1920. CPPFLAGS="${SAVED_CPPFLAGS}"
  1921. AC_MSG_CHECKING(whether hwloc should be used)
  1922. AC_MSG_RESULT($have_valid_hwloc)
  1923. AC_SUBST(HWLOC_REQUIRES)
  1924. # is the header file f77.h available ?
  1925. AC_CHECK_HEADER([f77.h], [have_f77_h=yes], [have_f77_h=no])
  1926. AC_SUBST(STARPU_HAVE_F77_H, $have_f77_h)
  1927. AM_CONDITIONAL(STARPU_HAVE_F77_H, test x$have_f77_h = xyes)
  1928. if test x$have_f77_h = xyes; then
  1929. AC_DEFINE([STARPU_HAVE_F77_H], [1], [Define to 1 if you have the <f77.h> header file.])
  1930. fi
  1931. # Check if icc is available
  1932. AC_CHECK_PROGS([ICC], [icc])
  1933. # If cuda and icc are both available, check they are compatible
  1934. if test "$enable_cuda" = "yes" -a "$ICC" != ""; then
  1935. AC_MSG_CHECKING(whether CUDA and ICC are compatible)
  1936. OLD_CC="$CC"
  1937. CC="$ICC"
  1938. OLD_CFLAGS="$CFLAGS"
  1939. CFLAGS="-I$PWD/include -I$srcdir/include"
  1940. AC_COMPILE_IFELSE(
  1941. [AC_LANG_PROGRAM(
  1942. [[#include <cuda.h>
  1943. #include <starpu.h>]],
  1944. [[]]
  1945. )],
  1946. AC_MSG_RESULT(yes),
  1947. [ICC=""
  1948. AC_MSG_RESULT(no)]
  1949. )
  1950. CC="$OLD_CC"
  1951. CFLAGS="$OLD_CFLAGS"
  1952. fi
  1953. # Disable ICC on windows
  1954. if test "x$ICC" != "x" -a "$starpu_windows" = "yes" ; then
  1955. ICC=""
  1956. fi
  1957. if test "x$ICC" != "x"; then
  1958. AC_DEFINE(STARPU_HAVE_ICC, [], [Define this if icc is available])
  1959. fi
  1960. AM_CONDITIONAL([STARPU_HAVE_ICC], [test "x$ICC" != "x"])
  1961. # Do not generate manpages for the tools if we do not have help2man
  1962. AC_CHECK_PROGS([HELP2MAN], [help2man])
  1963. # Disable on windows
  1964. if test "$starpu_windows" = "yes" ; then
  1965. HELP2MAN=""
  1966. fi
  1967. AM_CONDITIONAL([STARPU_HAVE_HELP2MAN], [test "x$HELP2MAN" != "x"])
  1968. AC_CHECK_MEMBER([struct cudaDeviceProp.pciDomainID],
  1969. AC_DEFINE([STARPU_HAVE_DOMAINID],[1],[Define to 1 if CUDA device properties include DomainID]),
  1970. , [[#include <cuda_runtime_api.h>]])
  1971. AC_CHECK_MEMBER([struct cudaDeviceProp.pciBusID],
  1972. AC_DEFINE([STARPU_HAVE_BUSID],[1],[Define to 1 if CUDA device properties include BusID]),
  1973. , [[#include <cuda_runtime_api.h>]])
  1974. dnl Set this condition when Automake 1.11 or later is being used.
  1975. dnl Automake 1.11 introduced `silent-rules', hence the check.
  1976. m4_ifdef([AM_SILENT_RULES],
  1977. AM_CONDITIONAL([STARPU_HAVE_AM111], [true]),
  1978. AM_CONDITIONAL([STARPU_HAVE_AM111], [false]))
  1979. ##########################################
  1980. # Documentation #
  1981. ##########################################
  1982. AC_ARG_ENABLE(build-doc, [AS_HELP_STRING([--disable-build-doc],
  1983. [disable building of documentation])],
  1984. enable_build_doc=$enableval, enable_build_doc=yes)
  1985. if test "$enable_build_doc" = "yes" ; then
  1986. # Check whether doxygen and pdflatex are installed
  1987. AC_PATH_PROG(doxygencommand, doxygen)
  1988. if test "$doxygencommand" = "" ; then
  1989. enable_build_doc="no"
  1990. else
  1991. DOXYGEN_VERSION_MAJOR=`$doxygencommand --version| cut -d '.' -f1`
  1992. DOXYGEN_VERSION_MINOR=`$doxygencommand --version| cut -d '.' -f2`
  1993. if test $DOXYGEN_VERSION_MAJOR -ge 1 -a $DOXYGEN_VERSION_MINOR -ge 8 ; then
  1994. enable_build_doc="yes"
  1995. else
  1996. enable_build_doc="no"
  1997. fi
  1998. fi
  1999. AC_PATH_PROG(pdflatex, pdflatex)
  2000. if test "pdflatexcommand" = "" ; then
  2001. enable_build_doc="no"
  2002. fi
  2003. fi
  2004. AC_MSG_CHECKING(whether documentation should be compiled)
  2005. AC_MSG_RESULT($enable_build_doc)
  2006. AM_CONDITIONAL(BUILD_DOC, [test x$enable_build_doc != xno])
  2007. ###############################################################################
  2008. # #
  2009. # Final settings #
  2010. # #
  2011. ###############################################################################
  2012. # these are the flags needed for static linking
  2013. LIBSTARPU_LDFLAGS="$STARPU_GLPK_LDFLAGS"
  2014. AC_SUBST([LIBSTARPU_LDFLAGS])
  2015. LIBSTARPU_LINK=libstarpu-$STARPU_EFFECTIVE_VERSION.la
  2016. if test x$enable_perf_debug = xyes; then
  2017. LIBSTARPU_LINK=".libs/libstarpu-$STARPU_EFFECTIVE_VERSION.a $LIBSTARPU_LDFLAGS $HWLOC_LIBS $SIMGRID_LIBS $STARPU_CUDA_LDFLAGS $STARPU_OPENCL_LDFLAGS"
  2018. fi
  2019. AC_SUBST([LIBSTARPU_LINK])
  2020. # File configuration
  2021. AC_CONFIG_COMMANDS([executable-scripts], [
  2022. chmod +x tests/regression/regression.sh
  2023. chmod +x tests/loader-cross.sh
  2024. chmod +x gcc-plugin/tests/run-test
  2025. chmod +x tools/starpu_codelet_profile
  2026. chmod +x tools/starpu_codelet_histo_profile
  2027. chmod +x tools/starpu_workers_activity
  2028. chmod +x doc/doxygen/doxygen_filter.sh
  2029. ])
  2030. # Create links to ICD files in build/socl/vendors directory. SOCL will use this
  2031. # directory as the OCL_ICD_VENDORS directory
  2032. SOCL_VENDORS="vendors/install/socl.icd"
  2033. for icd in /etc/OpenCL/vendors/*.icd ; do
  2034. if test -f $icd ; then
  2035. if test "$(basename $icd)" != "socl.icd" ; then
  2036. new_icd=$(basename $icd)
  2037. AC_CONFIG_LINKS([socl/vendors/$new_icd:$icd])
  2038. SOCL_VENDORS="$SOCL_VENDORS vendors/$new_icd"
  2039. fi
  2040. fi
  2041. done
  2042. AC_SUBST(SOCL_VENDORS)
  2043. AC_CONFIG_FILES(tests/regression/regression.sh tests/regression/profiles tests/regression/profiles.build.only)
  2044. AC_CONFIG_HEADER(src/common/config.h include/starpu_config.h gcc-plugin/include/starpu-gcc/config.h starpu-top/config.h)
  2045. AC_OUTPUT([
  2046. Makefile
  2047. src/Makefile
  2048. tools/Makefile
  2049. tools/starpu_codelet_profile
  2050. tools/starpu_codelet_histo_profile
  2051. tools/starpu_workers_activity
  2052. socl/Makefile
  2053. socl/src/Makefile
  2054. socl/examples/Makefile
  2055. socl/vendors/socl.icd
  2056. socl/vendors/install/socl.icd
  2057. libstarpu.pc
  2058. starpu-1.0.pc
  2059. starpu-1.1.pc
  2060. starpu-1.2.pc
  2061. mpi/libstarpumpi.pc
  2062. mpi/starpumpi-1.0.pc
  2063. mpi/starpumpi-1.1.pc
  2064. mpi/starpumpi-1.2.pc
  2065. starpufft/Makefile
  2066. starpufft/libstarpufft.pc
  2067. starpufft/starpufft-1.0.pc
  2068. starpufft/starpufft-1.1.pc
  2069. starpufft/starpufft-1.2.pc
  2070. examples/Makefile
  2071. examples/stencil/Makefile
  2072. tests/Makefile
  2073. tests/loader-cross.sh
  2074. mpi/Makefile
  2075. mpi/src/Makefile
  2076. mpi/tests/Makefile
  2077. mpi/examples/Makefile
  2078. starpu-top/StarPU-Top.pro
  2079. starpu-top/StarPU-Top-qwt-embed.pri
  2080. starpu-top/StarPU-Top-qwt-system.pri
  2081. gcc-plugin/Makefile
  2082. gcc-plugin/src/Makefile
  2083. gcc-plugin/tests/Makefile
  2084. gcc-plugin/tests/run-test
  2085. gcc-plugin/examples/Makefile
  2086. sc_hypervisor/Makefile
  2087. sc_hypervisor/src/Makefile
  2088. sc_hypervisor/examples/Makefile
  2089. doc/Makefile
  2090. doc/doxygen/Makefile
  2091. doc/doxygen/doxygen-config.cfg
  2092. doc/doxygen/doxygen_filter.sh
  2093. tools/mvsc/starpu_var.bat
  2094. ])
  2095. AC_MSG_NOTICE([
  2096. CPUs enabled: $enable_cpu
  2097. CUDA enabled: $enable_cuda
  2098. OpenCL enabled: $enable_opencl
  2099. SCC enabled: $enable_rcce
  2100. MIC enabled: $enable_mic
  2101. Compile-time limits
  2102. (change these with --enable-maxcpus, --enable-maxcudadev,
  2103. --enable-maxopencldev, --enable-maxbuffers)
  2104. Maximum number of CPUs: $maxcpus
  2105. Maximum number of CUDA devices: $nmaxcudadev
  2106. Maximum number of OpenCL devices: $nmaxopencldev
  2107. Maximum number of MIC threads: $nmaxmicthreads
  2108. Maximum number of memory nodes: $maxnodes
  2109. Maximum number of task buffers: $nmaxbuffers
  2110. GPU-GPU transfers: $have_cuda_memcpy_peer
  2111. Allocation cache: $enable_allocation_cache
  2112. Magma enabled: $have_magma
  2113. BLAS library: $blas_lib
  2114. hwloc: $have_valid_hwloc
  2115. FxT trace enabled: $use_fxt
  2116. StarPU-Top: $build_starpu_top
  2117. Documentation: $enable_build_doc
  2118. Examples: $enable_build_examples
  2119. StarPU Extensions:
  2120. MPI enabled: $use_mpi
  2121. MPI test suite: $running_mpi_check
  2122. FFT Support: $fft_support
  2123. GCC plug-in: $build_gcc_plugin
  2124. GCC plug-in test suite (requires GNU Guile): $run_gcc_plugin_test_suite
  2125. SOCL enabled: $build_socl
  2126. SOCL test suite: $run_socl_check
  2127. Scheduler Hypervisor: $build_sc_hypervisor
  2128. simgrid enabled: $enable_simgrid
  2129. ayudame enabled: $ac_cv_header_Ayudame_h
  2130. ])
  2131. if test "$build_socl" = "yes" -a "$run_socl_check" = "no" ; then
  2132. AC_MSG_NOTICE([
  2133. WARNING: SOCL test suite will not be run as the environment variable SOCL_OCL_LIB_OPENCL is not defined.
  2134. To run the tests, you need to install the OCL implementation of ICD
  2135. (https://forge.imag.fr/projects/ocl-icd/ or Debian package ocl-icd-libopencl1)
  2136. and set the variable SOCL_OCL_LIB_OPENCL to the location of the libOpenCL.so.])
  2137. fi
  2138. if test x"$have_valid_hwloc" = xno -a "$enable_simgrid" = "no"
  2139. then
  2140. AC_MSG_NOTICE([
  2141. WARNING: hwloc was not enabled. If the target machine is hyperthreaded the
  2142. performance may be impacted a lot. It is strongly recommended to install
  2143. hwloc])
  2144. fi