Skip to content

Commit efb4d7b

Browse files
committed
Manpage entries are now created during CMake to only show relevant flags and options.
1 parent d737672 commit efb4d7b

File tree

5 files changed

+54
-16
lines changed

5 files changed

+54
-16
lines changed

.gitignore

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,8 @@ tests/backends/SYCL/hipSYCL/*
6969
docs/*
7070
!docs/resources/
7171
!docs/CMakeLists.txt
72-
!docs/plssvm-train.1
73-
!docs/plssvm-predict.1
72+
!docs/plssvm-train.1.in
73+
!docs/plssvm-predict.1.in
7474

7575
# auto-generated version header
7676
include/plssvm/version/version.hpp

CMakeLists.txt

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -296,6 +296,7 @@ endif()
296296

297297
## parse provided target platforms
298298
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/parse_architecture_info.cmake)
299+
set(PLSSVM_PLATFORM_NAME_LIST "automatic")
299300
foreach(PLSSVM_PLATFORM ${PLSSVM_TARGET_PLATFORMS})
300301
if(PLSSVM_PLATFORM MATCHES "^cpu")
301302
# parse provided CPU architectures
@@ -304,27 +305,31 @@ foreach(PLSSVM_PLATFORM ${PLSSVM_TARGET_PLATFORMS})
304305
message(FATAL_ERROR "Target platform \"cpu\" must at most have one architecture specification!")
305306
endif()
306307
target_compile_definitions(${PLSSVM_BASE_LIBRARY_NAME} PUBLIC PLSSVM_HAS_CPU_TARGET)
308+
list(APPEND PLSSVM_PLATFORM_NAME_LIST "cpu")
307309
elseif(PLSSVM_PLATFORM MATCHES "^nvidia")
308310
# parse provided NVIDIA GPU architectures
309311
parse_architecture_info(${PLSSVM_PLATFORM} PLSSVM_NVIDIA_TARGET_ARCHS PLSSVM_NUM_NVIDIA_TARGET_ARCHS)
310312
if(PLSSVM_NUM_NVIDIA_TARGET_ARCHS EQUAL 0)
311313
message(FATAL_ERROR "Target platform \"nvidia\" must at least have one architecture specification!")
312314
endif()
313315
target_compile_definitions(${PLSSVM_BASE_LIBRARY_NAME} PUBLIC PLSSVM_HAS_NVIDIA_TARGET)
316+
list(APPEND PLSSVM_PLATFORM_NAME_LIST "gpu_nvidia")
314317
elseif(PLSSVM_PLATFORM MATCHES "^amd")
315318
# parse provided AMD GPU architectures
316319
parse_architecture_info(${PLSSVM_PLATFORM} PLSSVM_AMD_TARGET_ARCHS PLSSVM_NUM_AMD_TARGET_ARCHS)
317320
if(PLSSVM_NUM_AMD_TARGET_ARCHS EQUAL 0)
318321
message(FATAL_ERROR "Target platform \"amd\" must at least have one architecture specification!")
319322
endif()
320323
target_compile_definitions(${PLSSVM_BASE_LIBRARY_NAME} PUBLIC PLSSVM_HAS_AMD_TARGET)
324+
list(APPEND PLSSVM_PLATFORM_NAME_LIST "gpu_amd")
321325
elseif(PLSSVM_PLATFORM MATCHES "^intel")
322326
# parse provided Intel GPU architectures
323327
parse_architecture_info(${PLSSVM_PLATFORM} PLSSVM_INTEL_TARGET_ARCHS PLSSVM_NUM_INTEL_TARGET_ARCHS)
324328
if(PLSSVM_NUM_INTEL_TARGET_ARCHS EQUAL 0)
325329
message(FATAL_ERROR "Target platform \"intel\" must at least have one architecture specification!")
326330
endif()
327331
target_compile_definitions(${PLSSVM_BASE_LIBRARY_NAME} PUBLIC PLSSVM_HAS_INTEL_TARGET)
332+
list(APPEND PLSSVM_PLATFORM_NAME_LIST "gpu_intel")
328333
else()
329334
message(FATAL_ERROR "Unrecognized target platform \"${PLSSVM_PLATFORM}\"! Must be one of: cpu nvidia amd intel")
330335
endif()
@@ -481,25 +486,63 @@ endif()
481486
## print short (backend) summary ##
482487
########################################################################################################################
483488
message(STATUS "Enabled backends with respective targets:")
489+
set(PLSSVM_BACKEND_NAME_LIST "automatic")
484490
if(TARGET ${PLSSVM_OPENMP_BACKEND_LIBRARY_NAME})
485491
message(STATUS "${PLSSVM_OPENMP_BACKEND_SUMMARY_STRING}")
492+
list(APPEND PLSSVM_BACKEND_NAME_LIST "openmp")
486493
endif()
487494
if(TARGET ${PLSSVM_CUDA_BACKEND_LIBRARY_NAME})
488495
message(STATUS "${PLSSVM_CUDA_BACKEND_SUMMARY_STRING}")
496+
list(APPEND PLSSVM_BACKEND_NAME_LIST "cuda")
489497
endif()
490498
if(TARGET ${PLSSVM_HIP_BACKEND_LIBRARY_NAME})
491499
message(STATUS "${PLSSVM_HIP_BACKEND_SUMMARY_STRING}")
500+
list(APPEND PLSSVM_BACKEND_NAME_LIST "hip")
492501
endif()
493502
if(TARGET ${PLSSVM_OPENCL_BACKEND_LIBRARY_NAME})
494503
message(STATUS "${PLSSVM_OPENCL_BACKEND_SUMMARY_STRING}")
504+
list(APPEND PLSSVM_BACKEND_NAME_LIST "opencl")
495505
endif()
496506
if(TARGET ${PLSSVM_SYCL_BACKEND_LIBRARY_NAME})
497507
foreach(SUMMARY_STRING ${PLSSVM_SYCL_BACKEND_SUMMARY_STRINGS})
498508
message(STATUS "${SUMMARY_STRING}")
499509
endforeach()
510+
list(APPEND PLSSVM_BACKEND_NAME_LIST "sycl")
500511
endif()
501512

502513

514+
########################################################################################################################
515+
## generate man pages ##
516+
########################################################################################################################
517+
string(REPLACE ";" "|" PLSSVM_PLATFORM_NAME_LIST "${PLSSVM_PLATFORM_NAME_LIST}")
518+
string(REPLACE ";" "|" PLSSVM_BACKEND_NAME_LIST "${PLSSVM_BACKEND_NAME_LIST}")
519+
string(REPLACE ";" "|" PLSSVM_SYCL_BACKEND_NAME_LIST "${PLSSVM_SYCL_BACKEND_NAME_LIST}")
520+
if(TARGET ${PLSSVM_SYCL_BACKEND_LIBRARY_NAME})
521+
set(PLSSVM_SYCL_IMPLEMENTATION_TYPE_MANPAGE_ENTRY "
522+
.TP
523+
.B --sycl_implementation_type
524+
choose the SYCL implementation to be used in the SYCL backend: ${PLSSVM_SYCL_BACKEND_NAME_LIST} (default: automatic)
525+
")
526+
set(PLSSVM_SYCL_KERNEL_INVOCATION_TYPE_MANPAGE_ENTRY "
527+
.TP
528+
.B --sycl_kernel_invocation_type
529+
choose the kernel invocation type when using SYCL as backend: automatic|nd_range|hierarchical (default: automatic)
530+
")
531+
endif()
532+
set(PLSSVM_SYCL_MANPAGE_ENTRY "${PLSSVM_SYCL_KERNEL_INVOCATION_TYPE_MANPAGE_ENTRY}${PLSSVM_SYCL_IMPLEMENTATION_TYPE_MANPAGE_ENTRY}")
533+
configure_file(
534+
${CMAKE_CURRENT_SOURCE_DIR}/docs/plssvm-train.1.in
535+
${CMAKE_CURRENT_SOURCE_DIR}/docs/plssvm-train.1
536+
@ONLY
537+
)
538+
set(PLSSVM_SYCL_MANPAGE_ENTRY "${PLSSVM_SYCL_IMPLEMENTATION_TYPE_MANPAGE_ENTRY}")
539+
configure_file(
540+
${CMAKE_CURRENT_SOURCE_DIR}/docs/plssvm-predict.1.in
541+
${CMAKE_CURRENT_SOURCE_DIR}/docs/plssvm-predict.1
542+
@ONLY
543+
)
544+
545+
503546
########################################################################################################################
504547
## add support for `make install` ##
505548
########################################################################################################################
Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,13 @@ plssvm-predict is a utility to predict the labels of a data set using a LIBSVM m
1414

1515
.TP
1616
.B -b, --backend arg
17-
choose the backend: automatic|openmp|cuda|hip|opencl|sycl (default: automatic)
17+
choose the backend: @PLSSVM_BACKEND_NAME_LIST@ (default: automatic)
1818

1919
.TP
2020
.B -p, --target_platform arg
21-
choose the target platform: automatic|cpu|gpu_nvidia|gpu_amd|gpu_intel (default: automatic)
21+
choose the target platform: @PLSSVM_PLATFORM_NAME_LIST@ (default: automatic)
2222

23-
.TP
24-
.B --sycl_implementation_type
25-
choose the SYCL implementation to be used in the SYCL backend: automatic|dpcpp|hipsycl (default: automatic)
23+
@PLSSVM_SYCL_MANPAGE_ENTRY@
2624

2725
.TP
2826
.B -q, --quiet
Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -41,19 +41,13 @@ set the tolerance of termination criterion (default: 0.001)
4141

4242
.TP
4343
.B -b, --backend arg
44-
choose the backend: automatic|openmp|cuda|hip|opencl|sycl (default: automatic)
44+
choose the backend: @PLSSVM_BACKEND_NAME_LIST@ (default: automatic)
4545

4646
.TP
4747
.B -p, --target_platform arg
48-
choose the target platform: automatic|cpu|gpu_nvidia|gpu_amd|gpu_intel (default: automatic)
48+
choose the target platform: @PLSSVM_PLATFORM_NAME_LIST@ (default: automatic)
4949

50-
.TP
51-
.B --sycl_kernel_invocation_type
52-
choose the kernel invocation type when using SYCL as backend: automatic|nd_range|hierarchical
53-
54-
.TP
55-
.B --sycl_implementation_type
56-
choose the SYCL implementation to be used in the SYCL backend: automatic|dpcpp|hipsycl
50+
@PLSSVM_SYCL_MANPAGE_ENTRY@
5751

5852
.TP
5953
.B -q, --quiet

src/plssvm/backends/SYCL/CMakeLists.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -309,6 +309,9 @@ target_compile_definitions(${PLSSVM_BASE_LIBRARY_NAME} PRIVATE PLSSVM_HAS_SYCL_B
309309
list(APPEND PLSSVM_TARGETS_TO_INSTALL "${PLSSVM_SYCL_BACKEND_LIBRARY_NAME}")
310310
set(PLSSVM_TARGETS_TO_INSTALL ${PLSSVM_TARGETS_TO_INSTALL} PARENT_SCOPE)
311311

312+
# set manpage string
313+
set_local_and_parent(PLSSVM_SYCL_BACKEND_NAME_LIST "automatic;${PLSSVM_SYCL_BACKEND_FOUND_IMPLEMENTATIONS}")
314+
312315

313316
# generate summary string
314317
include(${PROJECT_SOURCE_DIR}/cmake/assemble_summary_string.cmake)

0 commit comments

Comments
 (0)