CMakeLists.txt 4.51 KB
Newer Older
1 2 3 4 5 6
###
#
# @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.
7
# @copyright (c) 2012-2014 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria, Univ. Bordeaux. All rights reserved.
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
#
###
#
# @file CMakeLists.c
#
#  MORSE example routines
#  MORSE is a software package provided by Inria Bordeaux - Sud-Ouest, LaBRI,
#  University of Bordeaux, Bordeaux INP
#
#  @version 1.0.0
#  @author Florent Pruvost
#  @date 2014-10-13
#
###


include_directories(${CMAKE_CURRENT_BINARY_DIR})
include_directories(${CMAKE_CURRENT_SOURCE_DIR})

# compilation for other sources step1 and >
set(LTM_SOURCES 
    step1.c
    step2.c
    step3.c
    step4.c
    step5.c
    step6.c
   )

# Define what libraries we have to link with
# ------------------------------------------
unset(libs_for_ltm)
list(APPEND libs_for_ltm
41
     chameleon
42 43
)

44
if(CHAMELEON_SCHED_STARPU)
45 46 47 48
    list(APPEND libs_for_ltm
      chameleon_starpu
      ${STARPU_LIBRARIES_DEP}
    )
49
    link_directories(${STARPU_LIBRARY_DIRS})
50 51 52 53 54 55
elseif(CHAMELEON_SCHED_PARSEC)
    list(APPEND libs_for_ltm
         chameleon_parsec
         ${PARSEC_LIBRARIES_DEP}
      )
    link_directories(${PARSEC_LIBRARY_DIRS_DEP})
56
elseif(CHAMELEON_SCHED_QUARK)
57
    list(APPEND libs_for_ltm
58
         chameleon_quark
59 60 61 62 63 64 65 66 67 68
         ${QUARK_LIBRARIES}
      )
    link_directories(${QUARK_LIBRARY_DIRS})
endif()


# specific compilation for step0 because we potentially want to use 
# multithreaded BLAS and LAPACK libraries for this step
unset(libs_for_step0)

69
if(NOT CHAMELEON_SIMULATION)
70

71 72 73 74
    if(CHAMELEON_USE_CUDA OR CHAMELEON_USE_MAGMA)
        list(APPEND libs_for_ltm
        cudablas)
    endif()
75
    if(CHAMELEON_USE_CUDA)
76 77 78 79 80
        list(APPEND libs_for_ltm
             ${CUDA_LIBRARIES}
        )
        link_directories(${CUDA_LIBRARY_DIRS})
    endif()
81
    if(CHAMELEON_USE_MAGMA)
82 83 84 85 86
        list(APPEND libs_for_ltm
             ${MAGMA_LIBRARIES}
        )
        link_directories(${MAGMA_LIBRARY_DIRS})
    endif()
PRUVOST Florent's avatar
PRUVOST Florent committed
87

88 89
    list(APPEND libs_for_step0 ${libs_for_ltm})

90 91 92
    list(APPEND libs_for_ltm
         coreblas
         ${LAPACKE_LIBRARIES}
PRUVOST Florent's avatar
PRUVOST Florent committed
93
         ${CBLAS_LIBRARIES}
94 95 96 97 98
         ${LAPACK_SEQ_LIBRARIES}
         ${BLAS_SEQ_LIBRARIES}
         ${HWLOC_LIBRARIES}
         ${EXTRA_LIBRARIES}
    )
PRUVOST Florent's avatar
PRUVOST Florent committed
99

100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116
    if( BLA_VENDOR MATCHES "Intel10_64lp*" OR BLA_VENDOR MATCHES "ACML*")
        if(BLAS_PAR_LIBRARIES)
            set(CBLAS_LIBRARIES "${BLAS_PAR_LIBRARIES}")
        endif()
        if(LAPACK_PAR_LIBRARIES)
            set(LAPACKE_LIBRARIES "${LAPACK_PAR_LIBRARIES}")
        endif()
    endif()
    if (BLAS_PAR_LIBRARIES AND LAPACK_PAR_LIBRARIES)
        list(APPEND libs_for_step0
             coreblas
             ${LAPACKE_LIBRARIES}
             ${CBLAS_LIBRARIES} 
             ${LAPACK_PAR_LIBRARIES}
             ${BLAS_PAR_LIBRARIES}
             ${HWLOC_LIBRARIES}
             ${EXTRA_LIBRARIES}
PRUVOST Florent's avatar
PRUVOST Florent committed
117 118
        )

119 120 121 122
    else()
        list(APPEND libs_for_step0
             coreblas
             ${LAPACKE_LIBRARIES}
PRUVOST Florent's avatar
PRUVOST Florent committed
123
             ${CBLAS_LIBRARIES}
124 125 126 127 128
             ${LAPACK_SEQ_LIBRARIES}
             ${BLAS_SEQ_LIBRARIES}
             ${HWLOC_LIBRARIES}
             ${EXTRA_LIBRARIES}
        )
PRUVOST Florent's avatar
PRUVOST Florent committed
129 130
    endif ()

131 132 133 134 135 136 137 138 139
    link_directories(${LAPACKE_LIBRARY_DIRS})
    link_directories(${LAPACK_LIBRARY_DIRS})
    link_directories(${CBLAS_LIBRARY_DIRS})
    link_directories(${BLAS_LIBRARY_DIRS})

else()

    list(APPEND libs_for_ltm
         coreblas
PRUVOST Florent's avatar
PRUVOST Florent committed
140
         simulapacke
141 142 143 144 145 146
         simucblas
         ${HWLOC_LIBRARIES}
         ${EXTRA_LIBRARIES}
    )
    list(APPEND libs_for_step0
         coreblas
PRUVOST Florent's avatar
PRUVOST Florent committed
147
         simulapacke
148 149 150 151
         simucblas
         ${HWLOC_LIBRARIES}
         ${EXTRA_LIBRARIES}
    )
PRUVOST Florent's avatar
PRUVOST Florent committed
152

153 154 155 156
endif()

link_directories(${HWLOC_LIBRARY_DIRS})

157 158

# message(STATUS "libs examples: ${libs_for_ltm}")
159 160 161 162 163 164
foreach(_ltm ${LTM_SOURCES})
    get_filename_component(_name_exe ${_ltm} NAME_WE)
    add_executable(${_name_exe} ${_ltm})
    set_property(TARGET ${_name_exe} PROPERTY LINKER_LANGUAGE Fortran)
    target_link_libraries(${_name_exe} ${libs_for_ltm})
    install(TARGETS ${_name_exe}
165
            DESTINATION ${CMAKE_INSTALL_PREFIX}/lib/chameleon/example/lapack_to_morse)
166 167 168 169 170 171
endforeach()

add_executable(step0 step0.c)
set_property(TARGET step0 PROPERTY LINKER_LANGUAGE Fortran)
target_link_libraries(step0 ${libs_for_step0})
install(TARGETS step0
172
        DESTINATION ${CMAKE_INSTALL_PREFIX}/lib/chameleon/example/lapack_to_morse)
173

174 175 176
#-------- Tests ---------
include(CTestLists.cmake)

177 178 179
###
### END CMakeLists.txt
###