configure.ac 111 KB

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