-
Notifications
You must be signed in to change notification settings - Fork 1
/
CMakeLists.txt
831 lines (724 loc) · 56.7 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
# ---------------------------------------------------------------------------------------------------------------------
# ------------------------------------------------------------------------------------------------------- CMAKE PROJECT
# ---------------------------------------------------------------------------------------------------------------------
cmake_minimum_required(VERSION 3.5)
cmake_policy(SET CMP0054 NEW)
if(${CMAKE_VERSION} VERSION_EQUAL "3.14" OR ${CMAKE_VERSION} VERSION_GREATER "3.14")
cmake_policy(SET CMP0083 NEW)
endif()
project(streampu CXX)
# ---------------------------------------------------------------------------------------------------------------------
# ------------------------------------------------------------------------------------------------------- CMAKE OPTIONS
# ---------------------------------------------------------------------------------------------------------------------
option(SPU_COMPILE_STATIC_LIB "Compile the static library" ON )
option(SPU_COMPILE_SHARED_LIB "Compile the shared library" OFF)
option(SPU_LINK_HWLOC "Link with the hwloc library (used for threads pinning)" OFF)
option(SPU_COLORS "Enable the colors in the terminal" ON )
option(SPU_TESTS "Enable the compilation of the tests" ON )
option(SPU_STACKTRACE "Print the stack trace when an exception is raised" ON )
option(SPU_STACKTRACE_SEGFAULT "Try to print the stack trace when a segfault occurs" OFF)
option(SPU_SHOW_DEPRECATED "Print message each time a deprecated func. is called" OFF)
option(SPU_FAST "Remove checks to speedup the code" OFF)
option(SPU_OVERRIDE_VERSION "Compile without .git directory, provided a version and hash" OFF)
if(NOT EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/.git" AND NOT SPU_OVERRIDE_VERSION)
message(FATAL_ERROR "The '.git' folder can't be found, StreamPU can't be compiled if it is not cloned "
"from a Git repository. Please do not download archives from GitHub and make a Git "
"clone instead (git clone https://github.com/aff3ct/streampu.git).")
endif()
# ---------------------------------------------------------------------------------------------------------------------
# ------------------------------------------------------------------------------------------------- CMAKE CONFIGURATION
# ---------------------------------------------------------------------------------------------------------------------
# set CMAKE_INSTALL_BINDIR, CMAKE_INSTALL_LIBDIR, CMAKE_INSTALL_INCLUDEDIR and CMAKE_INSTALL_DATAROOTDIR variables
include(GNUInstallDirs)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules/")
set(CMAKE_MACOSX_RPATH 1)
# Enable C++11
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
# Specify bin and lib paths
set(EXECUTABLE_OUTPUT_PATH bin/)
set(LIBRARY_OUTPUT_PATH lib/)
# Generate the source files list
file(GLOB_RECURSE source_files ${CMAKE_CURRENT_SOURCE_DIR}/src/*)
# ---------------------------------------------------------------------------------------------------------------------
# ------------------------------------------------------------------------------------------------ GET VERSION FROM GIT
# ---------------------------------------------------------------------------------------------------------------------
if(NOT SPU_OVERRIDE_VERSION)
include(GetGitRevisionDescription)
get_git_head_revision(GIT_REFSPEC GIT_SHA1)
git_describe(GIT_VERSION "--tags" "--abbrev=7")
else()
set(GIT_VERSION ${SPU_OVERRIDE_VERSION})
endif()
string(REGEX REPLACE "^v" "" SPU_VERSION_FULL ${GIT_VERSION})
string(REGEX REPLACE "-.*" "" SPU_VERSION ${SPU_VERSION_FULL})
string(REGEX REPLACE "^.*-" "" SPU_HASH ${SPU_VERSION_FULL})
string( REPLACE "-" "" SPU_BUILD ${SPU_VERSION_FULL})
string( REPLACE "${SPU_VERSION}" "" SPU_BUILD ${SPU_BUILD})
string(REGEX REPLACE "(.*)\\..*\\..*" "\\1" SPU_VERSION_MAJOR ${SPU_VERSION})
string(REGEX REPLACE ".*\\.(.*)\\..*" "\\1" SPU_VERSION_MINOR ${SPU_VERSION})
string(REGEX REPLACE ".*\\..*\\.(.*)" "\\1" SPU_VERSION_PATCH ${SPU_VERSION})
if(NOT "${SPU_BUILD}" STREQUAL "")
string(REPLACE "${SPU_HASH}" "" SPU_BUILD ${SPU_BUILD})
else()
set(SPU_HASH "")
endif()
message(STATUS "StreamPU - Version: ${SPU_VERSION}")
if(NOT "${SPU_BUILD}" STREQUAL "")
message(STATUS "StreamPU - Build: ${SPU_BUILD}")
endif()
if(NOT "${SPU_HASH}" STREQUAL "")
message(STATUS "StreamPU - Hash: ${SPU_HASH}")
endif()
if(("${SPU_BUILD}" STREQUAL "") OR ("${SPU_HASH}" STREQUAL ""))
set(SPU_VERSION_EXTRA "")
else()
set(SPU_VERSION_EXTRA "-${SPU_BUILD}-${SPU_HASH}")
endif()
# ---------------------------------------------------------------------------------------------------------------------
# ------------------------------------------------------------------------------------------------------ GENERATE FILES
# ---------------------------------------------------------------------------------------------------------------------
# Auto generate cmake config version file to link with StreamPU lib (only if an StreamPU library has been compiled)
if (SPU_COMPILE_STATIC_LIB OR SPU_COMPILE_SHARED_LIB)
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules/streampu-config-version.cmake.in"
"lib/cmake/streampu/streampu-config-version.cmake" @ONLY)
endif()
# ---------------------------------------------------------------------------------------------------------------------
# ------------------------------------------------------------------------------------------------------ CREATE FILTERS
# ---------------------------------------------------------------------------------------------------------------------
# Filters creation for IDEs (tested on Visual Studio and based on the "source_group" function)
function(assign_source_group)
foreach(_source IN ITEMS ${ARGN})
if(IS_ABSOLUTE "${_source}")
file(RELATIVE_PATH _source_rel "${CMAKE_CURRENT_SOURCE_DIR}" "${_source}")
else()
set(source_rel "${_source}")
endif()
get_filename_component(_source_path "${_source_rel}" PATH)
string(REPLACE "/" "\\" _source_path_msvc "${_source_path}")
source_group("${_source_path_msvc}" FILES "${_source}")
endforeach()
endfunction(assign_source_group)
assign_source_group(${source_files})
# ---------------------------------------------------------------------------------------------------------------------
# ---------------------------------------------------------------------------------------------------- OBJECTS/LIBS/EXE
# ---------------------------------------------------------------------------------------------------------------------
if(${CMAKE_VERSION} VERSION_EQUAL "3.14" OR ${CMAKE_VERSION} VERSION_GREATER "3.14")
include(CheckPIESupported)
check_pie_supported()
endif()
add_library(spu-obj OBJECT ${source_files})
set_target_properties(spu-obj PROPERTIES POSITION_INDEPENDENT_CODE ON)
list(APPEND spu_targets_list spu-obj)
# Library
if(SPU_COMPILE_SHARED_LIB)
add_library(spu-shared-lib SHARED $<TARGET_OBJECTS:spu-obj>)
set_target_properties(spu-shared-lib PROPERTIES OUTPUT_NAME streampu POSITION_INDEPENDENT_CODE ON)
list(APPEND spu_targets_list spu-shared-lib)
message(STATUS "StreamPU - Compile: shared library")
endif(SPU_COMPILE_SHARED_LIB)
if(SPU_COMPILE_STATIC_LIB)
add_library(spu-static-lib STATIC $<TARGET_OBJECTS:spu-obj>)
set_target_properties(spu-static-lib PROPERTIES OUTPUT_NAME streampu POSITION_INDEPENDENT_CODE ON)
list(APPEND spu_targets_list spu-static-lib)
message(STATUS "StreamPU - Compile: static library")
endif(SPU_COMPILE_STATIC_LIB)
if(SPU_STACKTRACE_SEGFAULT AND CPPTRACE_UNWIND_WITH_LIBUNWIND)
add_executable(spu-signal-tracer ${CMAKE_CURRENT_SOURCE_DIR}/signal_tracer/main.cpp)
set_target_properties(spu-signal-tracer PROPERTIES OUTPUT_NAME streampu-signal-tracer POSITION_INDEPENDENT_CODE ON)
endif()
# Tests
if(SPU_TESTS)
add_executable(spu-test-simple-chain $<TARGET_OBJECTS:spu-obj> ${CMAKE_CURRENT_SOURCE_DIR}/tests/bootstrap/simple_chain.cpp)
set_target_properties(spu-test-simple-chain PROPERTIES OUTPUT_NAME test-simple-chain POSITION_INDEPENDENT_CODE ON)
list(APPEND spu_tests_list spu-test-simple-chain)
list(APPEND spu_targets_list spu-test-simple-chain)
add_executable(spu-test-simple-chain-fwd $<TARGET_OBJECTS:spu-obj> ${CMAKE_CURRENT_SOURCE_DIR}/tests/bootstrap/simple_chain_fwd.cpp)
set_target_properties(spu-test-simple-chain-fwd PROPERTIES OUTPUT_NAME test-simple-chain-fwd POSITION_INDEPENDENT_CODE ON)
list(APPEND spu_tests_list spu-test-simple-chain-fwd)
list(APPEND spu_targets_list spu-test-simple-chain-fwd)
add_executable(spu-test-simple-chain-hybrid $<TARGET_OBJECTS:spu-obj> ${CMAKE_CURRENT_SOURCE_DIR}/tests/bootstrap/simple_chain_hybrid.cpp)
set_target_properties(spu-test-simple-chain-hybrid PROPERTIES OUTPUT_NAME test-simple-chain-hybrid POSITION_INDEPENDENT_CODE ON)
list(APPEND spu_tests_list spu-test-simple-chain-hybrid)
list(APPEND spu_targets_list spu-test-simple-chain-hybrid)
add_executable(spu-test-for-loop $<TARGET_OBJECTS:spu-obj> ${CMAKE_CURRENT_SOURCE_DIR}/tests/bootstrap/for_loop.cpp)
set_target_properties(spu-test-for-loop PROPERTIES OUTPUT_NAME test-for-loop POSITION_INDEPENDENT_CODE ON)
list(APPEND spu_tests_list spu-test-for-loop)
list(APPEND spu_targets_list spu-test-for-loop)
add_executable(spu-test-do-while-loop $<TARGET_OBJECTS:spu-obj> ${CMAKE_CURRENT_SOURCE_DIR}/tests/bootstrap/do_while_loop.cpp)
set_target_properties(spu-test-do-while-loop PROPERTIES OUTPUT_NAME test-do-while-loop POSITION_INDEPENDENT_CODE ON)
list(APPEND spu_tests_list spu-test-do-while-loop)
list(APPEND spu_targets_list spu-test-do-while-loop)
add_executable(spu-test-exclusive-paths $<TARGET_OBJECTS:spu-obj> ${CMAKE_CURRENT_SOURCE_DIR}/tests/bootstrap/exclusive_paths.cpp)
set_target_properties(spu-test-exclusive-paths PROPERTIES OUTPUT_NAME test-exclusive-paths POSITION_INDEPENDENT_CODE ON)
list(APPEND spu_tests_list spu-test-exclusive-paths)
list(APPEND spu_targets_list spu-test-exclusive-paths)
add_executable(spu-test-nested-loops $<TARGET_OBJECTS:spu-obj> ${CMAKE_CURRENT_SOURCE_DIR}/tests/bootstrap/nested_loops.cpp)
set_target_properties(spu-test-nested-loops PROPERTIES OUTPUT_NAME test-nested-loops POSITION_INDEPENDENT_CODE ON)
list(APPEND spu_tests_list spu-test-nested-loops)
list(APPEND spu_targets_list spu-test-nested-loops)
add_executable(spu-test-nested-do-while-loops $<TARGET_OBJECTS:spu-obj> ${CMAKE_CURRENT_SOURCE_DIR}/tests/bootstrap/nested_do_while_loops.cpp)
set_target_properties(spu-test-nested-do-while-loops PROPERTIES OUTPUT_NAME test-nested-do-while-loops POSITION_INDEPENDENT_CODE ON)
list(APPEND spu_tests_list spu-test-nested-do-while-loops)
list(APPEND spu_targets_list spu-test-nested-do-while-loops)
add_executable(spu-test-simple-pipeline $<TARGET_OBJECTS:spu-obj>
${CMAKE_CURRENT_SOURCE_DIR}/tests/bootstrap/simple_pipeline.cpp)
set_target_properties(spu-test-simple-pipeline PROPERTIES OUTPUT_NAME test-simple-pipeline POSITION_INDEPENDENT_CODE ON)
list(APPEND spu_targets_list spu-test-simple-pipeline)
add_executable(spu-test-pipeline-probe $<TARGET_OBJECTS:spu-obj>
${CMAKE_CURRENT_SOURCE_DIR}/tests/advanced/pipeline_probe.cpp)
set_target_properties(spu-test-pipeline-probe PROPERTIES OUTPUT_NAME test-pipeline-probe POSITION_INDEPENDENT_CODE ON)
list(APPEND spu_targets_list spu-test-pipeline-probe)
add_executable(spu-test-complex-pipeline-inter-stage $<TARGET_OBJECTS:spu-obj>
${CMAKE_CURRENT_SOURCE_DIR}/tests/advanced/complex_pipeline_inter_stage.cpp)
set_target_properties(spu-test-complex-pipeline-inter-stage PROPERTIES OUTPUT_NAME test-complex-pipeline-inter-stage POSITION_INDEPENDENT_CODE ON)
list(APPEND spu_targets_list spu-test-complex-pipeline-inter-stage)
add_executable(spu-test-pipeline-double-chain $<TARGET_OBJECTS:spu-obj>
${CMAKE_CURRENT_SOURCE_DIR}/tests/advanced/pipeline_double_chain.cpp)
set_target_properties(spu-test-pipeline-double-chain PROPERTIES OUTPUT_NAME test-pipeline-double-chain POSITION_INDEPENDENT_CODE ON)
list(APPEND spu_targets_list spu-test-pipeline-double-chain)
add_executable(spu-test-complex-pipeline-full-fwd $<TARGET_OBJECTS:spu-obj>
${CMAKE_CURRENT_SOURCE_DIR}/tests/advanced/complex_pipeline_full_fwd.cpp)
set_target_properties(spu-test-complex-pipeline-full-fwd PROPERTIES OUTPUT_NAME test-complex-pipeline-full-fwd POSITION_INDEPENDENT_CODE ON)
list(APPEND spu_targets_list spu-test-complex-pipeline-full-fwd)
add_executable(spu-test-complex-pipeline-mix-fwd $<TARGET_OBJECTS:spu-obj>
${CMAKE_CURRENT_SOURCE_DIR}/tests/advanced/complex_pipeline_mix_fwd.cpp)
set_target_properties(spu-test-complex-pipeline-mix-fwd PROPERTIES OUTPUT_NAME test-complex-pipeline-mix-fwd POSITION_INDEPENDENT_CODE ON)
list(APPEND spu_targets_list spu-test-complex-pipeline-mix-fwd)
add_executable(spu-test-generic-pipeline $<TARGET_OBJECTS:spu-obj>
${CMAKE_CURRENT_SOURCE_DIR}/tests/advanced/generic_pipeline.cpp)
set_target_properties(spu-test-generic-pipeline PROPERTIES OUTPUT_NAME test-generic-pipeline POSITION_INDEPENDENT_CODE ON)
list(APPEND spu_targets_list spu-test-generic-pipeline)
add_executable(spu-test-exclusive-paths-pipeline $<TARGET_OBJECTS:spu-obj>
${CMAKE_CURRENT_SOURCE_DIR}/tests/ctrl_flow/exclusive_paths_pipeline.cpp)
set_target_properties(spu-test-exclusive-paths-pipeline PROPERTIES OUTPUT_NAME test-exclusive-paths-pipeline POSITION_INDEPENDENT_CODE ON)
list(APPEND spu_targets_list spu-test-exclusive-paths-pipeline)
add_executable(spu-test-nest-loops-pipeline $<TARGET_OBJECTS:spu-obj>
${CMAKE_CURRENT_SOURCE_DIR}/tests/ctrl_flow/nested_loops_pipeline.cpp)
set_target_properties(spu-test-nest-loops-pipeline PROPERTIES OUTPUT_NAME test-nested-loops-pipeline POSITION_INDEPENDENT_CODE ON)
list(APPEND spu_targets_list spu-test-nest-loops-pipeline)
if (SPU_LINK_HWLOC)
# pin test addition
add_executable(spu-test-thread-pinning $<TARGET_OBJECTS:spu-obj> ${CMAKE_CURRENT_SOURCE_DIR}/tests/advanced/thread_pinning.cpp)
set_target_properties(spu-test-thread-pinning PROPERTIES OUTPUT_NAME test-thread-pinning POSITION_INDEPENDENT_CODE ON)
list(APPEND spu_targets_list spu-test-thread-pinning)
endif (SPU_LINK_HWLOC)
endif()
# ---------------------------------------------------------------------------------------------------------------------
# -------------------------------------------------------------------------------------------------------- SUB-PROJECTS
# ---------------------------------------------------------------------------------------------------------------------
# cpptrace
if (SPU_STACKTRACE OR SPU_STACKTRACE_SEGFAULT)
if (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/lib/cpptrace/include/cpptrace/cpptrace.hpp")
option(CPPTRACE_GET_SYMBOLS_WITH_LIBDWARF "" OFF)
option(CPPTRACE_GET_SYMBOLS_WITH_ADDR2LINE "" ON)
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/lib/cpptrace/)
else()
message(FATAL_ERROR "'cpptrace' can't be found, try to init the submodule with the following cmd:\n"
"$ git submodule update --init -- ../lib/cpptrace/")
endif()
endif()
# ---------------------------------------------------------------------------------------------------------------------
# ------------------------------------------------------------------------------------------------ COMPILER DEFINITIONS
# ---------------------------------------------------------------------------------------------------------------------
macro(spu_target_compile_definitions targets privacy def)
foreach(_target IN ITEMS ${targets})
target_compile_definitions(${_target} ${privacy} $<BUILD_INTERFACE:${def}> $<INSTALL_INTERFACE:${def}>)
endforeach()
endmacro()
# by system
if(WIN32) # for Windows operating system in general
set(WINDOWS_VISTA 0x0600)
spu_target_compile_definitions("${spu_targets_list}" PUBLIC _WIN32_WINNT=${WINDOWS_VISTA})
spu_target_compile_definitions("${spu_targets_list}" PUBLIC NOMINMAX)
message(STATUS "StreamPU - System: Windows")
elseif(APPLE) # for macOS
message(STATUS "StreamPU - System: macOS")
elseif(UNIX AND NOT APPLE) # for Linux, BSD, Solaris, Minix
message(STATUS "StreamPU - System: Unix/Linux")
endif()
# common
if(SPU_COLORS)
spu_target_compile_definitions("${spu_targets_list}" PUBLIC SPU_COLORS)
message(STATUS "StreamPU - Terminal colors: on")
else()
message(STATUS "StramPU - Terminal colors: off")
endif()
if(SPU_STACKTRACE)
spu_target_compile_definitions("${spu_targets_list}" PUBLIC SPU_STACKTRACE)
message(STATUS "StreamPU - Stacktrace: on")
else()
message(STATUS "StreamPU - Stacktrace: off")
endif()
if (SPU_STACKTRACE_SEGFAULT)
spu_target_compile_definitions("${spu_targets_list}" PUBLIC SPU_STACKTRACE_SEGFAULT)
if(CPPTRACE_UNWIND_WITH_LIBUNWIND)
spu_target_compile_definitions("${spu_targets_list}" PUBLIC SPU_STACKTRACE_SEGFAULT_LIBUNWIND)
if(SPU_COLORS)
target_compile_definitions(streampu-signal-tracer PRIVATE SPU_COLORS)
endif()
message(STATUS "StreamPU - Stacktrace segfault: on [with libunwind -> experimental]")
else()
message(STATUS "StreamPU - Stacktrace segfault: on [unsafe method]")
endif(CPPTRACE_UNWIND_WITH_LIBUNWIND)
else()
message(STATUS "StreamPU - Stacktrace segfault: off")
endif()
if(SPU_SHOW_DEPRECATED)
spu_target_compile_definitions("${spu_targets_list}" PUBLIC SPU_SHOW_DEPRECATED)
message(STATUS "StreamPU - Show deprecated: on")
else()
message(STATUS "StreamPU - Show deprecated: off")
endif()
if(SPU_FAST)
spu_target_compile_definitions("${spu_targets_list}" PUBLIC SPU_FAST)
message(STATUS "StreamPU - Fast: on")
else()
message(STATUS "StreamPU - Fast: off")
endif()
# ---------------------------------------------------------------------------------------------------------------------
# ----------------------------------------------------------------------------------------------- HEADER ONLY LIBRARIES
# ---------------------------------------------------------------------------------------------------------------------
macro(spu_target_include_directories targets privacy dir_build dir_install)
foreach(_target IN ITEMS ${targets})
target_include_directories(${_target}
${privacy}
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/${dir_build}/>
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/${dir_install}>)
endforeach()
endmacro()
macro(spu_target_include_directories2 targets privacy dir)
foreach(_target IN ITEMS ${targets})
target_include_directories(${_target} ${privacy} $<BUILD_INTERFACE:${dir}> $<INSTALL_INTERFACE:${dir}>)
endforeach()
endmacro()
# StreamPU headers
spu_target_include_directories("${spu_targets_list}" PRIVATE "src" "streampu")
spu_target_include_directories("${spu_targets_list}" PUBLIC "include" "streampu")
# rang
if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/lib/rang/include/rang.hpp")
spu_target_include_directories("${spu_targets_list}" PUBLIC "lib/rang/include" "rang")
message(STATUS "StreamPU - Header found: rang")
else()
message(FATAL_ERROR "StreamPU - rang can't be found, try to init the submodule with the following cmd:\n"
"$ git submodule update --init -- ../lib/rang/")
endif()
# ---------------------------------------------------------------------------------------------------------------------
# -------------------------------------------------------------------------------------------------- COMPILED LIBRARIES
# ---------------------------------------------------------------------------------------------------------------------
macro(spu_target_link_libraries targets privacy lib)
foreach(_target IN ITEMS ${targets})
target_link_libraries(${_target} ${privacy} ${lib})
endforeach()
endmacro()
# hwloc
if(SPU_LINK_HWLOC)
spu_target_compile_definitions("${spu_targets_list}" PUBLIC "SPU_HWLOC")
find_package(Hwloc REQUIRED QUIET)
if(Hwloc_FOUND)
message(STATUS "StramPU - Library found: hwloc")
spu_target_include_directories2("${spu_targets_list}" PUBLIC "${Hwloc_INCLUDE_DIRS}")
spu_target_link_libraries("${spu_targets_list}" PUBLIC "${Hwloc_LIBRARIES}")
endif(Hwloc_FOUND)
endif(SPU_LINK_HWLOC)
# cpptrace
if(SPU_STACKTRACE OR SPU_STACKTRACE_SEGFAULT)
spu_target_link_libraries("${spu_targets_list}" PUBLIC "cpptrace::cpptrace")
if(SPU_STACKTRACE_SEGFAULT AND CPPTRACE_UNWIND_WITH_LIBUNWIND)
target_link_libraries(streampu-signal-tracer PRIVATE "cpptrace::cpptrace")
endif()
endif()
# Threads
set(CMAKE_THREAD_PREFER_PTHREAD ON)
set(THREADS_PREFER_PTHREAD_FLAG ON)
find_package(Threads REQUIRED)
spu_target_link_libraries("${spu_targets_list}" PUBLIC Threads::Threads)
# ---------------------------------------------------------------------------------------------------------------------
# -------------------------------------------------------------------------------------------------------------- EXPORT
# ---------------------------------------------------------------------------------------------------------------------
if(SPU_STACKTRACE OR SPU_STACKTRACE_SEGFAULT)
set(CPPTRACE_TARGETS cpptrace-lib)
if (CPPTRACE_GET_SYMBOLS_WITH_LIBDWARF)
set(CPPTRACE_TARGETS ${CPPTRACE_TARGETS} dwarf)
endif()
else()
set(CPPTRACE_TARGETS)
endif()
if (SPU_COMPILE_SHARED_LIB AND NOT SPU_COMPILE_STATIC_LIB)
export(TARGETS spu-shared-lib ${CPPTRACE_TARGETS}
NAMESPACE spu::
FILE "lib/cmake/streampu/streampu-config.cmake")
endif()
if (SPU_COMPILE_STATIC_LIB AND NOT SPU_COMPILE_SHARED_LIB)
export(TARGETS spu-static-lib ${CPPTRACE_TARGETS}
NAMESPACE spu::
FILE "lib/cmake/streampu/streampu-config.cmake")
endif()
if(SPU_COMPILE_SHARED_LIB AND SPU_COMPILE_STATIC_LIB)
export(TARGETS spu-shared-lib spu-static-lib ${CPPTRACE_TARGETS}
NAMESPACE spu::
FILE "lib/cmake/streampu/streampu-config.cmake")
endif()
# ---------------------------------------------------------------------------------------------------------------------
# ------------------------------------------------------------------------------------------------------------- INSTALL
# ---------------------------------------------------------------------------------------------------------------------
if(SPU_COMPILE_SHARED_LIB)
if(WIN32)
install(TARGETS spu-shared-lib
EXPORT streampu-config
RUNTIME DESTINATION ${CMAKE_INSTALL_LIBDIR}/
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}/
COMPONENT library)
else()
install(TARGETS spu-shared-lib
EXPORT streampu-config
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}/
COMPONENT library)
endif()
endif()
if(SPU_COMPILE_STATIC_LIB)
install(TARGETS spu-static-lib
EXPORT streampu-config
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}/
COMPONENT library)
endif()
if (SPU_COMPILE_SHARED_LIB OR SPU_COMPILE_STATIC_LIB)
install(EXPORT
streampu-config
DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/streampu/"
NAMESPACE spu::
COMPONENT library)
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/lib/cmake/streampu/streampu-config-version.cmake"
DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/streampu/"
COMPONENT library)
install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/include/"
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/streampu/
COMPONENT headers
FILES_MATCHING PATTERN "*.h")
install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/include/"
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/streampu/
COMPONENT headers
FILES_MATCHING PATTERN "*.hpp")
install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/include/"
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/streampu/
COMPONENT headers
FILES_MATCHING PATTERN "*.hxx")
install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/lib/rang/include/"
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/rang
COMPONENT headers
FILES_MATCHING PATTERN "*.hpp")
endif()
# ---------------------------------------------------------------------------------------------------------------------
# ---------------------------------------------------------------------------------------------------------------- TEST
# ---------------------------------------------------------------------------------------------------------------------
if(SPU_TESTS)
find_program(MEMORYCHECK_COMMAND valgrind)
set(MEMORYCHECK_COMMAND_OPTIONS "--trace-children=yes --leak-check=full --show-leak-kinds=all")
include(CTest)
enable_testing()
macro(spu_run_1t_tests targets)
foreach(_target IN ITEMS ${targets})
add_test(NAME run-1t::${_target} COMMAND ${_target} -d 2048 -s 5 -e 10 -t 1)
set_tests_properties(run-1t::${_target} PROPERTIES LABELS run-1t)
endforeach()
endmacro()
spu_run_1t_tests("${spu_tests_list}")
macro(spu_run_tests targets)
foreach(_target IN ITEMS ${targets})
add_test(NAME run::${_target} COMMAND ${_target} -d 2048 -s 5 -e 100)
set_tests_properties(run::${_target} PROPERTIES LABELS run)
endforeach()
endmacro()
spu_run_tests("${spu_tests_list}")
macro(spu_inter_frames_tests targets)
foreach(_target IN ITEMS ${targets})
add_test(NAME inter-frames::${_target} COMMAND ${_target} -d 2048 -s 5 -e 10 -f 13)
set_tests_properties(inter-frames::${_target} PROPERTIES LABELS inter-frames)
endforeach()
endmacro()
spu_inter_frames_tests("${spu_tests_list}")
macro(spu_step_by_step_tests targets)
foreach(_target IN ITEMS ${targets})
add_test(NAME step-by-step::${_target} COMMAND ${_target} -d 2048 -s 5 -e 11 -f 13 -b)
set_tests_properties(step-by-step::${_target} PROPERTIES LABELS step-by-step)
endforeach()
endmacro()
spu_step_by_step_tests("${spu_tests_list}")
macro(spu_copy_mode_tests targets)
foreach(_target IN ITEMS ${targets})
add_test(NAME copy-mode::${_target} COMMAND ${_target} -d 2048 -s 5 -e 15 -f 13 -c)
set_tests_properties(copy-mode::${_target} PROPERTIES LABELS copy-mode)
endforeach()
endmacro()
spu_copy_mode_tests("${spu_tests_list}")
macro(spu_graph_dot_tests targets)
foreach(_target IN ITEMS ${targets})
add_test(NAME graph-dot::${_target} COMMAND ${_target} -d 2048 -s 5 -e 15 -f 13 -o graph.dot)
set_tests_properties(graph-dot::${_target} PROPERTIES LABELS graph-dot)
endforeach()
endmacro()
spu_graph_dot_tests("${spu_tests_list}")
set(INPUT_FILE "../mkdocs.yml")
add_test(NAME set0::spu-test-simple-chain COMMAND spu-test-simple-chain -d 2048 -s 5 -e 15 -f 13 -u)
set_tests_properties(set0::spu-test-simple-chain PROPERTIES LABELS set)
add_test(NAME set1::spu-test-simple-chain COMMAND spu-test-simple-chain -d 2048 -s 5 -v)
set_tests_properties(set1::spu-test-simple-chain PROPERTIES LABELS set)
add_test(NAME path0::spu-test-exclusive-paths COMMAND spu-test-exclusive-paths -d 2048 -s 5 -e 10 -f 13 -a 0)
set_tests_properties(path0::spu-test-exclusive-paths PROPERTIES LABELS exclusive-paths)
add_test(NAME path1::spu-test-exclusive-paths COMMAND spu-test-exclusive-paths -d 2048 -s 5 -e 10 -f 13 -a 1)
set_tests_properties(path1::spu-test-exclusive-paths PROPERTIES LABELS exclusive-paths)
add_test(NAME path2::spu-test-exclusive-paths COMMAND spu-test-exclusive-paths -d 2048 -s 5 -e 10 -f 13 -a 2)
set_tests_properties(path2::spu-test-exclusive-paths PROPERTIES LABELS exclusive-paths)
add_test(NAME cyclic::spu-test-exclusive-paths COMMAND spu-test-exclusive-paths -d 2048 -s 5 -e 10 -f 13 -y)
set_tests_properties(cyclic::spu-test-exclusive-paths PROPERTIES LABELS exclusive-paths)
add_test(NAME sequence0::spu-test-simple-pipeline COMMAND spu-test-simple-pipeline -q -t 1 -i ${INPUT_FILE})
set_tests_properties(sequence0::spu-test-simple-pipeline PROPERTIES LABELS simple-pipeline)
add_test(NAME sequence1::spu-test-simple-pipeline COMMAND spu-test-simple-pipeline -q -t 1 -i ${INPUT_FILE} -p -g)
set_tests_properties(sequence1::spu-test-simple-pipeline PROPERTIES LABELS simple-pipeline)
add_test(NAME sequence2::spu-test-simple-pipeline COMMAND spu-test-simple-pipeline -q -t 1 -i ${INPUT_FILE} -b)
set_tests_properties(sequence2::spu-test-simple-pipeline PROPERTIES LABELS simple-pipeline)
add_test(NAME sequence3::spu-test-simple-pipeline COMMAND spu-test-simple-pipeline -q -t 1 -i ${INPUT_FILE} -o graph.dot)
set_tests_properties(sequence3::spu-test-simple-pipeline PROPERTIES LABELS simple-pipeline)
add_test(NAME sequence4::spu-test-simple-pipeline COMMAND spu-test-simple-pipeline -q -t 1 -i ${INPUT_FILE} -f 2)
set_tests_properties(sequence4::spu-test-simple-pipeline PROPERTIES LABELS simple-pipeline)
add_test(NAME sequence5::spu-test-simple-pipeline COMMAND spu-test-simple-pipeline -q -t 1 -i ${INPUT_FILE} -f 13)
set_tests_properties(sequence5::spu-test-simple-pipeline PROPERTIES LABELS simple-pipeline)
add_test(NAME pipeline0::spu-test-simple-pipeline COMMAND spu-test-simple-pipeline -i ${INPUT_FILE})
set_tests_properties(pipeline0::spu-test-simple-pipeline PROPERTIES LABELS simple-pipeline)
add_test(NAME pipeline1::spu-test-simple-pipeline COMMAND spu-test-simple-pipeline -i ${INPUT_FILE} -p)
set_tests_properties(pipeline1::spu-test-simple-pipeline PROPERTIES LABELS simple-pipeline)
add_test(NAME pipeline2::spu-test-simple-pipeline COMMAND spu-test-simple-pipeline -i ${INPUT_FILE} -w)
set_tests_properties(pipeline2::spu-test-simple-pipeline PROPERTIES LABELS "simple-pipeline;skip-memcheck") # to exclude this previous test from memchecks, active waiting is too long in Valgrind :-(
add_test(NAME pipeline3::spu-test-simple-pipeline COMMAND spu-test-simple-pipeline -i ${INPUT_FILE} -u 1)
set_tests_properties(pipeline3::spu-test-simple-pipeline PROPERTIES LABELS simple-pipeline)
add_test(NAME pipeline4::spu-test-simple-pipeline COMMAND spu-test-simple-pipeline -i ${INPUT_FILE} -u 1024)
set_tests_properties(pipeline4::spu-test-simple-pipeline PROPERTIES LABELS simple-pipeline)
add_test(NAME pipeline5::spu-test-simple-pipeline COMMAND spu-test-simple-pipeline -i ${INPUT_FILE} -u 128 -o graph.dot)
set_tests_properties(pipeline5::spu-test-simple-pipeline PROPERTIES LABELS simple-pipeline)
add_test(NAME pipeline6::spu-test-simple-pipeline COMMAND spu-test-simple-pipeline -i ${INPUT_FILE} -u 8 -f 2)
set_tests_properties(pipeline6::spu-test-simple-pipeline PROPERTIES LABELS simple-pipeline)
add_test(NAME pipeline7::spu-test-simple-pipeline COMMAND spu-test-simple-pipeline -i ${INPUT_FILE} -u 17 -f 5)
set_tests_properties(pipeline7::spu-test-simple-pipeline PROPERTIES LABELS simple-pipeline)
# probes
add_test(NAME sequence0::spu-test-pipeline-probe COMMAND spu-test-pipeline-probe -q -t 1 -i ${INPUT_FILE})
set_tests_properties(sequence0::spu-test-pipeline-probe PROPERTIES LABELS pipeline-probe)
add_test(NAME sequence1::spu-test-pipeline-probe COMMAND spu-test-pipeline-probe -q -t 1 -i ${INPUT_FILE} -p -g)
set_tests_properties(sequence1::spu-test-pipeline-probe PROPERTIES LABELS pipeline-probe)
add_test(NAME sequence2::spu-test-pipeline-probe COMMAND spu-test-pipeline-probe -q -t 1 -i ${INPUT_FILE} -b)
set_tests_properties(sequence2::spu-test-pipeline-probe PROPERTIES LABELS pipeline-probe)
add_test(NAME sequence3::spu-test-pipeline-probe COMMAND spu-test-pipeline-probe -q -t 1 -i ${INPUT_FILE} -o graph.dot)
set_tests_properties(sequence3::spu-test-pipeline-probe PROPERTIES LABELS pipeline-probe)
add_test(NAME sequence4::spu-test-pipeline-probe COMMAND spu-test-pipeline-probe -q -t 1 -i ${INPUT_FILE} -f 2)
set_tests_properties(sequence4::spu-test-pipeline-probe PROPERTIES LABELS pipeline-probe)
add_test(NAME sequence5::spu-test-pipeline-probe COMMAND spu-test-pipeline-probe -q -t 1 -i ${INPUT_FILE} -f 13)
set_tests_properties(sequence5::spu-test-pipeline-probe PROPERTIES LABELS pipeline-probe)
add_test(NAME pipeline0::spu-test-pipeline-probe COMMAND spu-test-pipeline-probe -i ${INPUT_FILE})
set_tests_properties(pipeline0::spu-test-pipeline-probe PROPERTIES LABELS pipeline-probe)
add_test(NAME pipeline1::spu-test-pipeline-probe COMMAND spu-test-pipeline-probe -i ${INPUT_FILE} -p)
set_tests_properties(pipeline1::spu-test-pipeline-probe PROPERTIES LABELS pipeline-probe)
add_test(NAME pipeline2::spu-test-pipeline-probe COMMAND spu-test-pipeline-probe -i ${INPUT_FILE} -w)
set_tests_properties(pipeline2::spu-test-pipeline-probe PROPERTIES LABELS "pipeline-probe;skip-memcheck") # to exclude this previous test from memchecks, active waiting is too long in Valgrind :-(
add_test(NAME pipeline3::spu-test-pipeline-probe COMMAND spu-test-pipeline-probe -i ${INPUT_FILE} -u 1)
set_tests_properties(pipeline3::spu-test-pipeline-probe PROPERTIES LABELS pipeline-probe)
add_test(NAME pipeline4::spu-test-pipeline-probe COMMAND spu-test-pipeline-probe -i ${INPUT_FILE} -u 1024)
set_tests_properties(pipeline4::spu-test-pipeline-probe PROPERTIES LABELS pipeline-probe)
add_test(NAME pipeline5::spu-test-pipeline-probe COMMAND spu-test-pipeline-probe -i ${INPUT_FILE} -u 128 -o graph.dot)
set_tests_properties(pipeline5::spu-test-pipeline-probe PROPERTIES LABELS pipeline-probe)
add_test(NAME pipeline6::spu-test-pipeline-probe COMMAND spu-test-pipeline-probe -i ${INPUT_FILE} -u 8 -f 2)
set_tests_properties(pipeline6::spu-test-pipeline-probe PROPERTIES LABELS pipeline-probe)
add_test(NAME pipeline7::spu-test-pipeline-probe COMMAND spu-test-pipeline-probe -i ${INPUT_FILE} -u 17 -f 5)
set_tests_properties(pipeline7::spu-test-pipeline-probe PROPERTIES LABELS pipeline-probe)
# complex pipeline interstage
add_test(NAME pipeline0::spu-test-complex-pipeline-inter-stage COMMAND spu-test-complex-pipeline-inter-stage -i ${INPUT_FILE})
set_tests_properties(pipeline0::spu-test-complex-pipeline-inter-stage PROPERTIES LABELS complex-pipeline-inter-stage)
add_test(NAME pipeline1::spu-test-complex-pipeline-inter-stage COMMAND spu-test-complex-pipeline-inter-stage -q -t 1 -i ${INPUT_FILE} -p -g)
set_tests_properties(pipeline1::spu-test-complex-pipeline-inter-stage PROPERTIES LABELS complex-pipeline-inter-stage)
add_test(NAME pipeline2::spu-test-complex-pipeline-inter-stage COMMAND spu-test-complex-pipeline-inter-stage -i ${INPUT_FILE} -u 1)
set_tests_properties(pipeline2::spu-test-complex-pipeline-inter-stage PROPERTIES LABELS complex-pipeline-inter-stage)
# pipeline double-chain
add_test(NAME sequence0::spu-test-pipeline-double-chain COMMAND spu-test-pipeline-double-chain -e 30 -q -t 1)
set_tests_properties(sequence0::spu-test-pipeline-double-chain PROPERTIES LABELS pipeline-double-chain)
add_test(NAME sequence1::spu-test-pipeline-double-chain COMMAND spu-test-pipeline-double-chain -e 19 -q -t 3)
set_tests_properties(sequence1::spu-test-pipeline-double-chain PROPERTIES LABELS pipeline-double-chain)
add_test(NAME sequence2::spu-test-pipeline-double-chain COMMAND spu-test-pipeline-double-chain -e 19 -q -t 3 -f 7)
set_tests_properties(sequence2::spu-test-pipeline-double-chain PROPERTIES LABELS pipeline-double-chain)
add_test(NAME sequence3::spu-test-pipeline-double-chain COMMAND spu-test-pipeline-double-chain -e 19 -q -t 3 -f 7 -b)
set_tests_properties(sequence3::spu-test-pipeline-double-chain PROPERTIES LABELS pipeline-double-chain)
add_test(NAME pipeline0::spu-test-pipeline-double-chain COMMAND spu-test-pipeline-double-chain -e 30)
set_tests_properties(pipeline0::spu-test-pipeline-double-chain PROPERTIES LABELS pipeline-double-chain)
add_test(NAME pipeline1::spu-test-pipeline-double-chain COMMAND spu-test-pipeline-double-chain -e 115 -u 1024)
set_tests_properties(pipeline1::spu-test-pipeline-double-chain PROPERTIES LABELS pipeline-double-chain)
add_test(NAME pipeline2::spu-test-pipeline-double-chain COMMAND spu-test-pipeline-double-chain -e 10 -u 15 -f 3)
set_tests_properties(pipeline2::spu-test-pipeline-double-chain PROPERTIES LABELS pipeline-double-chain)
# complex pipeline fwd
add_test(NAME sequence0::spu-test-complex-pipeline-full-fwd COMMAND spu-test-complex-pipeline-full-fwd -e 100 -q -t 1)
set_tests_properties(sequence0::spu-test-complex-pipeline-full-fwd PROPERTIES LABELS complex-pipeline-full-fwd)
add_test(NAME sequence1::spu-test-complex-pipeline-full-fwd COMMAND spu-test-complex-pipeline-full-fwd -e 100 -q)
set_tests_properties(sequence1::spu-test-complex-pipeline-full-fwd PROPERTIES LABELS complex-pipeline-full-fwd)
add_test(NAME sequence2::spu-test-complex-pipeline-full-fwd COMMAND spu-test-complex-pipeline-full-fwd -e 100 -q -b -o graph.dot)
set_tests_properties(sequence2::spu-test-complex-pipeline-full-fwd PROPERTIES LABELS complex-pipeline-full-fwd)
add_test(NAME sequence3::spu-test-complex-pipeline-full-fwd COMMAND spu-test-complex-pipeline-full-fwd -e 100 -q -b -f 5 -t 3)
set_tests_properties(sequence3::spu-test-complex-pipeline-full-fwd PROPERTIES LABELS complex-pipeline-full-fwd)
add_test(NAME pipeline0::spu-test-complex-pipeline-full-fwd COMMAND spu-test-complex-pipeline-full-fwd -e 10 -t 1)
set_tests_properties(pipeline0::spu-test-complex-pipeline-full-fwd PROPERTIES LABELS complex-pipeline-full-fwd)
add_test(NAME pipeline1::spu-test-complex-pipeline-full-fwd COMMAND spu-test-complex-pipeline-full-fwd -e 10)
set_tests_properties(pipeline1::spu-test-complex-pipeline-full-fwd PROPERTIES LABELS complex-pipeline-full-fwd)
add_test(NAME pipeline2::spu-test-complex-pipeline-full-fwd COMMAND spu-test-complex-pipeline-full-fwd -e 1000 -u 128 -o graph.dot)
set_tests_properties(pipeline2::spu-test-complex-pipeline-full-fwd PROPERTIES LABELS complex-pipeline-full-fwd)
add_test(NAME pipeline3::spu-test-complex-pipeline-full-fwd COMMAND spu-test-complex-pipeline-full-fwd -e 1000 -u 49 -f 13)
set_tests_properties(pipeline3::spu-test-complex-pipeline-full-fwd PROPERTIES LABELS complex-pipeline-full-fwd)
add_test(NAME pipeline4::spu-test-complex-pipeline-full-fwd COMMAND spu-test-complex-pipeline-full-fwd -e 1000 -u 413 -w)
set_tests_properties(pipeline4::spu-test-complex-pipeline-full-fwd PROPERTIES LABELS "complex-pipeline-full-fwd;skip-memcheck") # to exclude this previous test from memchecks, active waiting is too long in Valgrind :-(
# complex mix pipeline (fwd + in-out)
add_test(NAME sequence0::spu-test-complex-pipeline-mix-fwd COMMAND spu-test-complex-pipeline-mix-fwd -e 100 -q -t 1)
set_tests_properties(sequence0::spu-test-complex-pipeline-mix-fwd PROPERTIES LABELS complex-pipeline-mix-fwd)
add_test(NAME sequence1::spu-test-complex-pipeline-mix-fwd COMMAND spu-test-complex-pipeline-mix-fwd -e 100 -q)
set_tests_properties(sequence1::spu-test-complex-pipeline-mix-fwd PROPERTIES LABELS complex-pipeline-mix-fwd)
add_test(NAME sequence2::spu-test-complex-pipeline-mix-fwd COMMAND spu-test-complex-pipeline-mix-fwd -e 100 -q -b -o graph.dot)
set_tests_properties(sequence2::spu-test-complex-pipeline-mix-fwd PROPERTIES LABELS complex-pipeline-mix-fwd)
add_test(NAME sequence3::spu-test-complex-pipeline-mix-fwd COMMAND spu-test-complex-pipeline-mix-fwd -e 100 -q -f 5 -t 3)
set_tests_properties(sequence3::spu-test-complex-pipeline-mix-fwd PROPERTIES LABELS complex-pipeline-mix-fwd)
add_test(NAME pipeline0::spu-test-complex-pipeline-mix-fwd COMMAND spu-test-complex-pipeline-mix-fwd -e 10 -t 1)
set_tests_properties(pipeline0::spu-test-complex-pipeline-mix-fwd PROPERTIES LABELS complex-pipeline-mix-fwd)
add_test(NAME pipeline1::spu-test-complex-pipeline-mix-fwd COMMAND spu-test-complex-pipeline-mix-fwd -e 10)
set_tests_properties(pipeline1::spu-test-complex-pipeline-mix-fwd PROPERTIES LABELS complex-pipeline-mix-fwd)
add_test(NAME pipeline2::spu-test-complex-pipeline-mix-fwd COMMAND spu-test-complex-pipeline-mix-fwd -e 1000 -u 128 -o graph.dot)
set_tests_properties(pipeline2::spu-test-complex-pipeline-mix-fwd PROPERTIES LABELS complex-pipeline-mix-fwd)
add_test(NAME pipeline3::spu-test-complex-pipeline-mix-fwd COMMAND spu-test-complex-pipeline-mix-fwd -e 1000 -u 49 -f 13)
set_tests_properties(pipeline3::spu-test-complex-pipeline-mix-fwd PROPERTIES LABELS complex-pipeline-mix-fwd)
add_test(NAME pipeline4::spu-test-complex-pipeline-mix-fwd COMMAND spu-test-complex-pipeline-mix-fwd -e 1000 -u 413 -w)
set_tests_properties(pipeline4::spu-test-complex-pipeline-mix-fwd PROPERTIES LABELS "complex-pipeline-mix-fwd;skip-memcheck") # to exclude this previous test from memchecks, active waiting is too long in Valgrind :-(
add_test(NAME pipeline5::spu-test-complex-pipeline-mix-fwd COMMAND spu-test-complex-pipeline-mix-fwd -t 12 -o dot2.dot -S "OTAC" -v)
set_tests_properties(pipeline5::spu-test-complex-pipeline-mix-fwd PROPERTIES LABELS complex-pipeline-mix-fwd)
# simple sequence example
add_test(NAME sequence0::spu-test-generic-pipeline COMMAND spu-test-generic-pipeline -i ${INPUT_FILE} -n "1,3,1" -t "1" -R "(read,relay,write)" -q)
set_tests_properties(sequence0::spu-test-generic-pipeline PROPERTIES LABELS generic-pipeline)
add_test(NAME sequence1::spu-test-generic-pipeline COMMAND spu-test-generic-pipeline -i ${INPUT_FILE} -n "1,3,1" -t "1" -R "(read,relayf,write)" -q -b)
set_tests_properties(sequence1::spu-test-generic-pipeline PROPERTIES LABELS generic-pipeline)
add_test(NAME sequence2::spu-test-generic-pipeline COMMAND spu-test-generic-pipeline -i ${INPUT_FILE} -t "1" -r "((read),(relayf,relay,relayf,relay),(write))" -q)
set_tests_properties(sequence2::spu-test-generic-pipeline PROPERTIES LABELS generic-pipeline)
add_test(NAME sequence3::spu-test-generic-pipeline COMMAND spu-test-generic-pipeline -i ${INPUT_FILE} -t "1,3,1,3,1" -r "((read),(relayf,relay,relayf,relay),(relayf),(relay,relay),(write))" -q -b)
set_tests_properties(sequence3::spu-test-generic-pipeline PROPERTIES LABELS generic-pipeline)
# simple pipeline example
add_test(NAME pipeline0::spu-test-generic-pipeline COMMAND spu-test-generic-pipeline -i ${INPUT_FILE} -n "1,3,1" -t "1,3,1" -R "(read,relay,write)")
set_tests_properties(pipeline0::spu-test-generic-pipeline PROPERTIES LABELS generic-pipeline)
# simple pipeline FWD example
add_test(NAME pipeline1::spu-test-generic-pipeline COMMAND spu-test-generic-pipeline -i ${INPUT_FILE} -n "1,3,1" -t "1,3,1" -R "(read,relayf,write)")
set_tests_properties(pipeline1::spu-test-generic-pipeline PROPERTIES LABELS generic-pipeline)
add_test(NAME pipeline2::spu-test-generic-pipeline COMMAND spu-test-generic-pipeline -i ${INPUT_FILE} -n "1,3,1" -t "1,3,1" -R "(read,relayf,write)" -p)
set_tests_properties(pipeline2::spu-test-generic-pipeline PROPERTIES LABELS generic-pipeline)
add_test(NAME pipeline3::spu-test-generic-pipeline COMMAND spu-test-generic-pipeline -i ${INPUT_FILE} -n "1,3,1" -t "1,3,1" -R "(read,relayf,write)" -w)
set_tests_properties(pipeline3::spu-test-generic-pipeline PROPERTIES LABELS "generic-pipeline;skip-memcheck") # to exclude this previous test from memchecks, active waiting is too long in Valgrind :-(
add_test(NAME pipeline4::spu-test-generic-pipeline COMMAND spu-test-generic-pipeline -i ${INPUT_FILE} -n "1,3,1" -t "1,3,1" -R "(read,relayf,write)" -u 1)
set_tests_properties(pipeline4::spu-test-generic-pipeline PROPERTIES LABELS generic-pipeline)
add_test(NAME pipeline5::spu-test-generic-pipeline COMMAND spu-test-generic-pipeline -i ${INPUT_FILE} -n "1,3,1" -t "1,3,1" -R "(read,relayf,write)" -u 1024)
set_tests_properties(pipeline5::spu-test-generic-pipeline PROPERTIES LABELS generic-pipeline)
# simple pipeline hybrid
add_test(NAME pipeline6::spu-test-generic-pipeline COMMAND spu-test-generic-pipeline -i ${INPUT_FILE} -t "1,3,1" -r "((read),(relayf,relay,relayf,relay),(write))")
set_tests_properties(pipeline6::spu-test-generic-pipeline PROPERTIES LABELS generic-pipeline)
add_test(NAME pipeline7::spu-test-generic-pipeline COMMAND spu-test-generic-pipeline -i ${INPUT_FILE} -t "1,3,1" -r "((read),(relayf,relay,relayf,relay),(write))" -u 1024)
set_tests_properties(pipeline7::spu-test-generic-pipeline PROPERTIES LABELS generic-pipeline)
# pipeline multiple stages
add_test(NAME pipeline8::spu-test-generic-pipeline COMMAND spu-test-generic-pipeline -i ${INPUT_FILE} -t "1,3,1,3,1" -r "((read),(relayf,relay,relayf,relay),(relayf),(relay,relay),(write))")
set_tests_properties(pipeline8::spu-test-generic-pipeline PROPERTIES LABELS generic-pipeline)
add_test(NAME pipeline9::spu-test-generic-pipeline COMMAND spu-test-generic-pipeline -i ${INPUT_FILE} -t "1,3,1,3,1" -r "((read),(relayf,relay,relayf,relay),(relayf),(relay,relay),(write))" -p)
set_tests_properties(pipeline9::spu-test-generic-pipeline PROPERTIES LABELS generic-pipeline)
add_test(NAME pipeline10::spu-test-generic-pipeline COMMAND spu-test-generic-pipeline -i ${INPUT_FILE} -t "1,3,1,3,1" -r "((read),(relayf,relay,relayf,relay),(relayf),(relay,relay),(write))" -w)
set_tests_properties(pipeline10::spu-test-generic-pipeline PROPERTIES LABELS "generic-pipeline;skip-memcheck") # to exclude this previous test from memchecks, active waiting is too long in Valgrind :-(
add_test(NAME pipeline11::spu-test-generic-pipeline COMMAND spu-test-generic-pipeline -i ${INPUT_FILE} -t "1,3,1,3,1" -r "((read),(relayf,relay,relayf,relay),(relayf),(relay,relay),(write))" -u 1)
set_tests_properties(pipeline11::spu-test-generic-pipeline PROPERTIES LABELS generic-pipeline)
add_test(NAME pipeline12::spu-test-generic-pipeline COMMAND spu-test-generic-pipeline -i ${INPUT_FILE} -t "1,3,1,3,1" -r "((read),(relayf,relay,relayf,relay),(relayf),(relay,relay),(write))" -u 1024)
set_tests_properties(pipeline12::spu-test-generic-pipeline PROPERTIES LABELS generic-pipeline)
# pipeline with socket type per stage
add_test(NAME pipeline13::spu-test-generic-pipeline COMMAND spu-test-generic-pipeline -i ${INPUT_FILE} -n "1,4,3,2,1" -t "1,3,1,3,1" -R "(read,relayf,relay,relayf,write)")
set_tests_properties(pipeline13::spu-test-generic-pipeline PROPERTIES LABELS generic-pipeline)
############################# same tests with increment instead of relayers #######################################
# simple sequence example
add_test(NAME sequence4::spu-test-generic-pipeline COMMAND spu-test-generic-pipeline -e 100 -n "1,3,1" -t "3" -R "(init,incr,fin)" -q)
set_tests_properties(sequence4::spu-test-generic-pipeline PROPERTIES LABELS generic-pipeline)
add_test(NAME sequence5::spu-test-generic-pipeline COMMAND spu-test-generic-pipeline -e 100 -n "1,3,1" -t "3" -R "(init,incrf,fin)" -q -b)
set_tests_properties(sequence5::spu-test-generic-pipeline PROPERTIES LABELS generic-pipeline)
add_test(NAME sequence6::spu-test-generic-pipeline COMMAND spu-test-generic-pipeline -e 100 -t "3" -r "((init),(incrf,incr,incrf,incr),(fin))" -q)
set_tests_properties(sequence6::spu-test-generic-pipeline PROPERTIES LABELS generic-pipeline)
add_test(NAME sequence7::spu-test-generic-pipeline COMMAND spu-test-generic-pipeline -e 123 -t "1,3,1,3,1" -r "((init),(relayf,incr,relayf,relay),(relayf),(incr,relay),(fin))" -q -b)
set_tests_properties(sequence7::spu-test-generic-pipeline PROPERTIES LABELS generic-pipeline)
# simple pipeline example
add_test(NAME pipeline14::spu-test-generic-pipeline COMMAND spu-test-generic-pipeline -e 1000 -n "1,3,1" -t "1,3,1" -R "(init,relay,fin)")
set_tests_properties(pipeline14::spu-test-generic-pipeline PROPERTIES LABELS generic-pipeline)
# simple pipeline FWD example
add_test(NAME pipeline15::spu-test-generic-pipeline COMMAND spu-test-generic-pipeline -e 10 -n "1,3,1" -t "1,3,1" -R "(init,incrf,fin)")
set_tests_properties(pipeline15::spu-test-generic-pipeline PROPERTIES LABELS generic-pipeline)
add_test(NAME pipeline16::spu-test-generic-pipeline COMMAND spu-test-generic-pipeline -e 13 -n "1,3,1" -t "1,3,1" -R "(init,incrf,fin)" -p)
set_tests_properties(pipeline16::spu-test-generic-pipeline PROPERTIES LABELS generic-pipeline)
add_test(NAME pipeline17::spu-test-generic-pipeline COMMAND spu-test-generic-pipeline -e 9 -n "1,3,1" -t "1,3,1" -R "(init,incrf,fin)" -w)
set_tests_properties(pipeline17::spu-test-generic-pipeline PROPERTIES LABELS "generic-pipeline;skip-memcheck") # to exclude this previous test from memchecks, active waiting is too long in Valgrind :-(
add_test(NAME pipeline18::spu-test-generic-pipeline COMMAND spu-test-generic-pipeline -e 13 -n "1,3,1" -t "1,3,1" -R "(init,relayf,fin)" -u 1)
set_tests_properties(pipeline18::spu-test-generic-pipeline PROPERTIES LABELS generic-pipeline)
add_test(NAME pipeline19::spu-test-generic-pipeline COMMAND spu-test-generic-pipeline -e 128 -n "1,3,1" -t "1,3,1" -R "(init,incrf,fin)" -u 1024)
set_tests_properties(pipeline19::spu-test-generic-pipeline PROPERTIES LABELS generic-pipeline)
# simple pipeline hybrid
add_test(NAME pipeline20::spu-test-generic-pipeline COMMAND spu-test-generic-pipeline -e 128 -t "1,3,1" -r "((init),(relayf,relay,relayf,incr),(fin))")
set_tests_properties(pipeline20::spu-test-generic-pipeline PROPERTIES LABELS generic-pipeline)
add_test(NAME pipeline21::spu-test-generic-pipeline COMMAND spu-test-generic-pipeline -e 128 -t "1,3,1" -r "((init),(incrf,relay,relayf,incr),(fin))" -u 1024)
set_tests_properties(pipeline21::spu-test-generic-pipeline PROPERTIES LABELS generic-pipeline)
# pipeline multiple stages
add_test(NAME pipeline22::spu-test-generic-pipeline COMMAND spu-test-generic-pipeline -e 12 -t "1,3,1,3,1" -r "((init),(relayf,relay,relayf,relay),(relayf),(incr,incr),(fin))")
set_tests_properties(pipeline22::spu-test-generic-pipeline PROPERTIES LABELS generic-pipeline)
add_test(NAME pipeline23::spu-test-generic-pipeline COMMAND spu-test-generic-pipeline -e 12 -t "1,3,1,3,1" -r "((init),(incrf,incr,incrf,incr),(incrf),(incr,incr),(fin))" -p)
set_tests_properties(pipeline23::spu-test-generic-pipeline PROPERTIES LABELS generic-pipeline)
add_test(NAME pipeline24::spu-test-generic-pipeline COMMAND spu-test-generic-pipeline -e 12 -t "1,3,1,3,1" -r "((init),(relayf,relay,relayf,relay),(incrf),(relay,relay),(fin))" -w)
set_tests_properties(pipeline24::spu-test-generic-pipeline PROPERTIES LABELS "generic-pipeline;skip-memcheck") # to exclude this previous test from memchecks, active waiting is too long in Valgrind :-(
add_test(NAME pipeline25::spu-test-generic-pipeline COMMAND spu-test-generic-pipeline -e 12 -t "1,3,1,3,1" -r "((init),(relayf,incr,incrf,incr),(relayf),(incr,relay),(fin))" -u 1)
set_tests_properties(pipeline25::spu-test-generic-pipeline PROPERTIES LABELS generic-pipeline)
add_test(NAME pipeline26::spu-test-generic-pipeline COMMAND spu-test-generic-pipeline -e 12 -t "1,3,1,3,1" -r "((init),(incrf,relay,incrf,relay),(incrf),(relay,incr),(fin))" -u 1024)
set_tests_properties(pipeline26::spu-test-generic-pipeline PROPERTIES LABELS generic-pipeline)
# pipeline with socket type per stage
add_test(NAME pipeline27::spu-test-generic-pipeline COMMAND spu-test-generic-pipeline -e 12 -n "1,4,3,2,1" -t "1,3,1,3,1" -R "(init,incrf,incr,relayf,fin)")
set_tests_properties(pipeline27::spu-test-generic-pipeline PROPERTIES LABELS generic-pipeline)
# scheduler tests
add_test(NAME pipeline28::spu-test-generic-pipeline COMMAND spu-test-generic-pipeline -e 12 -t "1" -S "OTAC" -C "(init,relayf_15,incrementf_S_20,relay_15,fin)" -P "none")
set_tests_properties(pipeline28::spu-test-generic-pipeline PROPERTIES LABELS generic-pipeline)
add_test(NAME pipeline29::spu-test-generic-pipeline COMMAND spu-test-generic-pipeline -e 13 -t "4" -S "OTAC" -C "(init,relayf_15,incrementf_20,relay_15,fin)" -P "none")
set_tests_properties(pipeline29::spu-test-generic-pipeline PROPERTIES LABELS generic-pipeline)
add_test(NAME pipeline30::spu-test-generic-pipeline COMMAND spu-test-generic-pipeline -e 50 -t "3" -S "OTAC" -C "(init_S,relayf_S_15,incrementf_S_20,relay_S_15,fin_S)" -P "none")
set_tests_properties(pipeline30::spu-test-generic-pipeline PROPERTIES LABELS generic-pipeline)
add_test(NAME pipeline31::spu-test-generic-pipeline COMMAND spu-test-generic-pipeline -e 67 -t "6" -S "OTAC" -C "(init_S,relayf_S_15,incrementf_120,relay_S_15,fin_S)" -P "none")
set_tests_properties(pipeline31::spu-test-generic-pipeline PROPERTIES LABELS generic-pipeline)
add_test(NAME pipeline32::spu-test-generic-pipeline COMMAND spu-test-generic-pipeline -e 21 -t "3" -S "OTAC" -C "(init,relayf_15,incrementf_S_60,relay_15,fin)" -P "none")
set_tests_properties(pipeline32::spu-test-generic-pipeline PROPERTIES LABELS generic-pipeline)
add_test(NAME sequence0::spu-test-exclusive-paths-pipeline COMMAND spu-test-exclusive-paths-pipeline -t 1 -q -i ${INPUT_FILE})
set_tests_properties(sequence0::spu-test-exclusive-paths-pipeline PROPERTIES LABELS exclusive-paths-pipeline)
add_test(NAME sequence1::spu-test-exclusive-paths-pipeline COMMAND spu-test-exclusive-paths-pipeline -t 1 -u 13 -q -b -i ${INPUT_FILE})
set_tests_properties(sequence1::spu-test-exclusive-paths-pipeline PROPERTIES LABELS exclusive-paths-pipeline)
add_test(NAME pipeline0::spu-test-exclusive-paths-pipeline COMMAND spu-test-exclusive-paths-pipeline -t 4 -u 1 -i ${INPUT_FILE})
set_tests_properties(pipeline0::spu-test-exclusive-paths-pipeline PROPERTIES LABELS exclusive-paths-pipeline)
add_test(NAME pipeline1::spu-test-exclusive-paths-pipeline COMMAND spu-test-exclusive-paths-pipeline -t 1 -u 5 -i ${INPUT_FILE})
set_tests_properties(pipeline1::spu-test-exclusive-paths-pipeline PROPERTIES LABELS exclusive-paths-pipeline)
add_test(NAME pipeline2::spu-test-exclusive-paths-pipeline COMMAND spu-test-exclusive-paths-pipeline -t 8 -u 15 -i ${INPUT_FILE})
set_tests_properties(pipeline2::spu-test-exclusive-paths-pipeline PROPERTIES LABELS exclusive-paths-pipeline)
add_test(NAME sequence0::spu-test-nest-loops-pipeline COMMAND spu-test-nest-loops-pipeline -e 200 -f 2 -q)
set_tests_properties(sequence0::spu-test-nest-loops-pipeline PROPERTIES LABELS nest-loops-pipeline)
add_test(NAME sequence1::spu-test-nest-loops-pipeline COMMAND spu-test-nest-loops-pipeline -e 200 -f 13 -q -b -t 12)
set_tests_properties(sequence1::spu-test-nest-loops-pipeline PROPERTIES LABELS nest-loops-pipeline)
add_test(NAME pipeline0::spu-test-nest-loops-pipeline COMMAND spu-test-nest-loops-pipeline -e 10 -f 13 -i 10 -j 12 -t 8)
set_tests_properties(pipeline0::spu-test-nest-loops-pipeline PROPERTIES LABELS nest-loops-pipeline)
add_test(NAME pipeline1::spu-test-nest-loops-pipeline COMMAND spu-test-nest-loops-pipeline -e 10 -a -i 5 -j 13 -t 1)
set_tests_properties(pipeline1::spu-test-nest-loops-pipeline PROPERTIES LABELS nest-loops-pipeline)
add_test(NAME pipeline2::spu-test-nest-loops-pipeline COMMAND spu-test-nest-loops-pipeline -e 200 -i 5 -j 3 -t 2)
set_tests_properties(pipeline2::spu-test-nest-loops-pipeline PROPERTIES LABELS nest-loops-pipeline)
add_test(NAME pipeline3::spu-test-nest-loops-pipeline COMMAND spu-test-nest-loops-pipeline -e 200 -f 13)
set_tests_properties(pipeline3::spu-test-nest-loops-pipeline PROPERTIES LABELS nest-loops-pipeline)
if (SPU_LINK_HWLOC)
# Static test to verify pinning (for CPUs with at least 4 hardware threads)
add_test(NAME pipeline0::spu-test-thread-pinning COMMAND spu-test-thread-pinning -e 30)
set_tests_properties(pipeline0::spu-test-thread-pinning PROPERTIES LABELS "thread-pinning;skip-memcheck") # to exclude this previous test from memchecks, it looks like there is a liitle memory leak in the hwloc lib but not sure
add_test(NAME pipeline1::spu-test-thread-pinning COMMAND spu-test-thread-pinning -e 300 -f 5)
set_tests_properties(pipeline1::spu-test-thread-pinning PROPERTIES LABELS "thread-pinning;skip-memcheck") # to exclude this previous test from memchecks, it looks like there is a liitle memory leak in the hwloc lib but not sure
endif (SPU_LINK_HWLOC)
# check if the automatic pipeline scheduling is giving expected results
find_program (BASH_PROGRAM bash)
if (BASH_PROGRAM)
add_test (pipeline::sched ${BASH_PROGRAM} ${CMAKE_CURRENT_SOURCE_DIR}/ci/test-sched.sh)
set_tests_properties(pipeline::sched PROPERTIES LABELS "scheduler;skip-memcheck")
endif (BASH_PROGRAM)
endif(SPU_TESTS)