CMakeLists.txt 5.68 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
#
###
#
#  @file CMakeLists.txt
#
13 14
#  @project CHAMELEON
#  CHAMELEON is a software package provided by:
15 16 17 18 19 20
#     Inria Bordeaux - Sud-Ouest,
#     Univ. of Tennessee,
#     King Abdullah Univesity of Science and Technology
#     Univ. of California Berkeley,
#     Univ. of Colorado Denver.
#
21
#  @version 0.9.0
22 23 24 25 26 27 28 29 30
#  @author Cedric Castagnede
#  @author Emmanuel Agullo
#  @author Mathieu Faverge
#  @author Florent Pruvost
#  @date 13-07-2012
#
###


31
# check if magma_dgetrf_incpiv_gpu is accessible in libmagma and activate it in chameleon
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55
if ( CBLAS_FOUND AND LAPACKE_FOUND AND LAPACK_FOUND AND CUDA_FOUND AND CUDA_CUBLAS_LIBRARIES AND MAGMA_FOUND )
    set(CMAKE_REQUIRED_LIBRARIES "${CBLAS_LIBRARIES};${LAPACKE_LIBRARIES};${LAPACK_SEQ_LIBRARIES};${CUDA_LIBRARIES};${CUDA_CUBLAS_LIBRARIES};${MAGMA_LIBRARIES};${COREBLAS_LIBRARIES}")
    unset(MAGMA_DGETRF_INCPIV_GPU_FOUND CACHE)
    check_function_exists(magma_dgetrf_incpiv_gpu MAGMA_DGETRF_INCPIV_GPU_FOUND)
    if ( MAGMA_DGETRF_INCPIV_GPU_FOUND )
        message(STATUS "Set HAVE_MAGMA_GETRF_INCPIV_GPU")
        add_definitions(-DHAVE_MAGMA_GETRF_INCPIV_GPU)
    endif()
endif()

# Generate the magma headers for all possible precisions
# ------------------------------------------------------
set(RUNTIME_HDRS_GENERATED "")
set(ZHDR
  include/codelet_z.h
)

precisions_rules_py(RUNTIME_HDRS_GENERATED "${ZHDR}"
                    PRECISIONS "s;d;c;z;ds;zc"
                    TARGETDIR  "include")

# Define the list of headers
# --------------------------
set(RUNTIME_HDRS
56
    include/codelet_profile.h
57
    include/codelets.h
58 59 60
    include/morse_starpu.h
    include/profiling.h
    include/workspace.h
61 62 63 64 65 66 67
    ${RUNTIME_HDRS_GENERATED}
    )

# Force generation of headers
# ---------------------------
add_custom_target(runtime_starpu_include ALL SOURCES ${RUNTIME_HDRS})

68 69 70 71 72
# installation
# ------------
#install(FILES ${RUNTIME_HDRS}
#        DESTINATION include)

73 74 75 76 77 78 79 80 81
# Generate the morse common for all possible precisions
# -----------------------------------------------------
set(RUNTIME_COMMON_GENERATED "")
set(ZSRC
    control/zprofiling.c
    control/zlocality.c
    )

precisions_rules_py(RUNTIME_COMMON_GENERATED "${ZSRC}"
82
                    PRECISIONS "${CHAMELEON_PRECISION}"
83 84 85 86 87 88 89 90 91 92 93 94 95
                    TARGETDIR "control")

set(RUNTIME_COMMON
    control/control.c
    control/context.c
    control/descriptor.c
    control/async.c
    control/options.c
    control/profiling.c
    control/workspace.c
    codelets/codelet_dataflush.c
    ${RUNTIME_COMMON_GENERATED}
    )
96

97
set(flags_to_add "")
98
foreach(_prec ${CHAMELEON_PRECISION})
99
    set(flags_to_add "${flags_to_add} -DPRECISION_${_prec}")
100
endforeach()
101
set_source_files_properties(control/profiling.c PROPERTIES COMPILE_FLAGS "${flags_to_add}")
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

# Generate the morse sources for all possible precisions
# ------------------------------------------------------
set(RUNTIME_SRCS_GENERATED "")
set(ZSRC
    codelets/codelet_zcallback.c
    codelets/codelet_ztile_zero.c
    codelets/codelet_zasum.c
    ##################
    # BLAS 1
    ##################
    codelets/codelet_zaxpy.c
    ##################
    # BLAS 3
    ##################
    codelets/codelet_zgemm.c
    codelets/codelet_zhemm.c
    codelets/codelet_zher2k.c
    codelets/codelet_zherk.c
    codelets/codelet_zsymm.c
    codelets/codelet_zsyr2k.c
    codelets/codelet_zsyrk.c
    codelets/codelet_ztrmm.c
    codelets/codelet_ztrsm.c
    ##################
    # LAPACK
    ##################
    codelets/codelet_zgeadd.c
    codelets/codelet_zgelqt.c
    codelets/codelet_zgeqrt.c
    codelets/codelet_zgessm.c
    codelets/codelet_zgessq.c
    codelets/codelet_zgetrf.c
    codelets/codelet_zgetrf_incpiv.c
    codelets/codelet_zgetrf_nopiv.c
    codelets/codelet_zhessq.c
    codelets/codelet_zlacpy.c
    codelets/codelet_zlange.c
    codelets/codelet_zlanhe.c
141 142
    codelets/codelet_zlansy.c
    codelets/codelet_zlantr.c
143 144 145 146 147 148 149 150 151 152
    codelets/codelet_zlaset2.c
    codelets/codelet_zlaset.c
    codelets/codelet_zlauum.c
    codelets/codelet_zplghe.c
    codelets/codelet_zplgsy.c
    codelets/codelet_zplrnt.c
    codelets/codelet_zplssq.c
    codelets/codelet_zpotrf.c
    codelets/codelet_zssssm.c
    codelets/codelet_zsyssq.c
153
    codelets/codelet_zsytrf_nopiv.c
154 155 156 157 158 159 160 161 162 163 164 165 166 167 168
    codelets/codelet_ztrasm.c
    codelets/codelet_ztrssq.c
    codelets/codelet_ztrtri.c
    codelets/codelet_ztslqt.c
    codelets/codelet_ztsmlq.c
    codelets/codelet_ztsmqr.c
    codelets/codelet_ztsqrt.c
    codelets/codelet_ztstrf.c
    codelets/codelet_zttlqt.c
    codelets/codelet_zttmlq.c
    codelets/codelet_zttmqr.c
    codelets/codelet_zttqrt.c
    codelets/codelet_zunmlq.c
    codelets/codelet_zunmqr.c
    )
169
list(REMOVE_DUPLICATES ZSRC)
170 171

precisions_rules_py(RUNTIME_SRCS_GENERATED "${ZSRC}"
172
                    PRECISIONS "${CHAMELEON_PRECISION}"
173 174 175 176 177 178 179 180 181 182 183 184 185 186
                    TARGETDIR "codelets")

set(RUNTIME_SRCS
  ${RUNTIME_COMMON}
  ${RUNTIME_SRCS_GENERATED}
  )

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

# Add library
# -----------
187 188
add_library(chameleon_starpu ${RUNTIME_SRCS})
set_property(TARGET chameleon_starpu PROPERTY LINKER_LANGUAGE Fortran)
189

190 191
add_dependencies(chameleon_starpu
  chameleon_include
192 193 194 195 196 197 198
  coreblas_include
  control_include
  runtime_starpu_include
)

# installation
# ------------
199
install(TARGETS chameleon_starpu
200 201 202 203 204
        DESTINATION lib)

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