configure.ac 135 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680
  1. # StarPU --- Runtime system for heterogeneous multicore architectures.
  2. #
  3. # Copyright (C) 2009-2021 Université de Bordeaux, CNRS (LaBRI UMR 5800), Inria
  4. # Copyright (C) 2011 Télécom-SudParis
  5. # Copyright (C) 2013 Thibaut Lambert
  6. # Copyright (C) 2017 Guillaume Beauchamp
  7. # Copyright (C) 2018,2020 Federal University of Rio Grande do Sul (UFRGS)
  8. # Copyright (C) 2018 Umeà University
  9. #
  10. # StarPU is free software; you can redistribute it and/or modify
  11. # it under the terms of the GNU Lesser General Public License as published by
  12. # the Free Software Foundation; either version 2.1 of the License, or (at
  13. # your option) any later version.
  14. #
  15. # StarPU is distributed in the hope that it will be useful, but
  16. # WITHOUT ANY WARRANTY; without even the implied warranty of
  17. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  18. #
  19. # See the GNU Lesser General Public License in COPYING.LGPL for more details.
  20. #
  21. AC_INIT([StarPU], [1.3.99], [starpu-devel@inria.fr], [starpu], [http://gitlab.inria.fr/starpu/starpu])
  22. AC_CONFIG_SRCDIR(include/starpu.h)
  23. AC_CONFIG_AUX_DIR([build-aux])
  24. # libtool doesn't actually properly manage a space in the workdir
  25. case `pwd` in
  26. *[[\\\"\#\$\&\'\`$am_lf\ \ ]]*)
  27. AC_MSG_ERROR([unsafe absolute working directory name]);;
  28. esac
  29. dnl Versioning.
  30. STARPU_MAJOR_VERSION="`echo $PACKAGE_VERSION | cut -d . -f 1`"
  31. STARPU_MINOR_VERSION="`echo $PACKAGE_VERSION | cut -d . -f 2`"
  32. STARPU_RELEASE_VERSION="`echo $PACKAGE_VERSION | cut -d . -f 3`"
  33. STARPU_RELEASE_VERSION="`echo $PACKAGE_VERSION | cut -d . -f 3| sed 's/rc.*//'`"
  34. 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
  35. AC_SUBST([STARPU_MAJOR_VERSION])
  36. AC_SUBST([STARPU_MINOR_VERSION])
  37. AC_SUBST([STARPU_RELEASE_VERSION])
  38. AC_SUBST([STARPU_EFFECTIVE_VERSION])
  39. AC_DEFINE_UNQUOTED([STARPU_MAJOR_VERSION], [$STARPU_MAJOR_VERSION], [Major version number of StarPU.])
  40. AC_DEFINE_UNQUOTED([STARPU_MINOR_VERSION], [$STARPU_MINOR_VERSION], [Minor version number of StarPU.])
  41. AC_DEFINE_UNQUOTED([STARPU_RELEASE_VERSION], [$STARPU_RELEASE_VERSION], [Release version number of StarPU.])
  42. . "$srcdir/STARPU-VERSION"
  43. AC_SUBST([LIBSTARPU_INTERFACE_CURRENT])
  44. AC_SUBST([LIBSTARPU_INTERFACE_REVISION])
  45. AC_SUBST([LIBSTARPU_INTERFACE_AGE])
  46. AC_SUBST([LIBSTARPUMPI_INTERFACE_CURRENT])
  47. AC_SUBST([LIBSTARPUMPI_INTERFACE_REVISION])
  48. AC_SUBST([LIBSTARPUMPI_INTERFACE_AGE])
  49. AC_SUBST([LIBSTARPUFFT_INTERFACE_CURRENT])
  50. AC_SUBST([LIBSTARPUFFT_INTERFACE_REVISION])
  51. AC_SUBST([LIBSTARPUFFT_INTERFACE_AGE])
  52. AC_SUBST([LIBSTARPURM_INTERFACE_CURRENT])
  53. AC_SUBST([LIBSTARPURM_INTERFACE_REVISION])
  54. AC_SUBST([LIBSTARPURM_INTERFACE_AGE])
  55. AC_SUBST([LIBSOCL_INTERFACE_CURRENT])
  56. AC_SUBST([LIBSOCL_INTERFACE_REVISION])
  57. AC_SUBST([LIBSOCL_INTERFACE_AGE])
  58. AC_SUBST([LIBSTARPUJULIA_INTERFACE_CURRENT])
  59. AC_SUBST([LIBSTARPUJULIA_INTERFACE_REVISION])
  60. AC_SUBST([LIBSTARPUJULIA_INTERFACE_AGE])
  61. AC_CANONICAL_SYSTEM
  62. AM_INIT_AUTOMAKE([1.11 -Wall -Wno-portability foreign silent-rules color-tests parallel-tests subdir-objects])
  63. m4_ifdef([AM_SILENT_RULES],
  64. [AM_SILENT_RULES(yes)])
  65. AC_PREREQ(2.64)
  66. m4_ifdef([AM_PROG_AR], [AM_PROG_AR])
  67. AC_PROG_CC
  68. AM_PROG_CC_C_O
  69. AC_PROG_CXX
  70. AC_PROG_CPP
  71. AC_PROG_SED
  72. AC_PROG_LN_S
  73. AC_PROG_F77
  74. AC_PROG_FC
  75. AC_PROG_GREP
  76. AC_PROG_EGREP
  77. AC_PROG_INSTALL
  78. AC_PROG_MKDIR_P
  79. AC_CHECK_PROGS(PROG_STAT,gstat stat)
  80. AC_CHECK_PROGS(PROG_DATE,gdate date)
  81. AC_PATH_PROGS(PROG_FIND,find)
  82. dnl locate pkg-config
  83. PKG_PROG_PKG_CONFIG
  84. AC_ARG_ENABLE(simgrid, [AS_HELP_STRING([--enable-simgrid],
  85. [Enable simulating execution in simgrid])],
  86. enable_simgrid=$enableval, enable_simgrid=no)
  87. if test x$enable_perf_debug = xyes; then
  88. enable_shared=no
  89. fi
  90. default_enable_mpi_check=maybe
  91. if test x$enable_simgrid = xyes ; then
  92. default_enable_mpi=no
  93. else
  94. default_enable_mpi=maybe
  95. fi
  96. ###############################################################################
  97. # #
  98. # Drivers #
  99. # #
  100. ###############################################################################
  101. AC_ARG_ENABLE(opencl-simulator, [AS_HELP_STRING([--enable-opencl-simulator],
  102. [Enable the use of an OpenCL simulator])],
  103. enable_opencl_simulator=$enableval, enable_opencl_simulator=no)
  104. if test x$enable_opencl_simulator = xyes; then
  105. enable_simgrid=yes
  106. AC_DEFINE(STARPU_OPENCL_SIMULATOR, [1], [Define this to enable using an OpenCL simulator])
  107. fi
  108. AC_ARG_WITH(simgrid-dir,
  109. [AS_HELP_STRING([--with-simgrid-dir=<path>],
  110. [specify SimGrid installation directory])],
  111. [
  112. simgrid_dir="$withval"
  113. # in case this was not explicit yet
  114. enable_simgrid=yes
  115. ], simgrid_dir=no)
  116. AC_ARG_WITH(simgrid-include-dir,
  117. [AS_HELP_STRING([--with-simgrid-include-dir=<path>],
  118. [specify where SimGrid headers are installed])],
  119. [
  120. simgrid_include_dir="$withval"
  121. # in case this was not explicit yet
  122. enable_simgrid=yes
  123. ], [simgrid_include_dir=no])
  124. AC_ARG_WITH(simgrid-lib-dir,
  125. [AS_HELP_STRING([--with-simgrid-lib-dir=<path>],
  126. [specify where SimGrid libraries are installed])],
  127. [
  128. simgrid_lib_dir="$withval"
  129. # in case this was not explicit yet
  130. enable_simgrid=yes
  131. ], [simgrid_lib_dir=no])
  132. if test x$enable_simgrid = xyes ; then
  133. PKG_CHECK_MODULES([SIMGRID], [simgrid], [], [:])
  134. if test "$simgrid_include_dir" != "no" ; then
  135. SIMGRID_CFLAGS="-I$simgrid_include_dir $SIMGRID_CFLAGS"
  136. fi
  137. if test "$simgrid_lib_dir" != "no" ; then
  138. SIMGRID_LIBS="-L$simgrid_lib_dir $SIMGRID_LIBS"
  139. fi
  140. if test "$simgrid_dir" != "no" ; then
  141. SIMGRID_CFLAGS="-I$simgrid_dir/include $SIMGRID_CFLAGS"
  142. SIMGRID_LIBS="-L$simgrid_dir/lib $SIMGRID_LIBS"
  143. fi
  144. if test -n "$SIMGRID_CFLAGS" ; then
  145. CFLAGS="$SIMGRID_CFLAGS $CFLAGS"
  146. CXXFLAGS="$SIMGRID_CFLAGS $CXXFLAGS"
  147. NVCCFLAGS="$SIMGRID_CFLAGS $NVCCFLAGS"
  148. fi
  149. SAVED_LIBS="${LIBS}"
  150. LIBS="$SIMGRID_LIBS $LIBS"
  151. AC_HAVE_LIBRARY([simgrid], [],
  152. [
  153. AC_MSG_ERROR(Simgrid support needs simgrid installed)
  154. ]
  155. )
  156. AC_CHECK_HEADERS([simgrid/msg.h], [AC_DEFINE([STARPU_HAVE_SIMGRID_MSG_H], [1], [Define to 1 if you have msg.h in simgrid/.])])
  157. AC_CHECK_HEADERS([msg/msg.h], [AC_DEFINE([STARPU_HAVE_MSG_MSG_H], [1], [Define to 1 if you have msg.h in msg/.])])
  158. AC_CHECK_HEADERS([simgrid/host.h], [AC_DEFINE([STARPU_HAVE_SIMGRID_HOST_H], [1], [Define to 1 if you have host.h in simgrid/.])])
  159. AC_CHECK_HEADERS([xbt/base.h], [AC_DEFINE([STARPU_HAVE_XBT_BASE_H], [1], [Define to 1 if you have base.h in xbt/.])])
  160. AC_CHECK_HEADERS([simgrid/version.h], [AC_DEFINE([STARPU_HAVE_SIMGRID_VERSION_H], [1], [Define to 1 if you have version.h in simgrid/.])], [], [[
  161. #ifdef STARPU_HAVE_XBT_BASE_H
  162. #include <xbt/base.h>
  163. #endif
  164. ]])
  165. AC_CHECK_HEADERS([simgrid/simdag.h], [AC_DEFINE([STARPU_HAVE_SIMGRID_SIMDAG_H], [1], [Define to 1 if you have simdag.h in simgrid/.])])
  166. AC_CHECK_HEADERS([xbt/synchro.h], [AC_DEFINE([STARPU_HAVE_XBT_SYNCHRO_H], [1], [Define to 1 if you have synchro.h in xbt/.])])
  167. AC_CHECK_HEADERS([xbt/config.h], [AC_DEFINE([STARPU_HAVE_XBT_CONFIG_H], [1], [Define to 1 if you have config.h in xbt/.])])
  168. AC_CHECK_HEADERS([simgrid/actor.h], [AC_DEFINE([STARPU_HAVE_SIMGRID_ACTOR_H], [1], [Define to 1 if you have actor.h in simgrid/.])])
  169. AC_CHECK_HEADERS([simgrid/engine.h], [AC_DEFINE([STARPU_HAVE_SIMGRID_ENGINE_H], [1], [Define to 1 if you have engine.h in simgrid/.])])
  170. AC_CHECK_HEADERS([simgrid/semaphore.h], [AC_DEFINE([STARPU_HAVE_SIMGRID_SEMAPHORE_H], [1], [Define to 1 if you have semaphore.h in simgrid/.])])
  171. AC_CHECK_HEADERS([simgrid/mutex.h], [AC_DEFINE([STARPU_HAVE_SIMGRID_MUTEX_H], [1], [Define to 1 if you have mutex.h in simgrid/.])])
  172. AC_CHECK_HEADERS([simgrid/cond.h], [AC_DEFINE([STARPU_HAVE_SIMGRID_COND_H], [1], [Define to 1 if you have cond.h in simgrid/.])])
  173. AC_CHECK_HEADERS([simgrid/barrier.h], [AC_DEFINE([STARPU_HAVE_SIMGRID_BARRIER_H], [1], [Define to 1 if you have barrier.h in simgrid/.])])
  174. AC_CHECK_HEADERS([simgrid/engine.h])
  175. AC_CHECK_HEADERS([simgrid/zone.h], [AC_DEFINE([STARPU_HAVE_SIMGRID_ZONE_H], [1], [Define to 1 if you have zone.h in simgrid/.])])
  176. AC_CHECK_TYPES([smx_actor_t], [AC_DEFINE([STARPU_HAVE_SMX_ACTOR_T], [1], [Define to 1 if you have the smx_actor_t type.])], [], [[#include <simgrid/simix.h>]])
  177. # Latest functions
  178. AC_CHECK_FUNCS([MSG_process_attach sg_actor_attach sg_actor_init sg_actor_set_stacksize sg_actor_on_exit MSG_zone_get_hosts sg_zone_get_hosts MSG_process_self_name MSG_process_userdata_init sg_actor_get_data sg_actor_set_data sg_actor_data])
  179. AC_CHECK_FUNCS([xbt_mutex_try_acquire smpi_process_set_user_data SMPI_thread_create sg_zone_get_by_name sg_link_get_name sg_link_name sg_link_set_bandwidth sg_link_bandwidth_set sg_host_get_route sg_host_route sg_host_self sg_host_list sg_host_get_speed sg_host_speed simcall_process_create sg_config_continue_after_help])
  180. AC_CHECK_FUNCS([simgrid_init], [AC_DEFINE([STARPU_SIMGRID_HAVE_SIMGRID_INIT], [1], [Define to 1 if you have the `simgrid_init' function.])])
  181. 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.])])
  182. AC_CHECK_FUNCS([sg_actor_sleep_for sg_actor_self sg_actor_ref sg_host_get_properties sg_host_send_to sg_host_sendto sg_cfg_set_int sg_actor_self_execute sg_actor_execute simgrid_get_clock])
  183. AC_CHECK_DECLS([smpi_process_set_user_data], [], [], [[#include <smpi/smpi.h>]])
  184. # Oldies for compatibility with older simgrid
  185. AC_CHECK_FUNCS([MSG_get_as_by_name MSG_zone_get_by_name MSG_environment_get_routing_root MSG_host_get_speed])
  186. LIBS="${SAVED_LIBS}"
  187. AC_DEFINE(STARPU_SIMGRID, [1], [Define this to enable simgrid execution])
  188. # We won't bind or detect anything
  189. with_hwloc=no
  190. # disable mpi checks by default, they require static linking, we don't
  191. # want that by default
  192. default_enable_mpi_check=no
  193. # disable MPI support by default
  194. default_enable_mpi=no
  195. AC_LANG_PUSH([C++])
  196. if test x$enable_shared = xno ; then
  197. # When linking statically, libtool does not realize we need libstdc++ for simgrid_cpp.cpp
  198. SIMGRID_LIBS="$SIMGRID_LIBS -lstdc++"
  199. LIBS="$LIBS -lstdc++"
  200. fi
  201. SIMGRID_LDFLAGS="$SIMGRID_LIBS -lsimgrid"
  202. # Simgrid 3.12 & 3.13 need -std=c++11 to be able to build anything in C++...
  203. case \ $CXXFLAGS\ in
  204. *\ -std=*\ *) ;;
  205. *)
  206. # Make sure our C++ compiler can compile simgrid headers
  207. SIMGRID_INCLUDES="
  208. #ifdef STARPU_HAVE_SIMGRID_MSG_H
  209. #include <simgrid/msg.h>
  210. #include <simgrid/host.h>
  211. #elif defined(STARPU_HAVE_MSG_MSG_H)
  212. #include <msg/msg.h>
  213. #endif
  214. #ifdef STARPU_HAVE_XBT_BASE_H
  215. #include <xbt/base.h>
  216. #endif
  217. #ifdef STARPU_HAVE_SIMGRID_VERSION_H
  218. #include <simgrid/version.h>
  219. #endif
  220. #ifdef STARPU_HAVE_SIMGRID_ZONE_H
  221. #include <simgrid/zone.h>
  222. #endif
  223. #ifdef STARPU_HAVE_SIMGRID_HOST_H
  224. #include <simgrid/host.h>
  225. #endif
  226. #include <xbt/xbt_os_time.h>
  227. "
  228. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[$SIMGRID_INCLUDES]])],,
  229. CXXFLAGS="-std=c++11 $CXXFLAGS")
  230. ;;
  231. esac
  232. AC_LANG_POP([C++])
  233. AC_ARG_ENABLE(simgrid-mc, [AS_HELP_STRING([--enable-simgrid-mc],
  234. [Enable using Model Checker of simgrid])],
  235. enable_simgrid_mc=$enableval, enable_simgrid_mc=no)
  236. if test x$enable_simgrid_mc = xyes ; then
  237. AC_DEFINE(STARPU_SIMGRID_MC, [1], [Define this to enable Model Checker in simgrid execution])
  238. AC_PATH_PROG([SIMGRID_MC], [simgrid-mc], [no], [$simgrid_dir/bin:$PATH])
  239. LDFLAGS="$LDFLAGS -Wl,-znorelro -Wl,-znoseparate-code"
  240. # libsimgrid needs to be linked from binaries themselves for MC to work
  241. STARPU_EXPORTED_LIBS="$STARPU_EXPORTED_LIBS $SIMGRID_LDFLAGS"
  242. fi
  243. fi
  244. AM_CONDITIONAL(STARPU_SIMGRID_MC, test x$enable_simgrid_mc = xyes)
  245. AM_CONDITIONAL(STARPU_SIMGRID, test x$enable_simgrid = xyes)
  246. AC_SUBST(SIMGRID_CFLAGS)
  247. AC_SUBST(SIMGRID_LDFLAGS)
  248. AC_MSG_CHECKING(whether SimGrid is enabled)
  249. AC_MSG_RESULT($enable_simgrid)
  250. AC_MSG_CHECKING(whether blocking drivers should be enabled)
  251. AC_ARG_ENABLE(blocking-drivers, [AS_HELP_STRING([--enable-blocking-drivers], [enable blocking drivers])],
  252. enable_blocking=$enableval, enable_blocking=$enable_simgrid)
  253. AC_MSG_RESULT($enable_blocking)
  254. if test x$enable_blocking = xno ; then
  255. AC_DEFINE(STARPU_NON_BLOCKING_DRIVERS, [1], [drivers must progress])
  256. fi
  257. if test x$enable_blocking = xyes ; then
  258. AC_MSG_CHECKING(whether worker callbacks should be enabled)
  259. AC_ARG_ENABLE(worker-callbacks, [AS_HELP_STRING([--enable-worker-callbacks], [enable worker callbacks])],
  260. enable_worker_cb=$enableval, enable_worker_cb=no)
  261. AC_MSG_RESULT($enable_worker_cb)
  262. else
  263. # worker sleep/wake-up callbacks only make sense if blocking drivers are enabled
  264. enable_worker_cb=no
  265. fi
  266. if test x$enable_worker_cb = xyes ; then
  267. AC_DEFINE(STARPU_WORKER_CALLBACKS, [1], [workers must call callbacks on sleep/wake-up])
  268. fi
  269. ###############################################################################
  270. # #
  271. # LIBTOOLS #
  272. # #
  273. ###############################################################################
  274. #c++11 detection
  275. AX_CXX_COMPILE_STDCXX(11,noext,optional)
  276. AC_SUBST([STARPU_HAVE_CXX11], $HAVE_CXX11)
  277. AM_CONDITIONAL([STARPU_HAVE_CXX11], [test "$HAVE_CXX11" -eq 1])
  278. if test $HAVE_CXX11 -eq 1; then
  279. AC_DEFINE(STARPU_HAVE_CXX11, [1], [compiler supports cxx11])
  280. fi
  281. LT_PREREQ([2.2])
  282. LT_INIT([win32-dll])
  283. AC_HEADER_STDC
  284. AC_C_RESTRICT
  285. # Check if bash is available
  286. AC_PATH_PROG([REALBASH], [bash], , [/bin:$PATH])
  287. # Record git version
  288. AC_PATH_PROG(gitcommand, git)
  289. if test "$gitcommand" = "" ; then
  290. if test -f $srcdir/STARPU-REVISION ; then
  291. cp $srcdir/STARPU-REVISION .
  292. else
  293. echo "unknown" > ./STARPU-REVISION
  294. fi
  295. else
  296. git log -n 1 --pretty="%H" $srcdir > ./STARPU-REVISION
  297. fi
  298. AM_CONDITIONAL([STARPU_CROSS_COMPILING], [test "x$cross_compiling" = "xyes"])
  299. ###############################################################################
  300. # #
  301. # MPI compilers #
  302. # #
  303. ###############################################################################
  304. #Check MPICC
  305. if test x$enable_simgrid = xyes ; then
  306. DEFAULT_MPICC=smpicc
  307. else
  308. DEFAULT_MPICC=mpicc
  309. fi
  310. AC_ARG_WITH(mpicc, [AS_HELP_STRING([--with-mpicc=<mpicc name or path to mpicc>], [Name or path of the mpicc compiler])], [DEFAULT_MPICC=$withval])
  311. case $DEFAULT_MPICC in
  312. /*) mpicc_path="$DEFAULT_MPICC" ;;
  313. *) AC_PATH_PROG(mpicc_path, $DEFAULT_MPICC, [no], [$simgrid_dir/bin:$PATH]) ;;
  314. esac
  315. # We test if the MPICC compiler exists
  316. if test ! -x $mpicc_path; then
  317. AC_MSG_RESULT(The mpicc compiler '$mpicc_path' does not have the execute permission)
  318. mpicc_path=no
  319. fi
  320. AC_MSG_CHECKING(whether mpicc is available)
  321. AC_MSG_RESULT($mpicc_path)
  322. AC_SUBST(MPICC, $mpicc_path)
  323. if test x$mpicc_path != xno ; then
  324. MPIPATH=$(dirname $mpicc_path):$PATH
  325. else
  326. MPIPATH=$PATH
  327. fi
  328. #Check MPICXX/MPIC++
  329. if test x$enable_simgrid = xyes ; then
  330. DEFAULT_MPICXX=smpicxx
  331. else
  332. DEFAULT_MPICXX=mpicxx
  333. fi
  334. AC_ARG_WITH(mpicxx, [AS_HELP_STRING([--with-mpicxx=<mpicxx name or path to mpicxx>], [Name or path of the mpicxx/mpic++ compiler])], [DEFAULT_MPICXX=$withval])
  335. case $DEFAULT_MPICXX in
  336. /*) mpicxx_path="$DEFAULT_MPICXX" ;;
  337. *) AC_PATH_PROG(mpicxx_path, $DEFAULT_MPICXX, [no], [$MPIPATH]) ;;
  338. esac
  339. # try with mpic++ if mpicxx was not found
  340. if test x$mpicxx_path = xno ; then
  341. DEFAULT_MPICXX=mpic++
  342. AC_PATH_PROG(mpicxx_path, $DEFAULT_MPICXX, [no], [$MPIPATH])
  343. fi
  344. # We test if the MPICXX/MPIC++ compiler exists
  345. if test ! -x $mpicxx_path; then
  346. AC_MSG_RESULT(The mpicxx compiler '$mpicxx_path' does not have the execute permission)
  347. mpicxx_path=no
  348. fi
  349. AC_MSG_CHECKING(whether mpicxx is available)
  350. AC_MSG_RESULT($mpicxx_path)
  351. AC_SUBST(MPICXX, $mpicxx_path)
  352. # Check if mpiexec is available
  353. if test x$enable_simgrid = xyes ; then
  354. DEFAULT_MPIEXEC=smpirun
  355. AC_ARG_WITH(smpirun, [AS_HELP_STRING([--with-smpirun[=<name of smpirun or path to smpirun>]], [Name or path of the smpirun helper])], [DEFAULT_MPIEXEC=$withval])
  356. else
  357. DEFAULT_MPIEXEC=mpiexec
  358. AC_ARG_WITH(mpiexec, [AS_HELP_STRING([--with-mpiexec=<name of mpiexec or path to mpiexec>], [Name or path of mpiexec])], [DEFAULT_MPIEXEC=$withval])
  359. fi
  360. case $DEFAULT_MPIEXEC in
  361. /*) mpiexec_path="$DEFAULT_MPIEXEC" ;;
  362. *) AC_PATH_PROG(mpiexec_path, $DEFAULT_MPIEXEC, [no], [$MPIPATH])
  363. esac
  364. AC_MSG_CHECKING(whether mpiexec is available)
  365. AC_MSG_RESULT($mpiexec_path)
  366. # We test if MPIEXEC exists
  367. if test ! -x $mpiexec_path; then
  368. AC_MSG_RESULT(The mpiexec script '$mpiexec_path' is not valid)
  369. default_enable_mpi_check=no
  370. mpiexec_path=""
  371. fi
  372. AC_SUBST(MPIEXEC,$mpiexec_path)
  373. ###############################################################################
  374. # #
  375. # MPI #
  376. # #
  377. ###############################################################################
  378. AC_ARG_ENABLE(mpi, [AS_HELP_STRING([--disable-mpi],
  379. [Disable StarPU MPI library generation])],
  380. [enable_mpi=$enableval],
  381. [enable_mpi=$default_enable_mpi])
  382. if test x$enable_mpi = xmaybe ; then
  383. if test -x "$mpicc_path"; then
  384. enable_mpi=yes
  385. else
  386. enable_mpi=no
  387. fi
  388. fi
  389. # in case MPI was explicitely required, but mpicc is not available, this is an error
  390. if test x$enable_mpi = xyes -a ! -x "$mpicc_path"; then
  391. AC_MSG_ERROR([Compiler MPI '$mpicc_path' not valid])
  392. fi
  393. build_mpi_lib=$enable_mpi
  394. ###############################################################################
  395. # #
  396. # NEW MADELEINE #
  397. # #
  398. ###############################################################################
  399. AC_ARG_ENABLE(nmad, [AS_HELP_STRING([--enable-nmad],
  400. [Enable StarPU MPI library generation using the new madeleine backend])],
  401. [enable_nmad=$enableval],
  402. [enable_nmad=no])
  403. build_nmad_lib=no
  404. AC_SUBST(CC_OR_MPICC, $cc_or_mpicc)
  405. #We can only build StarPU MPI Library if User wants it and MPI is available
  406. if test x$enable_mpi = xyes -a x$enable_nmad = xyes ; then
  407. build_nmad_lib=yes
  408. build_mpi_lib=no
  409. PKG_CHECK_MODULES([NMAD],[nmad])
  410. AC_CHECK_DECL([piom_ltask_set_bound_thread_os_indexes], have_piom_ltask_set_bound_thread_os_indexes=yes, have_piom_ltask_set_bound_thread_os_indexes=no, [[#include <pioman.h>]])
  411. if test x$have_piom_ltask_set_bound_thread_os_indexes = xyes; then
  412. AC_DEFINE(HAVE_PIOM_LTASK_SET_BOUND_THREAD_OS_INDEXES, [1], [piom_ltask_set_bound_thread_os_indexes is availabe])
  413. fi
  414. else
  415. build_nmad_lib=no
  416. fi
  417. ###############################################################################
  418. # #
  419. # MPI Master Slave #
  420. # #
  421. ###############################################################################
  422. AC_ARG_ENABLE(mpi-master-slave, [AS_HELP_STRING([--enable-mpi-master-slave],
  423. [Enable StarPU to run with the master-slave mode])],
  424. use_mpi_master_slave=$enableval,
  425. use_mpi_master_slave=no)
  426. # in case it is explicitely required, but mpicc is not available, this is an error
  427. if test x$use_mpi_master_slave = xyes -a ! -x "$mpicc_path"; then
  428. AC_MSG_ERROR([Compiler MPI '$mpicc_path' not valid])
  429. fi
  430. #We can only build MPI Master Slave if User wants it and MPI compiler are available
  431. if test x$use_mpi_master_slave = xyes -a x$mpicc_path != xno -a x${mpicxx_path} != xno ; then
  432. build_mpi_master_slave=yes
  433. else
  434. build_mpi_master_slave=no
  435. fi
  436. #users cannot use both at the same time
  437. if test x$build_mpi_master_slave = xyes -a x$enable_mpi = xyes; then
  438. AC_MSG_WARN(StarPU-MPI and MPI Master-Slave cannot be used at the same time ! Disabling StarPU-MPI...)
  439. build_mpi_lib=no
  440. build_nmad_lib=no
  441. enable_mpi=no
  442. fi
  443. if test x$build_mpi_master_slave = xyes; then
  444. AC_DEFINE(STARPU_USE_MPI_MASTER_SLAVE, [1], [MPI Master Slave support is enabled])
  445. CC=$mpicc_path
  446. CCLD=$mpicc_path
  447. CXX=$mpicxx_path
  448. CXXLD=mpicxx_path
  449. fi
  450. AC_ARG_WITH(mpi-master-slave-multiple-thread, [AS_HELP_STRING([--with-mpi-master-slave-multiple-thread])],
  451. [AC_DEFINE([STARPU_MPI_MASTER_SLAVE_MULTIPLE_THREAD], [1], [Use multiple threads to communicate with slaves])])
  452. AC_MSG_CHECKING(whether the master-slave mode should be enabled)
  453. AC_MSG_RESULT($build_mpi_master_slave)
  454. AM_CONDITIONAL([STARPU_USE_MPI_MASTER_SLAVE], [test x$build_mpi_master_slave = xyes])
  455. AC_MSG_CHECKING(maximum number of MPI master-slave devices)
  456. AC_ARG_ENABLE(maxmpidev, [AS_HELP_STRING([--enable-maxmpidev=<number>],
  457. [maximum number of MPI master-slave devices])],
  458. nmaxmpidev=$enableval,
  459. [
  460. if test x$build_mpi_master_slave = xyes; then
  461. nmaxmpidev=4
  462. else
  463. nmaxmpidev=0
  464. fi
  465. ])
  466. AC_MSG_RESULT($nmaxmpidev)
  467. AC_DEFINE_UNQUOTED(STARPU_MAXMPIDEVS, [$nmaxmpidev], [maximum number of MPI devices])
  468. ###############################################################################
  469. # #
  470. # Miscellaneous things for MPI #
  471. # #
  472. ###############################################################################
  473. AC_ARG_ENABLE(mpi-pedantic-isend, [AS_HELP_STRING([--enable-mpi-pedantic-isend],
  474. [Prevent StarPU MPI from reading buffers while being sent over MPI])],
  475. enable_mpi_pedantic_isend=$enableval, enable_mpi_pedantic_isend=no)
  476. if test x$enable_mpi_pedantic_isend = xyes; then
  477. AC_DEFINE(STARPU_MPI_PEDANTIC_ISEND, [1], [enable StarPU MPI pedantic isend])
  478. fi
  479. # If the user specifically asks for it, or if we are in a developer checkout, we enable mpi check
  480. AC_ARG_ENABLE(mpi-check, AC_HELP_STRING([--enable-mpi-check], [Enable execution of MPI testcases]),
  481. [enable_mpi_check=$enableval], [enable_mpi_check=$default_enable_mpi_check])
  482. running_mpi_check=no
  483. if test -d "$srcdir/.git" -o -f "$srcdir/.git"; then
  484. running_mpi_check=yes
  485. fi
  486. if test x$enable_mpi_check = xyes ; then
  487. running_mpi_check=yes
  488. fi
  489. if test x$enable_mpi_check = xno ; then
  490. running_mpi_check=no
  491. fi
  492. if test x$enable_mpi = xno ; then
  493. running_mpi_check=no
  494. fi
  495. AM_CONDITIONAL(STARPU_MPI_CHECK, test x$running_mpi_check = xyes)
  496. AC_MSG_CHECKING(whether MPI tests should be run)
  497. AC_MSG_RESULT($running_mpi_check)
  498. AC_MSG_CHECKING(whether the StarPU MPI library should be generated)
  499. AC_MSG_RESULT($build_mpi_lib)
  500. AC_MSG_CHECKING(whether the StarPU MPI nmad library should be generated)
  501. AC_MSG_RESULT($build_nmad_lib)
  502. if test x$build_mpi_lib = xyes -o x$build_nmad_lib = xyes ; then
  503. AC_DEFINE(STARPU_USE_MPI,[1],[whether the StarPU MPI library is available])
  504. if test x$build_mpi_lib = xyes ; then
  505. AC_DEFINE(STARPU_USE_MPI_MPI,[1],[whether the StarPU MPI library (with a native MPI implementation) is available])
  506. else
  507. AC_DEFINE(STARPU_USE_MPI_NMAD,[1],[whether the StarPU MPI library (with a NewMadeleine implementation) is available])
  508. fi
  509. fi
  510. if test x$enable_mpi = xyes ; then
  511. if test x$enable_simgrid = xyes ; then
  512. if test x$enable_shared = xyes ; then
  513. AC_MSG_ERROR([MPI with simgrid can not work with shared libraries, if you need the MPI support, then use --disable-shared to fix this, else disable MPI with --disable-mpi])
  514. else
  515. CFLAGS="$CFLAGS -fPIC"
  516. CXXFLAGS="$CXXFLAGS -fPIC"
  517. NVCCFLAGS="$NVCCFLAGS --compiler-options -fPIC"
  518. FFLAGS="$FFLAGS -fPIC"
  519. FCLAGS="$FFLAGS -fPIC"
  520. fi
  521. fi
  522. enable_mpi_sync_clocks=no
  523. PKG_CHECK_MODULES([MPI_SYNC_CLOCKS],[mpi_sync_clocks],[enable_mpi_sync_clocks=yes],[enable_mpi_sync_clocks=no])
  524. if test x$enable_mpi_sync_clocks = xyes ; then
  525. MPI_SYNC_CLOCKS_LDFLAGS="$(pkg-config --libs mpi_sync_clocks)"
  526. MPI_SYNC_CLOCKS_CFLAGS="$(pkg-config --cflags mpi_sync_clocks)"
  527. fi
  528. fi
  529. AM_CONDITIONAL(STARPU_MPI_SYNC_CLOCKS, test x$enable_mpi_sync_clocks = xyes)
  530. AM_CONDITIONAL(STARPU_USE_MPI_MPI, test x$build_mpi_lib = xyes)
  531. AM_CONDITIONAL(STARPU_USE_MPI_NMAD, test x$build_nmad_lib = xyes)
  532. AM_CONDITIONAL(STARPU_USE_MPI, test x$build_nmad_lib = xyes -o x$build_mpi_lib = xyes)
  533. AC_ARG_WITH(mpiexec-args, [AS_HELP_STRING([--with-mpiexec-args[=<arguments to give when running mpiexec>]],
  534. [Arguments for mpiexec])],
  535. [
  536. mpiexec_args=$withval
  537. ])
  538. AC_SUBST(MPIEXEC_ARGS,$mpiexec_args)
  539. AC_MSG_CHECKING(whether MPI debug messages should be displayed)
  540. AC_ARG_ENABLE(mpi-verbose, [AS_HELP_STRING([--enable-mpi-verbose],
  541. [display MPI verbose debug messages (--enable-mpi-verbose=extra increase the verbosity)])],
  542. enable_mpi_verbose=$enableval, enable_mpi_verbose=no)
  543. AC_MSG_RESULT($enable_mpi_verbose)
  544. if test x$enable_mpi_verbose = xyes; then
  545. AC_DEFINE(STARPU_MPI_VERBOSE, [1], [display MPI verbose debug messages])
  546. fi
  547. if test x$enable_mpi_verbose = xextra; then
  548. AC_DEFINE(STARPU_MPI_VERBOSE, [1], [display MPI verbose debug messages])
  549. AC_DEFINE(STARPU_MPI_EXTRA_VERBOSE, [1], [display MPI verbose debug messages])
  550. fi
  551. if test x$enable_mpi = xyes -o x$build_mpi_master_slave = xyes ; then
  552. cc_or_mpicc=$mpicc_path
  553. # For some reason, libtool uses gcc instead of mpicc when linking
  554. # libstarpumpi.
  555. # On Darwin (and maybe other systems ?) the linker will fail (undefined
  556. # references to MPI_*). We manually add the required flags to fix this
  557. # issue.
  558. # openmpi version
  559. MPICC_LDFLAGS=`$mpicc_path --showme:link 2>/dev/null`
  560. if test -z "$MPICC_LDFLAGS"
  561. then
  562. # mpich version
  563. MPICC_LDFLAGS=`$mpicc_path -link_info | awk '{$1=""; print}'`
  564. fi
  565. AC_SUBST(MPICC_LDFLAGS)
  566. else
  567. cc_or_mpicc=$CC
  568. fi
  569. AC_SUBST(CC_OR_MPICC, $cc_or_mpicc)
  570. ###############################################################################
  571. # #
  572. # NUMA memory nodes #
  573. # #
  574. ###############################################################################
  575. AC_MSG_CHECKING(maximum number of NUMA nodes)
  576. AC_ARG_ENABLE(maxnumanodes, [AS_HELP_STRING([--enable-maxnumanodes=<number>],
  577. [maximum number of NUMA nodes])],
  578. nmaxnumanodes=$enableval, nmaxnumanodes=2)
  579. AC_MSG_RESULT($nmaxnumanodes)
  580. AC_DEFINE_UNQUOTED(STARPU_MAXNUMANODES, [$nmaxnumanodes],
  581. [maximum number of NUMA nodes])
  582. ###############################################################################
  583. AC_PATH_PROGS([STARPU_MS_LIB], [lib])
  584. AC_ARG_VAR([STARPU_MS_LIB], [Path to Microsoft's Visual Studio `lib' tool])
  585. AM_CONDITIONAL([STARPU_HAVE_MS_LIB], [test "x$STARPU_MS_LIB" != "x"])
  586. case "$target" in
  587. *-*-mingw*|*-*-cygwin*|*-*-msys*)
  588. starpu_windows=yes
  589. libext=a
  590. AC_DEFINE(STARPU_HAVE_WINDOWS, [1], [Define this on windows.])
  591. ;;
  592. *-*-linux*)
  593. starpu_linux=yes
  594. AC_DEFINE(STARPU_LINUX_SYS, [1], [Define to 1 on Linux])
  595. ;;
  596. *-*-openbsd*)
  597. starpu_openbsd=yes
  598. AC_DEFINE(STARPU_OPENBSD_SYS, [1], [Define to 1 on OpenBSD systems])
  599. ;;
  600. *-*darwin*)
  601. starpu_darwin=yes
  602. AC_DEFINE(STARPU_HAVE_DARWIN, [1], [Define this on darwin.])
  603. ;;
  604. esac
  605. AM_CONDITIONAL([STARPU_HAVE_WINDOWS], [test "x$starpu_windows" = "xyes"])
  606. AM_CONDITIONAL([STARPU_LINUX_SYS], [test "x$starpu_linux" = "xyes"])
  607. AM_CONDITIONAL([STARPU_HAVE_DARWIN], [test "x$starpu_darwin" = "xyes"])
  608. AM_CONDITIONAL([STARPU_OPENBSD_SYS], [test "x$starpu_openbsd" = "xyes"])
  609. # on Darwin, GCC targets i386 by default, so we don't have atomic ops
  610. AC_CHECK_SIZEOF([void *])
  611. SIZEOF_VOID_P=$ac_cv_sizeof_void_p
  612. case $SIZEOF_VOID_P in
  613. 4)
  614. case "$target" in
  615. i386-*darwin*) CFLAGS+=" -march=i686 " ;;
  616. esac
  617. STARPU_MS_LIB_ARCH=X86
  618. ;;
  619. 8)
  620. STARPU_MS_LIB_ARCH=X64
  621. ;;
  622. esac
  623. AC_SUBST(STARPU_MS_LIB_ARCH)
  624. # This will be useful for program which use CUDA (and .cubin files) which need
  625. # some path to the CUDA code at runtime.
  626. AC_DEFINE_UNQUOTED(STARPU_BUILD_DIR, "$PWD", [location of StarPU build directory])
  627. AC_SUBST(STARPU_BUILD_DIR, $PWD)
  628. case "${srcdir}" in
  629. /*) AC_DEFINE_UNQUOTED(STARPU_SRC_DIR, "$(eval echo ${srcdir})", [location of StarPU sources])
  630. AC_SUBST(STARPU_SRC_DIR, "$(eval echo ${srcdir})") ;;
  631. *) AC_DEFINE_UNQUOTED(STARPU_SRC_DIR, "$(eval echo $PWD/${srcdir})", [location of StarPU sources])
  632. AC_SUBST(STARPU_SRC_DIR, "$(eval echo $PWD/${srcdir})") ;;
  633. esac
  634. case "$target" in
  635. *-*-mingw*|*-*-cygwin*)
  636. AC_ARG_ENABLE(native-winthreads, [AS_HELP_STRING([--enable-native-winthreads],
  637. [Use native windows threads instead of pthread])],
  638. enable_native_winthreads=$enableval, enable_native_winthreads=no)
  639. ;;
  640. esac
  641. if test x"$enable_native_winthreads" != xyes ; then
  642. INCLUDE_PTHREAD_H='#include <pthread.h>'
  643. fi
  644. AC_CHECK_HEADERS([unistd.h], [AC_DEFINE([STARPU_HAVE_UNISTD_H], [1], [Define to 1 if you have the <unistd.h> header file.])])
  645. AC_CHECK_TYPE([struct timespec],
  646. AC_DEFINE(STARPU_HAVE_STRUCT_TIMESPEC,[1],[struct timespec is defined]),
  647. [], [
  648. #include <sys/types.h>
  649. #include <sys/stat.h>
  650. #ifdef HAVE_UNISTD_H
  651. #include <unistd.h>
  652. #endif
  653. #include <time.h>
  654. $INCLUDE_PTHREAD_H
  655. ])
  656. if test x"$enable_native_winthreads" = xyes ; then
  657. CPPFLAGS+=" -I$STARPU_SRC_DIR/include/pthread_win32 "
  658. AC_COMPILE_IFELSE(
  659. [AC_LANG_PROGRAM([[
  660. #define STARPU_CONFIGURE
  661. #include <pthread.h>
  662. ]],
  663. [[ pthread_t t; pthread_create(&t, NULL, NULL, NULL); ]])],
  664. AC_DEFINE(STARPU_NATIVE_WINTHREADS,[1],[Using native windows threads]),
  665. AC_MSG_ERROR([pthread_create unavailable]))
  666. else
  667. AC_CHECK_LIB([pthread], [pthread_create], [
  668. LIBS="$LIBS -lpthread"
  669. STARPU_EXPORTED_LIBS="$STARPU_EXPORTED_LIBS -lpthread"
  670. ])
  671. fi
  672. AC_SEARCH_LIBS([sqrt],[m],,AC_MSG_ERROR([math library unavailable]))
  673. AC_HAVE_LIBRARY([ws2_32])
  674. AC_CHECK_FUNCS([sysconf])
  675. AC_CHECK_FUNCS([getrlimit])
  676. AC_CHECK_FUNCS([scandir])
  677. AC_CHECK_FUNC([pthread_spin_lock], have_pthread_spin_lock=yes, have_pthread_spin_lock=no)
  678. if test x$have_pthread_spin_lock = xyes; then
  679. AC_DEFINE(HAVE_PTHREAD_SPIN_LOCK,[1],[pthread_spin_lock is available])
  680. AC_DEFINE(STARPU_HAVE_PTHREAD_SPIN_LOCK,[1],[pthread_spin_lock is available])
  681. fi
  682. AC_CHECK_FUNC([pthread_barrier_init], have_pthread_barrier=yes, have_pthread_barrier=no)
  683. if test x$have_pthread_barrier = xyes; then
  684. AC_DEFINE(STARPU_HAVE_PTHREAD_BARRIER,[1],[pthread_barrier is available])
  685. fi
  686. # yes, that's non portable, but it's still better than sched_setaffinity
  687. AC_CHECK_FUNCS(pthread_setaffinity_np)
  688. AC_CHECK_FUNC([pthread_setname_np], have_pthread_setname_np=yes, have_pthread_setname_np=no)
  689. if test x$have_pthread_setname_np = xyes; then
  690. AC_DEFINE(STARPU_HAVE_PTHREAD_SETNAME_NP,[1],[pthread_setname_np is available])
  691. fi
  692. if test "x$cross_compiling" = "xno"; then
  693. STARPU_INIT_ZERO([[#include <pthread.h>]], pthread_mutex_t, PTHREAD_MUTEX_INITIALIZER)
  694. STARPU_INIT_ZERO([[#include <pthread.h>]], pthread_cond_t, PTHREAD_COND_INITIALIZER)
  695. STARPU_INIT_ZERO([[#include <pthread.h>]], pthread_rwlock_t, PTHREAD_RWLOCK_INITIALIZER)
  696. fi
  697. # There is no posix_memalign on Mac OS X, only memalign
  698. AC_CHECK_FUNCS([posix_memalign], [AC_DEFINE([STARPU_HAVE_POSIX_MEMALIGN], [1], [Define to 1 if you have the `posix_memalign' function.])])
  699. AC_CHECK_FUNCS([memalign], [AC_DEFINE([STARPU_HAVE_MEMALIGN], [1], [Define to 1 if you have the `memalign' function.])])
  700. # Some systems don't have drand48
  701. AC_CHECK_FUNC([drand48], have_drand48=yes, have_drand48=no)
  702. AC_CHECK_FUNC([erand48_r], have_erand48_r=yes, have_erand48_r=no)
  703. # Maybe the user still does not want to use the provided drand48
  704. AC_ARG_ENABLE(default-drand48, [AS_HELP_STRING([--disable-default-drand48],
  705. [Do not use the default version of drand48])],
  706. enable_default_drand48=$enableval, enable_default_drand48=yes)
  707. if test x$have_drand48 = xyes -a x$enable_default_drand48 = xyes ; then
  708. AC_DEFINE([STARPU_USE_DRAND48], [1], [Define to 1 if drandr48 is available and should be used])
  709. fi
  710. if test x$have_erand48_r = xyes ; then
  711. AC_DEFINE([STARPU_USE_ERAND48_R], [1], [Define to 1 if erandr48_r is available])
  712. fi
  713. # Some systems do not define strerror_r
  714. AC_CHECK_FUNC([strerror_r], [AC_DEFINE([STARPU_HAVE_STRERROR_R], [1], [Define to 1 if the function strerro_r is available.])])
  715. # Some systems may not define setenv
  716. AC_CHECK_FUNC([setenv], [AC_DEFINE([STARPU_HAVE_SETENV], [1], [Define to 1 if the function setenv is available.])])
  717. # Some systems do not define unsetenv
  718. AC_CHECK_FUNC([unsetenv], [AC_DEFINE([STARPU_HAVE_UNSETENV], [1], [Define to 1 if the function unsetenv is available.])])
  719. # Some systems do not define nearbyintf...
  720. AC_CHECK_FUNC([nearbyintf], [AC_DEFINE([STARPU_HAVE_NEARBYINTF], [1], [Define to 1 if the function nearbyintf is available.])])
  721. # ... but they may define rintf.
  722. AC_CHECK_FUNC([rintf], [AC_DEFINE([STARPU_HAVE_RINTF], [1], [Define to 1 if the function rintf is available.])])
  723. # Define quick check
  724. AC_ARG_ENABLE(quick-check, [AS_HELP_STRING([--enable-quick-check],
  725. [Lower default values for the testcases run by make check to allow a faster execution])],
  726. enable_quick_check=$enableval, enable_quick_check=no)
  727. if test x$enable_quick_check = xyes; then
  728. AC_DEFINE(STARPU_QUICK_CHECK, [1], [enable quick check])
  729. fi
  730. AM_CONDITIONAL([STARPU_QUICK_CHECK], [test "x$enable_quick_check" = "xyes"])
  731. # Define long check
  732. AC_ARG_ENABLE(long-check, [AS_HELP_STRING([--enable-long-check],
  733. [Enable some exhaustive checks which take a really long time])],
  734. enable_long_check=$enableval, enable_long_check=no)
  735. if test x$enable_long_check = xyes; then
  736. AC_DEFINE(STARPU_LONG_CHECK, [1], [enable long check])
  737. fi
  738. AM_CONDITIONAL([STARPU_LONG_CHECK], [test "x$enable_long_check" = "xyes"])
  739. # Define new check
  740. AC_ARG_ENABLE(new-check, [AS_HELP_STRING([--enable-new-check],
  741. [Enable new and known-to-fail testcases])],
  742. enable_new_check=$enableval, enable_new_check=no)
  743. if test x$enable_new_check = xyes; then
  744. AC_DEFINE(STARPU_NEW_CHECK, [1], [enable new check])
  745. fi
  746. AM_CONDITIONAL([STARPU_NEW_CHECK], [test "x$enable_new_check" = "xyes"])
  747. AC_CHECK_HEADERS([malloc.h], [AC_DEFINE([STARPU_HAVE_MALLOC_H], [1], [Define to 1 if you have the <malloc.h> header file.])])
  748. AC_ARG_ENABLE(valgrind, [AS_HELP_STRING([--disable-valgrind],
  749. [Do not check the availability of valgrind.h and helgrind.h])],
  750. enable_valgrind=$enableval, enable_valgrind=yes)
  751. if test "$enable_valgrind" != "no" ; then
  752. 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.])])
  753. 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.])])
  754. 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.])])
  755. fi
  756. if test "$enable_valgrind" = "full" ; then
  757. AC_DEFINE([STARPU_VALGRIND_FULL], [1], [Define to 1 to disable STARPU_SKIP_IF_VALGRIND when running tests.])
  758. fi
  759. AC_CHECK_FUNC([sched_yield], [AC_DEFINE([STARPU_HAVE_SCHED_YIELD], [1], [Define to 1 if the function sched_yield is available.])])
  760. AC_CHECK_HEADERS([aio.h])
  761. AC_CHECK_LIB([rt], [aio_read])
  762. #AC_CHECK_HEADERS([libaio.h])
  763. #AC_CHECK_LIB([aio], [io_setup])
  764. AC_CHECK_FUNCS([copy_file_range])
  765. AC_CHECK_FUNCS([mkostemp])
  766. AC_CHECK_FUNCS([mkdtemp])
  767. AC_CHECK_FUNCS([pread pwrite])
  768. AC_ARG_ENABLE(hdf5, [AS_HELP_STRING([--enable-hdf5], [disable HDF5 support])],
  769. enable_hdf5=$enableval, enable_hdf5=no)
  770. if test "x$enable_hdf5" != xno ; then
  771. AC_ARG_WITH(hdf5-include-dir,
  772. [AS_HELP_STRING([--with-hdf5-include-dir=<path>],
  773. [specify where HDF5 headers are installed])],
  774. [
  775. hdf5_include_dir="$withval"
  776. ], [hdf5_include_dir=""])
  777. hdf5_inc_dir="/usr/include/hdf5 /usr/include/hdf5/serial ${hdf5_include_dir}"
  778. enable_include_hdf5=no
  779. for f in $hdf5_inc_dir; do
  780. if test -n "$f" ; then
  781. SAVED_CPPFLAGS="${CPPFLAGS}"
  782. CPPFLAGS="$CPPFLAGS -I$f"
  783. AC_CHECK_HEADERS([hdf5.h])
  784. if test "$ac_cv_header_hdf5_h" = "yes" ; then
  785. CPPFLAGS="-I${f} ${SAVED_CFLAGS}"
  786. enable_include_hdf5=yes
  787. break
  788. else
  789. CPPFLAGS=${SAVED_CPPFLAGS}
  790. fi
  791. unset ac_cv_header_hdf5_h
  792. fi
  793. done
  794. AC_ARG_WITH(hdf5-lib-dir,
  795. [AS_HELP_STRING([--with-hdf5-lib-dir=<path>],
  796. [specify where HDF5 libraries are installed])],
  797. [
  798. hdf5_libraries_dir="$withval"
  799. ], [hdf5_libraries_dir=""])
  800. hdf5_lib_dir="/usr/lib/x86_64-linux-gnu/hdf5 /usr/lib/x86_64-linux-gnu/hdf5/serial ${hdf5_libraries_dir}"
  801. enable_libraries_hdf5=no
  802. for f in $hdf5_lib_dir; do
  803. if test -n "$f" ; then
  804. SAVED_LDFLAGS="${LDFLAGS}"
  805. LDFLAGS=-L${f}
  806. STARPU_HAVE_LIBRARY(HDF5, [hdf5])
  807. if test "$ac_cv_lib_hdf5_main" = "yes" ; then
  808. LDFLAGS="-L${f} ${SAVED_LDFLAGS} ${STARPU_HDF5_LDFLAGS}"
  809. enable_libraries_hdf5=yes
  810. break
  811. else
  812. LDFLAGS=${SAVED_LDFLAGS}
  813. fi
  814. unset ac_cv_lib_hdf5_main
  815. fi
  816. done
  817. fi
  818. if test "x$enable_libraries_hdf5" = "xyes" -a "x$enable_include_hdf5" = "xyes" -a "x$enable_hdf5" != "xno"; then
  819. AC_DEFINE([STARPU_HAVE_HDF5], [1], [Define to 1 if you have the <hdf5.h> header file.])
  820. enable_hdf5=yes
  821. else
  822. enable_hdf5=no
  823. fi
  824. AM_CONDITIONAL(STARPU_HAVE_HDF5, test "x$enable_hdf5" = "xyes")
  825. # This defines HAVE_SYNC_VAL_COMPARE_AND_SWAP
  826. STARPU_CHECK_SYNC_VAL_COMPARE_AND_SWAP
  827. # This defines HAVE_SYNC_BOOL_COMPARE_AND_SWAP
  828. STARPU_CHECK_SYNC_BOOL_COMPARE_AND_SWAP
  829. # This defines HAVE_SYNC_FETCH_AND_ADD
  830. STARPU_CHECK_SYNC_FETCH_AND_ADD
  831. # This defines HAVE_SYNC_FETCH_AND_OR
  832. STARPU_CHECK_SYNC_FETCH_AND_OR
  833. # This defines HAVE_SYNC_LOCK_TEST_AND_SET
  834. STARPU_CHECK_SYNC_LOCK_TEST_AND_SET
  835. # This defines HAVE_ATOMIC_COMPARE_EXCHANGE_N
  836. STARPU_CHECK_ATOMIC_COMPARE_EXCHANGE_N
  837. # This defines HAVE_ATOMIC_EXCHANGE_N
  838. STARPU_CHECK_ATOMIC_EXCHANGE_N
  839. # This defines HAVE_ATOMIC_FETCH_ADD
  840. STARPU_CHECK_ATOMIC_FETCH_ADD
  841. # This defines HAVE_ATOMIC_FETCH_OR
  842. STARPU_CHECK_ATOMIC_FETCH_OR
  843. # This defines HAVE_ATOMIC_TEST_AND_SET
  844. STARPU_CHECK_ATOMIC_TEST_AND_SET
  845. # This defines HAVE_SYNC_SYNCHRONIZE
  846. STARPU_CHECK_SYNC_SYNCHRONIZE
  847. CPPFLAGS="${CPPFLAGS} -D_GNU_SOURCE "
  848. STARPU_SEARCH_LIBS([LIBNUMA],[set_mempolicy],[numa],[enable_libnuma=yes],[enable_libnuma=no])
  849. AC_MSG_CHECKING(whether libnuma is available)
  850. AC_MSG_RESULT($enable_libnuma)
  851. if test x$enable_libnuma = xyes; then
  852. AC_DEFINE(STARPU_HAVE_LIBNUMA,[1],[libnuma is available])
  853. fi
  854. AC_MSG_CHECKING(whether statement expressions are available)
  855. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
  856. #define maxint(a,b) ({int _a = (a), _b = (b); _a > _b ? _a : _b; })
  857. ]],
  858. [[ int x=maxint(12,42); ]])],
  859. [statement_expressions="yes"],
  860. [statement_expressions="no"])
  861. AC_MSG_RESULT($statement_expressions)
  862. if test x$statement_expressions = xyes; then
  863. AC_DEFINE(STARPU_HAVE_STATEMENT_EXPRESSIONS,[1],[statement expressions are available])
  864. fi
  865. ###############################################################################
  866. # #
  867. # SCHED_CTX settings #
  868. # #
  869. ###############################################################################
  870. AC_MSG_CHECKING(maximum number of sched_ctxs)
  871. AC_ARG_ENABLE(max_sched_ctxs, [AS_HELP_STRING([--enable-max-sched-ctxs=<number>],
  872. [maximum number of sched_ctxs])],
  873. max_sched_ctxs=$enableval, max_sched_ctxs=10)
  874. AC_MSG_RESULT($max_sched_ctxs)
  875. AC_DEFINE_UNQUOTED(STARPU_NMAX_SCHED_CTXS, [$max_sched_ctxs], [Maximum number of sched_ctxs supported])
  876. AC_ARG_ENABLE([sc_hypervisor],
  877. [AS_HELP_STRING([--enable-sc-hypervisor],
  878. [enable resizing contexts (experimental)])],
  879. [enable_sc_hypervisor="yes"],
  880. [enable_sc_hypervisor="no"])
  881. #for pkgconfig
  882. AC_SUBST(STARPU_SC_HYPERVISOR)
  883. if test "x$enable_sc_hypervisor" = "xyes"; then
  884. AC_DEFINE(STARPU_USE_SC_HYPERVISOR, [1], [enable sc_hypervisor lib])
  885. # PKG_CHECK_MODULES([SC_HYPERVISOR], [libsc_hypervisor], [], build_sc_hypervisor="yes")
  886. STARPU_SC_HYPERVISOR="-lsc_hypervisor"
  887. build_sc_hypervisor="yes"
  888. else
  889. build_sc_hypervisor="no"
  890. fi
  891. AM_CONDITIONAL([STARPU_BUILD_SC_HYPERVISOR], [test "x$build_sc_hypervisor" = "xyes"])
  892. AM_CONDITIONAL([STARPU_USE_SC_HYPERVISOR], [test "x$build_sc_hypervisor" = "xyes"])
  893. AC_ARG_ENABLE([sc_hypervisor_debug],
  894. [AS_HELP_STRING([--enable-sc-hypervisor-debug],
  895. [enable debug for resizing contexts (experimental)])],
  896. [enable_sc_hypervisor_debug="yes"],
  897. [enable_sc_hypervisor_debug="no"])
  898. AC_SUBST(STARPU_SC_HYPERVISOR_DEBUG, $enable_sc_hypervisor_debug)
  899. AM_CONDITIONAL([STARPU_SC_HYPERVISOR_DEBUG], [test "x$enable_sc_hypervisor_debug" = "xyes"])
  900. if test "x$enable_sc_hypervisor_debug" = "xyes"; then
  901. AC_DEFINE(STARPU_SC_HYPERVISOR_DEBUG, [1], [enable debug sc_hypervisor])
  902. fi
  903. ###############################################################################
  904. # #
  905. # CPUs settings #
  906. # #
  907. ###############################################################################
  908. AC_MSG_CHECKING(maximum number of CPUs)
  909. AC_ARG_ENABLE(maxcpus, [AS_HELP_STRING([--enable-maxcpus=<number>],
  910. [maximum number of CPUs])],
  911. maxcpus=$enableval, maxcpus=auto)
  912. if test x$maxcpus == xauto
  913. then
  914. confcpu=$(getconf _NPROCESSORS_ONLN 2>/dev/null)
  915. if test x$confcpu = x
  916. then
  917. AC_MSG_ERROR([cannot get the number of CPUS, please specify a numerical value with --enable-maxcpus])
  918. fi
  919. maxcpus=2
  920. while test $maxcpus -lt $confcpu
  921. do
  922. maxcpus=`expr $maxcpus \* 2`
  923. done
  924. fi
  925. AC_MSG_RESULT($maxcpus)
  926. AC_DEFINE_UNQUOTED(STARPU_MAXCPUS, [$maxcpus], [Maximum number of CPUs supported])
  927. AC_MSG_CHECKING(whether CPUs should be used)
  928. AC_ARG_ENABLE(cpu, [AS_HELP_STRING([--disable-cpu],
  929. [do not use the CPU(s)])],
  930. enable_cpu=$enableval, enable_cpu=yes)
  931. AC_MSG_RESULT($enable_cpu)
  932. AC_SUBST(STARPU_USE_CPU, $enable_cpu)
  933. AM_CONDITIONAL(STARPU_USE_CPU, test x$enable_cpu = xyes)
  934. if test x$enable_cpu = xyes; then
  935. AC_DEFINE(STARPU_USE_CPU, [1], [CPU driver is activated])
  936. fi
  937. ###############################################################################
  938. # #
  939. # CUDA settings #
  940. # #
  941. ###############################################################################
  942. AC_MSG_CHECKING(maximum number of CUDA devices)
  943. AC_ARG_ENABLE(maxcudadev, [AS_HELP_STRING([--enable-maxcudadev=<number>],
  944. [maximum number of CUDA devices])],
  945. nmaxcudadev=$enableval, nmaxcudadev=4)
  946. AC_MSG_RESULT($nmaxcudadev)
  947. AC_DEFINE_UNQUOTED(STARPU_MAXCUDADEVS, [$nmaxcudadev],
  948. [maximum number of CUDA devices])
  949. AC_ARG_ENABLE(cuda, [AS_HELP_STRING([--disable-cuda],
  950. [do not use CUDA device(s)])],, [enable_cuda=maybe])
  951. #AC_MSG_CHECKING(whether CUDA is available)
  952. AC_ARG_WITH(cuda-dir,
  953. [AS_HELP_STRING([--with-cuda-dir=<path>],
  954. [specify CUDA installation directory])],
  955. [
  956. cuda_dir="$withval"
  957. # in case this was not explicit yet
  958. enable_cuda=yes
  959. ], cuda_dir=no)
  960. AC_ARG_WITH(cuda-include-dir,
  961. [AS_HELP_STRING([--with-cuda-include-dir=<path>],
  962. [specify where CUDA headers are installed])],
  963. [
  964. cuda_include_dir="$withval"
  965. # in case this was not explicit yet
  966. enable_cuda=yes
  967. ], [cuda_include_dir=no])
  968. AC_ARG_WITH(cuda-lib-dir,
  969. [AS_HELP_STRING([--with-cuda-lib-dir=<path>],
  970. [specify where CUDA libraries are installed])],
  971. [
  972. cuda_lib_dir="$withval"
  973. # in case this was not explicit yet
  974. enable_cuda=yes
  975. ], [cuda_lib_dir=no])
  976. AC_DEFUN([STARPU_CHECK_CUDA_L],
  977. [
  978. __cuda_L=$1
  979. SAVED_LDFLAGS="${LDFLAGS}"
  980. STARPU_CUDA_LDFLAGS="${__cuda_L}"
  981. AC_MSG_CHECKING(whether CUDA library is available in $__cuda_L)
  982. AC_MSG_RESULT()
  983. LDFLAGS="${SAVED_LDFLAGS} ${__cuda_L}"
  984. AC_HAVE_LIBRARY([cudart],[have_valid_cuda=yes],[have_valid_cuda=no])
  985. unset ac_cv_lib_cudart_main
  986. if test "$have_valid_cuda" = yes ; then
  987. STARPU_CUDA_LDFLAGS="$STARPU_CUDA_LDFLAGS -lcudart"
  988. LDFLAGS="${SAVED_LDFLAGS} ${STARPU_CUDA_LDFLAGS}"
  989. # we also check that CUBLAS is available
  990. AC_HAVE_LIBRARY([cublas],[have_valid_cuda=yes],[have_valid_cuda=no])
  991. unset ac_cv_lib_cublas_main
  992. if test "$have_valid_cuda" = "yes" ; then
  993. STARPU_CUDA_LDFLAGS="$STARPU_CUDA_LDFLAGS -lcublas"
  994. fi
  995. fi
  996. LDFLAGS="${SAVED_LDFLAGS}"
  997. ])
  998. AC_DEFUN([STARPU_CHECK_CUDA],
  999. [
  1000. __cuda_dir=$1
  1001. __cuda_include_dir=$2
  1002. __cuda_lib_dir=$3
  1003. if test -z "$__cuda_lib_dir" ; then
  1004. __cuda_lib_dir=no
  1005. fi
  1006. if test -z "$__cuda_include_dir" ; then
  1007. __cuda_include_dir=no
  1008. fi
  1009. if test -z "$__cuda_dir" ; then
  1010. __cuda_dir=no
  1011. fi
  1012. if test "$__cuda_dir" != "no" ; then
  1013. AC_MSG_CHECKING(whether CUDA is available in $__cuda_dir, $__cuda_include_dir and $__cuda_lib_dir)
  1014. else
  1015. AC_MSG_CHECKING(whether CUDA is available)
  1016. fi
  1017. AC_MSG_RESULT()
  1018. if test "$__cuda_include_dir" = "no" -a "$__cuda_dir" != "no" ; then
  1019. __cuda_include_dir="$__cuda_dir/include"
  1020. fi
  1021. SAVED_CPPFLAGS="$CPPFLAGS"
  1022. have_valid_cuda=no
  1023. if test "$__cuda_include_dir" != "no" ; then
  1024. CPPFLAGS="${CPPFLAGS} -I$__cuda_include_dir"
  1025. fi
  1026. AC_CHECK_HEADER([cuda.h],[have_valid_cuda=yes],[have_valid_cuda=no])
  1027. unset ac_cv_header_cuda_h
  1028. if test "$have_valid_cuda" = "yes" ; then
  1029. if test "$__cuda_lib_dir" != "no" ; then
  1030. STARPU_CHECK_CUDA_L("-L${__cuda_lib_dir}")
  1031. else
  1032. if test "$__cuda_dir" != "no" ; then
  1033. for __cuda_libdir in lib64 lib lib/x64 lib/Win32 ; do
  1034. STARPU_CHECK_CUDA_L("-L${__cuda_dir}/${__cuda_libdir}")
  1035. if test "$have_valid_cuda" = yes ; then
  1036. break
  1037. fi
  1038. done
  1039. else
  1040. STARPU_CHECK_CUDA_L("")
  1041. fi
  1042. fi
  1043. fi
  1044. if test "$have_valid_cuda" = "no" ; then
  1045. CPPFLAGS="${SAVED_CPPFLAGS}"
  1046. unset STARPU_CUDA_LDFLAGS
  1047. else
  1048. if test "$NVCC" = "" ; then
  1049. AC_PATH_PROG([NVCC], [nvcc], [not-found],
  1050. [$cuda_dir/bin:$PATH:/usr/local/cuda/bin:/usr/bin:/bin])
  1051. fi
  1052. if test "x$NVCC" = "xnot-found"; then
  1053. AC_MSG_WARN(['nvcc' not found, disabling CUDA])
  1054. have_valid_cuda=no
  1055. else
  1056. # This is for very old cuda, to enable the use of double etc.
  1057. AC_MSG_CHECKING(whether nvcc supports sm_13 architecture)
  1058. OLD_NVCCFLAGS="$NVCCFLAGS"
  1059. NVCCFLAGS="$NVCCFLAGS -arch sm_13"
  1060. echo "int main(int argc, char **argv) { return 0;}" > cuda_test.cu
  1061. $NVCC $NVCCFLAGS -c cuda_test.cu >/dev/null 2>&1
  1062. if test $? -eq 0
  1063. then
  1064. AC_MSG_RESULT(yes)
  1065. else
  1066. AC_MSG_RESULT(no)
  1067. NVCCFLAGS="$OLD_NVCCFLAGS"
  1068. fi
  1069. # This is for recent cuda, which complains if we don't actually set an arch!?
  1070. AC_MSG_CHECKING(whether nvcc supports -Wno-deprecated-gpu-targets)
  1071. OLD_NVCCFLAGS="$NVCCFLAGS"
  1072. NVCCFLAGS="$NVCCFLAGS -Wno-deprecated-gpu-targets"
  1073. echo "int main(int argc, char **argv) { return 0;}" > cuda_test.cu
  1074. $NVCC $NVCCFLAGS -c cuda_test.cu >/dev/null 2>&1
  1075. if test $? -eq 0
  1076. then
  1077. AC_MSG_RESULT(yes)
  1078. else
  1079. AC_MSG_RESULT(no)
  1080. NVCCFLAGS="$OLD_NVCCFLAGS"
  1081. fi
  1082. rm -f cuda_test*
  1083. fi
  1084. if test -n "$NVCC_CC"; then
  1085. NVCCFLAGS="${NVCCFLAGS} -ccbin \${NVCC_CC}"
  1086. fi
  1087. if test "$__cuda_include_dir" != "no"; then
  1088. STARPU_CUDA_CPPFLAGS="-I$__cuda_include_dir"
  1089. NVCCFLAGS="${NVCCFLAGS} -I$__cuda_include_dir"
  1090. fi
  1091. fi
  1092. ])
  1093. if test x$enable_cuda = xyes -o x$enable_cuda = xmaybe; then
  1094. STARPU_CHECK_CUDA("$cuda_dir", "$cuda_include_dir", "$cuda_lib_dir")
  1095. if test "$have_valid_cuda" = "no" ; then
  1096. STARPU_CHECK_CUDA("$CUDA_ROOT", "$CUDA_PATH", "$CUDA_INC_PATH", "$CUDA_LIB_PATH")
  1097. fi
  1098. if test "$have_valid_cuda" = "no" ; then
  1099. 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
  1100. if test -n "$f" ; then
  1101. STARPU_CHECK_CUDA("$f", "no", "no")
  1102. if test "$have_valid_cuda" = "yes" ; then
  1103. break
  1104. fi
  1105. fi
  1106. done
  1107. fi
  1108. # Check cuda is compatible with the C compiler
  1109. AC_MSG_CHECKING(whether CUDA is working)
  1110. if test "$have_valid_cuda" = "yes" ; then
  1111. SAVED_CPPFLAGS="${CPPFLAGS}"
  1112. CPPFLAGS="${CPPFLAGS} ${STARPU_CUDA_CPPFLAGS}"
  1113. SAVED_LDFLAGS="${LDFLAGS}"
  1114. LDFLAGS="${LDFLAGS} ${STARPU_CUDA_LDFLAGS} -lcudart"
  1115. AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
  1116. [[#include <cuda.h>]],
  1117. [[]]
  1118. )],
  1119. [
  1120. AC_RUN_IFELSE([AC_LANG_PROGRAM(
  1121. [[#include <cuda.h>]],
  1122. [[]]
  1123. )],
  1124. [have_valid_cuda="yes"],
  1125. [
  1126. 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?])
  1127. have_valid_cuda="no"
  1128. ])
  1129. ],
  1130. [
  1131. AC_MSG_ERROR([CUDA found, but cuda.h could not be compiled])
  1132. have_valid_cuda="no"
  1133. ]
  1134. )
  1135. CPPFLAGS="${SAVED_CPPFLAGS}"
  1136. LDFLAGS="${SAVED_LDFLAGS}"
  1137. fi
  1138. AC_MSG_RESULT($have_valid_cuda)
  1139. # in case CUDA was explicitely required, but is not available, this is an error
  1140. if test x$enable_cuda = xyes -a x$have_valid_cuda = xno; then
  1141. AC_MSG_ERROR([cannot find CUDA])
  1142. fi
  1143. # now we enable CUDA if and only if a proper setup is available
  1144. enable_cuda=$have_valid_cuda
  1145. fi
  1146. AC_MSG_CHECKING(whether CUDA should be used)
  1147. AC_MSG_RESULT($enable_cuda)
  1148. AC_SUBST(STARPU_USE_CUDA, $enable_cuda)
  1149. AM_CONDITIONAL(STARPU_USE_CUDA, test x$enable_cuda = xyes)
  1150. cc_or_nvcc=$CC
  1151. if test x$enable_cuda = xyes; then
  1152. cc_or_nvcc=$NVCC
  1153. AC_DEFINE(STARPU_USE_CUDA, [1], [CUDA support is activated])
  1154. # On Darwin, the libstdc++ dependency is not automatically added by nvcc
  1155. # case "$target" in
  1156. # *-*darwin*) AC_HAVE_LIBRARY([stdc++], []) ;;
  1157. # #*-*darwin*) AC_HAVE_LIBRARY([stdc++], [STARPU_CUDA_LDFLAGS="$STARPU_CUDA_LDFLAGS -lstdc++"]) ;;
  1158. # esac
  1159. STARPU_CUDA_LDFLAGS="$STARPU_CUDA_LDFLAGS -lcudart"
  1160. STARPU_CUFFT_LDFLAGS="-lcufft"
  1161. AC_LANG_PUSH([C++])
  1162. case \ $NVCCFLAGS\ in
  1163. *\ -std=*\ *) ;;
  1164. *)
  1165. SAVED_CXX="$CXX"
  1166. CXX="$NVCC"
  1167. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
  1168. #ifdef STARPU_HAVE_SIMGRID_MSG_H
  1169. #include <simgrid/msg.h>
  1170. #include <simgrid/host.h>
  1171. #else
  1172. #include <msg/msg.h>
  1173. #endif
  1174. ]])],,
  1175. NVCCFLAGS="-std=c++11 $NVCCFLAGS")
  1176. CXX="$SAVED_CXX"
  1177. esac
  1178. AC_LANG_POP([C++])
  1179. if test "$F77" = "gfortran" -o "$FC" = "gfortran" ; then
  1180. STARPU_CUDA_FORTRAN_LDFLAGS="-lgfortran"
  1181. AC_SUBST(STARPU_CUDA_FORTRAN_LDFLAGS)
  1182. fi
  1183. #in case this is a 64bit setup, we tell nvcc to use a -m64 flag, if missing from existing flags
  1184. if test x$SIZEOF_VOID_P = x8; then
  1185. case \ $NVCCFLAGS\ in
  1186. *\ -m64\ *) ;;
  1187. *) NVCCFLAGS="${NVCCFLAGS} -m64" ;;
  1188. esac
  1189. fi
  1190. SAVED_CPPFLAGS="${CPPFLAGS}"
  1191. CPPFLAGS="${CPPFLAGS} ${STARPU_CUDA_CPPFLAGS}"
  1192. SAVED_LDFLAGS="${LDFLAGS}"
  1193. LDFLAGS="${LDFLAGS} ${STARPU_CUDA_LDFLAGS}"
  1194. SAVED_LIBS="${LIBS}"
  1195. AC_CHECK_HEADERS([cuda_gl_interop.h])
  1196. AC_CHECK_LIB([cusparse], [cusparseCreate],
  1197. [AC_DEFINE([HAVE_LIBCUSPARSE], [1], [Define to 1 if you have the cusparse library])
  1198. STARPU_CUDA_LDFLAGS="$STARPU_CUDA_LDFLAGS -lcusparse"])
  1199. AC_CHECK_DECLS([cusparseSetStream], [], [], [[#include <cusparse.h>]])
  1200. LIBS="${LIBS} -lnvidia-ml"
  1201. AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
  1202. [[#include <nvml.h>]],
  1203. [[nvmlInit();]]
  1204. )],
  1205. [
  1206. AC_RUN_IFELSE([AC_LANG_PROGRAM(
  1207. [[#include <nvml.h>]],
  1208. [[nvmlInit();]]
  1209. )],
  1210. [have_valid_nvml="yes"],
  1211. [
  1212. AC_MSG_RESULT([NVML found and can be compiled, but compiled application can not be run, you are probably on a machine without the CUDA driver])
  1213. have_valid_nvml="no"
  1214. ])
  1215. ],
  1216. [
  1217. AC_MSG_WARN([NVML found, but nvml.h could not be compiled])
  1218. have_valid_nvml="no"
  1219. ]
  1220. )
  1221. if test x$have_valid_nvml = xyes ; then
  1222. AC_CHECK_DECLS([nvmlDeviceGetTotalEnergyConsumption], [
  1223. AC_CHECK_FUNCS([nvmlDeviceGetTotalEnergyConsumption])
  1224. ], [], [[#include <nvml.h>]])
  1225. AC_DEFINE([STARPU_HAVE_LIBNVIDIA_ML], [1], [Define to 1 if you have the nvidia-ml library])
  1226. STARPU_CUDA_LDFLAGS="$STARPU_CUDA_LDFLAGS -lnvidia-ml"
  1227. fi
  1228. AC_MSG_CHECKING(whether nvidia-ml should be used)
  1229. AC_MSG_RESULT($have_valid_nvml)
  1230. CPPFLAGS="${SAVED_CPPFLAGS}"
  1231. LDFLAGS="${SAVED_LDFLAGS}"
  1232. LIBS="${SAVED_LIBS}"
  1233. fi
  1234. AC_SUBST(CC_OR_NVCC, $cc_or_nvcc)
  1235. have_magma=no
  1236. if test x$enable_cuda = xyes; then
  1237. PKG_CHECK_MODULES([MAGMA], [magma], [
  1238. AC_DEFINE([STARPU_HAVE_MAGMA], [1], [Define to 1 if you have the MAGMA library.])
  1239. AC_SUBST([STARPU_HAVE_MAGMA], [1])
  1240. have_magma=yes
  1241. ], [:])
  1242. fi
  1243. AM_CONDITIONAL(STARPU_HAVE_MAGMA, [test x$have_magma = xyes])
  1244. AC_MSG_CHECKING(whether MAGMA should be used)
  1245. AC_MSG_RESULT($have_magma)
  1246. # cufftDoubleComplex may not be available on an old CUDA setup
  1247. AC_CHECK_TYPE(cufftDoubleComplex,
  1248. [have_cufftdoublecomplex=yes],
  1249. [have_cufftdoublecomplex=no], [#include <cufft.h>])
  1250. AM_CONDITIONAL(STARPU_HAVE_CUFFTDOUBLECOMPLEX, test x$have_cufftdoublecomplex = xyes)
  1251. if test x$have_cufftdoublecomplex = xyes; then
  1252. AC_DEFINE(STARPU_HAVE_CUFFTDOUBLECOMPLEX, [1], [cufftDoubleComplex is available])
  1253. fi
  1254. # The CURAND library is only available since CUDA 3.2
  1255. have_curand=$enable_cuda
  1256. if test x$enable_cuda = xyes; then
  1257. SAVED_LDFLAGS="${LDFLAGS}"
  1258. LDFLAGS="${LDFLAGS} ${STARPU_CUDA_LDFLAGS}"
  1259. AC_HAVE_LIBRARY([curand],[have_curand=yes],[have_curand=no])
  1260. LDFLAGS="${SAVED_LDFLAGS}"
  1261. fi
  1262. AC_MSG_CHECKING(whether CURAND is available)
  1263. AC_MSG_RESULT($have_curand)
  1264. if test x$have_curand = xyes; then
  1265. AC_DEFINE(STARPU_HAVE_CURAND,[1], [CURAND is available])
  1266. STARPU_CURAND_LDFLAGS="$STARPU_CURAND_LDFLAGS -lcurand"
  1267. AC_SUBST(STARPU_CURAND_LDFLAGS)
  1268. fi
  1269. # Peer transfers are only supported since CUDA 4.0
  1270. # Disable them if user explicity wants to disable them
  1271. 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=$enable_cuda])
  1272. if test x$enable_cuda_memcpy_peer = xyes; then
  1273. AC_DEFINE(STARPU_HAVE_CUDA_MEMCPY_PEER,[1],[Peer transfers are supported in CUDA])
  1274. fi
  1275. if test x$enable_cuda = xyes; then
  1276. if test x$starpu_windows != xyes ; then
  1277. STARPU_CUDA_LDFLAGS="$STARPU_CUDA_LDFLAGS -lstdc++"
  1278. fi
  1279. AC_SUBST(STARPU_CUDA_LDFLAGS)
  1280. AC_SUBST(STARPU_CUFFT_LDFLAGS)
  1281. AC_SUBST(STARPU_CUDA_CPPFLAGS)
  1282. fi
  1283. AC_ARG_VAR([NVCC], [CUDA compiler])
  1284. AC_ARG_VAR([NVCC_CC], [C compiler for CUDA compiler])
  1285. AC_ARG_VAR([NVCCFLAGS], [CUDA compiler flags])
  1286. ###############################################################################
  1287. # #
  1288. # OpenCL settings #
  1289. # #
  1290. ###############################################################################
  1291. AC_MSG_CHECKING(maximum number of OpenCL devices)
  1292. AC_ARG_ENABLE(maxopencldev, [AS_HELP_STRING([--enable-maxopencldev=<number>],
  1293. [maximum number of OPENCL devices])],
  1294. nmaxopencldev=$enableval, nmaxopencldev=8)
  1295. AC_MSG_RESULT($nmaxopencldev)
  1296. AC_DEFINE_UNQUOTED(STARPU_MAXOPENCLDEVS, [$nmaxopencldev],
  1297. [maximum number of OPENCL devices])
  1298. AC_ARG_ENABLE(opencl, [AS_HELP_STRING([--disable-opencl],
  1299. [do not use OpenCL device(s)])],, [enable_opencl=maybe])
  1300. have_valid_opencl=no
  1301. AC_DEFUN([STARPU_CHECK_OPENCL],
  1302. [
  1303. __opencl_dir=$1
  1304. __opencl_include_dir=$2
  1305. __opencl_lib_dir=$3
  1306. if test "$__opencl_dir" != "no" ; then
  1307. AC_MSG_CHECKING(whether OpenCL is available in $__opencl_dir $__opencl_include_dir and $__opencl_lib_dir)
  1308. else
  1309. AC_MSG_CHECKING(whether OpenCL is available)
  1310. fi
  1311. AC_MSG_RESULT()
  1312. if test "$__opencl_include_dir" = "no" -a "$__opencl_dir" != "no" ; then
  1313. __opencl_include_dir="$__opencl_dir/include"
  1314. fi
  1315. SAVED_CPPFLAGS="$CPPFLAGS"
  1316. SAVED_LDFLAGS="${LDFLAGS}"
  1317. if test "$__opencl_include_dir" != "no" ; then
  1318. CPPFLAGS="${CPPFLAGS} -I$__opencl_include_dir"
  1319. fi
  1320. AC_CHECK_HEADER([CL/cl.h],[have_valid_opencl=yes],[have_valid_opencl=no])
  1321. unset ac_cv_header_CL_cl_h
  1322. if test "$have_valid_opencl" = "yes" ; then
  1323. if test "$__opencl_lib_dir" != "no"; then
  1324. LDFLAGS="${SAVED_LDFLAGS} -L$__opencl_lib_dir"
  1325. AC_HAVE_LIBRARY([OpenCL],[have_valid_opencl=yes],[have_valid_opencl=no])
  1326. unset ac_cv_lib_OpenCL_main
  1327. else
  1328. AC_MSG_CHECKING(whether OpenCL is available in $__opencl_dir)
  1329. AC_MSG_RESULT()
  1330. AC_HAVE_LIBRARY([OpenCL],[have_valid_opencl=yes],[have_valid_opencl=no])
  1331. unset ac_cv_lib_OpenCL_main
  1332. if test "$have_valid_opencl" = "no" -a "$__opencl_dir" != "no" ; then
  1333. for __cuda_libdir in lib64 lib lib/x86 lib/Win32 ; do
  1334. __opencl_lib_dir="$__opencl_dir/$__cuda_libdir"
  1335. AC_MSG_CHECKING(whether OpenCL is available in $__opencl_dir and $__opencl_lib_dir)
  1336. AC_MSG_RESULT()
  1337. LDFLAGS="${SAVED_LDFLAGS} -L$__opencl_lib_dir"
  1338. AC_HAVE_LIBRARY([OpenCL],[have_valid_opencl=yes],[have_valid_opencl=no])
  1339. unset ac_cv_lib_OpenCL_main
  1340. if test "$have_valid_opencl" = yes ; then
  1341. break
  1342. fi
  1343. done
  1344. else
  1345. LDFLAGS="${SAVED_LDFLAGS}"
  1346. AC_HAVE_LIBRARY([OpenCL],[have_valid_opencl=yes],[have_valid_opencl=no])
  1347. unset ac_cv_lib_OpenCL_main
  1348. fi
  1349. fi
  1350. fi
  1351. if test "$have_valid_opencl" = "yes" -a "$__opencl_include_dir" != "no"; then
  1352. STARPU_OPENCL_CPPFLAGS="-I$__opencl_include_dir"
  1353. AC_CHECK_HEADERS([CL/cl_ext.h])
  1354. fi
  1355. CPPFLAGS="${SAVED_CPPFLAGS}"
  1356. LDFLAGS="${SAVED_LDFLAGS}"
  1357. if test "$have_valid_opencl" = "yes" ; then
  1358. if test "$__opencl_lib_dir" != "no"; then
  1359. STARPU_OPENCL_LDFLAGS="-L$__opencl_lib_dir"
  1360. fi
  1361. STARPU_OPENCL_LDFLAGS="${STARPU_OPENCL_LDFLAGS} -lOpenCL"
  1362. fi
  1363. ])
  1364. #AC_MSG_CHECKING(whether OpenCL is available)
  1365. AC_ARG_WITH(opencl-dir,
  1366. [AS_HELP_STRING([--with-opencl-dir=<path>],
  1367. [specify OpenCL installation directory])],
  1368. [
  1369. opencl_dir="$withval"
  1370. # in case this was not explicit yet
  1371. enable_opencl=yes
  1372. ], opencl_dir=no)
  1373. AC_ARG_WITH(opencl-include-dir,
  1374. [AS_HELP_STRING([--with-opencl-include-dir=<path>],
  1375. [specify where OpenCL headers are installed])],
  1376. [
  1377. opencl_include_dir="$withval"
  1378. # in case this was not explicit yet
  1379. enable_opencl=yes
  1380. ], [opencl_include_dir=no])
  1381. AC_ARG_WITH(opencl-lib-dir,
  1382. [AS_HELP_STRING([--with-opencl-lib-dir=<path>],
  1383. [specify where OpenCL libraries are installed])],
  1384. [
  1385. opencl_lib_dir="$withval"
  1386. # in case this was not explicit yet
  1387. enable_opencl=yes
  1388. ], [opencl_lib_dir=no])
  1389. AC_DEFUN([STARPU_LOOK_FOR_OPENCL],
  1390. [
  1391. if test "x$has_opencl_being_checked" != "xyes" ; then
  1392. STARPU_CHECK_OPENCL("$opencl_dir", "$opencl_include_dir", "$opencl_lib_dir")
  1393. if test "$have_valid_opencl" = "no" ; then
  1394. 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
  1395. if test -n "$f" ; then
  1396. STARPU_CHECK_OPENCL("$f", "no", "no")
  1397. if test "$have_valid_opencl" = "yes" ; then
  1398. break
  1399. fi
  1400. fi
  1401. done
  1402. fi
  1403. has_opencl_being_checked=yes
  1404. fi
  1405. ])
  1406. if test x$enable_opencl = xyes -o x$enable_opencl = xmaybe; then
  1407. case $target in
  1408. *-*-darwin*)
  1409. AC_MSG_CHECKING(whether OpenCL is available)
  1410. SAVED_LIBS=$LIBS
  1411. LIBS="$LIBS -framework OpenCL"
  1412. AC_LINK_IFELSE(
  1413. [AC_LANG_PROGRAM([[
  1414. #ifdef __APPLE_CC__
  1415. #include <OpenCL/opencl.h>
  1416. #else
  1417. #include <CL/cl.h>
  1418. #endif
  1419. ]],
  1420. [[return clSetKernelArg(0, 0, 0, 0); ]])],
  1421. [AC_MSG_RESULT(yes)
  1422. enable_opencl=yes
  1423. have_valid_opencl=yes
  1424. STARPU_OPENCL_CPPFLAGS=
  1425. STARPU_OPENCL_LDFLAGS="-framework OpenCL"],
  1426. [AC_MSG_RESULT(no)
  1427. enable_opencl=no])
  1428. LIBS=$SAVED_LIBS
  1429. ;;
  1430. *)
  1431. STARPU_LOOK_FOR_OPENCL()
  1432. # in case OpenCL was explicitely required, but is not available, this is an error
  1433. if test x$enable_opencl = xyes -a x$have_valid_opencl = xno; then
  1434. AC_MSG_ERROR([cannot find OpenCL])
  1435. fi
  1436. # now we enable OpenCL if and only if a proper setup is available
  1437. enable_opencl=$have_valid_opencl
  1438. ;;
  1439. esac
  1440. save_LIBS="$LIBS"
  1441. LIBS="$LIBS $STARPU_OPENCL_LDFLAGS"
  1442. AC_CHECK_FUNCS([clEnqueueMarkerWithWaitList])
  1443. LIBS="$save_LIBS"
  1444. fi
  1445. AC_MSG_CHECKING(whether OpenCL should be used)
  1446. AC_MSG_RESULT($enable_opencl)
  1447. AC_SUBST(STARPU_USE_OPENCL, $enable_opencl)
  1448. AM_CONDITIONAL(STARPU_USE_OPENCL, test x$enable_opencl = xyes)
  1449. if test x$enable_opencl = xyes ; then
  1450. AC_DEFINE(STARPU_USE_OPENCL, [1], [OpenCL support is activated])
  1451. STARPU_OPENCL_CPPFLAGS="${STARPU_OPENCL_CPPFLAGS} -DSTARPU_OPENCL_DATADIR=${datarootdir}/starpu/opencl -DCL_USE_DEPRECATED_OPENCL_1_1_APIS"
  1452. AC_SUBST(STARPU_OPENCL_DATAdir, "$(eval echo ${datarootdir}/starpu/opencl/examples)")
  1453. AC_SUBST(STARPU_OPENCL_CPPFLAGS)
  1454. AC_SUBST(STARPU_OPENCL_LDFLAGS)
  1455. fi
  1456. ###############################################################################
  1457. # #
  1458. # General GPU settings #
  1459. # #
  1460. ###############################################################################
  1461. AC_MSG_CHECKING(whether asynchronous copy should be disabled)
  1462. AC_ARG_ENABLE(asynchronous-copy, [AS_HELP_STRING([--disable-asynchronous-copy],
  1463. [disable asynchronous copy between CPU and GPU])],
  1464. enable_asynchronous_copy=$enableval, enable_asynchronous_copy=yes)
  1465. disable_asynchronous_copy=no
  1466. if test x$enable_asynchronous_copy = xno ; then
  1467. disable_asynchronous_copy=yes
  1468. fi
  1469. AC_MSG_RESULT($disable_asynchronous_copy)
  1470. if test x$disable_asynchronous_copy = xyes ; then
  1471. AC_DEFINE([STARPU_DISABLE_ASYNCHRONOUS_COPY], [1], [Define to 1 to disable asynchronous copy between CPU and GPU devices])
  1472. fi
  1473. AC_MSG_CHECKING(whether asynchronous CUDA copy should be disabled)
  1474. AC_ARG_ENABLE(asynchronous-cuda-copy, [AS_HELP_STRING([--disable-asynchronous-cuda-copy],
  1475. [disable asynchronous copy between CPU and CUDA devices])],
  1476. enable_asynchronous_cuda_copy=$enableval, enable_asynchronous_cuda_copy=yes)
  1477. disable_asynchronous_cuda_copy=no
  1478. if test x$enable_asynchronous_cuda_copy = xno ; then
  1479. disable_asynchronous_cuda_copy=yes
  1480. fi
  1481. AC_MSG_RESULT($disable_asynchronous_cuda_copy)
  1482. if test x$disable_asynchronous_cuda_copy = xyes ; then
  1483. AC_DEFINE([STARPU_DISABLE_ASYNCHRONOUS_CUDA_COPY], [1], [Define to 1 to disable asynchronous copy between CPU and CUDA devices])
  1484. fi
  1485. AC_MSG_CHECKING(whether asynchronous OpenCL copy should be disabled)
  1486. AC_ARG_ENABLE(asynchronous-opencl-copy, [AS_HELP_STRING([--disable-asynchronous-opencl-copy],
  1487. [disable asynchronous copy between CPU and OPENCL devices])],
  1488. enable_asynchronous_opencl_copy=$enableval, enable_asynchronous_opencl_copy=yes)
  1489. disable_asynchronous_opencl_copy=no
  1490. if test x$enable_asynchronous_opencl_copy = xno ; then
  1491. disable_asynchronous_opencl_copy=yes
  1492. fi
  1493. AC_MSG_RESULT($disable_asynchronous_opencl_copy)
  1494. if test x$disable_asynchronous_opencl_copy = xyes ; then
  1495. AC_DEFINE([STARPU_DISABLE_ASYNCHRONOUS_OPENCL_COPY], [1], [Define to 1 to disable asynchronous copy between CPU and OpenCL devices])
  1496. fi
  1497. AC_MSG_CHECKING(whether asynchronous MPI Master Slave copy should be disabled)
  1498. AC_ARG_ENABLE(asynchronous-mpi-master-slave-copy, [AS_HELP_STRING([--disable-asynchronous-mpi-master-slave-copy],
  1499. [disable asynchronous copy between MPI Master and MPI Slave devices])],
  1500. enable_asynchronous_mpi_master_slave_copy=$enableval, enable_asynchronous_mpi_master_slave_copy=yes)
  1501. disable_asynchronous_mpi_master_slave_copy=no
  1502. if test x$enable_asynchronous_mpi_master_slave_copy = xno ; then
  1503. disable_asynchronous_mpi_master_slave_copy=yes
  1504. fi
  1505. AC_MSG_RESULT($disable_asynchronous_mpi_master_slave_copy)
  1506. if test x$disable_asynchronous_mpi_master_slave_copy = xyes ; then
  1507. AC_DEFINE([STARPU_DISABLE_ASYNCHRONOUS_MPI_MS_COPY], [1], [Define to 1 to disable asynchronous copy between MPI Master and MPI Slave devices])
  1508. fi
  1509. ###############################################################################
  1510. # #
  1511. # Debug and Performance analysis tools #
  1512. # #
  1513. ###############################################################################
  1514. AC_MSG_CHECKING(whether debug mode should be enabled)
  1515. AC_ARG_ENABLE(debug, [AS_HELP_STRING([--enable-debug], [enable debug mode])],
  1516. enable_debug=$enableval, enable_debug=no)
  1517. AC_MSG_RESULT($enable_debug)
  1518. AC_ARG_ENABLE(spinlock_check, [AS_HELP_STRING([--enable-spinlock-check], [enable spinlock check])], enable_spinlock_check=$enableval, enable_spinlock_check=no)
  1519. 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)
  1520. if test x$enable_debug = xyes; then
  1521. AC_DEFINE(STARPU_DEBUG, [1], [enable debugging statements])
  1522. CFLAGS="$CFLAGS -O0"
  1523. CXXFLAGS="$CXXFLAGS -O0"
  1524. FFLAGS="$FFLAGS -O0"
  1525. FCFLAGS="$FCFLAGS -O0"
  1526. enable_spinlock_check=yes
  1527. if test x$GCC = xyes; then
  1528. IS_SUPPORTED_FLAG(-Og)
  1529. if test x$starpu_windows != xyes ; then
  1530. if test x$enable_fstack_protector_all = xyes ; then
  1531. CFLAGS="$CFLAGS -fstack-protector-all"
  1532. CXXFLAGS="$CXXFLAGS -fstack-protector-all"
  1533. FFLAGS="$FFLAGS -fstack-protector-all"
  1534. FCFLAGS="$FCFLAGS -fstack-protector-all"
  1535. fi
  1536. fi
  1537. fi
  1538. else
  1539. CFLAGS="-O3 $CFLAGS"
  1540. CXXFLAGS="-O3 $CXXFLAGS"
  1541. FFLAGS="-O3 $FFLAGS"
  1542. FCFLAGS="-O3 $FCFLAGS"
  1543. fi
  1544. AC_MSG_CHECKING(whether gdb information should be enabled)
  1545. AC_ARG_ENABLE(gdb, [AS_HELP_STRING([--disable-gdb], [disable gdb information])],
  1546. enable_gdb=$enableval, enable_gdb=yes)
  1547. AC_MSG_RESULT($enable_gdb)
  1548. AC_MSG_CHECKING(whether full gdb information should be enabled)
  1549. AC_ARG_ENABLE(full-gdb-information, [AS_HELP_STRING([--disable-full-gdb-information], [disable full gdb information])],
  1550. enable_full_gdb_information=$enableval, enable_full_gdb_information=yes)
  1551. AC_MSG_RESULT($enable_full_gdb_information)
  1552. if test x$enable_gdb = xyes; then
  1553. if test x$enable_full_gdb_information = xyes -a x$GCC = xyes; then
  1554. CFLAGS+=" -gdwarf-2 -g3"
  1555. CXXFLAGS+=" -gdwarf-2 -g3"
  1556. FFLAGS+=" -gdwarf-2 -g3"
  1557. FCFLAGS+=" -gdwarf-2 -g3"
  1558. LDFLAGS+=" -gdwarf-2 -g3"
  1559. else
  1560. CFLAGS+=" -g "
  1561. CXXFLAGS+=" -g "
  1562. FFLAGS+=" -g "
  1563. FCFLAGS+=" -g "
  1564. LDFLAGS+=" -g "
  1565. fi
  1566. else
  1567. CFLAGS+=" -g0 "
  1568. CXXFLAGS+=" -g0 "
  1569. FFLAGS+=" -g0 "
  1570. FCFLAGS+=" -g0 "
  1571. LDFLAGS+=" -g0 "
  1572. fi
  1573. if test x$enable_spinlock_check = xyes; then
  1574. AC_DEFINE(STARPU_SPINLOCK_CHECK, [1], [check spinlock use])
  1575. fi
  1576. AC_MSG_CHECKING(whether extra checks should be performed)
  1577. AC_ARG_ENABLE(fast, [AS_HELP_STRING([--enable-fast],
  1578. [do not enforce assertions])],
  1579. enable_fast=$enableval, enable_fast=no)
  1580. AC_MSG_RESULT($enable_fast)
  1581. if test x$enable_fast = xyes; then
  1582. AC_DEFINE(STARPU_NO_ASSERT, [1], [disable assertions])
  1583. else
  1584. # fortify gets really enabled only with optimizations, avoid enabling it
  1585. # when optimizations are not enabled, because with some glibc it
  1586. # spews a lot of warnings.
  1587. if test x$enable_debug != xyes; then
  1588. if test x$GCC = xyes; then
  1589. CPPFLAGS="-D_FORTIFY_SOURCE=1 $CPPFLAGS"
  1590. fi
  1591. fi
  1592. fi
  1593. AC_MSG_CHECKING(whether debug messages should be displayed)
  1594. AC_ARG_ENABLE(verbose, [AS_HELP_STRING([--enable-verbose],
  1595. [display verbose debug messages (--enable-verbose=extra increase the verbosity)])],
  1596. enable_verbose=$enableval, enable_verbose=no)
  1597. AC_MSG_RESULT($enable_verbose)
  1598. if test x$enable_verbose = xyes; then
  1599. AC_DEFINE(STARPU_VERBOSE, [1], [display verbose debug messages])
  1600. fi
  1601. if test x$enable_verbose = xextra; then
  1602. AC_DEFINE(STARPU_VERBOSE, [1], [display verbose debug messages])
  1603. AC_DEFINE(STARPU_EXTRA_VERBOSE, [1], [display verbose debug messages])
  1604. fi
  1605. AC_MSG_CHECKING(whether coverage testing should be enabled)
  1606. AC_ARG_ENABLE(coverage, [AS_HELP_STRING([--enable-coverage],
  1607. [enable coverage checking])],
  1608. enable_coverage=$enableval, enable_coverage=no)
  1609. AC_MSG_RESULT($enable_coverage)
  1610. AC_SUBST(COVERAGE, $enable_coverage)
  1611. AM_CONDITIONAL(STARPU_COVERAGE_ENABLED, [test "x$enable_coverage" = "xyes"])
  1612. if test x$enable_coverage = xyes; then
  1613. CFLAGS="${CFLAGS} --coverage"
  1614. CXXFLAGS="${CXXFLAGS} --coverage"
  1615. FFLAGS="${FFLAGS} --coverage"
  1616. FCFLAGS="${FCFLAGS} --coverage"
  1617. LDFLAGS="${LDFLAGS} --coverage"
  1618. LIBS="${LIBS} -lgcov"
  1619. fi
  1620. AC_MSG_CHECKING(whether coverity mode should be enabled)
  1621. AC_ARG_ENABLE(coverity, [AS_HELP_STRING([--enable-coverity], [enable coverity mode])],
  1622. enable_coverity=$enableval, enable_coverity=no)
  1623. AC_MSG_RESULT($enable_coverity)
  1624. AM_CONDITIONAL(STARPU_COVERITY, test x$enable_coverity = xyes)
  1625. # shall we use FxT to generate trace of the execution ?
  1626. AC_ARG_ENABLE(fxt, [AS_HELP_STRING([--disable-fxt],
  1627. [disable FxT trace mechanisms])],, [enable_fxt=maybe])
  1628. AC_ARG_WITH(fxt,
  1629. [AS_HELP_STRING([--with-fxt=<path>],
  1630. [specify FxT installation directory])],
  1631. [
  1632. fxt_dir="$withval"
  1633. use_fxt_from_system=no
  1634. # in case this was not explicit yet
  1635. enable_fxt=yes
  1636. AC_SUBST(FXTDIR, $fxt_dir)
  1637. ],
  1638. [
  1639. use_fxt_from_system=yes
  1640. fxt_dir=""
  1641. ])
  1642. if test x$enable_fxt != xno; then
  1643. if test x$use_fxt_from_system = xno; then
  1644. save_PKG_CONFIG_PATH="$PKG_CONFIG_PATH"
  1645. PKG_CONFIG_PATH="$fxt_dir/lib/pkgconfig:$PKG_CONFIG_PATH"
  1646. PKG_CHECK_MODULES([FXT], [fxt], [have_valid_fxt=yes], [
  1647. have_valid_fxt=yes
  1648. AC_MSG_WARN([Old FxT without fxt.pc file, hoping link will succeed])
  1649. FXT_CFLAGS="-I$fxt_dir/include/ "
  1650. FXT_LDFLAGS="-L$fxt_dir/lib/"
  1651. AC_ARG_VAR(FXT_LDFLAGS)
  1652. FXT_LIBS="-lfxt"
  1653. ])
  1654. PKG_CONFIG_PATH="$save_PKG_CONFIG_PATH"
  1655. else
  1656. PKG_CHECK_MODULES([FXT], [fxt], [have_valid_fxt=yes], [have_valid_fxt=no])
  1657. fi
  1658. if test x$have_valid_fxt = xyes ; then
  1659. enable_fxt=yes
  1660. save_LIBS="$LIBS"
  1661. LIBS="$LIBS $FXT_LIBS"
  1662. save_LDFLAGS="$LDFLAGS"
  1663. LDFLAGS="$LDFLAGS $FXT_LDFLAGS"
  1664. AC_CHECK_FUNCS([fxt_close])
  1665. AC_CHECK_FUNCS([fxt_blockev_leave])
  1666. AC_CHECK_FUNCS([enable_fut_flush])
  1667. AC_CHECK_FUNCS([fut_set_filename])
  1668. AC_CHECK_FUNCS([fut_setup_flush_callback])
  1669. LDFLAGS="$save_LDFLAGS"
  1670. LIBS="$save_LIBS"
  1671. save_CFLAGS="$CFLAGS"
  1672. CFLAGS="$CFLAGS $FXT_CFLAGS"
  1673. AC_CHECK_DECLS([enable_fut_flush], [], [], [[#include <fut.h>]])
  1674. AC_CHECK_DECLS([fut_set_filename], [], [], [[#include <fut.h>]])
  1675. AC_CHECK_DECLS([fut_setup_flush_callback], [], [], [[#include <fut.h>]])
  1676. CFLAGS="$save_CFLAGS"
  1677. if test x$enable_simgrid = xyes -a x$enable_shared = xno ; then
  1678. # simgrid's SMPI needs fxt to be linked in statically for
  1679. # variable privatization to work
  1680. FXT_LIBS="$(pkg-config --variable=libdir fxt)/libfxt.a -Wl,--as-needed $(pkg-config --libs --static fxt) -Wl,--no-as-needed"
  1681. fi
  1682. AC_CHECK_LIB([papi], [PAPI_library_init],
  1683. [AC_DEFINE([STARPU_PAPI], [1], [Define to 1 if you have the libpapi library])
  1684. PAPI_LIBS=-lpapi])
  1685. ##########################################
  1686. # Poti is a library to generate paje trace files
  1687. ##########################################
  1688. PKG_CHECK_MODULES([POTI], [poti], [have_valid_poti=yes], [have_valid_poti=no])
  1689. AC_ARG_ENABLE(poti, [AS_HELP_STRING([--enable-poti],
  1690. [Enable the use of the POTI library to generate Paje traces])],
  1691. enable_poti=$enableval, enable_poti=no)
  1692. if test x$enable_poti = xyes -a x$have_valid_poti = xyes ; then
  1693. AC_DEFINE(STARPU_HAVE_POTI, [1], [Define to 1 if you have libpoti and it is meant to be used])
  1694. save_LIBS="$LIBS"
  1695. LIBS="$LIBS $POTI_LIBS"
  1696. AC_CHECK_FUNCS([poti_init_custom poti_user_NewEvent])
  1697. LIBS="$save_LIBS"
  1698. FXT_CFLAGS="$FXT_CFLAGS $POTI_CFLAGS"
  1699. FXT_LIBS="$FXT_LIBS $POTI_LIBS"
  1700. fi
  1701. else
  1702. if test x$enable_fxt = xyes ; then
  1703. AC_MSG_ERROR([FxT is required but not available])
  1704. fi
  1705. enable_fxt=no
  1706. fi
  1707. fi
  1708. AC_MSG_CHECKING(whether FxT traces should be generated)
  1709. AC_MSG_RESULT($enable_fxt)
  1710. if test x$enable_fxt = xyes; then
  1711. AC_DEFINE(STARPU_USE_FXT, [1], [enable FxT traces])
  1712. AC_DEFINE(CONFIG_FUT, [1], [enable FUT traces])
  1713. fi
  1714. AC_SUBST(STARPU_USE_FXT, $enable_fxt)
  1715. AM_CONDITIONAL(STARPU_USE_FXT, test x$enable_fxt = xyes)
  1716. AC_MSG_CHECKING(whether additional locking systems FxT traces should be enabled)
  1717. AC_ARG_ENABLE(fxt-lock, [AS_HELP_STRING([--enable-fxt-lock],
  1718. [enable additional locking systems FxT traces])],
  1719. enable_fxt_lock=$enableval, enable_fxt_lock=no)
  1720. AC_MSG_RESULT($enable_fxt_lock)
  1721. if test x$enable_fxt_lock = xyes; then
  1722. AC_DEFINE(STARPU_FXT_LOCK_TRACES, [1], [enable additional locking systems FxT traces])
  1723. fi
  1724. AC_CHECK_LIB([papi], [PAPI_library_init],
  1725. [AC_DEFINE([STARPU_PAPI], [1], [Define to 1 if you have the libpapi library])
  1726. PAPI_LIBS=-lpapi])
  1727. AC_SUBST(PAPI_LIBS)
  1728. AC_MSG_CHECKING(whether performance debugging should be enabled)
  1729. AC_ARG_ENABLE(perf-debug, [AS_HELP_STRING([--enable-perf-debug],
  1730. [enable performance debugging through gprof])],
  1731. enable_perf_debug=$enableval, enable_perf_debug=no)
  1732. AC_MSG_RESULT($enable_perf_debug)
  1733. AC_SUBST(STARPU_PERF_DEBUG, $enable_perf_debug)
  1734. if test x$enable_perf_debug = xyes; then
  1735. AC_DEFINE(STARPU_PERF_DEBUG, [1], [enable performance debug])
  1736. CPPFLAGS="${CPPFLAGS} -pg "
  1737. LDFLAGS="${LDFLAGS} -pg "
  1738. fi
  1739. AC_MSG_CHECKING(whether performance model debugging should be enabled)
  1740. AC_ARG_ENABLE(model-debug, [AS_HELP_STRING([--enable-model-debug],
  1741. [enable performance model debugging])],
  1742. enable_model_debug=$enableval, enable_model_debug=no)
  1743. AC_MSG_RESULT($enable_model_debug)
  1744. if test x$enable_model_debug = xyes; then
  1745. AC_DEFINE(STARPU_MODEL_DEBUG, [1], [enable performance model debug])
  1746. fi
  1747. AC_MSG_CHECKING(whether memory stats should be displayed)
  1748. AC_ARG_ENABLE(memory-stats, [AS_HELP_STRING([--enable-memory-stats],
  1749. [enable memory stats])],
  1750. enable_memory_stats=$enableval, enable_memory_stats=no)
  1751. AC_MSG_RESULT($enable_memory_stats)
  1752. if test x$enable_memory_stats = xyes; then
  1753. AC_DEFINE(STARPU_MEMORY_STATS, [1], [enable memory stats])
  1754. fi
  1755. AC_ARG_ENABLE(glpk, [AS_HELP_STRING([--disable-glpk],
  1756. [disable using glpk for bound computation])],
  1757. enable_glpk=$enableval, enable_glpk=yes)
  1758. if test x$enable_glpk = xyes; then
  1759. AC_CHECK_HEADERS([glpk.h], [AC_DEFINE([STARPU_HAVE_GLPK_H], [1], [Define to 1 if you have the <glpk.h> header file.])])
  1760. STARPU_HAVE_LIBRARY(GLPK, [glpk])
  1761. fi
  1762. AC_ARG_WITH(ayudame1-include-dir,
  1763. [AS_HELP_STRING([--with-ayudame1-include-dir=<path>],
  1764. [specify where Ayudame version 1 headers are installed])],
  1765. [
  1766. ayudame1_include_dir="$withval"
  1767. if test -n "$ayudame1_include_dir"; then
  1768. CPPFLAGS="-I$ayudame1_include_dir $CPPFLAGS"
  1769. fi
  1770. ], [ayudame1_include_dir=no])
  1771. AC_ARG_WITH(ayudame2-include-dir,
  1772. [AS_HELP_STRING([--with-ayudame2-include-dir=<path>],
  1773. [specify where Ayudame version 2 headers are installed])],
  1774. [
  1775. ayudame2_include_dir="$withval"
  1776. if test -n "$ayudame2_include_dir"; then
  1777. CPPFLAGS="-I$ayudame2_include_dir $CPPFLAGS"
  1778. fi
  1779. ], [ayudame2_include_dir=no])
  1780. # Ayudame 1 header is capitalized
  1781. AC_CHECK_HEADERS([Ayudame.h])
  1782. AC_ARG_ENABLE(ayudame1, [AS_HELP_STRING([--disable-ayudame1],
  1783. [Do not use Ayudame lib version 1])],
  1784. enable_ayudame1=$enableval, enable_ayudame1=yes)
  1785. # Ayudame 2 header is lowercase
  1786. AC_CHECK_HEADERS([ayudame.h])
  1787. AC_ARG_ENABLE(ayudame2, [AS_HELP_STRING([--disable-ayudame2],
  1788. [Do not use Ayudame lib version 2])],
  1789. enable_ayudame2=$enableval, enable_ayudame2=yes)
  1790. if test x$enable_ayudame1 = xyes -a x$ac_cv_header_Ayudame_h = xyes; then
  1791. AC_DEFINE([STARPU_USE_AYUDAME1], [1], [Define to 1 if Ayudame 1 is available and should be used])
  1792. ayu_msg="yes, use version 1"
  1793. else
  1794. if test x$enable_ayudame2 = xyes -a x$ac_cv_header_ayudame_h = xyes; then
  1795. AC_DEFINE([STARPU_USE_AYUDAME2], [1], [Define to 1 if Ayudame 2 is available and should be used])
  1796. ayu_msg="yes, use version 2"
  1797. else
  1798. ayu_msg="no"
  1799. fi
  1800. fi
  1801. AM_CONDITIONAL([STARPU_USE_AYUDAME1], [test "x$enable_ayudame1" = "xyes"])
  1802. AM_CONDITIONAL([STARPU_USE_AYUDAME2], [test "x$enable_ayudame2" = "xyes"])
  1803. STARPU_FXT_EVENT_DEFINES="`grep -E '#define\s+_STARPU_(MPI_)?FUT_' ${srcdir}/src/common/fxt.h ${srcdir}/mpi/src/starpu_mpi_fxt.h | grep 0x | grep -v 0x1 | cut -d : -f 2`"
  1804. AC_SUBST([STARPU_FXT_EVENT_DEFINES])
  1805. # Heteroprio works better if it can store information based on the program's name
  1806. AC_MSG_CHECKING(whether the target supports program_invocation_short_name)
  1807. AC_LINK_IFELSE([AC_LANG_SOURCE(
  1808. [
  1809. #include <stdio.h>
  1810. #include <errno.h>
  1811. int main() {
  1812. printf("%s\n", program_invocation_short_name);
  1813. return 0;
  1814. }
  1815. ])],
  1816. [AC_DEFINE([STARPU_HAVE_PROGRAM_INVOCATION_SHORT_NAME], [1], [variable program_invocation_short_name is available]) AC_MSG_RESULT(yes)],
  1817. AC_MSG_RESULT(no)
  1818. )
  1819. ###############################################################################
  1820. # #
  1821. # Miscellaneous options for StarPU #
  1822. # #
  1823. ###############################################################################
  1824. AC_MSG_CHECKING(how many buffers can be manipulated per task)
  1825. AC_ARG_ENABLE(maxbuffers, [AS_HELP_STRING([--enable-maxbuffers=<nbuffers>],
  1826. [maximum number of buffers per task])],
  1827. nmaxbuffers=$enableval, nmaxbuffers=8)
  1828. AC_MSG_RESULT($nmaxbuffers)
  1829. AC_DEFINE_UNQUOTED(STARPU_NMAXBUFS, [$nmaxbuffers],
  1830. [how many buffers can be manipulated per task])
  1831. AC_MSG_CHECKING(how many MPI nodes fxt files can be manipulated when generating traces)
  1832. AC_ARG_ENABLE(fxt-max-files, [AS_HELP_STRING([--enable-fxt-max-files=<nbuffers>],
  1833. [maximum number of mpi nodes for traces])],
  1834. nmaxfxtfiles=$enableval, nmaxfxtfiles=64)
  1835. AC_MSG_RESULT($nmaxfxtfiles)
  1836. AC_DEFINE_UNQUOTED(STARPU_FXT_MAX_FILES, [$nmaxfxtfiles],
  1837. [how many MPI nodes fxt files can be manipulated when generating traces])
  1838. AC_MSG_CHECKING(maximum number of memory nodes to use per MPI rank)
  1839. AC_ARG_ENABLE(maxnodes, [AS_HELP_STRING([--enable-maxnodes=<nnodes>],
  1840. [maximum number of memory nodes per MPI rank])],
  1841. maxnodes=$enableval, maxnodes=0)
  1842. if test x$maxnodes = x0 ; then
  1843. if test x$enable_simgrid = xyes ; then
  1844. # We need the room for the virtual CUDA/OpenCL devices
  1845. nodes=`expr 4 + $nmaxcudadev + $nmaxopencldev + 1 + $nmaxmpidev`
  1846. else
  1847. # We have one memory node shared by all CPU workers, one node per GPU
  1848. # we add nodes to use 2 memory disks
  1849. nodes=`expr $nmaxnumanodes + 2`
  1850. if test x$enable_cuda = xyes ; then
  1851. # we could have used nmaxcudadev + 1, but this would certainly give an
  1852. # odd number.
  1853. nodes=`expr $nodes + $nmaxcudadev`
  1854. fi
  1855. if test x$enable_opencl = xyes ; then
  1856. # we could have used nmaxcudadev + 1, but this would certainly give an
  1857. # odd number.
  1858. nodes=`expr $nodes + $nmaxopencldev`
  1859. fi
  1860. #nmaxmpidev = 0 if mpi master-slave is disabled
  1861. nodes=`expr $nodes + $nmaxmpidev`
  1862. fi
  1863. # set maxnodes to the next power of 2 greater than nodes
  1864. maxnodes=1
  1865. while test "$maxnodes" -lt "$nodes"
  1866. do
  1867. maxnodes=`expr $maxnodes \* 2`
  1868. done
  1869. fi
  1870. if test $maxnodes -gt 32 ; then
  1871. AC_MSG_WARN([Note: the wt_mask feature only supports 32 memory nodes])
  1872. fi
  1873. AC_MSG_CHECKING(maximum number of memory nodes)
  1874. AC_MSG_RESULT($maxnodes)
  1875. AC_DEFINE_UNQUOTED(STARPU_MAXNODES, [$maxnodes],
  1876. [maximum number of memory nodes])
  1877. AC_MSG_CHECKING(whether allocation cache should be used)
  1878. AC_ARG_ENABLE(allocation-cache, [AS_HELP_STRING([--disable-allocation-cache],
  1879. [disable data allocation cache])],
  1880. enable_allocation_cache=$enableval, enable_allocation_cache=yes)
  1881. AC_MSG_RESULT($enable_allocation_cache)
  1882. if test x$enable_allocation_cache = xyes; then
  1883. AC_DEFINE(STARPU_USE_ALLOCATION_CACHE, [1], [enable data allocation cache])
  1884. fi
  1885. AC_ARG_WITH(perf-model-dir, [AS_HELP_STRING([--with-perf-model-dir=<dir>], [specify where performance models should be stored])],
  1886. [
  1887. if test x$withval = xno; then
  1888. AC_MSG_ERROR(--without-perf-model-dir is not a valid option)
  1889. fi
  1890. perf_model_dir="$withval"
  1891. have_explicit_perf_model_dir=yes
  1892. AC_DEFINE_UNQUOTED(STARPU_PERF_MODEL_DIR, ["$perf_model_dir"], [performance models location])
  1893. ], [
  1894. # by default, we put the performance models in
  1895. # $HOME/.starpu/sampling/
  1896. have_explicit_perf_model_dir=no
  1897. perf_model_dir="\$HOME/.starpu/sampling/"
  1898. ]
  1899. )
  1900. AC_MSG_CHECKING(using explicit performance model location)
  1901. AC_MSG_RESULT($have_explicit_perf_model_dir)
  1902. AC_MSG_CHECKING(performance models location)
  1903. AC_MSG_RESULT($perf_model_dir)
  1904. # On many multicore CPUs, clock cycles are not synchronized
  1905. AC_CHECK_LIB([rt], [clock_gettime])
  1906. AC_CHECK_FUNCS([clock_gettime])
  1907. # Compute the maximum number of workers (we round it to 16 for alignment
  1908. # purposes).
  1909. if test x$enable_simgrid != xyes; then
  1910. if test x$enable_cpu != xyes; then
  1911. maxcpus=0
  1912. fi
  1913. if test x$enable_cuda != xyes; then
  1914. nmaxcudadev=0
  1915. fi
  1916. if test x$enable_opencl != xyes; then
  1917. nmaxopencldev=0
  1918. fi
  1919. #By default, if we cannot build mpi master-slave nmaxmpidev is set to zero.
  1920. #But with the multiplication with maxcpus, we need to put it to one.
  1921. if test x$build_mpi_master_slave != xyes; then
  1922. nmaxmpidev=1
  1923. fi
  1924. fi
  1925. if test $maxcpus == 0
  1926. then
  1927. nmaxworkers=`expr 16 \* \( \( \( $nmaxmpidev \* 64 \) + $nmaxcudadev + $nmaxopencldev + 15 \) / 16 \) `
  1928. elif test $nmaxmpidev == 0
  1929. then
  1930. nmaxworkers=`expr 16 \* \( \( $maxcpus + $nmaxcudadev + $nmaxopencldev + 15 \) / 16 \) `
  1931. else
  1932. nmaxworkers=`expr 16 \* \( \( \( $nmaxmpidev \* $maxcpus \) + $nmaxcudadev + $nmaxopencldev + 15 \) / 16 \) `
  1933. fi
  1934. AC_MSG_CHECKING(Maximum number of workers)
  1935. AC_MSG_RESULT($nmaxworkers)
  1936. AC_DEFINE_UNQUOTED(STARPU_NMAXWORKERS, [$nmaxworkers], [Maximum number of workers])
  1937. nmaxdevs=0
  1938. if test $nmaxdevs -lt $nmaxcudadev; then
  1939. nmaxdevs=$nmaxcudadev
  1940. fi
  1941. if test $nmaxdevs -lt $nmaxopencldev; then
  1942. nmaxdevs=$nmaxopencldev
  1943. fi
  1944. if test $nmaxdevs -lt $nmaxmpidev; then
  1945. nmaxdevs=$nmaxmpidev
  1946. fi
  1947. AC_DEFINE_UNQUOTED(STARPU_NMAXDEVS, [$nmaxdevs], [Maximum number of device per device arch])
  1948. # Computes the maximun number of combined worker
  1949. nmaxcombinedworkers=$maxcpus
  1950. AC_MSG_CHECKING(Maximum number of workers combinations)
  1951. AC_MSG_RESULT($nmaxcombinedworkers)
  1952. AC_DEFINE_UNQUOTED(STARPU_NMAX_COMBINEDWORKERS,
  1953. [$nmaxcombinedworkers], [Maximum number of worker combinations])
  1954. # Computes the maximum number of implementations per arch
  1955. AC_MSG_CHECKING(maximum number of implementations)
  1956. AC_ARG_ENABLE(maximplementations, [AS_HELP_STRING([--enable-maximplementations=<number>],
  1957. [maximum number of implementations])],
  1958. maximplementations=$enableval, maximplementations=4)
  1959. AC_MSG_RESULT($maximplementations)
  1960. AC_DEFINE_UNQUOTED(STARPU_MAXIMPLEMENTATIONS, [$maximplementations],
  1961. [maximum number of implementations])
  1962. # Enable LevelDB support if requested and the lib is found
  1963. AC_ARG_ENABLE(leveldb, [AS_HELP_STRING([--enable-leveldb],
  1964. [Enable linking with LevelDB if available])],
  1965. enable_leveldb=$enableval, enable_leveldb=no)
  1966. if test x$enable_leveldb = xyes; then
  1967. AC_LANG_PUSH([C++])
  1968. AC_CHECK_HEADERS([leveldb/db.h], [AC_DEFINE([STARPU_HAVE_LEVELDB], [1], [Define to 1 if you have the <leveldb/db.h> header file.])])
  1969. STARPU_HAVE_LIBRARY(LEVELDB, [leveldb])
  1970. AC_LANG_POP([C++])
  1971. fi
  1972. AM_CONDITIONAL(STARPU_HAVE_LEVELDB, test "x$enable_leveldb" = "xyes" -a "x$ac_cv_lib_leveldb_main" = "xyes")
  1973. # Defines the calibration heuristic for the history-based calibration of StarPU
  1974. AC_MSG_CHECKING(calibration heuristic of history-based StarPU calibrator)
  1975. AC_ARG_ENABLE(calibration-heuristic, [AS_HELP_STRING([--enable-calibration-heuristic=<number>],
  1976. [Define the maximum authorized deviation of StarPU history-based calibrator.])],
  1977. calibration_heuristic=$enableval, calibration_heuristic=50)
  1978. AC_MSG_RESULT($calibration_heuristic)
  1979. AC_DEFINE_UNQUOTED(STARPU_HISTORYMAXERROR, [$calibration_heuristic], [calibration heuristic value])
  1980. ###############################################################################
  1981. # #
  1982. # MP Common settings #
  1983. # #
  1984. ###############################################################################
  1985. AM_CONDITIONAL([STARPU_USE_MP], [test "x$build_mpi_master_slave" = "xyes"])
  1986. AC_ARG_ENABLE([export-dynamic], [AS_HELP_STRING([--disable-export-dynamic],
  1987. [Prevent the linker from adding all symbols to the dynamic symbol table])], [], [])
  1988. if test x$build_mpi_master_slave = xyes ; then
  1989. AC_DEFINE(STARPU_USE_MP, [1], [Message-passing SINKs support
  1990. is enabled])
  1991. if test x$enable_export_dynamic != xno ; then
  1992. STARPU_EXPORT_DYNAMIC="-rdynamic"
  1993. fi
  1994. fi
  1995. AC_SUBST(STARPU_EXPORT_DYNAMIC)
  1996. # Computes the maximum number of different kernels a message-passing sink
  1997. # can lookup for and launch.
  1998. AC_MSG_CHECKING(Maximum number of message-passing kernels)
  1999. AC_ARG_ENABLE(maxmpkernels, [AS_HELP_STRING(
  2000. [-enable-maxmpkernels=<number>],
  2001. [maximum number of kernels a message-passing sink can lookup
  2002. for and execute])],
  2003. maxmpkernels=$enableval, maxmpkernels=10)
  2004. AC_MSG_RESULT($maxmpkernels)
  2005. AC_DEFINE_UNQUOTED(STARPU_MAXMPKERNELS, [$maxmpkernels],
  2006. [maximum number of message-passing kernels])
  2007. ###############################################################################
  2008. # #
  2009. # Flags for C Compiler #
  2010. # #
  2011. ###############################################################################
  2012. IS_SUPPORTED_FLAG(-Wall)
  2013. IS_SUPPORTED_CFLAG(-Werror=implicit)
  2014. IS_SUPPORTED_CFLAG(-Werror=implicit-function-declaration)
  2015. if test x$enable_perf_debug = xyes; then
  2016. IS_SUPPORTED_FLAG(-no-pie)
  2017. IS_SUPPORTED_FLAG(-no-PIE)
  2018. IS_SUPPORTED_FLAG(-fno-pie)
  2019. fi
  2020. IS_SUPPORTED_FLAG(-Wextra)
  2021. IS_SUPPORTED_FLAG(-Wunused)
  2022. IS_SUPPORTED_CFLAG(-Wundef)
  2023. IS_SUPPORTED_CXXFLAG(-Wundef)
  2024. IS_SUPPORTED_FLAG(-Wshadow)
  2025. IS_SUPPORTED_CFLAG(-Wpointer-arith)
  2026. IS_SUPPORTED_CXXFLAG(-Wpointer-arith)
  2027. if test "x$STARPU_DEVEL" != x; then
  2028. AC_DEFINE(STARPU_DEVEL, [1], [enable developer warnings])
  2029. IS_SUPPORTED_CFLAG(-Werror=pointer-arith)
  2030. IS_SUPPORTED_CXXFLAG(-Werror=pointer-arith)
  2031. IS_SUPPORTED_FLAG(-fno-common)
  2032. if test x$enable_debug = xyes; then
  2033. IS_SUPPORTED_FLAG(-fno-optimize-sibling-calls)
  2034. fi
  2035. fi
  2036. AM_CONDITIONAL([STARPU_DEVEL],[test "x$STARPU_DEVEL" != x])
  2037. AC_SUBST(GLOBAL_AM_CFLAGS)
  2038. AC_SUBST(GLOBAL_AM_CXXFLAGS)
  2039. AC_SUBST(GLOBAL_AM_FFLAGS)
  2040. AC_SUBST(GLOBAL_AM_FCFLAGS)
  2041. # Same value as Automake's, for use in other places.
  2042. pkglibdir="\${libdir}/$PACKAGE"
  2043. AC_SUBST([pkglibdir])
  2044. AC_ARG_WITH(check-flags, [AS_HELP_STRING([--with-check-flags],
  2045. [Specify flags for C and Fortran compilers])],
  2046. check_flags=$withval, check_flags="")
  2047. if test "x$check_flags" != "x" ; then
  2048. for xflag in $check_flags
  2049. do
  2050. IS_SUPPORTED_FLAG($xflag)
  2051. done
  2052. fi
  2053. ###############################################################################
  2054. # #
  2055. # Fortran #
  2056. # #
  2057. ###############################################################################
  2058. AC_ARG_ENABLE(fortran, [AS_HELP_STRING([--disable-fortran],
  2059. [disable build of fortran examples])],
  2060. enable_build_fortran_requested=$enableval, enable_build_fortran_requested=yes)
  2061. use_mpi_fort=no
  2062. enable_build_fortran=no
  2063. if test "x$enable_build_fortran_requested" = "xyes" ; then
  2064. if test "x$FC" != "x"; then
  2065. if $FC --version|grep -q 'GNU Fortran'; then
  2066. AC_LANG_PUSH([Fortran])
  2067. OLD_FCFLAGS="$FCFLAGS"
  2068. FCFLAGS="$FCFLAGS -cpp"
  2069. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [[
  2070. #if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 9)
  2071. #error GFortran too old, version >= 4.9.x needed, Fortran examples will not be built
  2072. #endif
  2073. ]]
  2074. )],
  2075. [enable_build_fortran="yes"],
  2076. [enable_build_fortran="no"])
  2077. FCFLAGS="$OLD_FCFLAGS"
  2078. AC_LANG_POP([Fortran])
  2079. if test "$enable_build_fortran" = "no" ; then
  2080. AC_MSG_WARN([GFortran too old, version >= 4.9.x needed, Fortran examples will not be built])
  2081. fi
  2082. else
  2083. if $FC -V 2>&1|grep -q 'Intel(R) Fortran'; then
  2084. enable_build_fortran="yes"
  2085. ifort_fc_version=`$FC -V 2>&1 |head -1|sed 's/.*Version //;s/ Build.*//'`
  2086. ifort_maj_version=`echo $ifort_fc_version|cut -d. -f1`
  2087. if test $ifort_maj_version -lt 16; then
  2088. AC_MSG_WARN([Intel Fortran compiler $ifort_fc_version too old, version >= 2016.x needed, Fortran examples will not be built])
  2089. enable_build_fortran="no"
  2090. fi
  2091. else
  2092. if $FC -qversion 2>&1|grep -q 'IBM XL Fortran'; then
  2093. xlf_fc_version=`$FC -V 2>&1 |tail -1|sed 's/.*Version: //'`
  2094. xlf_maj_version=`echo $xlf_fc_version|cut -d. -f1`
  2095. AC_MSG_WARN([IBM Fortran compiler $xlf_fc_version not validated with the native StarPU Fortran API, Fortran examples will not be built])
  2096. enable_build_fortran="no"
  2097. else
  2098. AC_MSG_WARN(Fortran compiler has not been tested for StarPU native Fortran support)
  2099. enable_build_fortran="yes"
  2100. fi
  2101. fi
  2102. fi
  2103. if test "x$enable_build_fortran" = "xyes" ; then
  2104. AC_DEFINE(STARPU_HAVE_FC, [1], [Define this if a Fortran compiler is available])
  2105. if test x$build_mpi_lib = xyes -o x$build_nmad_lib = xyes -o x$build_mpi_master_slave = xyes ; then
  2106. #Check MPIFORT
  2107. if test x$enable_simgrid = xyes ; then
  2108. DEFAULT_MPIFORT=smpifort
  2109. else
  2110. DEFAULT_MPIFORT=mpifort
  2111. fi
  2112. AC_ARG_WITH(mpifort, [AS_HELP_STRING([--with-mpifort=<mpifort name or path to mpifort>], [Name or path of the mpifort compiler])], [DEFAULT_MPIFORT=$withval])
  2113. case $DEFAULT_MPIFORT in
  2114. /*) mpifort_path="$DEFAULT_MPIFORT" ;;
  2115. *) AC_PATH_PROG(mpifort_path, $DEFAULT_MPIFORT, [no], [$simgrid_dir/bin:$PATH]) ;;
  2116. esac
  2117. # We test if the MPIFORT compiler exists
  2118. if test ! -x $mpifort_path; then
  2119. AC_MSG_RESULT(The mpifort compiler '$mpifort_path' does not have the execute permission)
  2120. mpifort_path=no
  2121. else
  2122. OLD_CC=$CC
  2123. CC=$mpicc_path
  2124. AC_LINK_IFELSE(
  2125. AC_LANG_PROGRAM(
  2126. [[#include <mpi.h>]],
  2127. [[AC_LANG_SOURCE([return MPI_Comm_f2c(0);])]]
  2128. ),
  2129. [use_mpi_fort=yes],
  2130. [use_mpi_fort=no]
  2131. )
  2132. CC=$OLD_CC
  2133. if test "x$use_mpi_fort" = xyes; then
  2134. AC_DEFINE([HAVE_MPI_COMM_F2C], [1], [Function MPI_Comm_f2c is available])
  2135. fi
  2136. fi
  2137. AC_MSG_CHECKING(whether mpifort is available)
  2138. AC_MSG_RESULT($mpifort_path)
  2139. AC_SUBST(MPIFORT, $mpifort_path)
  2140. if test x$mpifort_path != xno ; then
  2141. MPIPATH=$(dirname $mpifort_path):$PATH
  2142. else
  2143. MPIPATH=$PATH
  2144. fi
  2145. fi
  2146. fi
  2147. fi
  2148. fi
  2149. if test "x$enable_build_fortran" = "xyes" ; then
  2150. if test "x$FC" = "x" ; then
  2151. enable_build_fortran="no"
  2152. fi
  2153. fi
  2154. #We have MPI C/C++ compiler
  2155. if test x$build_mpi_master_slave = xyes; then
  2156. #Check if we can compile fortran cases
  2157. if test x$use_mpi_fort = xyes ; then
  2158. F77LD=$mpifort_path
  2159. FCLD=$mpifort_path
  2160. F77=$mpifort_path
  2161. FC=$mpifort_path
  2162. else
  2163. enable_build_fortran=no
  2164. fi
  2165. fi
  2166. AM_CONDITIONAL([STARPU_HAVE_FC], [test "x$FC" != "x" -a "x$enable_build_fortran" = "xyes"])
  2167. AM_CONDITIONAL([STARPU_HAVE_F77], [test "x$F77" != "x" -a "x$enable_build_fortran" = "xyes"])
  2168. AM_CONDITIONAL([STARPU_HAVE_MPIFORT], [test "x$use_mpi_fort" = "xyes"])
  2169. ########################################################################
  2170. # #
  2171. # Cluster support #
  2172. # #
  2173. ########################################################################
  2174. AC_ARG_ENABLE(cluster, [AS_HELP_STRING([--enable-cluster], [build the cluster support])],
  2175. enable_cluster=$enableval, enable_cluster=no)
  2176. AC_MSG_CHECKING(for cluster support)
  2177. if test x$enable_cluster = xyes; then
  2178. AC_DEFINE(STARPU_CLUSTER, [1], [Define this to enable cluster support])
  2179. AC_OPENMP
  2180. fi
  2181. AM_CONDITIONAL([STARPU_CLUSTER], [test "x$enable_cluster" = "xyes"])
  2182. AC_MSG_RESULT($enable_cluster)
  2183. ###############################################################################
  2184. # #
  2185. # OpenMP runtime support #
  2186. # #
  2187. ###############################################################################
  2188. AC_ARG_ENABLE(openmp, [AS_HELP_STRING([--enable-openmp],
  2189. [build the OpenMP runtime support])],
  2190. enable_openmp=$enableval, enable_openmp=yes)
  2191. openmp_msg=""
  2192. if test x$starpu_windows = xyes ; then
  2193. enable_openmp=no
  2194. openmp_msg="disabled on windows"
  2195. fi
  2196. if test "x$build_mpi_master_slave" = "xyes" ; then
  2197. enable_openmp=no
  2198. openmp_msg="incompatibility with MPI master slave support"
  2199. fi
  2200. if test x$enable_simgrid = xyes ; then
  2201. enable_openmp=no
  2202. openmp_msg="incompatibility with Simgrid support"
  2203. fi
  2204. if test x$enable_openmp = xyes; then
  2205. AC_DEFINE(STARPU_OPENMP, [1], [Define this to enable OpenMP runtime support])
  2206. fi
  2207. AC_MSG_CHECKING(for OpenMP runtime support)
  2208. AM_CONDITIONAL([STARPU_OPENMP], [test "x$enable_openmp" = "xyes"])
  2209. AC_MSG_RESULT($enable_openmp $openmp_msg)
  2210. if test x$enable_simgrid = xno; then
  2211. if test -n "{OPENMP_CFLAGS}"; then
  2212. CFLAGS="${CFLAGS} ${OPENMP_CFLAGS}"
  2213. STARPU_OMP_LDFLAGS="${OPENMP_CFLAGS}"
  2214. STARPU_EXPORTED_LIBS="$STARPU_EXPORTED_LIBS ${OPENMP_CFLAGS}"
  2215. fi
  2216. fi
  2217. AM_CONDITIONAL([STARPU_HAVE_OPENMP],[test x$enable_simgrid = xno -a -n "$OPENMP_CFLAGS"])
  2218. ###############################################################################
  2219. # #
  2220. # SOCL interface #
  2221. # #
  2222. ###############################################################################
  2223. AC_ARG_ENABLE([socl],
  2224. [AS_HELP_STRING([--enable-socl],
  2225. [build the OpenCL interface (experimental)])],
  2226. [enable_socl="$enableval"],
  2227. [enable_socl="maybe"])
  2228. AC_MSG_CHECKING(for SOCL)
  2229. # in case SOCL was explicitely required, but is not available, this is an error
  2230. if test "x$enable_socl" = "xyes" -a "$have_valid_opencl" = "no" ; then
  2231. AC_MSG_ERROR([SOCL cannot be enabled without OpenCL])
  2232. fi
  2233. # MPI Master Slave and SOCL are not compatible
  2234. if test "x$build_mpi_master_slave" = "xyes" ; then
  2235. if test "x$enable_socl" = "xyes" ; then
  2236. AC_MSG_ERROR([MPI Master-Slave and SOCL can not be used at the same time !])
  2237. fi
  2238. if test "x$enable_socl" = "xmaybe" ; then
  2239. enable_socl=no
  2240. fi
  2241. fi
  2242. # now we enable SOCL if and only if a proper setup is available
  2243. if test "x$enable_socl" = "xyes" -o "x$enable_socl" = "xmaybe" ; then
  2244. build_socl=$have_valid_opencl
  2245. else
  2246. build_socl=no
  2247. fi
  2248. AC_MSG_RESULT($build_socl)
  2249. AM_CONDITIONAL([STARPU_BUILD_SOCL], [test "x$build_socl" = "xyes"])
  2250. AM_CONDITIONAL([STARPU_USE_SOCL], [test "x$build_socl" = "xyes"])
  2251. if test "$build_socl" = "yes" ; then
  2252. AC_CHECK_FUNCS([clGetExtensionFunctionAddressForPlatform])
  2253. if test -n "$SOCL_OCL_LIB_OPENCL" -a -f "$SOCL_OCL_LIB_OPENCL" ; then
  2254. run_socl_check=yes
  2255. SOCL_OCL_LIB_OPENCL_DIR=$(dirname $SOCL_OCL_LIB_OPENCL)
  2256. AC_SUBST(SOCL_OCL_LIB_OPENCL_DIR)
  2257. else
  2258. run_socl_check=no
  2259. fi
  2260. else
  2261. run_socl_check=no
  2262. fi
  2263. ###############################################################################
  2264. # #
  2265. # Debugging #
  2266. # #
  2267. ###############################################################################
  2268. AC_PATH_PROG([GDB], [gdb], [not-found])
  2269. if test "x$GDB" != "xnot-found"; then
  2270. AC_DEFINE_UNQUOTED([STARPU_GDB_PATH], ["$GDB"],
  2271. [Path to the GNU debugger.])
  2272. fi
  2273. ###############################################################################
  2274. # #
  2275. # Examples #
  2276. # #
  2277. ###############################################################################
  2278. AC_ARG_ENABLE(build-tests, [AS_HELP_STRING([--disable-build-tests],
  2279. [disable building of tests])],
  2280. enable_build_tests=$enableval, enable_build_tests=yes)
  2281. # check stuff for tests (todo)
  2282. AM_CONDITIONAL(STARPU_BUILD_TESTS, [test x$enable_build_tests != xno])
  2283. AC_ARG_ENABLE(build-examples, [AS_HELP_STRING([--disable-build-examples],
  2284. [disable building of examples])],
  2285. enable_build_examples=$enableval, enable_build_examples=yes)
  2286. # check stuff for examples (todo)
  2287. AM_CONDITIONAL(STARPU_BUILD_EXAMPLES, [test x$enable_build_examples != xno])
  2288. AC_ARG_ENABLE(opengl-render, [AS_HELP_STRING([--enable-opengl-render],
  2289. [enable OpenGL rendering of some examples])],
  2290. enable_opengl_render=$enableval, enable_opengl_render=no)
  2291. if test x$enable_opengl_render = xyes; then
  2292. STARPU_CHECK_LIB(OPENGL_RENDER, glut, glutInit,,AC_MSG_ERROR([cannot find glut]))
  2293. STARPU_CHECK_LIB(OPENGL_RENDER, GL, glXCreateContext,,AC_MSG_ERROR([cannot find GL]))
  2294. STARPU_CHECK_LIB(OPENGL_RENDER, GLU, gluLookAt,,AC_MSG_ERROR([cannot find GLU]))
  2295. AC_DEFINE(STARPU_OPENGL_RENDER, [1], [enable OpenGL rendering of some examples])
  2296. fi
  2297. AC_MSG_CHECKING(whether OpenGL rendering is enabled)
  2298. AC_SUBST(STARPU_OPENGL_RENDER, $enable_opengl_render)
  2299. AC_MSG_RESULT($enable_opengl_render)
  2300. AM_CONDITIONAL([STARPU_HAVE_OPENGL], [test "x$enable_opengl_render" = xyes])
  2301. AC_PATH_XTRA
  2302. if test "x$no_x" != "xyes"; then
  2303. AC_DEFINE(STARPU_HAVE_X11, [1], [enable X11])
  2304. fi
  2305. AM_CONDITIONAL([STARPU_HAVE_X11], [test "x$no_x" != "xyes"])
  2306. # In case there are BLAS kernels that are used by the example applications
  2307. # we may specify which library to use. Note that this is not used for StarPU
  2308. # itself.
  2309. blas_lib=maybe
  2310. AC_ARG_ENABLE(blas-lib,
  2311. [ --enable-blas-lib[=blaslibname]:
  2312. none [default]: no BLAS lib is used
  2313. atlas: use ATLAS library
  2314. goto: use GotoBLAS library
  2315. mkl: use MKL library (you may need to set specific CFLAGS and LDFLAGS with --with-mkl-cflags and --with-mkl-ldflags)],
  2316. [
  2317. if test "x$enableval" = "xatlas" ; then
  2318. blas_lib=atlas
  2319. elif test "x$enableval" = "xgoto" ; then
  2320. blas_lib=goto
  2321. elif test "x$enableval" = "xopenblas" ; then
  2322. blas_lib=openblas
  2323. elif test "x$enableval" = "xnone" ; then
  2324. blas_lib=none
  2325. elif test "x$enableval" = "xmkl" ; then
  2326. blas_lib=mkl
  2327. elif test "x$enableval" = "xarmpl" ; then
  2328. blas_lib=armpl
  2329. elif test x$enableval = xno; then
  2330. blas_lib=none
  2331. else
  2332. echo
  2333. echo "Error!"
  2334. echo "Unknown BLAS library"
  2335. exit -1
  2336. fi
  2337. ])
  2338. if test x$blas_lib = xmaybe -o x$blas_lib = xgoto; then
  2339. AC_ARG_WITH(goto-dir, [AS_HELP_STRING([--with-goto-dir=<dir>], [specify GotoBLAS lib location])],
  2340. [
  2341. blas_lib=goto
  2342. gotodir=$withval
  2343. AC_SUBST(GOTODIR, $gotodir)
  2344. CPPFLAGS="${CPPFLAGS} -I$gotodir/ "
  2345. LDFLAGS="${LDFLAGS} -L$gotodir/ "
  2346. ]
  2347. )
  2348. if test x$blas_lib = xgoto; then
  2349. STARPU_CHECK_LIB(BLAS, gfortran, main,,)
  2350. STARPU_CHECK_LIB(BLAS, ifcore, main,,)
  2351. # Perhaps that GotoBLAS2 is available instead (so that we have libgotoblas2.{so,a})
  2352. STARPU_CHECK_LIB(BLAS, goto2, sgemm_,, [havegoto2=no], [$STARPU_BLAS_LDFLAGS])
  2353. if test x$havegoto2 = xno; then
  2354. STARPU_CHECK_LIB(BLAS, goto, sgemm_,,AC_MSG_ERROR([cannot find goto lib]), [$STARPU_BLAS_LDFLAGS])
  2355. fi
  2356. AC_DEFINE(STARPU_GOTO, [1], [use STARPU_GOTO library])
  2357. fi
  2358. fi
  2359. if test x$blas_lib = xmaybe -o x$blas_lib = xatlas; then
  2360. AC_ARG_WITH(atlas-dir, [AS_HELP_STRING([--with-atlas-dir=<dir>], [specify ATLAS lib location])],
  2361. [
  2362. AC_MSG_CHECKING(STARPU_ATLAS location)
  2363. blas_lib=atlas
  2364. atlasdir=$withval
  2365. AC_MSG_RESULT($atlasdir)
  2366. AC_SUBST(ATLASDIR, $atlasdir)
  2367. CPPFLAGS="${CPPFLAGS} -I$atlasdir/include/ "
  2368. LDFLAGS="${LDFLAGS} -L$atlasdir/lib/ "
  2369. ]
  2370. )
  2371. if test x$blas_lib = xatlas; then
  2372. # test whether STARPU_ATLAS is actually available
  2373. AC_CHECK_HEADER([cblas.h],,AC_MSG_ERROR([cannot find atlas headers]))
  2374. STARPU_CHECK_LIB(BLAS, atlas, ATL_sgemm,,AC_MSG_ERROR([cannot find atlas lib]),)
  2375. STARPU_CHECK_LIB(BLAS, cblas, cblas_sgemm,,AC_MSG_ERROR([cannot find atlas lib]),[-latlas])
  2376. AC_DEFINE(STARPU_ATLAS, [1], [use STARPU_ATLAS library])
  2377. fi
  2378. fi
  2379. if test x$blas_lib = xmaybe -o x$blas_lib = xopenblas; then
  2380. PKG_CHECK_MODULES([OPENBLAS], [openblas],
  2381. [PKG_CHECK_MODULES([BLAS_OPENBLAS], [blas-openblas],
  2382. [AC_DEFINE([STARPU_OPENBLAS], [1], [Define to 1 if you use the openblas library.])
  2383. AC_SUBST([STARPU_OPENBLAS], [1])
  2384. CFLAGS="${CFLAGS} ${OPENBLAS_CFLAGS} ${BLAS_OPENBLAS_CFLAGS} "
  2385. LIBS="${LIBS} ${OPENBLAS_LIBS} ${BLAS_OPENBLAS_LIBS} "
  2386. blas_lib=openblas
  2387. ],
  2388. [ if test x$blas_lib = xopenblas; then
  2389. STARPU_CHECK_LIB(OPENBLAS, blas-openblas, cblas_sgemm,,AC_MSG_ERROR([cannot find blas-openblas lib]),[-lblas-openblas])
  2390. AC_DEFINE([STARPU_OPENBLAS], [1], [Define to 1 if you use the openblas library.])
  2391. AC_SUBST([STARPU_OPENBLAS], [1])
  2392. fi
  2393. ])
  2394. ],
  2395. [ if test x$blas_lib = xopenblas; then
  2396. STARPU_CHECK_LIB(OPENBLAS, openblas, cblas_sgemm,,AC_MSG_ERROR([cannot find openblas lib]),[-lopenblas])
  2397. AC_DEFINE([STARPU_OPENBLAS], [1], [Define to 1 if you use the openblas library.])
  2398. AC_SUBST([STARPU_OPENBLAS], [1])
  2399. fi
  2400. ] )
  2401. fi
  2402. if test x$blas_lib = xmaybe -o x$blas_lib = xmkl; then
  2403. # Should we use MKL ?
  2404. if test -n "$MKLROOT" ; then
  2405. CPPFLAGS="${CPPFLAGS} -I$MKLROOT/include"
  2406. case $host_vendor in
  2407. *1om) mkl_plat=mic ;;
  2408. *) mkl_plat=intel64 ;;
  2409. esac
  2410. SAVED_LIBS=$LIBS
  2411. STARPU_BLAS_LDFLAGS="-L$MKLROOT/lib/$mkl_plat -lmkl_intel_lp64 -lmkl_sequential -lmkl_core -lm -lpthread -ldl"
  2412. LIBS="$LIBS $STARPU_BLAS_LDFLAGS"
  2413. AC_LINK_IFELSE(
  2414. [AC_LANG_PROGRAM([[
  2415. #include <mkl.h>
  2416. ]], [[ ]])],
  2417. [ blas_lib=mkl ],
  2418. [ STARPU_BLAS_LDFLAGS="" ],
  2419. )
  2420. LIBS=$SAVED_LIBS
  2421. fi
  2422. AC_ARG_WITH(mkl-cflags, [AS_HELP_STRING([--with-mkl-cflags], [specify MKL compilation flags])],
  2423. [
  2424. CPPFLAGS="${CPPFLAGS} $withval"
  2425. blas_lib=mkl
  2426. ])
  2427. AC_ARG_WITH(mkl-ldflags, [AS_HELP_STRING([--with-mkl-ldflags], [specify MKL linking flags])],
  2428. [
  2429. STARPU_BLAS_LDFLAGS="$withval"
  2430. blas_lib=mkl
  2431. ])
  2432. if test x$blas_lib = xmkl; then
  2433. AC_DEFINE(STARPU_MKL, [1], [use MKL library])
  2434. fi
  2435. fi
  2436. if test x$blas_lib = xmaybe -o x$blas_lib = xarmpl; then
  2437. # Should we use ARMPL ?
  2438. if test -n "$ARMPL_DIR" ; then
  2439. CPPFLAGS="${CPPFLAGS} -I$ARMPL_INCLUDES"
  2440. SAVED_LIBS=$LIBS
  2441. STARPU_BLAS_LDFLAGS="-L$ARMPL_LIBRARIES -larmpl_lp64 -lgfortran -lm"
  2442. LIBS="$LIBS $STARPU_BLAS_LDFLAGS"
  2443. AC_LINK_IFELSE(
  2444. [AC_LANG_PROGRAM([[
  2445. #include <armpl.h>
  2446. ]], [[ ]])],
  2447. [ blas_lib=armpl ],
  2448. [ STARPU_BLAS_LDFLAGS="" ],
  2449. )
  2450. LIBS=$SAVED_LIBS
  2451. fi
  2452. AC_ARG_WITH(armpl-cflags, [AS_HELP_STRING([--with-armpl-cflags], [specify ARMPL compilation flags])],
  2453. [
  2454. CPPFLAGS="${CPPFLAGS} $withval"
  2455. blas_lib=armpl
  2456. ])
  2457. AC_ARG_WITH(armpl-ldflags, [AS_HELP_STRING([--with-armpl-ldflags], [specify ARMPL linking flags])],
  2458. [
  2459. STARPU_BLAS_LDFLAGS="$withval"
  2460. blas_lib=armpl
  2461. ])
  2462. if test x$blas_lib = xarmpl; then
  2463. AC_DEFINE(STARPU_ARMPL, [1], [use ARMPL library])
  2464. fi
  2465. fi
  2466. if test x$blas_lib = xmaybe; then
  2467. #perhaps it is possible to use some BLAS lib from the system
  2468. use_system_blas=no
  2469. STARPU_SEARCH_LIBS(BLAS,[sgemm_],[blas],use_system_blas=yes,,)
  2470. if test x$use_system_blas = xyes; then
  2471. AC_DEFINE(STARPU_SYSTEM_BLAS, [1], [use refblas library])
  2472. blas_lib=system
  2473. elif test x"$BLAS_LIBS" != x; then
  2474. AC_DEFINE(STARPU_SYSTEM_BLAS, [1], [use user defined library])
  2475. STARPU_BLAS_LDFLAGS="$BLAS_LIBS"
  2476. blas_lib=system
  2477. AC_ARG_VAR([BLAS_LIBS], [linker flags for blas])
  2478. else
  2479. blas_lib=none
  2480. fi
  2481. fi
  2482. if test x$blas_lib = xsystem; then
  2483. AC_CHECK_HEADER([cblas.h], [have_cblas_h=yes], [have_cblas_h=no])
  2484. fi
  2485. AM_CONDITIONAL(STARPU_HAVE_CBLAS_H, test x$have_cblas_h = xyes)
  2486. if test x$have_cblas_h = xyes; then
  2487. AC_DEFINE(STARPU_HAVE_CBLAS_H, [1], [The blas library has blas.h])
  2488. fi
  2489. if test x$blas_lib != xnone; then
  2490. AC_DEFINE(STARPU_HAVE_BLAS, [1], [The blas library is available])
  2491. SAVED_LIBS="$LIBS"
  2492. LIBS="$LIBS -lblas"
  2493. AC_CHECK_FUNCS([cblas_sgemv])
  2494. LIBS="$SAVED_LIBS"
  2495. fi
  2496. AM_CONDITIONAL(STARPU_HAVE_CBLAS_SGEMV, test x$HAVE_CBLAS_SGEMV = x1)
  2497. AM_CONDITIONAL(STARPU_ATLAS_BLAS_LIB, test x$blas_lib = xatlas)
  2498. AM_CONDITIONAL(STARPU_GOTO_BLAS_LIB, test x$blas_lib = xgoto)
  2499. AM_CONDITIONAL(STARPU_MKL_BLAS_LIB, test x$blas_lib = xmkl)
  2500. AM_CONDITIONAL(STARPU_SYSTEM_BLAS_LIB, test x$blas_lib = xsystem)
  2501. AM_CONDITIONAL(STARPU_NO_BLAS_LIB, test x$blas_lib = xnone -a x$enable_simgrid = xno)
  2502. AC_SUBST(STARPU_BLAS_LDFLAGS)
  2503. AC_MSG_CHECKING(which BLAS lib should be used)
  2504. AC_MSG_RESULT($blas_lib)
  2505. AC_SUBST(BLAS_LIB,$blas_lib)
  2506. ###############################################################################
  2507. # #
  2508. # Multiple linear regression #
  2509. # #
  2510. ###############################################################################
  2511. AC_ARG_ENABLE(mlr, [AS_HELP_STRING([--enable-mlr],
  2512. [Enable multiple linear regression models])],
  2513. enable_mlr=$enableval, enable_mlr=no)
  2514. AC_ARG_ENABLE(mlr-system-blas, [AS_HELP_STRING([--enable-mlr-system-blas],
  2515. [Make the multiple linear regression models use the system BLAS instead of min-dgels])],
  2516. enable_mlr_blas=$enableval, enable_mlr_blas=no)
  2517. AC_MSG_CHECKING(whether multiple linear regression models are disabled)
  2518. if test x$enable_mlr = xyes -a "$starpu_windows" != "yes" ; then
  2519. AC_MSG_RESULT(no)
  2520. install_min_dgels=no
  2521. support_mlr=yes
  2522. STARPU_SEARCH_LIBS(LAPACK,[dgels_],[lapack],use_system_lapack=yes,,)
  2523. if test x$blas_lib = xnone ; then
  2524. use_system_lapack=no
  2525. fi
  2526. if test x$enable_mlr_blas = xyes -a x$use_system_lapack = xyes; then
  2527. AC_DEFINE(STARPU_MLR_MODEL, [1], [use reflapack library])
  2528. LDFLAGS="-llapack $LDFLAGS"
  2529. else
  2530. if test x$enable_mlr_blas=xyes -a x$blas_lib = xmkl; then
  2531. AC_DEFINE(STARPU_MLR_MODEL, [1], [use mkl library])
  2532. else
  2533. AC_MSG_CHECKING(whether min-dgels is linked)
  2534. if test x"$DGELS_LIBS" != x; then
  2535. AC_MSG_RESULT(yes)
  2536. AC_DEFINE(STARPU_MLR_MODEL, [1], [use user defined library])
  2537. AC_ARG_VAR([DGELS_LIBS], [linker flags for lapack dgels])
  2538. else
  2539. AC_MSG_RESULT(no)
  2540. AC_MSG_CHECKING(min-dgels source)
  2541. if test "${cross_compiling}" != "no" ; then
  2542. # Cross-compiling is not supported by min-dgels
  2543. AC_MSG_RESULT(no)
  2544. install_min_dgels=no
  2545. support_mlr=no
  2546. else
  2547. AC_MSG_RESULT(yes)
  2548. DGELS_LIBS="-Wl,--start-group $STARPU_BUILD_DIR/min-dgels/build/minlibblas.a $STARPU_BUILD_DIR/min-dgels/build/minlibdgels.a $STARPU_BUILD_DIR/min-dgels/build/minlibf2c.a -Wl,--end-group"
  2549. AC_DEFINE(STARPU_MLR_MODEL, [1], [use user defined library])
  2550. AC_DEFINE(STARPU_BUILT_IN_MIN_DGELS, [1], [use built-in min_dgels])
  2551. AC_ARG_VAR([DGELS_LIBS], [linker flags for lapack dgels])
  2552. install_min_dgels=yes
  2553. fi
  2554. fi
  2555. fi
  2556. fi
  2557. else
  2558. AC_MSG_RESULT(yes)
  2559. install_min_dgels=no
  2560. support_mlr=no
  2561. fi
  2562. AM_CONDITIONAL(STARPU_USE_MIN_DGELS, test x$install_min_dgels = xyes)
  2563. ##########################################
  2564. # FFT #
  2565. ##########################################
  2566. have_fftw=no
  2567. have_fftwf=no
  2568. have_fftwl=no
  2569. fft_support=no
  2570. AC_ARG_ENABLE(starpufft, [AS_HELP_STRING([--disable-starpufft],
  2571. [Disable build of StarPU-FFT])],
  2572. enable_starpufft=$enableval,enable_starpufft=yes)
  2573. PKG_CHECK_MODULES([FFTW], [fftw3], [
  2574. AC_DEFINE([STARPU_HAVE_FFTW], [1], [Define to 1 if you have the libfftw3 library.])
  2575. AC_SUBST([STARPU_HAVE_FFTW], [1])
  2576. have_fftw=yes
  2577. ], [:])
  2578. AM_CONDITIONAL(STARPU_HAVE_FFTW, [test x$have_fftw = xyes])
  2579. PKG_CHECK_MODULES([FFTWF], [fftw3f], [
  2580. AC_DEFINE([STARPU_HAVE_FFTWF], [1], [Define to 1 if you have the libfftw3f library.])
  2581. AC_SUBST([STARPU_HAVE_FFTWF], [1])
  2582. have_fftwf=yes
  2583. ], [:])
  2584. AM_CONDITIONAL(STARPU_HAVE_FFTWF, [test x$have_fftwf = xyes])
  2585. PKG_CHECK_MODULES([FFTWL], [fftw3l], [
  2586. AC_DEFINE([STARPU_HAVE_FFTWL], [1], [Define to 1 if you have the libfftw3l library.])
  2587. AC_SUBST([HAVE_FFTWFL], [1])
  2588. have_fftwl=yes
  2589. ], [:])
  2590. AM_CONDITIONAL(STARPU_HAVE_FFTWL, [test x$have_fftwl = xyes])
  2591. 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
  2592. fft_support=yes
  2593. fi
  2594. AM_CONDITIONAL(STARPU_BUILD_STARPUFFT, [test x$fft_support = xyes])
  2595. AC_ARG_ENABLE(starpufft-examples, [AS_HELP_STRING([--enable-starpufft-examples],
  2596. [enable build of StarPU FFT examples])],
  2597. enable_starpufft_examples=$enableval, enable_starpufft_examples=no)
  2598. AM_CONDITIONAL(STARPU_BUILD_STARPUFFT_EXAMPLES, [test x$enable_starpufft_examples = xyes])
  2599. ##########################################
  2600. # hwloc #
  2601. ##########################################
  2602. have_valid_hwloc=no
  2603. SAVED_LIBS="${LIBS}"
  2604. SAVED_CPPFLAGS="${CPPFLAGS}"
  2605. SAVED_PKG_CONFIG_PATH="$PKG_CONFIG_PATH"
  2606. AC_ARG_WITH([hwloc],
  2607. [AS_HELP_STRING([--without-hwloc], [Disable hwloc (enabled by default)])],
  2608. [
  2609. if test x$withval != xno; then
  2610. if test "$withval" = "yes" ; then
  2611. use_hwloc=yes
  2612. else
  2613. # use specified path
  2614. if test ! -d "$withval" ; then
  2615. AC_MSG_ERROR("Directory specified for hwloc <$withval> does not exist")
  2616. fi
  2617. if test -d "$withval/lib64/pkgconfig" ; then
  2618. export PKG_CONFIG_PATH=$withval/lib64/pkgconfig:$PKG_CONFIG_PATH
  2619. else
  2620. if test -d "$withval/lib/pkgconfig" ; then
  2621. export PKG_CONFIG_PATH=$withval/lib/pkgconfig:$PKG_CONFIG_PATH
  2622. else
  2623. AC_MSG_ERROR("Hwloc directory <$withval> does not have a subdirectory lib/pkgconfig or lib64/pkgconfig")
  2624. fi
  2625. fi
  2626. use_hwloc=yes
  2627. fi
  2628. else
  2629. use_hwloc=no
  2630. fi
  2631. ],
  2632. [
  2633. use_hwloc=maybe
  2634. ])
  2635. AS_IF([test "$use_hwloc" != "no"],
  2636. [PKG_CHECK_MODULES([HWLOC],[hwloc], [have_valid_hwloc=yes], [have_valid_hwloc=no])]
  2637. )
  2638. AM_CONDITIONAL(STARPU_HAVE_HWLOC, test "x$have_valid_hwloc" = "xyes")
  2639. # in case hwloc was explicitely required, but is not available, this is an error
  2640. AS_IF([test "$use_hwloc" = "yes" -a "$have_valid_hwloc" = "no"],
  2641. [AC_MSG_ERROR([cannot find hwloc or pkg-config])]
  2642. )
  2643. # in case hwloc is not available but was not explicitely disabled, this is an error
  2644. AS_IF([test "$have_valid_hwloc" = "no" -a "$use_hwloc" != "no"],
  2645. [AC_MSG_ERROR([libhwloc or pkg-config 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 and pkg-config. However, if you really want to use StarPU without enabling libhwloc, please restart configure by specifying the option '--without-hwloc'.])]
  2646. )
  2647. LIBS="${HWLOC_LIBS} ${SAVED_LIBS}"
  2648. CPPFLAGS="${HWLOC_CFLAGS} ${SAVED_CPPFLAGS}"
  2649. AS_IF([test "$have_valid_hwloc" = "yes"],
  2650. [AC_DEFINE([STARPU_HAVE_HWLOC], [1], [Define to 1 if you have the hwloc library.])
  2651. HWLOC_REQUIRES=hwloc
  2652. AC_SUBST([STARPU_HAVE_HWLOC], [1])
  2653. AC_CHECK_DECLS([hwloc_cuda_get_device_osdev_by_index], [], [], [[#include <hwloc/cuda.h>]])
  2654. ])
  2655. AC_CHECK_FUNCS([hwloc_topology_dup])
  2656. AC_CHECK_FUNCS([hwloc_topology_set_components])
  2657. AC_CHECK_FUNCS([hwloc_cpukinds_get_nr])
  2658. AM_CONDITIONAL(STARPU_HWLOC_HAVE_TOPOLOGY_DUP, test $ac_cv_func_hwloc_topology_dup = yes)
  2659. LIBS="${SAVED_LIBS}"
  2660. CPPFLAGS="${SAVED_CPPFLAGS}"
  2661. export PKG_CONFIG_PATH=$SAVED_PKG_CONFIG_PATH
  2662. AC_MSG_CHECKING(whether hwloc should be used)
  2663. AC_MSG_RESULT($have_valid_hwloc)
  2664. AC_SUBST(HWLOC_REQUIRES)
  2665. # is the header file f77.h available ?
  2666. AC_CHECK_HEADER([f77.h], [have_f77_h=yes], [have_f77_h=no])
  2667. AC_SUBST(STARPU_HAVE_F77_H, $have_f77_h)
  2668. AM_CONDITIONAL(STARPU_HAVE_F77_H, test x$have_f77_h = xyes)
  2669. if test x$have_f77_h = xyes; then
  2670. AC_DEFINE([STARPU_HAVE_F77_H], [1], [Define to 1 if you have the <f77.h> header file.])
  2671. fi
  2672. AC_ARG_ENABLE(icc, [AS_HELP_STRING([--enable-icc],
  2673. [Enable the compilation of specific ICC examples])],
  2674. enable_icc=$enableval, enable_icc=yes)
  2675. ICC=""
  2676. if test "$enable_icc" = "yes" ; then
  2677. # Check if icc is available
  2678. AC_CHECK_PROGS([ICC], [icc])
  2679. fi
  2680. # If cuda and icc are both available, check they are compatible
  2681. if test "$enable_cuda" = "yes" -a "$ICC" != ""; then
  2682. AC_MSG_CHECKING(whether CUDA and ICC are compatible)
  2683. OLD_CC="$CC"
  2684. CC="$ICC"
  2685. OLD_CFLAGS="$CFLAGS"
  2686. CFLAGS="-I$PWD/include -I$srcdir/include"
  2687. AC_COMPILE_IFELSE(
  2688. [AC_LANG_PROGRAM(
  2689. [[#include <cuda.h>
  2690. #include <starpu.h>]],
  2691. [[]]
  2692. )],
  2693. AC_MSG_RESULT(yes),
  2694. [ICC=""
  2695. AC_MSG_RESULT(no)]
  2696. )
  2697. CC="$OLD_CC"
  2698. CFLAGS="$OLD_CFLAGS"
  2699. fi
  2700. # Disable ICC on windows
  2701. if test "x$ICC" != "x" -a "$starpu_windows" = "yes" ; then
  2702. ICC=""
  2703. fi
  2704. if test "x$ICC" != "x"; then
  2705. AC_DEFINE(STARPU_HAVE_ICC, [1], [Define this if icc is available])
  2706. fi
  2707. AM_CONDITIONAL([STARPU_HAVE_ICC], [test "x$ICC" != "x"])
  2708. # Do not generate manpages for the tools if we do not have help2man
  2709. AC_CHECK_PROGS([HELP2MAN], [help2man])
  2710. # Disable on windows
  2711. if test "$starpu_windows" = "yes" ; then
  2712. HELP2MAN=""
  2713. fi
  2714. AM_CONDITIONAL([STARPU_HAVE_HELP2MAN], [test "x$HELP2MAN" != "x"])
  2715. AC_CHECK_MEMBER([struct cudaDeviceProp.pciDomainID],
  2716. AC_DEFINE([STARPU_HAVE_DOMAINID],[1],[Define to 1 if CUDA device properties include DomainID]),
  2717. , [[#include <cuda_runtime_api.h>]])
  2718. AC_CHECK_MEMBER([struct cudaDeviceProp.pciBusID],
  2719. AC_DEFINE([STARPU_HAVE_BUSID],[1],[Define to 1 if CUDA device properties include BusID]),
  2720. , [[#include <cuda_runtime_api.h>]])
  2721. dnl Set this condition when Automake 1.11 or later is being used.
  2722. dnl Automake 1.11 introduced `silent-rules', hence the check.
  2723. m4_ifdef([AM_SILENT_RULES],
  2724. AM_CONDITIONAL([STARPU_HAVE_AM111], [true]),
  2725. AM_CONDITIONAL([STARPU_HAVE_AM111], [false]))
  2726. ##########################################
  2727. # Resource Manager #
  2728. ##########################################
  2729. starpurm_support=no
  2730. starpurm_dlb_support=no
  2731. AC_ARG_ENABLE(starpurm, [AS_HELP_STRING([--enable-starpurm], [enable resource management support])],
  2732. enable_starpurm=$enableval, enable_starpurm=no)
  2733. if test "x$enable_starpurm" != xno
  2734. then
  2735. starpurm_support=yes
  2736. AC_MSG_CHECKING(whether resource management debug messages should be displayed)
  2737. AC_ARG_ENABLE(starpurm-verbose, [AS_HELP_STRING([--enable-starpurm-verbose],
  2738. [display resource management verbose debug messages])],
  2739. enable_starpurm_verbose=$enableval, enable_starpurm_verbose=no)
  2740. AC_MSG_RESULT($enable_starpurm_verbose)
  2741. if test x$enable_starpurm_verbose = xyes; then
  2742. AC_DEFINE(STARPURM_VERBOSE, [1], [display resource management verbose debug messages])
  2743. fi
  2744. # DLB
  2745. DLB_CFLAGS=""
  2746. DLB_LIBS=""
  2747. AC_ARG_ENABLE(dlb, [AS_HELP_STRING([--enable-dlb], [enable DLB support])],
  2748. enable_dlb=$enableval, enable_dlb=no)
  2749. if test "x$enable_dlb" != xno
  2750. then
  2751. AC_ARG_WITH(dlb-include-dir,
  2752. [AS_HELP_STRING([--with-dlb-include-dir=<path>],
  2753. [specify where DLB headers are installed])],
  2754. [dlb_inc_dirs="$withval"], [dlb_inc_dirs=""])
  2755. dlb_inc_dirs="${dlb_inc_dirs} /usr/include/dlb"
  2756. dlb_incdir_found=no
  2757. for dlb_incdir in $dlb_inc_dirs
  2758. do
  2759. if test -n "$dlb_incdir"
  2760. then
  2761. SAVED_CPPFLAGS="${CPPFLAGS}"
  2762. CPPFLAGS=-I${dlb_incdir}
  2763. AC_CHECK_HEADERS([dlb.h])
  2764. if test "$ac_cv_header_dlb_h" = "yes"
  2765. then
  2766. CPPFLAGS="-I$dlb_incdir ${SAVED_CPPFLAGS}"
  2767. DLB_CFLAGS="-I${dlb_incdir}"
  2768. dlb_incdir_found=yes
  2769. break
  2770. else
  2771. CPPFLAGS=${SAVED_CPPFLAGS}
  2772. fi
  2773. unset ac_cv_header_dlb_h
  2774. fi
  2775. done
  2776. AC_ARG_WITH(dlb-lib-dir,
  2777. [AS_HELP_STRING([--with-dlb-lib-dir=<path>],
  2778. [specify where DLB libraries are installed])],
  2779. [dlb_lib_dirs="$withval"], [dlb_lib_dirs=""])
  2780. dlb_lib_dirs="${dlb_lib_dirs} /usr/lib/dlb"
  2781. dlb_libdir_found=no
  2782. for dlb_libdir in $dlb_lib_dirs
  2783. do
  2784. if test -n "$dlb_libdir"
  2785. then
  2786. SAVED_LDFLAGS="${LDFLAGS}"
  2787. LDFLAGS=-L${dlb_libdir}
  2788. AC_CHECK_LIB(dlb, [DLB_Init])
  2789. if test "$ac_cv_lib_dlb_DLB_Init" = "yes"
  2790. then
  2791. LDFLAGS="-L${dlb_libdir} ${SAVED_LDFLAGS} ${STARPU_DLB_LDFLAGS}"
  2792. DLB_LIBS="-L${dlb_libdir} -ldlb"
  2793. dlb_libdir_found=yes
  2794. break
  2795. else
  2796. LDFLAGS=${SAVED_LDFLAGS}
  2797. fi
  2798. unset ac_cv_lib_dlb_DLB_Init
  2799. fi
  2800. done
  2801. SAVED_CPPFLAGS="${CPPFLAGS}"
  2802. SAVED_CFLAGS="${CFLAGS}"
  2803. SAVED_LDFLAGS="${LDFLAGS}"
  2804. CPPFLAGS="$HWLOC_CPPFLAGS -D_GNU_SOURCE $CPPFLAGS"
  2805. CFLAGS="$HWLOC_CFLAGS $CFLAGS"
  2806. LIBS="$HWLOC_LIBS $LIBS"
  2807. # check whether libhwloc has a dedicated glibc-sched.h include for conversion with glibc cpusets
  2808. AC_CHECK_HEADERS([hwloc/glibc-sched.h])
  2809. CPPFLAGS="$SAVED_CPPFLAGS"
  2810. CFLAGS="$SAVED_CFLAGS"
  2811. LIBS="$SAVED_LIBS"
  2812. SAVED_CPPFLAGS="${CPPFLAGS}"
  2813. SAVED_CFLAGS="${CFLAGS}"
  2814. SAVED_LDFLAGS="${LDFLAGS}"
  2815. CPPFLAGS="$STARPU_CPPFLAGS $CPPFLAGS"
  2816. CFLAGS="$STARPU_CFLAGS $CFLAGS"
  2817. LIBS="$STARPU_LIBS $LIBS"
  2818. # check if StarPU implements starpu_worker_set_going_to_sleep_callback()
  2819. if test x$enable_worker_cb = xyes ; then
  2820. AC_DEFINE([STARPURM_STARPU_HAVE_WORKER_CALLBACKS], [1], [Define to 1 if StarPU has support for worker callbacks.])
  2821. fi
  2822. #AC_CHECK_FUNC([starpu_worker_set_going_to_sleep_callback],AC_DEFINE([STARPURM_STARPU_HAVE_WORKER_CALLBACKS], [1], [Define to 1 if StarPU has support for worker callbacks.]))
  2823. CPPFLAGS="$SAVED_CPPFLAGS"
  2824. CFLAGS="$SAVED_CFLAGS"
  2825. LIBS="$SAVED_LIBS"
  2826. if test "x$dlb_incdir_found" != "xyes" -o "x$dlb_libdir_found" != "xyes"
  2827. then
  2828. enable_dlb=no
  2829. fi
  2830. fi
  2831. AC_MSG_CHECKING(whether DLB support should be enabled)
  2832. AC_MSG_RESULT($enable_dlb)
  2833. if test "x$enable_dlb" != "xno"
  2834. then
  2835. AC_DEFINE([STARPURM_HAVE_DLB], [1], [Define to 1 if dlb support is enabled.])
  2836. starpurm_dlb_support=yes
  2837. AC_MSG_CHECKING(whether DLB resource management debug messages should be displayed)
  2838. AC_ARG_ENABLE(starpurm-dlb-verbose, [AS_HELP_STRING([--enable-starpurm-dlb-verbose],
  2839. [display resource management verbose debug messages])],
  2840. enable_starpurm_dlb_verbose=$enableval, enable_starpurm_dlb_verbose=no)
  2841. AC_MSG_RESULT($enable_starpurm_dlb_verbose)
  2842. if test x$enable_starpurm_dlb_verbose = xyes; then
  2843. AC_DEFINE(STARPURM_DLB_VERBOSE, [1], [display DLB resource management verbose debug messages])
  2844. fi
  2845. AX_DLB_CALLBACK_ARG()
  2846. fi
  2847. AC_SUBST(DLB_CFLAGS)
  2848. AC_SUBST(DLB_LIBS)
  2849. fi
  2850. AM_CONDITIONAL(STARPURM_HAVE_DLB, test x$starpurm_dlb_support == "xyes")
  2851. AM_CONDITIONAL(STARPU_BUILD_STARPURM, [test x$starpurm_support = xyes])
  2852. AC_ARG_ENABLE(starpurm-examples, [AS_HELP_STRING([--enable-starpurm-examples],
  2853. [enable build of StarPU Resource Manager examples])],
  2854. enable_starpurm_examples=$enableval, enable_starpurm_examples=no)
  2855. AM_CONDITIONAL(STARPU_BUILD_STARPURM_EXAMPLES, [test x$enable_starpurm_examples = xyes])
  2856. #####################################
  2857. # StarPUPy #
  2858. #####################################
  2859. starpupy_support=no
  2860. AC_ARG_ENABLE(starpupy, [AS_HELP_STRING([--enable-starpupy], [enable StarPU python interface])],
  2861. enable_starpupy=$enableval, enable_starpupy=no)
  2862. if test "x$enable_starpupy" != xno
  2863. then
  2864. starpupy_support=yes
  2865. AC_CHECK_PROGS([PYTHON], python3)
  2866. if test "$ac_cv_prog_PYTHON" == ""
  2867. then
  2868. AC_MSG_ERROR([python3 missing, cannot build StarPU python interface])
  2869. fi
  2870. AC_SUBST(PYTHON)
  2871. PYTHON_INCLUDE_DIRS="`$PYTHON -c "from sysconfig import get_paths as gp; print(gp()@<:@'include'@:>@)"`"
  2872. SAVED_CPPFLAGS="${CPPFLAGS}"
  2873. CPPFLAGS="$CPPFLAGS -I$PYTHON_INCLUDE_DIRS"
  2874. AC_CHECK_HEADERS([Python.h],[have_python_h=yes],[have_python_h=no])
  2875. if test "$have_python_h" = "no" ; then
  2876. AC_MSG_ERROR([Python.h missing, cannot build StarPU python interface (consider installing python-dev)])
  2877. fi
  2878. CPPFLAGS=${SAVED_CPPFLAGS}
  2879. AC_MSG_CHECKING(for python3 module joblib)
  2880. AC_PYTHON_MODULE(joblib,[joblib_avail=yes],[joblib_avail=no])
  2881. AC_MSG_RESULT($joblib_avail)
  2882. if test "$joblib_avail" = "no" ; then
  2883. AC_MSG_ERROR([python3 module joblib missing, cannot build StarPU python interface (consider running 'pip3 install joblib')])
  2884. fi
  2885. AC_MSG_CHECKING(for python3 module cloudpickle)
  2886. AC_PYTHON_MODULE(cloudpickle,[cloudpickle_avail=yes],[cloudpickle_avail=no])
  2887. AC_MSG_RESULT($cloudpickle_avail)
  2888. if test "$cloudpickle_avail" = "no" ; then
  2889. AC_MSG_ERROR([python3 module cloudpickle missing, cannot build StarPU python interface (consider running 'pip3 install cloudpickle')])
  2890. fi
  2891. AC_MSG_CHECKING(for python3 module numpy)
  2892. AC_PYTHON_MODULE(numpy,[numpy_avail=yes],[numpy_avail=no])
  2893. AC_MSG_RESULT($numpy_avail)
  2894. PYTHON_NUMPY_DIR=""
  2895. if test "$numpy_avail" = "yes" ; then
  2896. AC_DEFINE(STARPU_PYTHON_HAVE_NUMPY, [1], [Python3 numpy package available])
  2897. PYTHON_NUMPY_DIR="`$PYTHON -c "import numpy ; print(numpy.get_include())"`"
  2898. fi
  2899. AC_SUBST(PYTHON_NUMPY_DIR)
  2900. PYTHON_SETUP_OPTIONS=""
  2901. if test x$enable_debug = xyes ; then
  2902. PYTHON_SETUP_OPTIONS="--debug"
  2903. fi
  2904. AC_SUBST(PYTHON_SETUP_OPTIONS)
  2905. fi
  2906. AM_CONDITIONAL(STARPU_BUILD_STARPUPY, [test x$starpupy_support = xyes])
  2907. AM_CONDITIONAL(STARPU_STARPUPY_NUMPY, [test x$numpy_avail = xyes])
  2908. ##########################################
  2909. # Documentation #
  2910. ##########################################
  2911. def_enable_build_doc="yes"
  2912. available_doc="no"
  2913. if test -d "$srcdir/doc/doxygen/html" ; then
  2914. def_enable_build_doc="no"
  2915. available_doc="yes"
  2916. fi
  2917. AC_ARG_ENABLE(build-doc, [AS_HELP_STRING([--disable-build-doc],
  2918. [disable building of documentation])],
  2919. enable_build_doc=$enableval, enable_build_doc=$def_enable_build_doc)
  2920. AC_ARG_ENABLE(build-doc-pdf, [AS_HELP_STRING([--enable-build-doc-pdf],
  2921. [enable building of PDF documentation])],
  2922. enable_build_doc_pdf=$enableval, enable_build_doc_pdf=no)
  2923. available_doc_pdf="no"
  2924. if test -f "$srcdir/doc/doxygen/starpu.pdf" ; then
  2925. enable_build_doc_pdf="no"
  2926. available_doc_pdf="yes"
  2927. fi
  2928. # Check whether doxygen needed tools are installed
  2929. AC_PATH_PROG(doxygencommand, doxygen)
  2930. if test "$doxygencommand" = "" ; then
  2931. enable_build_doc="no"
  2932. enable_build_doc_pdf="no"
  2933. fi
  2934. AC_PATH_PROG(pdflatexcommand, pdflatex)
  2935. if test "$pdflatexcommand" = "" ; then
  2936. enable_build_doc_pdf="no"
  2937. fi
  2938. AC_PATH_PROG(epstopdfcommand, epstopdf)
  2939. if test "$epstopdfcommand" = "" ; then
  2940. enable_build_doc_pdf="no"
  2941. fi
  2942. AC_MSG_CHECKING(whether HTML documentation should be compiled)
  2943. AC_MSG_RESULT($enable_build_doc)
  2944. AC_MSG_CHECKING(whether HTML documentation is available)
  2945. AC_MSG_RESULT($available_doc)
  2946. AC_MSG_CHECKING(whether PDF documentation should be compiled)
  2947. AC_MSG_RESULT($enable_build_doc_pdf)
  2948. AC_MSG_CHECKING(whether PDF documentation is available)
  2949. AC_MSG_RESULT($available_doc_pdf)
  2950. AM_CONDITIONAL(STARPU_BUILD_DOC, [test x$enable_build_doc != xno])
  2951. AM_CONDITIONAL(STARPU_AVAILABLE_DOC, [test x$available_doc != xno])
  2952. AM_CONDITIONAL(STARPU_BUILD_DOC_PDF, [test x$enable_build_doc_pdf != xno])
  2953. AM_CONDITIONAL(STARPU_AVAILABLE_DOC_PDF, [test x$available_doc_pdf != xno])
  2954. if test x$enable_build_doc_pdf != xno ; then
  2955. DOC_GENERATE_LATEX=YES
  2956. else
  2957. DOC_GENERATE_LATEX=NO
  2958. fi
  2959. AC_SUBST(DOC_GENERATE_LATEX)
  2960. ###############################################################################
  2961. # #
  2962. # Julia #
  2963. # #
  2964. ###############################################################################
  2965. AC_ARG_ENABLE(julia, [AS_HELP_STRING([--enable-julia],
  2966. [enable the Julia extension])],
  2967. enable_julia=$enableval, enable_julia=no)
  2968. if test "$enable_julia" = "yes" ; then
  2969. # Check whether the julia compiler is available
  2970. AC_PATH_PROG(juliapath, julia)
  2971. AC_MSG_CHECKING(whether julia is available)
  2972. AC_MSG_RESULT($juliapath)
  2973. if test ! -x $juliapath ; then
  2974. AC_MSG_ERROR(Julia compiler '$juliapath' is not valid)
  2975. enable_julia=no
  2976. fi
  2977. fi
  2978. AM_CONDITIONAL([STARPU_USE_JULIA], [test "x$enable_julia" = "xyes"])
  2979. AC_SUBST(JULIA, $juliapath)
  2980. ###############################################################################
  2981. # #
  2982. # Eclipse Plugin #
  2983. # #
  2984. ###############################################################################
  2985. AC_ARG_ENABLE(eclipse-plugin, [AS_HELP_STRING([--enable-eclipse-plugin],
  2986. [Build the Eclipse plugin])],
  2987. enable_eclipse_plugin=$enableval, enable_eclipse_plugin=no)
  2988. if test "$enable_eclipse_plugin" = "yes" ; then
  2989. AC_PATH_PROG(eclipsepath, eclipse)
  2990. AC_MSG_CHECKING(whether eclipse is available)
  2991. AC_MSG_RESULT($eclipsepath)
  2992. if test ! -x "$eclipsepath" ; then
  2993. AC_MSG_ERROR(Eclipse executable '$eclipsepath' is not valid)
  2994. enable_eclipse_plugin=no
  2995. fi
  2996. libs=$(for x in starpu-$STARPU_EFFECTIVE_VERSION $(echo $STARPU_EXPORTED_LIBS | sed 's/-l//g') $HWLOC_REQUIRES ; do echo $x ; done)
  2997. option_libs=$($srcdir/eclipse-plugin/tools/cproject.sh option $libs)
  2998. module_libs=$($srcdir/eclipse-plugin/tools/cproject.sh module $libs)
  2999. fi
  3000. AM_CONDITIONAL([STARPU_BUILD_ECLIPSE_PLUGIN], [test "x$enable_eclipse_plugin" = "xyes"])
  3001. AC_SUBST(ECLIPSE, $eclipsepath)
  3002. AC_SUBST(STARPU_INCLUDE_PATH, $(eval echo ${includedir}/starpu/$STARPU_EFFECTIVE_VERSION))
  3003. AC_SUBST(STARPU_LIB_PATH, $(eval echo ${prefix}/lib))
  3004. AC_SUBST(STARPU_MODULE_LIBS, "$module_libs")
  3005. AC_SUBST(STARPU_OPTION_LIBS, "$option_libs")
  3006. ###############################################################################
  3007. # #
  3008. # Final settings #
  3009. # #
  3010. ###############################################################################
  3011. # these are the flags needed to compile starpu.h
  3012. STARPU_H_CPPFLAGS="$HWLOC_CFLAGS $STARPU_CUDA_CPPFLAGS $STARPU_OPENCL_CPPFLAGS $SIMGRID_CFLAGS $OPENMP_CFLAGS"
  3013. AC_SUBST([STARPU_H_CPPFLAGS])
  3014. # these are the flags needed for linking libstarpu (and thus also for static linking)
  3015. LIBSTARPU_LDFLAGS="$STARPU_OPENCL_LDFLAGS $STARPU_CUDA_LDFLAGS $HWLOC_LIBS $FXT_LDFLAGS $FXT_LIBS $PAPI_LIBS $STARPU_LEVELDB_LDFLAGS $STARPU_GLPK_LDFLAGS $STARPU_LEVELDB_LDFLAGS $SIMGRID_LDFLAGS $STARPU_BLAS_LDFLAGS $STARPU_OMP_LDFLAGS $DGELS_LIBS"
  3016. AC_SUBST([LIBSTARPU_LDFLAGS])
  3017. # these are the flags needed for linking against libstarpu (because starpu.h makes its includer use pthread_*, simgrid, etc.)
  3018. if test "x$enable_shared" = xno; then
  3019. # No .so, so application will unexpectedly have to know which -l to
  3020. # use. Give them in .pc file.
  3021. AC_DEFINE(STARPU_STATIC_ONLY, [1], [Only static compilation was made])
  3022. STARPU_EXPORTED_LIBS="$STARPU_EXPORTED_LIBS $LDFLAGS $LIBS $LIBSTARPU_LDFLAGS"
  3023. fi
  3024. AC_SUBST(STARPU_EXPORTED_LIBS)
  3025. LIBSTARPU_LINK=libstarpu-$STARPU_EFFECTIVE_VERSION.la
  3026. LIBSTARPU_LINK="$LIBSTARPU_LINK $STARPU_EXPORTED_LIBS"
  3027. AC_SUBST([LIBSTARPU_LINK])
  3028. # File configuration
  3029. AC_CONFIG_COMMANDS([executable-scripts], [
  3030. chmod +x tests/regression/regression.sh
  3031. chmod +x tests/model-checking/starpu-mc.sh
  3032. chmod +x tools/starpu_env
  3033. chmod +x tools/starpu_codelet_profile
  3034. chmod +x tools/starpu_codelet_histo_profile
  3035. chmod +x tools/starpu_mpi_comm_matrix.py
  3036. chmod +x tools/starpu_fxt_number_events_to_names.py
  3037. chmod +x tools/starpu_workers_activity
  3038. chmod +x tools/starpu_paje_draw_histogram
  3039. chmod +x tools/starpu_paje_state_stats
  3040. chmod +x tools/starpu_paje_summary
  3041. chmod +x tools/starpu_mlr_analysis
  3042. chmod +x tools/starpu_paje_sort
  3043. chmod +x tools/starpu_smpirun
  3044. chmod +x doc/doxygen/doxygen_filter.sh
  3045. chmod +x doc/doxygen_dev/doxygen_filter.sh
  3046. chmod +x starpupy/examples/execute.sh
  3047. chmod +x julia/examples/execute.sh
  3048. for x in \
  3049. tests/microbenchs/tasks_data_overhead.sh \
  3050. tests/microbenchs/sync_tasks_data_overhead.sh \
  3051. tests/microbenchs/async_tasks_data_overhead.sh \
  3052. tests/microbenchs/tasks_size_overhead.sh \
  3053. tests/microbenchs/tasks_size_overhead_sched.sh \
  3054. tests/microbenchs/tasks_size_overhead_scheds.sh \
  3055. tests/microbenchs/tasks_size_overhead.gp \
  3056. tests/microbenchs/microbench.sh \
  3057. tests/microbenchs/parallel_dependent_homogeneous_tasks_data.sh \
  3058. tests/microbenchs/parallel_independent_heterogeneous_tasks_data.sh \
  3059. tests/microbenchs/parallel_independent_heterogeneous_tasks.sh \
  3060. tests/microbenchs/parallel_independent_homogeneous_tasks_data.sh \
  3061. tests/microbenchs/parallel_independent_homogeneous_tasks.sh \
  3062. tests/microbenchs/parallel_redux_homogeneous_tasks_data.sh \
  3063. tests/microbenchs/parallel_redux_heterogeneous_tasks_data.sh \
  3064. tests/microbenchs/bandwidth_scheds.sh \
  3065. tests/energy/static.sh \
  3066. tests/energy/dynamic.sh \
  3067. tests/datawizard/locality.sh \
  3068. tests/overlap/overlap.sh \
  3069. tests/model-checking/prio_list.sh \
  3070. tests/model-checking/barrier.sh \
  3071. examples/heat/heat.sh \
  3072. examples/lu/lu.sh \
  3073. examples/cholesky/cholesky.sh \
  3074. examples/mult/sgemm.sh \
  3075. examples/scheduler/schedulers.sh \
  3076. examples/scheduler/schedulers_context.sh \
  3077. tools/starpu_paje_draw_histogram.R \
  3078. tools/starpu_paje_state_stats.R \
  3079. tools/starpu_trace_state_stats.py \
  3080. julia/examples/check_deps/check_deps.sh \
  3081. julia/examples/mult/mult_starpu.sh \
  3082. julia/examples/mult/perf.sh \
  3083. julia/examples/variable/variable.sh \
  3084. julia/examples/task_insert_color/task_insert_color.sh \
  3085. julia/examples/vector_scal/vector_scal.sh \
  3086. julia/examples/mandelbrot/mandelbrot.sh \
  3087. julia/examples/callback/callback.sh \
  3088. julia/examples/dependency/task_dep.sh \
  3089. julia/examples/dependency/tag_dep.sh \
  3090. julia/examples/dependency/end_dep.sh \
  3091. julia/examples/axpy/axpy.sh \
  3092. julia/examples/gemm/gemm.sh \
  3093. julia/examples/cholesky/cholesky.sh \
  3094. starpupy/examples/starpu_py.sh \
  3095. starpupy/examples/starpu_py_np.sh \
  3096. starpupy/examples/starpu_py_parallel.sh \
  3097. ; do
  3098. test -e $x || ( mkdir -p $(dirname $x) && ln -sf $ac_abs_top_srcdir/$x $(dirname $x) )
  3099. done
  3100. ])
  3101. # Create links to ICD files in build/socl/vendors directory. SOCL will use this
  3102. # directory as the OCL_ICD_VENDORS directory
  3103. SOCL_VENDORS="vendors/install/socl.icd"
  3104. for icd in /etc/OpenCL/vendors/*.icd ; do
  3105. if test -f $icd ; then
  3106. if test "$(basename $icd)" != "socl.icd" ; then
  3107. new_icd=$(basename $icd)
  3108. AC_CONFIG_LINKS([socl/vendors/$new_icd:$icd])
  3109. SOCL_VENDORS="$SOCL_VENDORS vendors/$new_icd"
  3110. fi
  3111. fi
  3112. done
  3113. AC_SUBST(SOCL_VENDORS)
  3114. AC_CONFIG_FILES(tests/regression/regression.sh tests/regression/profiles tests/regression/profiles.build.only)
  3115. AC_CONFIG_HEADER(src/common/config.h include/starpu_config.h starpurm/include/starpurm_config.h)
  3116. SANITIZE=$(echo $CFLAGS | grep sanitize)
  3117. AM_CONDITIONAL(STARPU_SANITIZE, test -n "$SANITIZE")
  3118. AC_OUTPUT([
  3119. Makefile
  3120. src/Makefile
  3121. tools/Makefile
  3122. tools/starpu_env
  3123. tools/starpu_codelet_profile
  3124. tools/starpu_codelet_histo_profile
  3125. tools/starpu_mpi_comm_matrix.py
  3126. tools/starpu_fxt_number_events_to_names.py
  3127. tools/starpu_workers_activity
  3128. tools/starpu_paje_draw_histogram
  3129. tools/starpu_paje_state_stats
  3130. tools/starpu_paje_summary
  3131. tools/starpu_mlr_analysis
  3132. tools/starpu_paje_sort
  3133. tools/starpu_smpirun
  3134. socl/Makefile
  3135. socl/src/Makefile
  3136. socl/examples/Makefile
  3137. socl/vendors/socl.icd
  3138. socl/vendors/install/socl.icd
  3139. libstarpu.pc
  3140. starpu-1.0.pc
  3141. starpu-1.1.pc
  3142. starpu-1.2.pc
  3143. starpu-1.3.pc
  3144. mpi/libstarpumpi.pc
  3145. mpi/starpumpi-1.0.pc
  3146. mpi/starpumpi-1.1.pc
  3147. mpi/starpumpi-1.2.pc
  3148. mpi/starpumpi-1.3.pc
  3149. starpufft/Makefile
  3150. starpufft/src/Makefile
  3151. starpufft/tests/Makefile
  3152. starpufft/libstarpufft.pc
  3153. starpufft/starpufft-1.0.pc
  3154. starpufft/starpufft-1.1.pc
  3155. starpufft/starpufft-1.2.pc
  3156. starpufft/starpufft-1.3.pc
  3157. starpurm/Makefile
  3158. starpurm/src/Makefile
  3159. starpurm/examples/Makefile
  3160. starpurm/starpurm-1.3.pc
  3161. starpupy/src/setup.cfg
  3162. starpupy/src/setup.py
  3163. starpupy/Makefile
  3164. starpupy/src/Makefile
  3165. starpupy/examples/Makefile
  3166. starpupy/examples/execute.sh
  3167. examples/Makefile
  3168. examples/stencil/Makefile
  3169. tests/Makefile
  3170. tests/model-checking/Makefile
  3171. tests/model-checking/starpu-mc.sh
  3172. mpi/Makefile
  3173. mpi/src/Makefile
  3174. mpi/tests/Makefile
  3175. mpi/examples/Makefile
  3176. mpi/tools/Makefile
  3177. mpi/GNUmakefile
  3178. sc_hypervisor/Makefile
  3179. sc_hypervisor/src/Makefile
  3180. sc_hypervisor/examples/Makefile
  3181. doc/Makefile
  3182. doc/doxygen/Makefile
  3183. doc/doxygen/doxygen-config.cfg
  3184. doc/doxygen/doxygen_filter.sh
  3185. doc/doxygen_dev/Makefile
  3186. doc/doxygen_dev/doxygen-config.cfg
  3187. doc/doxygen_dev/doxygen_filter.sh
  3188. tools/msvc/starpu_var.bat
  3189. min-dgels/Makefile
  3190. julia/Makefile
  3191. julia/src/Makefile
  3192. julia/src/dynamic_compiler/Makefile
  3193. julia/examples/Makefile
  3194. julia/examples/execute.sh
  3195. eclipse-plugin/Makefile
  3196. eclipse-plugin/src/Makefile
  3197. eclipse-plugin/examples/Makefile
  3198. eclipse-plugin/examples/hello/.cproject
  3199. ])
  3200. AC_MSG_NOTICE([
  3201. CPUs enabled: $enable_cpu
  3202. CUDA enabled: $enable_cuda
  3203. OpenCL enabled: $enable_opencl
  3204. Compile-time limits
  3205. (change these with --enable-maxcpus, --enable-maxcudadev,
  3206. --enable-maxopencldev, --enable-maxnodes, --enable-maxbuffers)
  3207. (Note these numbers do not represent the number of detected
  3208. devices, but the maximum number of devices StarPU can manage)
  3209. Maximum number of CPUs: $maxcpus
  3210. Maximum number of CUDA devices: $nmaxcudadev
  3211. Maximum number of OpenCL devices: $nmaxopencldev
  3212. Maximum number of MPI master-slave devices: $nmaxmpidev
  3213. Maximum number of memory nodes: $maxnodes
  3214. Maximum number of task buffers: $nmaxbuffers
  3215. GPU-GPU transfers: $enable_cuda_memcpy_peer
  3216. Allocation cache: $enable_allocation_cache
  3217. Magma enabled: $have_magma
  3218. BLAS library: $blas_lib
  3219. hwloc: $have_valid_hwloc
  3220. FxT trace enabled: $enable_fxt
  3221. Documentation HTML: $enable_build_doc
  3222. Documentation PDF: $enable_build_doc_pdf
  3223. Examples: $enable_build_examples
  3224. StarPU Extensions:
  3225. StarPU MPI enabled: $build_mpi_lib
  3226. StarPU MPI(nmad) enabled: $build_nmad_lib
  3227. MPI test suite: $running_mpi_check
  3228. Master-Slave MPI enabled: $build_mpi_master_slave
  3229. FFT Support: $fft_support
  3230. Resource Management enabled: $starpurm_support
  3231. Python Interface enabled: $starpupy_support
  3232. OpenMP runtime support enabled: $enable_openmp
  3233. Cluster support enabled: $enable_cluster
  3234. SOCL enabled: $build_socl
  3235. SOCL test suite: $run_socl_check
  3236. Scheduler Hypervisor: $build_sc_hypervisor
  3237. simgrid enabled: $enable_simgrid
  3238. ayudame enabled: $ayu_msg
  3239. HDF5 enabled: $enable_hdf5
  3240. Native fortran support: $enable_build_fortran
  3241. Native MPI fortran support: $use_mpi_fort
  3242. Support for multiple linear regression models: $support_mlr
  3243. JULIA enabled: $enable_julia
  3244. ])
  3245. if test "$build_socl" = "yes" -a "$run_socl_check" = "no" ; then
  3246. AC_MSG_NOTICE([
  3247. WARNING: SOCL test suite will not be run as the environment variable SOCL_OCL_LIB_OPENCL is not defined.
  3248. To run the tests, you need to install the OCL implementation of ICD
  3249. (https://forge.imag.fr/projects/ocl-icd/ or Debian package ocl-icd-libopencl1)
  3250. and set the variable SOCL_OCL_LIB_OPENCL to the location of the libOpenCL.so.])
  3251. fi
  3252. if test x"$have_valid_hwloc" = xno -a "$enable_simgrid" = "no" ; then
  3253. AC_MSG_NOTICE([
  3254. WARNING: hwloc was not enabled. If the target machine is hyperthreaded the
  3255. performance may be impacted a lot. It is strongly recommended to install
  3256. hwloc])
  3257. fi
  3258. if test x"$starpu_windows" = xyes -a "x$STARPU_MS_LIB" = "x" ; then
  3259. AC_MSG_NOTICE([
  3260. WARNING: lib was not found, you will not be able to build StarPU applications
  3261. with Microsoft Visual Studio. Add to your PATH the directories for MSVC, e.g
  3262. c:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE;
  3263. c:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\bin])
  3264. fi