MAJ terminée. Nous sommes passés en version 14.6.2 . Pour consulter les "releases notes" associées c'est ici :

https://about.gitlab.com/releases/2022/01/11/security-release-gitlab-14-6-2-released/
https://about.gitlab.com/releases/2022/01/04/gitlab-14-6-1-released/

CMakeLists.txt 22.2 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
###
#
# @copyright (c) 2009-2014 The University of Tennessee and The University
#                          of Tennessee Research Foundation.
#                          All rights reserved.
# @copyright (c) 2012-2014 Inria. All rights reserved.
# @copyright (c) 2012-2014 IPB. All rights reserved.
#
###
#
#  @file CMakeLists.txt
#
13
14
#  @project CHAMELEON
#  CHAMELEON is a software package provided by:
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#     Inria Bordeaux - Sud-Ouest,
#     Univ. of Tennessee,
#     King Abdullah Univesity of Science and Technology
#     Univ. of California Berkeley,
#     Univ. of Colorado Denver.
#
#  @version 1.1.0
#  @author Cedric Castagnede
#  @author Emmanuel Agullo
#  @author Mathieu Faverge
#  @author Florent Pruvost
#  @date 13-07-2012
#
###
cmake_minimum_required(VERSION 2.8)
30
project(CHAMELEON Fortran C CXX)
31
32
33
34
35
36
37
38
39

# directly make an error if in-source build
if("${PROJECT_SOURCE_DIR}" STREQUAL "${PROJECT_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()

# set project version number
40
41
42
set(CHAMELEON_VERSION_MAJOR 1)
set(CHAMELEON_VERSION_MINOR 1)
set(CHAMELEON_VERSION_PATCH 0)
43
44
45
46
47
48
49
50
51
52
53

# Add extra cmake module path and initialize morse cmake modules
# --------------------------------------------------------------
set( MORSE_CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake_modules/morse )
list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake_modules)
list(APPEND CMAKE_MODULE_PATH ${MORSE_CMAKE_MODULE_PATH})
include(MorseInit)
include(GenPkgConfig)

#############################################
#                                           #
54
#        Compilation of CHAMELEON          #
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#                                           #
#############################################


###############################################################################
# Parameters/Options #
######################

# Add define for Fortran Mangling (should be defined somewhere else)
# ------------------------------------------------------------------
add_definitions(-DADD_)


# Misc options
# ------------
option(BUILD_SHARED_LIBS "Build shared libraries" OFF)

72
# Define precision supported by CHAMELEON
73
# -----------------------------------------
74
75
set( RP_CHAMELEON_DICTIONNARY ${MORSE_CMAKE_MODULE_PATH}/precision_generator/subs.py )
set( RP_CHAMELEON_PRECISIONS  "s;d;c;z" )
76
77
78
79
80
81
include(RulesPrecisions)

# Options to select the runtime
# -----------------------------

# Create a list of possible runtime
82
set(CHAMELEON_SCHED_list "STARPU" "QUARK")
83
84

# Initially StarPU runtime is enabled
85
option(CHAMELEON_SCHED_STARPU
86
    "Enable StarPU scheduler as the default runtime
87
88
    (Conflict with other CHAMELEON_SCHED_* options)" ON)
option(CHAMELEON_SCHED_QUARK
89
    "Enable Quark scheduler as the default runtime
90
    (Conflict with other CHAMELEON_SCHED_* options)" OFF)
91

92
93
94
95
if (CHAMELEON_SCHED_QUARK)
    set(CHAMELEON_SCHED_STARPU OFF)
elseif (CHAMELEON_SCHED_STARPU)
    set(CHAMELEON_SCHED_QUARK OFF)
96
97
98
99
100
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)
101
102
foreach (runtime ${CHAMELEON_SCHED_list})
    if (CHAMELEON_SCHED_${runtime})
103
104
105
106
107
108
109
110
111
112
        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()

# Warning if not coherent options
113
114
if (CHAMELEON_USE_MPI AND NOT CHAMELEON_SCHED_STARPU)
    message(WARNING "You have activated MPI but CHAMELEON_SCHED_STARPU is OFF.\n"
115
    "You should use StarPU Runtime system if you want to benefit from MPI.\n"
116
    "Use -DCHAMELEON_SCHED_QUARK=OFF -DCHAMELEON_SCHED_STARPU=ON at cmake \n"
117
118
119
    "configure to do so.")
endif()

120
121
if(CHAMELEON_USE_CUDA AND NOT CHAMELEON_SCHED_STARPU)
    message(WARNING "You have activated CUDA but CHAMELEON_SCHED_STARPU is OFF.\n"
122
    "You should use StarPU Runtime system if you want to benefit from GPUs.\n"
123
    "Use -DCHAMELEON_SCHED_QUARK=OFF -DCHAMELEON_SCHED_STARPU=ON at cmake \n"
124
125
126
    "configure to do so.")
endif()

127
128
if(CHAMELEON_USE_MAGMA AND NOT CHAMELEON_SCHED_STARPU)
    message(WARNING "You have activated MAGMA but CHAMELEON_SCHED_STARPU is OFF.\n"
129
    "You should use StarPU Runtime system if you want to benefit from GPUs.\n"
130
    "Use -DCHAMELEON_SCHED_QUARK=OFF -DCHAMELEON_SCHED_STARPU=ON at cmake \n"
131
132
133
    "configure to do so.")
endif()

134
135
if(CHAMELEON_USE_FXT AND NOT CHAMELEON_SCHED_STARPU)
    message(WARNING "You have activated FXT but CHAMELEON_SCHED_STARPU is OFF.\n"
136
    "You should use StarPU Runtime system if you want to benefit from FxT.\n"
137
    "Use -DCHAMELEON_SCHED_QUARK=OFF -DCHAMELEON_SCHED_STARPU=ON at cmake \n"
138
139
140
141
142
143
144
145
    "configure to do so.")
endif()
        
# Additional options
# ------------------

# Enable the distributed interface (allowed only when StarPU is enabled)
# TODO: Default should be changed to ON/OFF when it will be ok
146
cmake_dependent_option(CHAMELEON_USE_MPI
147
                    "Enable distributed memory through MPI" OFF
148
                    "CHAMELEON_SCHED_STARPU" OFF)
149
150
151

# Enable Cuda kernels if StarPU (only if StarPU runtime is enabled)
# TODO: Default should be changed to ON/OFF when it will be ok
152
cmake_dependent_option(CHAMELEON_USE_CUDA
153
                    "Enable CUDA kernels" OFF
154
                    "CHAMELEON_SCHED_STARPU" OFF)
155
156

# Enable MAGMA advanced kernels if CUDA is enabled
157
cmake_dependent_option(CHAMELEON_USE_MAGMA
158
                    "Enable MAGMA Cuda kernels" OFF
159
                    "CHAMELEON_USE_CUDA" OFF)
160
161

# Enable FXT if StarPU (only if StarPU runtime is enabled)
162
cmake_dependent_option(CHAMELEON_USE_FXT
163
                    "Enable FXT with STARPU" OFF
164
                    "CHAMELEON_SCHED_STARPU" OFF)
165
166
167

# Options to enable/disable testings and timings
# ----------------------------------------------
168
169
170
171
option(CHAMELEON_ENABLE_DOCS     "Enable documentation build"  ON)
option(CHAMELEON_ENABLE_EXAMPLE  "Enable examples build"       ON)
option(CHAMELEON_ENABLE_TESTING  "Enable testings build"       ON)
option(CHAMELEON_ENABLE_TIMING   "Enable timings build"        ON)
172
173
174

# Option to activate or not simulation mode (use Simgrid through StarPU)
# ----------------------------------------------------------------------
175
176
if(CHAMELEON_SCHED_STARPU)
    option(CHAMELEON_SIMULATION "Enable simulation mode using Simgrid through StarPU" OFF)
177
178
179
180
endif()

# Initially we need to generate files for different precisions
# TODO: use this option to avoid generate multiple precisions each time we launch cmake
181
#option(CHAMELEON_GEN_PREC "Generate source files precisions" ON)
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
#------------------------------------------------------------------------------


###############################################################################
# Look for dependencies #
#########################

# 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
234
if(NOT CHAMELEON_SIMULATION)
235

236
    # CHAMELEON depends on CBLAS
237
238
239
240
241
242
243
244
245
246
247
    #----------------------------
    find_package(BLASEXT REQUIRED)
    set(HAVE_BLAS ${BLAS_FOUND})

    find_package(CBLAS REQUIRED)
    set(HAVE_CBLAS ${CBLAS_FOUND})
    if(CBLAS_FOUND)
        include_directories(${CBLAS_INCLUDE_DIRS})
    endif()

    #---------------------------------------------
248
    # CHAMELEON depends on LAPACKE (via coreblas)
249
250
251
252
253
254
255
256
257
258
259
260
261
    find_package(LAPACKEXT REQUIRED)
    set(HAVE_LAPACK ${LAPACK_FOUND})

    # 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 REQUIRED)
    set(HAVE_LAPACKE ${LAPACKE_FOUND})
    if(LAPACKE_FOUND)
        include_directories(${LAPACKE_INCLUDE_DIRS})
    endif()

262
    # CHAMELEON depends on TMG
263
    #--------------------------
264
    if (CHAMELEON_ENABLE_TESTING OR CHAMELEON_ENABLE_TIMING)
265
266
267
268
        find_package(TMG REQUIRED)
        set(HAVE_TMG ${TMG_FOUND})
    endif()

269
    # CHAMELEON depends on CUDA/CUBLAS
270
    #----------------------------------
271
    if (CHAMELEON_USE_CUDA)
272
273
274
275
276

        find_package(CUDA REQUIRED)

        set(HAVE_CUDA ${CUDA_FOUND})
        if (CUDA_FOUND)
277
            add_definitions(-DCHAMELEON_USE_CUDA)
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
            if(CUDA_VERSION VERSION_LESS "3.0")
                set(CUDA_HOST_COMPILATION_CPP OFF)
            endif(CUDA_VERSION VERSION_LESS "3.0")
            set(CUDA_BUILD_EMULATION OFF)
            include_directories(${CUDA_INCLUDE_DIRS})
            list(APPEND EXTRA_LIBRARIES ${CUDA_LIBRARIES}) # need CUDA libs to link.
            list(APPEND EXTRA_SOURCES src/gpu_data.c)
            set(saved_include "${CMAKE_REQUIRED_INCLUDES}")
            set(saved_libs "${CMAKE_REQUIRED_LIBRARIES}")
            set(CMAKE_REQUIRED_INCLUDES  "${CMAKE_REQUIRED_INCLUDES};${CUDA_INCLUDE_DIRS}")
            set(CMAKE_REQUIRED_LIBRARIES "${CMAKE_REQUIRED_LIBRARIES};${CUDA_LIBRARIES}")
            if(CUDA_VERSION VERSION_LESS "4.0")
                set(CUDA_HAVE_PEER_DEVICE_MEMORY_ACCESS 0)
            else()
                check_function_exists(cuDeviceCanAccessPeer CUDA_HAVE_PEER_DEVICE_MEMORY_ACCESS)
            endif()
            set(CMAKE_REQUIRED_INCLUDES  "${saved_include}")
            set(CMAKE_REQUIRED_LIBRARIES "${saved_libs}")
        endif (CUDA_FOUND)

298
        # CHAMELEON depends on MAGMA gpu kernels
299
300
301
302
        # call our cmake module to test (in cmake_modules)
        # change this call position if not appropriated
        #----------------------------------------------
        if ( CUDA_FOUND )
303
            if ( CHAMELEON_USE_MAGMA )
304
305
306
307
308
                find_package(MAGMA REQUIRED COMPONENTS CBLAS LAPACK CUDA)

                set(HAVE_MAGMA ${MAGMA_FOUND})
                if ( MAGMA_FOUND )
                    add_definitions(-DHAVE_CUBLAS)
309
                    add_definitions(-DCHAMELEON_USE_MAGMA)
310
311
312
313
314
315
                    list(APPEND EXTRA_LIBRARIES ${CUDA_CUBLAS_LIBRARIES})
                    include_directories(${MAGMA_INCLUDE_DIRS})
                endif( MAGMA_FOUND )
            endif()
        endif()

316
    endif(CHAMELEON_USE_CUDA)
317
    
318
    # CHAMELEON depends on MPI
319
    #--------------------------
320
    if (CHAMELEON_USE_MPI)
321
322
323
324
325
326
327
328
329
330
331

        # 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)

        set(HAVE_MPI ${MPI_C_FOUND})
        if (MPI_C_FOUND)
332
            add_definitions(-DCHAMELEON_USE_MPI)
333
334
335
336
337
338
339
            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")
        endif (MPI_C_FOUND)

340
    endif (CHAMELEON_USE_MPI)
341
    
342
else (NOT CHAMELEON_SIMULATION)
343

344
    message("${BoldBlue}Simulation mode of CHAMELEON is activated (CHAMELEON_SIMULATION=ON)."
345
        "\nThis mode allows you to simulate execution of algorithms with StarPU compiled with SimGrid."
346
        "\nTo do so, we provide some perfmodels in the simucore/perfmodels/ directory of CHAMELEON sources."
347
348
349
350
351
352
353
        "\nThe resulting directory where to find perfmodels is: ${CMAKE_CURRENT_SOURCE_DIR}/simucore/perfmodels."
        "\nTo use these perfmodels, please set your STARPU_HOME environment variable to ${CMAKE_CURRENT_SOURCE_DIR}/simucore/perfmodels."
        "\nFinally, you need to set your STARPU_HOSTNAME environment variable to the name of the machine to simulate."
        "For example: STARPU_HOSTNAME=mirage."
        "\nNote that only POTRF kernels with block sizes of 320 or 960 (simple and double precision) on mirage machine are available for now."
        "\nDatabase of models is subject to change, it should be enrich in a near future.${ColourReset}")

354
355
356
357
    if (CHAMELEON_USE_CUDA)
        set(CHAMELEON_USE_CUDA OFF)
        message("${BoldBlue}CHAMELEON_USE_CUDA is set to ON but we turn it OFF."
        "Because we are compiling the simulation mode (CHAMELEON_SIMULATION=ON),"
358
359
        "we do not need to link with CUDA.${ColourReset}")
    endif ()
360
361
362
363
    if (CHAMELEON_USE_MAGMA)
        set(CHAMELEON_USE_MAGMA OFF)
        message("${BoldBlue}CHAMELEON_USE_MAGMA is set to ON but we turn it OFF."
        "Because we are compiling the simulation mode (CHAMELEON_SIMULATION=ON),"
364
365
        "we do not need to link with MAGMA.${ColourReset}")
    endif ()
366
367
368
369
    if (CHAMELEON_USE_MPI)
        set(CHAMELEON_USE_MPI OFF)
        message("${BoldBlue}CHAMELEON_USE_MPI is set to ON but we turn it OFF."
        "Because we are compiling the simulation mode (CHAMELEON_SIMULATION=ON),"
370
371
        "we do not need to link with MPI.${ColourReset}")
    endif ()
372
373
374
375
    if (CHAMELEON_ENABLE_TESTING)
        set(CHAMELEON_ENABLE_TESTING OFF)
        message("${BoldBlue}CHAMELEON_ENABLE_TESTING is set to ON but we turn it OFF."
        "Because we are compiling the simulation mode (CHAMELEON_SIMULATION=ON),"
376
377
378
379
        "there is no sense in compiling testing drivers that are used to check"
        "numerical correctness of algorithms and kernels.${ColourReset}")
    endif ()

380
endif(NOT CHAMELEON_SIMULATION)
381
382


383
# CHAMELEON depends on a runtime
384
385
386
387
# -------------------------------

# TODO: discuss on this with Manu
# try to find starpu runtime
388
if( CHAMELEON_SCHED_STARPU )
389

390
    set(CHAMELEON_STARPU_VERSION "1.1" CACHE STRING "oldest STARPU version desired")
391
392

    # create list of components in order to make a single call to find_package(starpu...)
393
    if(NOT CHAMELEON_SIMULATION)
394
        set(STARPU_COMPONENT_LIST "HWLOC")
395
        if(CHAMELEON_USE_MPI)
396
397
            list(APPEND STARPU_COMPONENT_LIST "MPI")
        endif()
398
        if(CHAMELEON_USE_CUDA)
399
400
401
            list(APPEND STARPU_COMPONENT_LIST "CUDA")
        endif()
    endif()
402
    if(CHAMELEON_USE_FXT)
403
404
405
        list(APPEND STARPU_COMPONENT_LIST "FXT")
    endif()

406
    find_package(STARPU ${CHAMELEON_STARPU_VERSION} REQUIRED
407
408
409
410
411
412
413
                 COMPONENTS ${STARPU_COMPONENT_LIST})

    # Is this useful??
    set(HAVE_STARPU ${STARPU_FOUND})

    # Add definition and include_dir if found
    if(STARPU_FOUND)
414
        add_definitions(-DCHAMELEON_SCHED_STARPU) # TODO: remove that
415
416
417
418
419
420
        include_directories(${STARPU_INCLUDE_DIRS})
        set(CMAKE_REQUIRED_INCLUDES "${STARPU_INCLUDE_DIRS}")
        foreach(libdir ${STARPU_LIBRARY_DIRS})
            list(APPEND CMAKE_REQUIRED_FLAGS "-L${libdir}")
        endforeach()
        string(REPLACE ";" " " CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS}")
421
422
        if(CHAMELEON_USE_FXT)
            # check if fxt profiling is accessible in starpu and activate it in chameleon
423
424
425
426
427
428
429
430
            set(CMAKE_REQUIRED_LIBRARIES "${STARPU_SHM_LIBRARIES}")
            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(STATUS "Set HAVE_STARPU_FXT_PROFILING - Activate FxT profiling through StarPU")
                add_definitions(-DHAVE_STARPU_FXT_PROFILING)
            endif()
        endif()
431
        if (CHAMELEON_USE_MPI AND STARPU_MPI_LIBRARIES)
432
433
434
435
436
437
438
439
440
441
442
443
444
            # Check if a specific function exist
            set(CMAKE_REQUIRED_LIBRARIES "${STARPU_MPI_LIBRARIES}")
            unset(STARPU_MPI_DATA_REGISTER_FOUND CACHE)
            check_function_exists(starpu_mpi_data_register STARPU_MPI_DATA_REGISTER_FOUND)
            if ( STARPU_MPI_DATA_REGISTER_FOUND )
                add_definitions(-DHAVE_STARPU_MPI_DATA_REGISTER)
            endif()
        endif()
    endif()

endif()

# try to find quark runtime
445
if( CHAMELEON_SCHED_QUARK )
446
447
448
449
450
451

    find_package(QUARK REQUIRED COMPONENTS HWLOC)
    set(HAVE_QUARK ${QUARK_FOUND})

    # Add definition and include_dir if found
    if(QUARK_FOUND)
452
        add_definitions(-DCHAMELEON_SCHED_QUARK) # TODO: remove that
453
454
455
456
457
458
459
        include_directories(${QUARK_INCLUDE_DIRS})
    endif()

endif()

#------------------------------------------------------------------------------
# Save all dependencies (all required links) 
460
461
462
463
464
set(CHAMELEON_DEP -lchameleon)
if(CHAMELEON_SCHED_STARPU)
    if ( CHAMELEON_USE_MPI )
        list(APPEND CHAMELEON_DEP
          -lchameleon_starpu
465
466
467
          ${STARPU_MPI_LIBRARIES}
        )
    else()
468
469
        list(APPEND CHAMELEON_DEP
          -lchameleon_starpu
470
471
472
          ${STARPU_SHM_LIBRARIES}
        )
    endif()
473
474
475
elseif(CHAMELEON_SCHED_QUARK)
    list(APPEND CHAMELEON_DEP
      -lchameleon_quark
476
477
478
479
      ${QUARK_LIBRARIES}
      )
    link_directories(${QUARK_LIBRARY_DIRS})
endif()
480
481
482
if(NOT CHAMELEON_SIMULATION)
    if(CHAMELEON_USE_CUDA)
        list(APPEND CHAMELEON_DEP
483
484
485
486
        ${CUDA_LIBRARIES}
        )
        link_directories(${CUDA_LIBRARY_DIRS})
    endif()
487
488
    if(CHAMELEON_USE_MAGMA)
        list(APPEND CHAMELEON_DEP
489
490
491
492
493
        ${MAGMA_LIBRARIES}
        )
        link_directories(${MAGMA_LIBRARY_DIRS})
    endif()

494
    list(APPEND CHAMELEON_DEP
495
496
497
498
499
500
501
502
503
    -lcoreblas
    ${LAPACKE_LIBRARIES}
    ${CBLAS_LIBRARIES}    
    ${LAPACK_SEQ_LIBRARIES}
    ${BLAS_SEQ_LIBRARIES}
    ${HWLOC_LIBRARIES}
    ${EXTRA_LIBRARIES}
    )
else()
504
    list(APPEND CHAMELEON_DEP
505
506
507
508
509
510
511
    -lcoreblas
    -lsimulapacke    
    -lsimucblas
    ${HWLOC_LIBRARIES}
    ${EXTRA_LIBRARIES}
    )
endif()
512
list(REMOVE_DUPLICATES CHAMELEON_DEP)
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527

# Check for the subdirectories
# ----------------------------

# include headers
# ---------------
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include)
include_directories(${CMAKE_CURRENT_BINARY_DIR}/include)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/coreblas/include)
include_directories(${CMAKE_CURRENT_BINARY_DIR}/coreblas/include)

###############################################################################
# simucore libraries #
######################

528
if ( CHAMELEON_SIMULATION )
529
530
531
532
533
    include_directories(${CMAKE_CURRENT_SOURCE_DIR}/simucore/simucblas)
    include_directories(${CMAKE_CURRENT_BINARY_DIR}/simucore/simucblas)
    include_directories(${CMAKE_CURRENT_SOURCE_DIR}/simucore/simulapacke)
    include_directories(${CMAKE_CURRENT_BINARY_DIR}/simucore/simulapacke)
    add_subdirectory(simucore)
534
    add_definitions(-DCHAMELEON_SIMULATION)
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
endif()
#------------------------------------------------------------------------------


###############################################################################
# Coreblas library (kernels for CPUs) #
#######################################

add_subdirectory(coreblas)
#------------------------------------------------------------------------------


###############################################################################
# Main library #
################

include_directories(${CMAKE_CURRENT_SOURCE_DIR}/control)
include_directories(${CMAKE_CURRENT_BINARY_DIR}/control)
add_subdirectory(include)
add_subdirectory(control)
add_subdirectory(compute)
#------------------------------------------------------------------------------


###############################################################################
# Runtime library #
###################

add_subdirectory(runtime)
#------------------------------------------------------------------------------


###############################################################################
# Executables and Tests #
#########################

enable_testing()
include(CTest)
#enable_testing()

# Necessary to compile executables (temporary)
# should use SystemDetection.cmake module?
string(REGEX MATCH ".*ifort$" _match_ifort ${CMAKE_Fortran_COMPILER})
if(_match_ifort)
    #message(STATUS "Add -nofor_main to the Fortran linker")
    set(CMAKE_Fortran_FLAGS "-nofor_main")
endif(_match_ifort)

# Testing executables
584
if(CHAMELEON_ENABLE_EXAMPLE)
585
  add_subdirectory(example)
586
endif(CHAMELEON_ENABLE_EXAMPLE)
587
588

# Testing executables
589
if(CHAMELEON_ENABLE_TESTING)
590
  add_subdirectory(testing)
591
endif(CHAMELEON_ENABLE_TESTING)
592
593

# Timing executables
594
if(CHAMELEON_ENABLE_TIMING)
595
  add_subdirectory(timing)
596
endif(CHAMELEON_ENABLE_TIMING)
597
598
599
600
601
602
603
#------------------------------------------------------------------------------


###############################################################################
# Documentation #
#################

604
if(CHAMELEON_ENABLE_DOCS)
605
606
607
608
609
610
611
612
613
614
615
    add_subdirectory(docs)
endif()
#------------------------------------------------------------------------------


###############################################################################
# Config files (pkg_config) #
#############################

# Create file morse_starpu.pc
# ---------------------------
616
617
if(CHAMELEON_SCHED_STARPU)
    generate_pkgconfig_file("${CMAKE_CURRENT_SOURCE_DIR}/lib/pkgconfig/chameleon-starpu.pc.in")
618
619
620
621
endif()

# # Create file morse_quark.pc
# # --------------------------
622
623
if(CHAMELEON_SCHED_QUARK)
    generate_pkgconfig_file("${CMAKE_CURRENT_SOURCE_DIR}/lib/pkgconfig/chameleon-quark.pc.in")
624
625
626
627
628
629
630
631
632
633
634
635
endif()
#------------------------------------------------------------------------------


###############################################################################
# Print Options #
#################
include(PrintOpts)

###
### END CMakeLists.txt
###