-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathCMakeLists.txt
1308 lines (1175 loc) · 53.4 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
###
#
# @copyright (c) 2009-2014 The University of Tennessee and The University
# of Tennessee Research Foundation.
# All rights reserved.
# @copyright (c) 2012-2016 Inria. All rights reserved.
# @copyright (c) 2012-2016 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria, Univ. Bordeaux. All rights reserved.
# @copyright (c) 2017-2022 King Abdullah University of Science and Technology (KAUST). All rights reserved.
#
###
#
# @file CMakeLists.txt
#
# @project HiCMA
# HiCMA is a software package provided by:
# King Abdullah University of Science and Technology
#
# @version 1.0.0
# @author Cedric Castagnede
# @author Emmanuel Agullo
# @author Mathieu Faverge
# @author Florent Pruvost
# @author Eduardo Gonzalez
# @author Kadir Akbudak
# @date 2019-11-25
#
## disables all rank descriptors and runs in fixed rank mode
#add_definitions(-DHICMA_ALWAYS_FIX_RANK)
## disables all computations so affect of communication can be measured
#add_definitions(-DHICMA_DISABLE_ALL_COMPUTATIONS)
## disables low rank operations except the dense potrf
#add_definitions(-DHICMA_DISABLE_HCORE_COMPUTATIONS)
#LAPACKE_dge_trans() is used in HiCMA. Appropriate header file must be included
#add_definitions(-DMKL)
#add_definitions(-DLAPACKE_UTILS)
cmake_minimum_required(VERSION 2.8)
# cmake_minimum_required(VERSION 3.2.3)
# directly make an error if in-source build
if ("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_BINARY_DIR}")
message(FATAL_ERROR "In-source builds are not allowed.\n"
"Please create a build directory first and execute cmake configuration from "
"this directory. Example: mkdir build && cd build && cmake ..")
endif ()
project(HICMA C)
# set project version number
set(HICMA_VERSION_MAJOR 0)
set(HICMA_VERSION_MINOR 1)
set(HICMA_VERSION_PATCH 1)
set(MORSE_CMAKE_DIR "" CACHE PATH "Directory of MORSE CMake modules, can be external to the project")
## CMAKE MODULES :: ECRC
## REQUIRED FOR TESTS TO LINK LIBRARIES
if (NOT EXISTS "${PROJECT_SOURCE_DIR}/cmake_modules/ecrc/modules")
find_package(Git REQUIRED)
execute_process(COMMAND ${GIT_EXECUTABLE} submodule init WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} RESULT_VARIABLE _res_init OUTPUT_QUIET ERROR_QUIET)
execute_process(COMMAND ${GIT_EXECUTABLE} submodule update WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} RESULT_VARIABLE _res_update OUTPUT_QUIET ERROR_QUIET)
if (${_res_init} GREATER 0 OR ${_res_update} GREATER 0)
message(FATAL_ERROR "ECRC CMake modules were not found.\n"
"We tried: 'git submodule init && git submodule update' and resulted in error")
endif ()
endif ()
## ECRC INITIALIZATION
list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake_modules)
list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake_modules/ecrc/modules")
set(ECRC_CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake_modules/ecrc/modules)
include(EcrcInit)
include(GenPkgConfig)
# # Add extra cmake module path and initialize morse cmake modules
# # --------------------------------------------------------------
# list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake_modules)
# if(MORSE_CMAKE_DIR)
# list(APPEND CMAKE_MODULE_PATH "${MORSE_CMAKE_DIR}/cmake_modules/morse_cmake/modules")
# set(MORSE_CMAKE_MODULE_PATH ${MORSE_CMAKE_DIR}/cmake_modules/morse_cmake/modules )
# elseif(EXISTS "${CMAKE_SOURCE_DIR}/cmake_modules/morse_cmake")
# list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake_modules/morse_cmake/modules")
# set(MORSE_CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake_modules/morse_cmake/modules )
# else()
# message(FATAL_ERROR "HiCMA CMake system relies on morse_cmake modules developed here: "
# "https://gitlab.inria.fr/solverstack/morse_cmake. Please set MORSE_CMAKE_DIR to this source "
# "directory.")
# endif()
# include(MorseInit)
# include(GenPkgConfig)
#############################################
# #
# Compilation of HICMA #
# #
#############################################
###############################################################################
# Parameters/Options #
######################
# Set the RPATH config
# --------------------
# use, i.e. don't skip the full RPATH for the build tree
set(CMAKE_SKIP_BUILD_RPATH FALSE)
# when building, don't use the install RPATH already
# (but later on when installing)
set(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE)
# the RPATH to be used when installing
list(APPEND CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib")
# Misc options
# ------------
option(BUILD_SHARED_LIBS "Build shared libraries" OFF)
# Define precision supported by HICMA
# -----------------------------------------
set(RP_HICMA_DICTIONNARY ${PROJECT_SOURCE_DIR}/cmake_modules/morse_cmake/modules/precision_generator/subs.py)
set(RP_HICMA_PRECISIONS "s;d;c;z")
include(RulesPrecisions)
# Options to select the runtime
# -----------------------------
# Create a list of possible runtime
#set(HICMA_SCHED_list "PARSEC" "STARPU" "QUARK")
set(HICMA_SCHED_list "STARPU")
# Initially PaRSEC runtime is enabled
option(HICMA_SCHED_PARSEC
"Enable PaRSEC scheduler as the default runtime
(Conflict with other HICMA_SCHED_* options)" OFF)
option(HICMA_SCHED_STARPU
"Enable StarPU scheduler as the default runtime
(Conflict with other HICMA_SCHED_* options)" ON)
option(HICMA_SCHED_QUARK
"Enable Quark scheduler as the default runtime
(Conflict with other HICMA_SCHED_* options)" OFF)
# For now, we are able to compile only one runtime at a time, so we disable combinations of runtimes
if (HICMA_SCHED_STARPU)
set(HICMA_SCHED_QUARK OFF)
set(HICMA_SCHED_PARSEC OFF)
elseif (HICMA_SCHED_QUARK)
set(HICMA_SCHED_STARPU OFF)
set(HICMA_SCHED_PARSEC OFF)
elseif (HICMA_SCHED_PARSEC)
set(HICMA_SCHED_QUARK OFF)
set(HICMA_SCHED_STARPU OFF)
endif ()
# Set default to StarPU if nothing specific is required by the user
if (NOT HICMA_SCHED_STARPU AND NOT HICMA_SCHED_PARSEC AND NOT HICMA_SCHED_QUARK)
set(HICMA_SCHED_STARPU ON)
endif ()
if (HICMA_SCHED_STARPU)
message("-- ${BoldGreen}HICMA_SCHED_STARPU is set to ON: HICMA uses StarPU runtime\n"
" To use HICMA with Quark runtime: set HICMA_SCHED_QUARK to ON\n"
" To use HICMA with PaRSEC runtime: set HICMA_SCHED_PARSEC to ON\n"
" (HICMA_SCHED_STARPU will be disabled)${ColourReset}")
elseif (HICMA_SCHED_QUARK)
message("-- ${BoldGreen}HICMA_SCHED_QUARK is set to ON: HICMA uses Quark runtime\n"
" To use HICMA with StarPU runtime: set HICMA_SCHED_STARPU to ON\n"
" To use HICMA with PaRSEC runtime: set HICMA_SCHED_PARSEC to ON\n"
" (HICMA_SCHED_QUARK will be disabled)${ColourReset}")
elseif (HICMA_SCHED_PARSEC)
message("-- ${BoldGreen}HICMA_SCHED_PARSEC is set to ON: HICMA uses PaRSEC runtime\n"
" To use HICMA with StarPU runtime: set HICMA_SCHED_STARPU to ON\n"
" To use HICMA with Quark runtime: set HICMA_SCHED_QUARK to ON\n"
" (HICMA_SCHED_PARSEC will be disabled)${ColourReset}")
endif ()
# Check that one, and only one, SCHED option is set to ON
# count number of runtime sets to ON
math(EXPR number_of_active_runtime 0)
foreach (runtime ${HICMA_SCHED_list})
if (HICMA_SCHED_${runtime})
math(EXPR number_of_active_runtime "${number_of_active_runtime}+1")
endif ()
endforeach ()
if (NOT number_of_active_runtime STREQUAL 1)
message(FATAL_ERROR
"Number of active runtime is ${number_of_active_runtime}, "
"the user should activate one (and only one) runtime. ")
endif ()
# Use intermediate variable since cmake_dependent_option doesn't have OR conditions
set(HICMA_ENABLE_MPI OFF CACHE INTERNAL "Tells if MPI might be supported by the runtime")
if (HICMA_SCHED_PARSEC OR HICMA_SCHED_STARPU)
set(HICMA_ENABLE_MPI ON FORCE)
endif ()
# Additional options
# ------------------
# Enable the distributed interface (allowed only when StarPU or PaRSEC is enabled)
# TODO: Default should be changed to ON/OFF when it will be ok
cmake_dependent_option(HICMA_USE_MPI
"Enable distributed memory through MPI" OFF
"HICMA_ENABLE_MPI" OFF)
if (HICMA_ENABLE_MPI AND NOT HICMA_USE_MPI)
message("-- ${BoldGreen}HICMA_USE_MPI is set to OFF, turn it ON to use MPI (unsupported by Quark)${ColourReset}")
endif ()
# Enable FXT if StarPU
option(HICMA_ENABLE_TRACING "Enable tracing support" OFF)
if (NOT HICMA_ENABLE_TRACING)
message("-- ${BoldGreen}HICMA_ENABLE_TRACING is set to OFF, turn it ON to use FxT (with StarPU)${ColourReset}")
endif ()
#option(HICMA_USE_EZTRACE "Enable EZTRACE to build modules" OFF)
# # Options to enable/disable testings and timings
# # ----------------------------------------------
# option(HICMA_ENABLE_DOCS "Enable documentation build" OFF)
# if (HICMA_ENABLE_DOCS)
# message("-- ${BoldGreen}HICMA_ENABLE_DOCS is set to ON, turn it OFF to avoid building docs${ColourReset}")
# endif()
# option(HICMA_ENABLE_EXAMPLE "Enable examples build" ON)
# if (HICMA_ENABLE_EXAMPLE)
# message("-- ${BoldGreen}HICMA_ENABLE_EXAMPLE is set to ON, turn it OFF to avoid building examples${ColourReset}")
# endif()
# option(HICMA_ENABLE_TESTING "Enable testings build" ON)
# if (HICMA_ENABLE_TESTING)
# message("-- ${BoldGreen}HICMA_ENABLE_TESTING is set to ON, turn it OFF to avoid building testing${ColourReset}")
# endif()
option(HICMA_ENABLE_DOCS "Build documentation in docs directory" ON)
# If docs option is ON
if (HICMA_ENABLE_DOCS)
find_package(Doxygen)
if (DOXYGEN_FOUND)
add_subdirectory("docs")
else ()
message(STATUS "Doxygen NOT found, skipping it")
endif ()
endif ()
option(HICMA_ENABLE_TIMING "Enable timings build" ON)
if (HICMA_ENABLE_TIMING)
message("-- ${BoldGreen}HICMA_ENABLE_TIMING is set to ON, turn it OFF to avoid building timing${ColourReset}")
endif ()
option(HICMA_ENABLE_TESTING "Enable testings build" ON)
if (HICMA_ENABLE_TESTING)
message("-- ${BoldGreen}HICMA_ENABLE_TESTING is set to ON, turn it OFF to avoid building testing${ColourReset}")
endif ()
# Option to activate or not simulation mode (use Simgrid through StarPU)
# ----------------------------------------------------------------------
if (HICMA_SCHED_STARPU)
option(HICMA_SIMULATION "Enable simulation mode using Simgrid through StarPU" OFF)
if (NOT HICMA_SIMULATION)
message("-- ${BoldGreen}HICMA_SIMULATION is set to OFF, turn it ON to use"
" SIMULATION mode (only with StarPU compiled with SimGrid)${ColourReset}")
endif ()
option(HICMA_ENABLE_PRUNING_STATS "Enable pruning statistics" OFF)
if (NOT HICMA_ENABLE_PRUNING_STATS)
message("-- ${BoldGreen}HICMA_ENABLE_PRUNING_STATS is set to OFF, turn it ON to build pruning statistics${ColourReset}")
endif ()
if (HICMA_ENABLE_PRUNING_STATS)
add_definitions(-DHICMA_ENABLE_PRUNING_STATS)
endif (HICMA_ENABLE_PRUNING_STATS)
endif ()
# Initially we need to generate files for different precisions
# TODO: use this option to avoid generate multiple precisions each time we launch cmake
#option(HICMA_GEN_PREC "Generate source files precisions" ON)
#------------------------------------------------------------------------------
###############################################################################
# Look for dependencies #
#########################
set(HICMA_DEP "")
# Check for Thread library
# ------------------------
set(CMAKE_THREAD_PREFER_PTHREAD TRUE)
find_package(Threads REQUIRED)
if (THREADS_FOUND)
list(APPEND EXTRA_LIBRARIES ${CMAKE_THREAD_LIBS_INIT})
endif ()
# Add math library to the list of extra
# it normally exists on all common systems provided with a C compiler
set(M_LIBRARIES "")
if (UNIX OR WIN32)
find_library(
M_m_LIBRARY
NAMES m
)
mark_as_advanced(M_m_LIBRARY)
if (M_m_LIBRARY)
list(APPEND M_LIBRARIES "${M_m_LIBRARY}")
list(APPEND EXTRA_LIBRARIES "${M_m_LIBRARY}")
else ()
message(FATAL_ERROR "Could NOT find libm on your system."
" Are you sure to a have a C compiler installed?")
endif ()
endif ()
# Try to find librt (libposix4 - POSIX.1b Realtime Extensions library)
# on Unix systems except Apple ones because it does not exist on it
set(RT_LIBRARIES "")
if (UNIX AND NOT APPLE)
find_library(
RT_rt_LIBRARY
NAMES rt
)
mark_as_advanced(RT_rt_LIBRARY)
if (RT_rt_LIBRARY)
list(APPEND RT_LIBRARIES "${RT_rt_LIBRARY}")
list(APPEND EXTRA_LIBRARIES "${RT_rt_LIBRARY}")
else ()
message(FATAL_ERROR "Could NOT find librt on your system")
endif ()
endif ()
# If simulation we don't enter in kernel functions so that we don't need to
# link with concerned libraries
if (NOT HICMA_SIMULATION)
# HICMA depends on CBLAS
#---------------------------
find_package(CBLAS COMPONENTS BLASEXT)
if (BLAS_FOUND)
if (BLAS_LIBRARY_DIRS)
# the RPATH to be used when installing
list(APPEND CMAKE_INSTALL_RPATH "${BLAS_LIBRARY_DIRS}")
endif ()
if (BLAS_LINKER_FLAGS)
list(APPEND CMAKE_EXE_LINKER_FLAGS "${BLAS_LINKER_FLAGS}")
endif ()
else ()
message(FATAL_ERROR "BLAS library has not been found")
endif ()
if (CBLAS_FOUND)
include_directories(${CBLAS_INCLUDE_DIRS})
if (CBLAS_LIBRARY_DIRS)
# the RPATH to be used when installing
list(APPEND CMAKE_INSTALL_RPATH "${CBLAS_LIBRARY_DIRS}")
endif ()
if (CBLAS_LIBRARIES)
if (CBLAS_LIBRARIES_DEP)
list(INSERT HICMA_DEP 0 ${CBLAS_LIBRARIES_DEP})
else ()
list(INSERT HICMA_DEP 0 ${CBLAS_LIBRARIES})
endif ()
endif ()
else ()
if (ECRC_VERBOSE_FIND_PACKAGE)
if (CBLAS_STANDALONE OR NOT CBLAS_WORKS)
if (NOT CBLAS_cblas.h_DIRS)
Print_Find_Header_Status(cblas cblas.h)
endif ()
if (NOT CBLAS_cblas_LIBRARY)
Print_Find_Library_Status(cblas libcblas)
endif ()
endif ()
else ()
message(WARNING "CBLAS library has not been found and ECRC_VERBOSE_FIND_PACKAGE is set to OFF."
" Try to activate ECRC_VERBOSE_FIND_PACKAGE option (-DECRC_VERBOSE_FIND_PACKAGE=ON) to get some hints for the detection")
endif ()
message(FATAL_ERROR "A CBLAS library is required but has not been found")
endif ()
list(REMOVE_DUPLICATES CMAKE_EXE_LINKER_FLAGS)
string(REPLACE ";" " " CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS}")
# HICMA depends on LAPACKE
#-----------------------------
# standalone version of lapacke seems useless for now
# let the comment in case we meet some problems of non existing lapacke
# functions in lapack library such as mkl, acml, ...
#set(LAPACKE_STANDALONE TRUE)
find_package(LAPACKE COMPONENTS LAPACKEXT)
if (LAPACK_FOUND AND LAPACK_LIBRARY_DIRS)
# the RPATH to be used when installing
list(APPEND CMAKE_INSTALL_RPATH "${LAPACK_LIBRARY_DIRS}")
else ()
message(FATAL_ERROR "A LAPACK library is required but has not been found")
endif ()
if (LAPACKE_FOUND)
include_directories(${LAPACKE_INCLUDE_DIRS})
if (LAPACKE_LIBRARY_DIRS)
# the RPATH to be used when installing
list(APPEND CMAKE_INSTALL_RPATH "${LAPACKE_LIBRARY_DIRS}")
endif ()
if (LAPACKE_LINKER_FLAGS)
list(APPEND CMAKE_EXE_LINKER_FLAGS "${LAPACKE_LINKER_FLAGS}")
endif ()
if (LAPACKE_LIBRARIES)
if (LAPACKE_LIBRARIES_DEP)
list(INSERT HICMA_DEP 0 ${LAPACKE_LIBRARIES_DEP})
else ()
list(INSERT HICMA_DEP 0 ${LAPACKE_LIBRARIES})
endif ()
endif ()
else ()
if (ECRC_VERBOSE_FIND_PACKAGE)
if (LAPACKE_STANDALONE OR NOT LAPACKE_WORKS)
if (NOT LAPACKE_lapacke.h_DIRS)
Print_Find_Header_Status(lapacke lapacke.h)
endif ()
if (NOT LAPACKE_lapacke_LIBRARY)
Print_Find_Library_Status(lapacke liblapacke)
endif ()
endif ()
else ()
message(WARNING "LAPACKE library has not been found and ECRC_VERBOSE_FIND_PACKAGE is set to OFF."
" Try to activate ECRC_VERBOSE_FIND_PACKAGE option (-DECRC_VERBOSE_FIND_PACKAGE=ON) to get some hints for the detection")
endif ()
message(FATAL_ERROR "A LAPACKE library is required but has not been found")
endif ()
# HICMA depends on MPI
#-------------------------
if (HICMA_USE_MPI)
add_definitions(-DHICMA_USE_MPI)
# allows to use an external mpi compilation by setting compilers with
# -DMPI_C_COMPILER=path/to/mpicc -DMPI_Fortran_COMPILER=path/to/mpif90
# at cmake configure
if (NOT MPI_C_COMPILER)
set(MPI_C_COMPILER mpicc)
endif ()
find_package(MPI REQUIRED)
if (MPI_C_FOUND)
message("-- ${Blue}Add definition HICMA_USE_MPI"
" - Activate MPI in HiCMA${ColourReset}")
set(HICMA_USE_MPI 1)
list(APPEND EXTRA_LIBRARIES ${MPI_C_LIBRARIES})
include_directories(${MPI_C_INCLUDE_PATH})
# tests for intel mpi
#list(APPEND MPI_C_COMPILE_FLAGS "-mt_mpi")
#list(APPEND MPI_COMPILE_FLAGS "-mt_mpi")
if (MPI_C_LINK_FLAGS)
list(APPEND CMAKE_EXE_LINKER_FLAGS "${MPI_C_LINK_FLAGS}")
endif ()
endif (MPI_C_FOUND)
endif (HICMA_USE_MPI)
else (NOT HICMA_SIMULATION)
message("-- ${BoldBlue}Simulation mode of HICMA is activated (HICMA_SIMULATION=ON)."
"\n This mode allows you to simulate execution of algorithms with StarPU compiled with SimGrid.${ColourReset}")
message("-- ${Blue}Add definition HICMA_SIMULATION"
" - Activate simulation mode in HiCMA (to use with StarPU+SimGrid)${ColourReset}")
set(HICMA_SIMULATION 1)
add_subdirectory(simucore)
if (NOT HICMA_SCHED_STARPU)
message(FATAL_ERROR "Simulation mode of HiCMA only works with"
"\n the StarPU runtime. Please use HICMA_SCHED_STARPU=ON.")
endif ()
if (HICMA_ENABLE_EXAMPLE)
set(HICMA_ENABLE_EXAMPLE OFF)
message("-- ${BoldBlue}HICMA_ENABLE_EXAMPLE is set to ON but we turn it OFF.")
endif ()
if (HICMA_ENABLE_TESTING)
set(HICMA_ENABLE_TESTING OFF)
message("-- ${BoldBlue}HICMA_ENABLE_TESTING is set to ON but we turn it OFF."
"\n Because we are compiling the simulation mode (HICMA_SIMULATION=ON),"
"\n there is no sense in compiling testing drivers that are used to check"
"\n numerical correctness of algorithms and kernels.${ColourReset}")
endif ()
# Simulation mode: we depend on SimGrid
find_package(SIMGRID REQUIRED)
# HICMA depends on MPI
#-------------------------
if (HICMA_USE_MPI)
# allows to use an external mpi compilation by setting compilers with
# -DMPI_C_COMPILER=path/to/mpicc -DMPI_Fortran_COMPILER=path/to/mpif90
# at cmake configure
if (NOT MPI_C_COMPILER)
set(MPI_C_COMPILER "${SIMGRID_DIR_FOUND}/bin/smpicc")
endif ()
if (NOT MPI_C_LIBRARIES)
set(MPI_C_LIBRARIES "${SIMGRID_LIBRARIES}")
endif ()
if (NOT MPI_C_INCLUDE_PATH)
set(MPI_C_INCLUDE_PATH "${SIMGRID_INCLUDE_DIRS}")
list(APPEND MPI_C_INCLUDE_PATH "${SIMGRID_INCLUDE_DIRS}/smpi")
endif ()
find_package(MPI REQUIRED)
if (MPI_C_FOUND)
message("-- ${Blue}Add definition HICMA_USE_MPI"
" - Activate MPI in HiCMA${ColourReset}")
set(HICMA_USE_MPI 1)
list(APPEND EXTRA_LIBRARIES ${MPI_C_LIBRARIES})
include_directories(${MPI_C_INCLUDE_PATH})
if (MPI_C_LINK_FLAGS)
list(APPEND CMAKE_EXE_LINKER_FLAGS "${MPI_C_LINK_FLAGS}")
endif ()
endif (MPI_C_FOUND)
endif (HICMA_USE_MPI)
endif (NOT HICMA_SIMULATION)
# HICMA depends on STARSH
# -------------------------------
find_package(STARSH REQUIRED)
if (STARSH_FOUND)
include_directories(${STARSH_INCLUDE_DIRS_DEP})
if (STARSH_LINKER_FLAGS)
list(APPEND CMAKE_EXE_LINKER_FLAGS "${STARSH_LINKER_FLAGS}")
endif ()
if (STARSH_LIBRARY_DIRS)
# the RPATH to be used when installing
list(APPEND CMAKE_INSTALL_RPATH "${STARSH_LIBRARY_DIRS}")
endif ()
if (STARSH_LIBRARIES)
# look for gsl
find_library(_STARSH_LIB NAME starsh PATHS ${STARSH_LIBRARY_DIRS})
if (_STARSH_LIB AND NOT "${STARSH_LIBRARIES_DEP}" MATCHES "gsl")
execute_process(COMMAND nm ${_STARSH_LIB} COMMAND grep -q gsl RESULT_VARIABLE GSL_IN_STARSH)
if (${GSL_IN_STARSH} EQUAL 0)
message(STATUS "STARSH depends on gsl. Adding it to dependency list")
find_package(GSL REQUIRED)
if (GSL_FOUND)
if (STARSH_LIBRARIES_DEP)
list(APPEND STARSH_LIBRARIES_DEP ${GSL_LIBRARIES})
else ()
list(APPEND STARSH_LIBRARIES ${GSL_LIBRARIES})
endif ()
endif ()
endif ()
endif ()
# insert to dependencies
if (STARSH_LIBRARIES_DEP)
list(APPEND HICMA_DEP ${STARSH_LIBRARIES_DEP})
else ()
list(APPEND HICMA_DEP ${STARSH_LIBRARIES})
endif ()
endif ()
endif ()
# HICMA depends on STARSHCORE
# -------------------------------
#pkg_search_module(STARSHCORE REQUIRED starsh_core)
#include_directories(${STARSHCORE_INCLUDE_DIRS})
#link_directories(${STARSHCORE_LIBRARY_DIRS})
#find_package( STARSHCORE REQUIRED )
#if( STARSHCORE_FOUND )
#include_directories(${STARSHCORE_INCLUDE_DIRS_DEP})
#if(STARSHCORE_LINKER_FLAGS)
#list(APPEND CMAKE_EXE_LINKER_FLAGS "${STARSHCORE_LINKER_FLAGS}")
#endif()
#if(STARSHCORE_LIBRARY_DIRS)
## the RPATH to be used when installing
#list(APPEND CMAKE_INSTALL_RPATH "${STARSHCORE_LIBRARY_DIRS}")
#endif()
#if (STARSHCORE_LIBRARIES)
## look for gsl
#find_library( _STARSHCORE_LIB NAME starsh_core PATHS ${STARSHCORE_LIBRARY_DIRS} )
#if( _STARSHCORE_LIB AND NOT "${STARSHCORE_LIBRARIES_DEP}" MATCHES "gsl" )
#execute_process( COMMAND nm ${_STARSHCORE_LIB} COMMAND grep -q gsl RESULT_VARIABLE GSL_IN_STARSHCORE )
#if ( ${GSL_IN_STARSHCORE} EQUAL 0)
#message( STATUS "STARSHCORE depends on gsl. Adding it to dependency list")
#find_package(GSL REQUIRED)
#if (STARSHCORE_LIBRARIES_DEP)
#list( APPEND STARSHCORE_LIBRARIES_DEP ${GSL_LIBRARIES})
#else()
#list( APPEND STARSHCORE_LIBRARIES ${GSL_LIBRARIES})
#endif()
#endif()
#endif()
## insert to dependencies
#if (STARSHCORE_LIBRARIES_DEP)
#list(APPEND HICMA_DEP ${STARSHCORE_LIBRARIES_DEP})
#else()
#list(APPEND HICMA_DEP ${STARSHCORE_LIBRARIES})
#endif()
#endif()
#endif()
# HICMA depends on a runtime
# -------------------------------
if (HICMA_SCHED_STARPU)
#set(HICMA_STARPU_VERSION "1.1" CACHE STRING "oldest STARPU version desired")
set(HICMA_STARPU_VERSION "1.2" CACHE STRING "STARPU version desired")
# create list of components in order to make a single call to find_package(starpu...)
if (NOT HICMA_SIMULATION)
set(STARPU_COMPONENT_LIST "HWLOC")
else ()
set(STARPU_COMPONENT_LIST "SIMGRID")
endif ()
if (HICMA_USE_MPI)
list(APPEND STARPU_COMPONENT_LIST "MPI")
endif ()
if (HICMA_ENABLE_TRACING)
list(APPEND STARPU_COMPONENT_LIST "FXT")
endif ()
find_package(STARPU ${HICMA_STARPU_VERSION} REQUIRED
COMPONENTS ${STARPU_COMPONENT_LIST})
# Add definition and include_dir if found
if (STARPU_FOUND)
message("-- ${Blue}Add definition HICMA_SCHED_STARPU"
" - Activate StarPU in HiCMA${ColourReset}")
set(HICMA_SCHED_STARPU ON)
include_directories(${STARPU_INCLUDE_DIRS_DEP})
if (STARPU_LINKER_FLAGS)
list(APPEND CMAKE_EXE_LINKER_FLAGS "${STARPU_LINKER_FLAGS}")
endif ()
set(CMAKE_REQUIRED_INCLUDES "${STARPU_INCLUDE_DIRS_DEP}")
foreach (libdir ${STARPU_LIBRARY_DIRS_DEP})
list(APPEND CMAKE_REQUIRED_FLAGS "-L${libdir}")
endforeach ()
set(CMAKE_REQUIRED_LIBRARIES "${STARPU_LIBRARIES_DEP}")
if (HICMA_USE_MPI)
list(APPEND CMAKE_REQUIRED_INCLUDES "${MPI_C_INCLUDE_PATH}")
list(APPEND CMAKE_REQUIRED_FLAGS "${MPI_C_LINK_FLAGS}")
list(APPEND CMAKE_REQUIRED_LIBRARIES "${MPI_C_LIBRARIES}")
endif ()
if (HICMA_SIMULATION)
list(APPEND CMAKE_REQUIRED_FLAGS "-include" "starpu_simgrid_wrap.h")
endif ()
string(REPLACE ";" " " CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS}")
check_function_exists(starpu_data_idle_prefetch_on_node STARPU_IDLE_PREFETCH_FOUND)
if (STARPU_IDLE_PREFETCH_FOUND)
set(HAVE_STARPU_IDLE_PREFETCH 1)
message("-- ${Blue}Add definition HAVE_STARPU_IDLE_PREFETCH${ColourReset}")
endif ()
check_function_exists(starpu_iteration_push STARPU_ITERATION_PUSH_FOUND)
if (STARPU_ITERATION_PUSH_FOUND)
set(HAVE_STARPU_ITERATION_PUSH 1)
message("-- ${Blue}Add definition HAVE_STARPU_ITERATION_PUSH${ColourReset}")
endif ()
check_function_exists(starpu_data_wont_use STARPU_DATA_WONT_USE_FOUND)
if (STARPU_DATA_WONT_USE_FOUND)
set(HAVE_STARPU_DATA_WONT_USE 1)
message("-- ${Blue}Add definition HAVE_STARPU_DATA_WONT_USE${ColourReset}")
endif ()
check_function_exists(starpu_data_set_coordinates STARPU_DATA_SET_COORDINATES_FOUND)
if (STARPU_DATA_SET_COORDINATES_FOUND)
set(HAVE_STARPU_DATA_SET_COORDINATES 1)
message("-- ${Blue}Add definition HAVE_STARPU_DATA_SET_COORDINATES${ColourReset}")
endif ()
check_function_exists(starpu_malloc_on_node_set_default_flags STARPU_MALLOC_ON_NODE_SET_DEFAULT_FLAGS)
if (STARPU_MALLOC_ON_NODE_SET_DEFAULT_FLAGS)
set(HAVE_STARPU_MALLOC_ON_NODE_SET_DEFAULT_FLAGS 1)
message("-- ${Blue}Add definition HAVE_STARPU_MALLOC_ON_NODE_SET_DEFAULT_FLAGS${ColourReset}")
endif ()
if (HICMA_ENABLE_TRACING)
# check if fxt profiling is accessible in starpu and activate it in hicma
unset(STARPU_FXT_START_PROFILING_FOUND CACHE)
check_function_exists(starpu_fxt_start_profiling STARPU_FXT_START_PROFILING_FOUND)
if (STARPU_FXT_START_PROFILING_FOUND)
message("-- ${Blue}Add definition HAVE_STARPU_FXT_PROFILING"
" - Activate FxT profiling through StarPU${ColourReset}")
set(HAVE_STARPU_FXT_PROFILING 1)
else ()
message("-- ${Red}Looking for starpu with fxt"
" - starpu_fxt_start_profiling() test fails in StarPU${ColourReset}")
message("-- ${Red}Check in CMakeFiles/CMakeError.log to figure out why it fails${ColourReset}")
endif ()
endif ()
if (HICMA_USE_MPI)
# Check if a specific function exist
unset(STARPU_MPI_DATA_REGISTER_FOUND CACHE)
check_function_exists(starpu_mpi_data_register_comm STARPU_MPI_DATA_REGISTER_FOUND)
if (STARPU_MPI_DATA_REGISTER_FOUND)
message("-- ${Blue}Add definition HAVE_STARPU_MPI_DATA_REGISTER - Activate"
" use of starpu_mpi_data_register() in HiCMA with StarPU${ColourReset}")
set(HAVE_STARPU_MPI_DATA_REGISTER 1)
else ()
message("-- ${Red}Looking for starpu with starpu_mpi_data_register"
" - starpu_mpi_data_register() test fails in StarPU${ColourReset}")
message("-- ${Red}Check in CMakeFiles/CMakeError.log to figure out why it fails${ColourReset}")
endif ()
unset(STARPU_MPI_COMM_RANK_FOUND CACHE)
check_function_exists(starpu_mpi_comm_rank STARPU_MPI_COMM_RANK_FOUND)
if (STARPU_MPI_COMM_RANK_FOUND)
message("-- ${Blue}Add definition HAVE_STARPU_MPI_COMM_RANK - Activate"
" use of starpu_mpi_comm_rank() in HiCMA with StarPU${ColourReset}")
set(HAVE_STARPU_MPI_COMM_RANK 1)
else ()
message("-- ${Red}Looking for starpu with starpu_mpi_comm_rank"
" - starpu_mpi_comm_rank() test fails in StarPU${ColourReset}")
message("-- ${Red}Check in CMakeFiles/CMakeError.log to figure out why it fails${ColourReset}")
endif ()
check_function_exists(starpu_mpi_cached_receive STARPU_MPI_CACHED_RECEIVE)
if (STARPU_MPI_CACHED_RECEIVE)
set(HAVE_STARPU_MPI_CACHED_RECEIVE 1)
message("-- ${Blue}Add definition HAVE_STARPU_MPI_CACHED_RECEIVE${ColourReset}")
endif ()
endif ()
if (HWLOC_FOUND AND HWLOC_LIBRARY_DIRS)
# the RPATH to be used when installing
list(APPEND CMAKE_INSTALL_RPATH "${HWLOC_LIBRARY_DIRS}")
endif ()
if (FXT_FOUND AND FXT_LIBRARY_DIRS)
# the RPATH to be used when installing
list(APPEND CMAKE_INSTALL_RPATH "${FXT_LIBRARY_DIRS}")
endif ()
if (SIMGRID_FOUND AND SIMGRID_LIBRARY_DIRS)
# the RPATH to be used when installing
list(APPEND CMAKE_INSTALL_RPATH "${SIMGRID_LIBRARY_DIRS}")
endif ()
if (STARPU_FOUND AND STARPU_LIBRARY_DIRS)
# the RPATH to be used when installing
list(APPEND CMAKE_INSTALL_RPATH "${STARPU_LIBRARY_DIRS}")
endif ()
if (STARPU_LIBRARIES)
if (STARPU_LIBRARIES_DEP)
list(INSERT HICMA_DEP 0 ${STARPU_LIBRARIES_DEP})
else ()
list(INSERT HICMA_DEP 0 ${STARPU_LIBRARIES})
endif ()
endif ()
else (STARPU_FOUND)
if (ECRC_VERBOSE_FIND_PACKAGE)
if (NOT HWLOC_FOUND OR NOT HWLOC_LIBRARIES)
if (NOT HWLOC_hwloc.h_DIRS)
Print_Find_Header_Status(hwloc hwloc.h)
endif ()
if (NOT HWLOC_hwloc_LIBRARY)
Print_Find_Library_Status(hwloc libhwloc)
endif ()
endif ()
if (HICMA_ENABLE_TRACING AND (NOT FXT_FOUND OR NOT FXT_LIBRARIES))
if (NOT FXT_fxt.h_DIRS)
Print_Find_Header_Status(fxt fxt.h)
endif ()
if (NOT FXT_fxt_LIBRARY)
Print_Find_Library_Status(fxt libfxt)
endif ()
endif ()
if (HICMA_SIMULATION AND (NOT SIMGRID_FOUND OR NOT SIMGRID_LIBRARIES))
if (NOT SIMGRID_simgrid.h_DIRS)
Print_Find_Header_Status(simgrid simgrid.h)
endif ()
if (NOT SIMGRID_simgrid_LIBRARY)
Print_Find_Library_Status(simgrid libsimgrid)
endif ()
endif ()
if ((NOT STARPU_SHM_FOUND) OR (NOT STARPU_SHM_LIBRARIES) OR
(STARPU_LOOK_FOR_MPI AND (NOT STARPU_MPI_FOUND OR NOT STARPU_MPI_LIBRARIES))
)
foreach (starpu_hdr ${STARPU_hdrs_to_find})
if (NOT STARPU_${starpu_hdr}_INCLUDE_DIRS)
Print_Find_Header_Status(starpu ${starpu_hdr})
endif ()
endforeach ()
if (STARPU_VERSION_STRING)
foreach (starpu_lib ${STARPU_libs_to_find})
if (NOT STARPU_${starpu_lib}_LIBRARY)
Print_Find_Library_Status(starpu ${starpu_lib})
endif ()
endforeach ()
endif ()
endif ()
else (ECRC_VERBOSE_FIND_PACKAGE)
message(WARNING "StarPU library has not been found and ECRC_VERBOSE_FIND_PACKAGE is set to OFF."
" Try to activate ECRC_VERBOSE_FIND_PACKAGE option (-DECRC_VERBOSE_FIND_PACKAGE=ON) to get some hints for the detection")
endif (ECRC_VERBOSE_FIND_PACKAGE)
if (NOT HWLOC_FOUND OR NOT HWLOC_LIBRARIES)
message(FATAL_ERROR "hwloc library is required but has not been found")
endif ()
if (HICMA_SIMULATION AND (NOT SIMGRID_FOUND OR NOT SIMGRID_LIBRARIES))
message(FATAL_ERROR "SimGrid library is required but has not been found")
endif ()
if (HICMA_ENABLE_TRACING AND (NOT FXT_FOUND OR NOT FXT_LIBRARIES))
message(FATAL_ERROR "FxT library is required but has not been found")
endif ()
if ((NOT STARPU_SHM_FOUND) OR (NOT STARPU_SHM_LIBRARIES) OR
(STARPU_LOOK_FOR_MPI AND (NOT STARPU_MPI_FOUND OR NOT STARPU_MPI_LIBRARIES))
)
message(FATAL_ERROR "StarPU library is required but has not been found")
endif ()
endif (STARPU_FOUND)
endif (HICMA_SCHED_STARPU)
if (HICMA_SCHED_PARSEC)
# create list of components in order to make a single call to find_package(starpu...)
set(PARSEC_COMPONENT_LIST "HWLOC")
if (HICMA_USE_MPI)
list(APPEND PARSEC_COMPONENT_LIST "MPI")
endif ()
# TODO: Add a HICMA_WITH_PROFILING option that enables Fxt for StarPU, or PAPI for PaRSEC
#if(HICMA_WITH_PROFILING)
# list(APPEND PARSEC_COMPONENT_LIST "PAPI")
#endif()
find_package(PARSEC COMPONENTS ${PARSEC_COMPONENT_LIST})
# Add definition and include_dir if found
if (PARSEC_FOUND)
message("-- ${Blue}Add definition HICMA_SCHED_PARSEC"
" - Activate PaRSEC in HiCMA${ColourReset}")
set(HICMA_SCHED_PARSEC 1)
include_directories(${PARSEC_INCLUDE_DIRS_DEP})
include_directories(${PARSEC_INCLUDE_DIRS}/daguepp)
set(CMAKE_REQUIRED_INCLUDES "${PARSEC_INCLUDE_DIRS_DEP}")
if (PARSEC_LINKER_FLAGS)
list(APPEND CMAKE_EXE_LINKER_FLAGS "${PARSEC_LINKER_FLAGS}")
endif ()
foreach (libdir ${PARSEC_LIBRARY_DIRS_DEP})
list(APPEND CMAKE_REQUIRED_FLAGS "-L${libdir}")
endforeach ()
string(REPLACE ";" " " CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS}")
set(CMAKE_REQUIRED_LIBRARIES "${PARSEC_LIBRARIES_DEP}")
if (HWLOC_FOUND AND HWLOC_LIBRARY_DIRS)
# the RPATH to be used when installing
list(APPEND CMAKE_INSTALL_RPATH "${HWLOC_LIBRARY_DIRS}")
endif ()
if (PARSEC_FOUND AND PARSEC_LIBRARY_DIRS_DEP)
# the RPATH to be used when installing
list(APPEND CMAKE_INSTALL_RPATH "${PARSEC_LIBRARY_DIRS_DEP}")
endif ()
if (PARSEC_LIBRARIES)
if (PARSEC_LIBRARIES_DEP)
list(INSERT HICMA_DEP 0 ${PARSEC_LIBRARIES_DEP})
else ()
list(INSERT HICMA_DEP 0 ${PARSEC_LIBRARIES})
endif ()
endif ()
else (PARSEC_FOUND)
if (ECRC_VERBOSE_FIND_PACKAGE)
if (NOT HWLOC_FOUND OR NOT HWLOC_LIBRARIES)
if (NOT HWLOC_hwloc.h_DIRS)
Print_Find_Header_Status(hwloc hwloc.h)
endif ()
if (NOT HWLOC_hwloc_LIBRARY)
Print_Find_Library_Status(hwloc libhwloc)
endif ()
endif ()
if ((NOT PARSEC_FOUND) OR (NOT PARSEC_LIBRARIES_DEP))
foreach (parsec_hdr ${PARSEC_hdrs_to_find})
if (NOT PARSEC_${parsec_hdr}_INCLUDE_DIRS)
Print_Find_Header_Status(parsec ${parsec_hdr})
endif ()
endforeach ()
if (PARSEC_VERSION_STRING)
foreach (parsec_lib ${PARSEC_libs_to_find})
if (NOT PARSEC_${parsec_lib}_LIBRARY)
Print_Find_Library_Status(parsec ${parsec_lib})
endif ()
endforeach ()
endif ()
endif ()
else (ECRC_VERBOSE_FIND_PACKAGE)
message(WARNING "PaRSEC library has not been found and ECRC_VERBOSE_FIND_PACKAGE is set to OFF."
" Try to activate ECRC_VERBOSE_FIND_PACKAGE option (-DECRC_VERBOSE_FIND_PACKAGE=ON) to get some hints for the detection")
endif (ECRC_VERBOSE_FIND_PACKAGE)
if (NOT HWLOC_FOUND OR NOT HWLOC_LIBRARIES)
message(FATAL_ERROR "hwloc library is required but has not been found")
endif ()
if ((NOT PARSEC_FOUND) OR (NOT PARSEC_LIBRARIES_DEP))
message(FATAL_ERROR "PaRSEC library is required but has not been found")
endif ()
endif (PARSEC_FOUND)
endif (HICMA_SCHED_PARSEC)
# try to find quark runtime
if (HICMA_SCHED_QUARK)
find_package(QUARK COMPONENTS HWLOC)
# Add definition and include_dir if found
if (QUARK_FOUND)
message("-- ${Blue}Add definition HICMA_SCHED_QUARK"
" - Activate QUARK in HiCMA${ColourReset}")
set(HICMA_SCHED_QUARK 1)
include_directories(${QUARK_INCLUDE_DIRS})
if (QUARK_LIBRARY_DIRS)
# the RPATH to be used when installing
list(APPEND CMAKE_INSTALL_RPATH "${QUARK_LIBRARY_DIRS}")
endif ()
if (QUARK_LIBRARIES)
if (QUARK_LIBRARIES_DEP)
list(INSERT HICMA_DEP 0 ${QUARK_LIBRARIES_DEP})
else ()
list(INSERT HICMA_DEP 0 ${QUARK_LIBRARIES})
endif ()
endif ()
else (QUARK_FOUND)
if (ECRC_VERBOSE_FIND_PACKAGE)
if (NOT HWLOC_FOUND OR NOT HWLOC_LIBRARIES)
if (NOT HWLOC_hwloc.h_DIRS)
Print_Find_Header_Status(hwloc hwloc.h)
endif ()
if (NOT HWLOC_hwloc_LIBRARY)
Print_Find_Library_Status(hwloc libhwloc)
endif ()
endif ()
if (NOT QUARK_quark.h_DIRS)
Print_Find_Header_Status(quark quark.h)
endif ()
if (NOT QUARK_quark_LIBRARY)
Print_Find_Library_Status(quark libquark)
endif ()
else ()
message(WARNING "QUARK library has not been found and ECRC_VERBOSE_FIND_PACKAGE is set to OFF."
" Try to activate ECRC_VERBOSE_FIND_PACKAGE option (-DECRC_VERBOSE_FIND_PACKAGE=ON) to get some hints for the detection")
endif ()
if (NOT HWLOC_FOUND OR NOT HWLOC_LIBRARIES)
message(FATAL_ERROR "hwloc library is required but has not been found")
endif ()
message(FATAL_ERROR "QUARK library is required but has not been found")
endif (QUARK_FOUND)
endif ()
#
#set( CHAMELEON_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/chameleon" CACHE PATH "Location of CHAMELEON source code" )
#set( CHAMELEON_BUILD_DIR "${CMAKE_CURRENT_SOURCE_DIR}/chameleon/build" CACHE PATH "Location of CHAMELEON build directory" )
#
##required files in source dir
#include_directories( AFTER ${CHAMELEON_SOURCE_DIR}/ )
#
#
##required files in build dir
##../chameleon/bb/runtime/starpu/include/chameleon_starpu.h
#include_directories( AFTER ${CHAMELEON_BUILD_DIR} )
# HICMA depends on CHAMELEON
# -------------------------------
#find_package( CHAMELEON REQUIRED )
#if( CHAMELEON_FOUND )
# include_directories( BEFORE ${CHAMELEON_INCLUDE_DIRS_DEP} )
# if(CHAMELEON_LINKER_FLAGS)
# list(APPEND CMAKE_EXE_LINKER_FLAGS "${CHAMELEON_LINKER_FLAGS}")
# endif()
# if(CHAMELEON_LIBRARY_DIRS)
# # the RPATH to be used when installing
# list(APPEND CMAKE_INSTALL_RPATH "${CHAMELEON_LIBRARY_DIRS}")
# endif()
# if (CHAMELEON_LIBRARIES)
# if (CHAMELEON_LIBRARIES_DEP)
# list(INSERT HICMA_DEP 0 ${CHAMELEON_LIBRARIES_DEP})
# else()
# list(INSERT HICMA_DEP 0 ${CHAMELEON_LIBRARIES})
# endif()
# endif()
#endif()
# HICMA depends on HCORE
# -------------------------------
find_package(HCORE REQUIRED)
if (HCORE_FOUND)
include_directories(BEFORE ${HCORE_INCLUDE_DIRS_DEP})
if (HCORE_LINKER_FLAGS)
list(APPEND CMAKE_EXE_LINKER_FLAGS "${HCORE_LINKER_FLAGS}")
endif ()
if (HCORE_LIBRARY_DIRS)
# the RPATH to be used when installing
list(APPEND CMAKE_INSTALL_RPATH "${HCORE_LIBRARY_DIRS}")
link_directories(${HCORE_LIBRARY_DIRS})
endif ()
if (HCORE_LIBRARIES)
if (HCORE_LIBRARIES_DEP)
list(INSERT HICMA_DEP 0 ${HCORE_LIBRARIES_DEP})
else ()
list(INSERT HICMA_DEP 0 ${HCORE_LIBRARIES})
endif ()
endif ()
endif ()
list(REMOVE_DUPLICATES CMAKE_EXE_LINKER_FLAGS)
string(REPLACE ";" " " CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS}")
# Fix a problem on Mac OS X when building shared libraries
if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
set(CMAKE_SHARED_LINKER_FLAGS "-undefined dynamic_lookup")
endif ()
# # Add define for Fortran Mangling (should be defined somewhere else)
# # ------------------------------------------------------------------
# message("-- ${Blue}Add definition ADD_"
# " - For Fortran mangling${ColourReset}")
# set(ADD_ 1)
#------------------------------------------------------------------------------