forked from triton-inference-server/server
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
836 lines (737 loc) · 20.1 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
832
833
834
835
836
# Copyright 2019-2022, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# * Neither the name of NVIDIA CORPORATION nor the names of its
# contributors may be used to endorse or promote products derived
# from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
# OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
cmake_minimum_required (VERSION 3.18)
project(tritonserverexe LANGUAGES C CXX)
include(GNUInstallDirs)
#
# Dependencies
#
# We must include the transitive closure of all repos so that we can
# override the tag. The backend repo is needed for the tests.
#
include(FetchContent)
FetchContent_Declare(
repo-common
GIT_REPOSITORY https://github.com/triton-inference-server/common.git
GIT_TAG ${TRITON_COMMON_REPO_TAG}
)
FetchContent_Declare(
repo-core
GIT_REPOSITORY https://github.com/triton-inference-server/core.git
GIT_TAG ${TRITON_CORE_REPO_TAG}
)
FetchContent_Declare(
repo-backend
GIT_REPOSITORY https://github.com/triton-inference-server/backend.git
GIT_TAG ${TRITON_BACKEND_REPO_TAG}
)
if(TRITON_ENABLE_GRPC)
set(TRITON_COMMON_ENABLE_PROTOBUF ON)
set(TRITON_COMMON_ENABLE_GRPC ON)
endif() # TRITON_ENABLE_GRPC
FetchContent_MakeAvailable(repo-common repo-core repo-backend)
# CUDA
#
if(${TRITON_ENABLE_GPU})
find_package(CUDAToolkit REQUIRED)
message(STATUS "Using CUDA ${CUDA_VERSION}")
endif() # TRITON_ENABLE_GPU
# GRPC
#
if(${TRITON_ENABLE_GRPC})
find_package(gRPC CONFIG REQUIRED)
message(STATUS "Using gRPC ${gRPC_VERSION}")
endif()
# libevent
#
if(${TRITON_ENABLE_HTTP} OR ${TRITON_ENABLE_METRICS} OR
${TRITON_ENABLE_SAGEMAKER} OR ${TRITON_ENABLE_VERTEX_AI})
find_package(Libevent CONFIG REQUIRED)
message(STATUS "Using libevent ${Libevent_VERSION}")
endif()
# re2
#
find_library(RE2_LIBRARY NAMES re2)
#
# tritonserver executable
#
add_executable(
main
classification.cc
common.cc
main.cc
shared_memory_manager.cc
triton_signal.cc
classification.h
common.h
shared_memory_manager.h
triton_signal.h
)
# On windows a *.lib file can be generated for a exe. When creating
# tritonserver.exe if we try to create tritonserver.lib it will fail
# because there is already a trtionserver.lib for tritonserver.dll,
# this causes the build to fail. To avoid we keep the build name as
# main.exe and then for windows after installing we rename it to
# tritonserver.exe (below in the install steps).
if (NOT WIN32)
set_property(TARGET main PROPERTY OUTPUT_NAME tritonserver)
endif()
target_compile_features(main PRIVATE cxx_std_11)
if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
message("Using MSVC as compiler, default target on Windows 10. "
"If the target system is not Windows 10, please update _WIN32_WINNT "
"to corresponding value.")
target_compile_options(
main
PRIVATE
/W1 /D_WIN32_WINNT=0x0A00 /EHsc
)
else()
target_compile_options(
main
PRIVATE
-Wall -Wextra -Wno-unused-parameter -Wno-deprecated-declarations -Werror
)
endif()
set_target_properties(
main
PROPERTIES
POSITION_INDEPENDENT_CODE ON
SKIP_BUILD_RPATH TRUE
BUILD_WITH_INSTALL_RPATH TRUE
INSTALL_RPATH_USE_LINK_PATH FALSE
INSTALL_RPATH "$\{ORIGIN\}/../lib"
)
target_link_libraries(
main
PRIVATE
triton-common-async-work-queue # from repo-common
triton-common-error # from repo-common
triton-common-logging # from repo-common
triton-core-serverapi # from repo-core
triton-core-serverstub # from repo-core
)
if(${TRITON_ENABLE_ASAN})
set(CMAKE_BUILD_TYPE Debug)
target_compile_definitions(
main
PRIVATE TRITON_ENABLE_ASAN=1
)
set(_ASAN_FLAGS "-static-libstdc++ -static-libasan -fno-omit-frame-pointer -fsanitize=address")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} ${_ASAN_FLAGS}")
set(CMAKE_LINKER_FLAGS_DEBUG "${CMAKE_LINKER_FLAGS_DEBUG} ${_ASAN_FLAGS}")
endif() # TRITON_ENABLE_ASAN
if(${TRITON_ENABLE_GPU})
target_compile_definitions(
main
PRIVATE TRITON_ENABLE_GPU=1
PRIVATE TRITON_MIN_COMPUTE_CAPABILITY=${TRITON_MIN_COMPUTE_CAPABILITY}
)
target_link_libraries(
main
PRIVATE
CUDA::cudart
)
endif() # TRITON_ENABLE_GPU
if(${TRITON_ENABLE_HTTP} OR ${TRITON_ENABLE_METRICS} OR
${TRITON_ENABLE_SAGEMAKER} OR ${TRITON_ENABLE_VERTEX_AI})
target_include_directories(
main
PRIVATE
${LIBEVENT_INCLUDE_DIRS}
)
endif()
if(${TRITON_ENABLE_GRPC})
target_include_directories(
main
PRIVATE
$<TARGET_PROPERTY:gRPC::grpc,INTERFACE_INCLUDE_DIRECTORIES>
)
target_compile_definitions(
main
PRIVATE TRITON_ENABLE_GRPC=1
)
endif() # TRITON_ENABLE_GRPC
if(${TRITON_ENABLE_HTTP})
target_compile_definitions(
main
PRIVATE TRITON_ENABLE_HTTP=1
)
endif() # TRITON_ENABLE_HTTP
if(${TRITON_ENABLE_SAGEMAKER})
target_compile_definitions(
main
PRIVATE TRITON_ENABLE_SAGEMAKER=1
)
endif() # TRITON_ENABLE_SAGEMAKER
if(${TRITON_ENABLE_VERTEX_AI})
target_compile_definitions(
main
PRIVATE TRITON_ENABLE_VERTEX_AI=1
)
endif() # TRITON_ENABLE_VERTEX_AI
if(${TRITON_ENABLE_LOGGING})
target_compile_definitions(
main
PRIVATE TRITON_ENABLE_LOGGING=1
)
endif() # TRITON_ENABLE_LOGGING
if(${TRITON_ENABLE_METRICS})
target_compile_definitions(
main
PRIVATE TRITON_ENABLE_METRICS=1
)
endif() # TRITON_ENABLE_METRICS
if(${TRITON_ENABLE_STATS})
target_compile_definitions(
main
PRIVATE TRITON_ENABLE_STATS=1
)
endif() # TRITON_ENABLE_STATS
if(${TRITON_ENABLE_TRACING})
target_compile_definitions(
main
PRIVATE TRITON_ENABLE_TRACING=1
)
endif() # TRITON_ENABLE_TRACING
if(${TRITON_ENABLE_NVTX})
target_compile_definitions(
main
PRIVATE TRITON_ENABLE_NVTX=1
)
endif() # TRITON_ENABLE_NVTX
if (NOT WIN32)
target_link_libraries(
main
PRIVATE
rt
dl
)
endif() # NOT WIN32
if (NOT WIN32)
install(
TARGETS main
RUNTIME DESTINATION bin
)
else()
# See explanation above as to why we need to rename main.exe to
# tritonserver.exe as part of the install process on windows.
install(
PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_BUILD_TYPE}/main.exe
DESTINATION bin
RENAME tritonserver.exe
)
endif()
# grpc endpoint
#
if(${TRITON_ENABLE_GRPC})
add_library(
grpc-endpoint-library EXCLUDE_FROM_ALL
grpc_server.cc
grpc_server.h
)
target_compile_features(grpc-endpoint-library PRIVATE cxx_std_11)
if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
target_compile_options(
grpc-endpoint-library
PRIVATE
/W1 /D_WIN32_WINNT=0x0A00 /EHsc
)
else()
target_compile_options(
grpc-endpoint-library
PRIVATE
-Wall -Wextra -Wno-unused-parameter -Wno-deprecated-declarations -Werror
)
endif()
set_target_properties(
grpc-endpoint-library
PROPERTIES
POSITION_INDEPENDENT_CODE ON
)
target_link_libraries(
grpc-endpoint-library
PUBLIC
proto-library # from repo-common
triton-common-logging # from repo-common
triton-common-json # from repo-common
grpc-service-library # from repo-common
triton-core-serverapi # from repo-core
triton-core-serverstub # from repo-core
gRPC::grpc++
gRPC::grpc
protobuf::libprotobuf
)
target_include_directories(
grpc-endpoint-library
PRIVATE
$<TARGET_PROPERTY:gRPC::grpc,INTERFACE_INCLUDE_DIRECTORIES>
)
target_compile_definitions(
grpc-endpoint-library
PRIVATE TRITON_ENABLE_GRPC=1
)
if(${TRITON_ENABLE_GPU})
target_compile_definitions(
grpc-endpoint-library
PRIVATE TRITON_ENABLE_GPU=1
PRIVATE TRITON_MIN_COMPUTE_CAPABILITY=${TRITON_MIN_COMPUTE_CAPABILITY}
)
target_link_libraries(
grpc-endpoint-library
PUBLIC
CUDA::cudart
)
endif() # TRITON_ENABLE_GPU
if(${TRITON_ENABLE_METRICS})
target_compile_definitions(
grpc-endpoint-library
PRIVATE TRITON_ENABLE_METRICS=1
)
endif() # TRITON_ENABLE_METRICS
if(${TRITON_ENABLE_LOGGING})
target_compile_definitions(
grpc-endpoint-library
PRIVATE TRITON_ENABLE_LOGGING=1
)
endif() # TRITON_ENABLE_LOGGING
if(${TRITON_ENABLE_STATS})
target_compile_definitions(
grpc-endpoint-library
PRIVATE TRITON_ENABLE_STATS=1
)
endif() # TRITON_ENABLE_STATS
if(${TRITON_ENABLE_TRACING})
target_compile_definitions(
grpc-endpoint-library
PRIVATE TRITON_ENABLE_TRACING=1
)
endif() # TRITON_ENABLE_TRACING
if(${TRITON_ENABLE_NVTX})
target_compile_definitions(
grpc-endpoint-library
PRIVATE TRITON_ENABLE_NVTX=1
)
endif() # TRITON_ENABLE_NVTX
target_link_libraries(
main
PRIVATE
grpc-endpoint-library
)
endif() # TRITON_ENABLE_GRPC
# http endpoint
#
if(${TRITON_ENABLE_HTTP}
OR ${TRITON_ENABLE_METRICS}
OR ${TRITON_ENABLE_SAGEMAKER}
OR ${TRITON_ENABLE_VERTEX_AI})
find_package(libevhtp CONFIG REQUIRED)
message(STATUS "Using libevhtp ${libevhtp_VERSION}")
list(APPEND
HTTP_ENDPOINT_SRCS
http_server.cc
)
list(APPEND
HTTP_ENDPOINT_HDRS
http_server.h
)
# Add header / src files based on HTTP related endpoint requested
if(${TRITON_ENABLE_SAGEMAKER})
list(APPEND
HTTP_ENDPOINT_SRCS
sagemaker_server.cc
)
list(APPEND
HTTP_ENDPOINT_HDRS
sagemaker_server.h
)
endif() # TRITON_ENABLE_SAGEMAKER
if(${TRITON_ENABLE_VERTEX_AI})
list(APPEND
HTTP_ENDPOINT_SRCS
vertex_ai_server.cc
)
list(APPEND
HTTP_ENDPOINT_HDRS
vertex_ai_server.h
)
endif() # TRITON_ENABLE_VERTEX_AI
add_library(
http-endpoint-library EXCLUDE_FROM_ALL
${HTTP_ENDPOINT_SRCS} ${HTTP_ENDPOINT_HDRS}
)
target_compile_features(http-endpoint-library PRIVATE cxx_std_11)
if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
target_compile_options(
http-endpoint-library
PRIVATE
/W1 /D_WIN32_WINNT=0x0A00 /EHsc
)
else()
target_compile_options(
http-endpoint-library
PRIVATE
-Wall -Wextra -Wno-unused-parameter -Wno-deprecated-declarations -Werror
)
endif()
set_target_properties(
http-endpoint-library
PROPERTIES
POSITION_INDEPENDENT_CODE ON
)
target_link_libraries(
http-endpoint-library
PUBLIC
triton-common-json # from repo-common
triton-common-logging # from repo-common
triton-core-serverapi # from repo-core
triton-core-serverstub # from repo-core
${LIBEVENT_LIBRARIES}
libevhtp::evhtp
${RE2_LIBRARY}
)
target_include_directories(
http-endpoint-library
PRIVATE $<TARGET_PROPERTY:libevhtp::evhtp,INTERFACE_INCLUDE_DIRECTORIES>
)
if(${TRITON_ENABLE_GPU})
target_compile_definitions(
http-endpoint-library
PRIVATE TRITON_ENABLE_GPU=1
PRIVATE TRITON_MIN_COMPUTE_CAPABILITY=${TRITON_MIN_COMPUTE_CAPABILITY}
)
target_link_libraries(
http-endpoint-library
PUBLIC
CUDA::cudart
)
endif() # TRITON_ENABLE_GPU
if(${TRITON_ENABLE_HTTP})
target_compile_definitions(
http-endpoint-library
PRIVATE TRITON_ENABLE_HTTP=1
)
endif() # TRITON_ENABLE_HTTP
if(${TRITON_ENABLE_SAGEMAKER})
target_compile_definitions(
http-endpoint-library
PRIVATE TRITON_ENABLE_SAGEMAKER=1
)
endif() # TRITON_ENABLE_SAGEMAKER
if(${TRITON_ENABLE_VERTEX_AI})
target_compile_definitions(
http-endpoint-library
PRIVATE TRITON_ENABLE_VERTEX_AI=1
)
endif() # TRITON_ENABLE_VERTEX_AI
if(${TRITON_ENABLE_METRICS})
target_compile_definitions(
http-endpoint-library
PRIVATE TRITON_ENABLE_METRICS=1
)
endif() # TRITON_ENABLE_METRICS
if(${TRITON_ENABLE_LOGGING})
target_compile_definitions(
http-endpoint-library
PRIVATE TRITON_ENABLE_LOGGING=1
)
endif() # TRITON_ENABLE_LOGGING
if(${TRITON_ENABLE_STATS})
target_compile_definitions(
http-endpoint-library
PRIVATE TRITON_ENABLE_STATS=1
)
endif() # TRITON_ENABLE_STATS
if(${TRITON_ENABLE_TRACING})
target_compile_definitions(
http-endpoint-library
PRIVATE TRITON_ENABLE_TRACING=1
)
endif() # TRITON_ENABLE_TRACING
if(${TRITON_ENABLE_NVTX})
target_compile_definitions(
http-endpoint-library
PRIVATE TRITON_ENABLE_NVTX=1
)
endif() # TRITON_ENABLE_NVTX
if (WIN32)
find_library(B64_LIBRARY NAMES b64)
find_library(ZLIB_LIBRARY NAMES zlib)
target_link_libraries(
http-endpoint-library
PUBLIC
${B64_LIBRARY}
${ZLIB_LIBRARY}
)
else()
target_link_libraries(
http-endpoint-library
PUBLIC
b64
z
)
endif()
target_link_libraries(
main
PRIVATE
http-endpoint-library
)
endif() # TRITON_ENABLE_HTTP || TRITON_ENABLE_METRICS ||
# TRITON_ENABLE_SAGEMAKER || TRITON_ENABLE_VERTEX_AI
# tracing
#
if(${TRITON_ENABLE_TRACING})
message(STATUS "Using tracing ${TRITON_TRACE_INSTALL_PATH}")
add_library(
tracing-library EXCLUDE_FROM_ALL
tracer.cc tracer.h
)
target_link_libraries(
tracing-library
PUBLIC
triton-common-logging # from repo-common
triton-core-serverapi # from repo-core
triton-core-serverstub # from repo-core
)
target_compile_definitions(
tracing-library
PRIVATE TRITON_ENABLE_TRACING=1
)
if(${TRITON_ENABLE_GPU})
target_compile_definitions(
tracing-library
PRIVATE TRITON_ENABLE_GPU=1
PRIVATE TRITON_MIN_COMPUTE_CAPABILITY=${TRITON_MIN_COMPUTE_CAPABILITY}
)
target_link_libraries(
tracing-library
PUBLIC
CUDA::cudart
)
endif() # TRITON_ENABLE_GPU
if(${TRITON_ENABLE_METRICS})
target_compile_definitions(
tracing-library
PRIVATE TRITON_ENABLE_METRICS=1
)
endif() # TRITON_ENABLE_METRICS
if(${TRITON_ENABLE_LOGGING})
target_compile_definitions(
tracing-library
PRIVATE TRITON_ENABLE_LOGGING=1
)
endif() # TRITON_ENABLE_LOGGING
if(${TRITON_ENABLE_STATS})
target_compile_definitions(
tracing-library
PRIVATE TRITON_ENABLE_STATS=1
)
endif() # TRITON_ENABLE_STATS
if(${TRITON_ENABLE_NVTX})
target_compile_definitions(
tracing-library
PRIVATE TRITON_ENABLE_NVTX=1
)
endif() # TRITON_ENABLE_NVTX
target_link_libraries(
main
PRIVATE
tracing-library
)
endif() # TRITON_ENABLE_TRACING
if (NOT WIN32)
#
# simple
#
add_executable(
simple
simple.cc
)
target_compile_features(simple PRIVATE cxx_std_11)
if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
message("Using MSVC as compiler, default target on Windows 10. "
"If the target system is not Windows 10, please update _WIN32_WINNT "
"to corresponding value.")
target_compile_options(
simple
PRIVATE
/W1 /D_WIN32_WINNT=0x0A00 /EHsc
)
else()
target_compile_options(
simple
PRIVATE
-Wall -Wextra -Wno-type-limits -Wno-unused-parameter -Wno-deprecated-declarations -Werror
)
endif()
set_target_properties(
simple
PROPERTIES
POSITION_INDEPENDENT_CODE ON
SKIP_BUILD_RPATH TRUE
BUILD_WITH_INSTALL_RPATH TRUE
INSTALL_RPATH_USE_LINK_PATH FALSE
INSTALL_RPATH ""
)
target_link_libraries(
simple
PRIVATE
triton-common-async-work-queue # from repo-common
triton-common-error # from repo-common
triton-core-serverapi # from repo-core
triton-core-serverstub # from repo-core
)
if(${TRITON_ENABLE_GPU})
target_compile_definitions(
simple
PRIVATE TRITON_ENABLE_GPU=1
PRIVATE TRITON_MIN_COMPUTE_CAPABILITY=${TRITON_MIN_COMPUTE_CAPABILITY}
)
target_link_libraries(
simple
PRIVATE
CUDA::cudart
)
endif() # TRITON_ENABLE_GPU
install(
TARGETS simple
RUNTIME DESTINATION bin
)
#
# multi_server example
#
add_executable(
multi_server
multi_server.cc
)
target_compile_features(multi_server PRIVATE cxx_std_11)
if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
message("Using MSVC as compiler, default target on Windows 10. "
"If the target system is not Windows 10, please update _WIN32_WINNT "
"to corresponding value.")
target_compile_options(
multi_server
PRIVATE
/W1 /D_WIN32_WINNT=0x0A00 /EHsc
)
else()
target_compile_options(
multi_server
PRIVATE
-Wall -Wextra -Wno-type-limits -Wno-unused-parameter -Wno-deprecated-declarations -Werror
)
endif()
set_target_properties(
multi_server
PROPERTIES
POSITION_INDEPENDENT_CODE ON
SKIP_BUILD_RPATH TRUE
BUILD_WITH_INSTALL_RPATH TRUE
INSTALL_RPATH_USE_LINK_PATH FALSE
INSTALL_RPATH ""
)
target_link_libraries(
multi_server
PRIVATE
triton-common-async-work-queue # from repo-common
triton-common-error # from repo-common
triton-core-serverapi # from repo-core
triton-core-serverstub # from repo-core
)
if(${TRITON_ENABLE_GPU})
target_compile_definitions(
multi_server
PRIVATE TRITON_ENABLE_GPU=1
PRIVATE TRITON_MIN_COMPUTE_CAPABILITY=${TRITON_MIN_COMPUTE_CAPABILITY}
)
target_link_libraries(
multi_server
PRIVATE
CUDA::cudart
)
endif() # TRITON_ENABLE_GPU
install(
TARGETS multi_server
RUNTIME DESTINATION bin
)
if(${TRITON_ENABLE_GPU})
#
# memory_alloc example
#
add_executable(
memory_alloc
memory_alloc.cc
)
target_compile_features(memory_alloc PRIVATE cxx_std_11)
if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
message("Using MSVC as compiler, default target on Windows 10. "
"If the target system is not Windows 10, please update _WIN32_WINNT "
"to corresponding value.")
target_compile_options(
memory_alloc
PRIVATE
/W1 /D_WIN32_WINNT=0x0A00 /EHsc
)
else()
target_compile_options(
memory_alloc
PRIVATE
-Wall -Wextra -Wno-type-limits -Wno-unused-parameter -Wno-deprecated-declarations -Werror
)
endif()
set_target_properties(
memory_alloc
PROPERTIES
POSITION_INDEPENDENT_CODE ON
SKIP_BUILD_RPATH TRUE
BUILD_WITH_INSTALL_RPATH TRUE
INSTALL_RPATH_USE_LINK_PATH FALSE
INSTALL_RPATH ""
)
target_compile_definitions(
memory_alloc
PRIVATE TRITON_ENABLE_GPU=1
PRIVATE TRITON_MIN_COMPUTE_CAPABILITY=${TRITON_MIN_COMPUTE_CAPABILITY}
)
target_link_libraries(
memory_alloc
PRIVATE
triton-common-async-work-queue # from repo-common
triton-common-error # from repo-common
triton-core-serverapi # from repo-core
triton-core-serverstub # from repo-core
CUDA::cudart
)
install(
TARGETS memory_alloc
RUNTIME DESTINATION bin
)
endif() # TRITON_ENABLE_GPU
endif() # NOT WIN32
# Currently unit tests do not build for windows...
if (NOT WIN32)
add_subdirectory(test test)
endif() # NOT WIN32