CMakeLists.txt 4.14 KB
Newer Older
1
2
###
#
3
# @copyright (c) 2009-2015 The University of Tennessee and The University
4
5
#                          of Tennessee Research Foundation.
#                          All rights reserved.
6
7
# @copyright (c) 2012-2017 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
#  @author Cedric Castagnede
#  @author Emmanuel Agullo
#  @author Mathieu Faverge
#  @author Florent Pruvost
#  @date 13-07-2012
#
###
29
cmake_minimum_required(VERSION 2.8)
30

31
32
33
include_directories( ${CMAKE_CURRENT_SOURCE_DIR}/include )
include_directories( ${CMAKE_CURRENT_BINARY_DIR}/include )

34
35
36
37
configure_file("include/chameleon_starpu.h.in"
               "include/chameleon_starpu.h"
               @ONLY)

38
39
# Generate headers for all possible precisions
# --------------------------------------------
40
41
set(RUNTIME_HDRS_GENERATED "")
set(ZHDR
42
  include/runtime_codelet_z.h
43
  )
44
45

precisions_rules_py(RUNTIME_HDRS_GENERATED "${ZHDR}"
46
47
  PRECISIONS "s;d;c;z;ds;zc"
  TARGETDIR  "include")
48
49
50
51

# Define the list of headers
# --------------------------
set(RUNTIME_HDRS
52
  ${CMAKE_CURRENT_BINARY_DIR}/include/chameleon_starpu.h
53
54
55
56
57
58
59
60
61
62
63
  include/runtime_codelet_profile.h
  include/runtime_codelets.h
  include/runtime_profiling.h
  include/runtime_workspace.h
  )

# Add generated headers
# ---------------------
foreach( hdr_file ${RUNTIME_HDRS_GENERATED} )
  list(APPEND RUNTIME_HDRS ${CMAKE_CURRENT_BINARY_DIR}/${hdr_file})
endforeach()
64
65
66

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

71
# Installation
72
# ------------
73
74
75
install(
  FILES ${RUNTIME_HDRS}
  DESTINATION include/runtime/starpu )
76

77
# Generate the Chameleon common for all possible precisions
78
79
80
# -----------------------------------------------------
set(RUNTIME_COMMON_GENERATED "")
set(ZSRC
81
82
83
  control/runtime_zprofiling.c
  control/runtime_zlocality.c
  )
84

85
86
87
88
precisions_rules_py(
  RUNTIME_COMMON_GENERATED "${ZSRC}"
  PRECISIONS "${CHAMELEON_PRECISION}"
  TARGETDIR "control")
89
90

set(RUNTIME_COMMON
91
92
93
94
95
96
97
98
99
100
  control/runtime_async.c
  control/runtime_context.c
  control/runtime_control.c
  control/runtime_descriptor.c
  control/runtime_options.c
  control/runtime_profiling.c
  control/runtime_workspace.c
  codelets/codelet_dataflush.c
  ${RUNTIME_COMMON_GENERATED}
  )
101

102
set(flags_to_add "")
103
foreach(_prec ${CHAMELEON_PRECISION})
104
  set(flags_to_add "${flags_to_add} -DPRECISION_${_prec}")
105
endforeach()
106
set_source_files_properties(control/runtime_profiling.c PROPERTIES COMPILE_FLAGS "${flags_to_add}")
107

108
# Generate the Chameleon sources for all possible precisions
109
110
111
# ------------------------------------------------------
set(RUNTIME_SRCS_GENERATED "")
set(ZSRC
112
113
114
  codelets/codelet_zcallback.c
  ${CODELETS_ZSRC}
  )
115
116

precisions_rules_py(RUNTIME_SRCS_GENERATED "${ZSRC}"
117
118
  PRECISIONS "${CHAMELEON_PRECISION}"
  TARGETDIR "codelets")
119
120
121
122
123
124
125
126

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

# Add library
# -----------
127
add_library(chameleon_starpu ${RUNTIME_SRCS})
Mathieu Faverge's avatar
Mathieu Faverge committed
128
129
#set_property(TARGET chameleon_starpu PROPERTY LINKER_LANGUAGE Fortran)
#set_property(TARGET chameleon_starpu PROPERTY INSTALL_NAME_DIR "${CMAKE_INSTALL_PREFIX}/lib")
130

Mathieu Faverge's avatar
Mathieu Faverge committed
131
132
target_link_libraries(chameleon_starpu
  ${STARPU_LIBRARIES_DEP})
133
if (NOT CHAMELEON_SIMULATION)
Mathieu Faverge's avatar
Mathieu Faverge committed
134
135
136
137
138
139
140
  target_link_libraries(chameleon_starpu
    coreblas)
  if(CHAMELEON_USE_CUDA)
    target_link_libraries(chameleon_starpu
      cudablas)
  endif(CHAMELEON_USE_CUDA)
endif(NOT CHAMELEON_SIMULATION)
141

142
143
add_dependencies(chameleon_starpu
  chameleon_include
144
145
146
  coreblas_include
  control_include
  runtime_starpu_include
147
  )
148
if (NOT CHAMELEON_SIMULATION)
149
  add_dependencies(chameleon_starpu coreblas_include)
Mathieu Faverge's avatar
Mathieu Faverge committed
150
151
152
  if (CHAMELEON_USE_CUDA)
    add_dependencies(chameleon_starpu cudablas_include)
  endif()
153
endif()
154
155
156

# installation
# ------------
157
install(TARGETS chameleon_starpu
Mathieu Faverge's avatar
Mathieu Faverge committed
158
159
  ARCHIVE DESTINATION lib
  LIBRARY DESTINATION lib)
160
161
162
163

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