configure.ac 92 KB

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