Skip to content

Commit

Permalink
Merge pull request #25 from SC-SGS/improved_man_pages
Browse files Browse the repository at this point in the history
Manpage improvements
  • Loading branch information
breyerml authored May 12, 2022
2 parents d737672 + efb4d7b commit 15e1cb8
Show file tree
Hide file tree
Showing 5 changed files with 54 additions and 16 deletions.
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@ tests/backends/SYCL/hipSYCL/*
docs/*
!docs/resources/
!docs/CMakeLists.txt
!docs/plssvm-train.1
!docs/plssvm-predict.1
!docs/plssvm-train.1.in
!docs/plssvm-predict.1.in

# auto-generated version header
include/plssvm/version/version.hpp
Expand Down
43 changes: 43 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,7 @@ endif()

## parse provided target platforms
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/parse_architecture_info.cmake)
set(PLSSVM_PLATFORM_NAME_LIST "automatic")
foreach(PLSSVM_PLATFORM ${PLSSVM_TARGET_PLATFORMS})
if(PLSSVM_PLATFORM MATCHES "^cpu")
# parse provided CPU architectures
Expand All @@ -304,27 +305,31 @@ foreach(PLSSVM_PLATFORM ${PLSSVM_TARGET_PLATFORMS})
message(FATAL_ERROR "Target platform \"cpu\" must at most have one architecture specification!")
endif()
target_compile_definitions(${PLSSVM_BASE_LIBRARY_NAME} PUBLIC PLSSVM_HAS_CPU_TARGET)
list(APPEND PLSSVM_PLATFORM_NAME_LIST "cpu")
elseif(PLSSVM_PLATFORM MATCHES "^nvidia")
# parse provided NVIDIA GPU architectures
parse_architecture_info(${PLSSVM_PLATFORM} PLSSVM_NVIDIA_TARGET_ARCHS PLSSVM_NUM_NVIDIA_TARGET_ARCHS)
if(PLSSVM_NUM_NVIDIA_TARGET_ARCHS EQUAL 0)
message(FATAL_ERROR "Target platform \"nvidia\" must at least have one architecture specification!")
endif()
target_compile_definitions(${PLSSVM_BASE_LIBRARY_NAME} PUBLIC PLSSVM_HAS_NVIDIA_TARGET)
list(APPEND PLSSVM_PLATFORM_NAME_LIST "gpu_nvidia")
elseif(PLSSVM_PLATFORM MATCHES "^amd")
# parse provided AMD GPU architectures
parse_architecture_info(${PLSSVM_PLATFORM} PLSSVM_AMD_TARGET_ARCHS PLSSVM_NUM_AMD_TARGET_ARCHS)
if(PLSSVM_NUM_AMD_TARGET_ARCHS EQUAL 0)
message(FATAL_ERROR "Target platform \"amd\" must at least have one architecture specification!")
endif()
target_compile_definitions(${PLSSVM_BASE_LIBRARY_NAME} PUBLIC PLSSVM_HAS_AMD_TARGET)
list(APPEND PLSSVM_PLATFORM_NAME_LIST "gpu_amd")
elseif(PLSSVM_PLATFORM MATCHES "^intel")
# parse provided Intel GPU architectures
parse_architecture_info(${PLSSVM_PLATFORM} PLSSVM_INTEL_TARGET_ARCHS PLSSVM_NUM_INTEL_TARGET_ARCHS)
if(PLSSVM_NUM_INTEL_TARGET_ARCHS EQUAL 0)
message(FATAL_ERROR "Target platform \"intel\" must at least have one architecture specification!")
endif()
target_compile_definitions(${PLSSVM_BASE_LIBRARY_NAME} PUBLIC PLSSVM_HAS_INTEL_TARGET)
list(APPEND PLSSVM_PLATFORM_NAME_LIST "gpu_intel")
else()
message(FATAL_ERROR "Unrecognized target platform \"${PLSSVM_PLATFORM}\"! Must be one of: cpu nvidia amd intel")
endif()
Expand Down Expand Up @@ -481,25 +486,63 @@ endif()
## print short (backend) summary ##
########################################################################################################################
message(STATUS "Enabled backends with respective targets:")
set(PLSSVM_BACKEND_NAME_LIST "automatic")
if(TARGET ${PLSSVM_OPENMP_BACKEND_LIBRARY_NAME})
message(STATUS "${PLSSVM_OPENMP_BACKEND_SUMMARY_STRING}")
list(APPEND PLSSVM_BACKEND_NAME_LIST "openmp")
endif()
if(TARGET ${PLSSVM_CUDA_BACKEND_LIBRARY_NAME})
message(STATUS "${PLSSVM_CUDA_BACKEND_SUMMARY_STRING}")
list(APPEND PLSSVM_BACKEND_NAME_LIST "cuda")
endif()
if(TARGET ${PLSSVM_HIP_BACKEND_LIBRARY_NAME})
message(STATUS "${PLSSVM_HIP_BACKEND_SUMMARY_STRING}")
list(APPEND PLSSVM_BACKEND_NAME_LIST "hip")
endif()
if(TARGET ${PLSSVM_OPENCL_BACKEND_LIBRARY_NAME})
message(STATUS "${PLSSVM_OPENCL_BACKEND_SUMMARY_STRING}")
list(APPEND PLSSVM_BACKEND_NAME_LIST "opencl")
endif()
if(TARGET ${PLSSVM_SYCL_BACKEND_LIBRARY_NAME})
foreach(SUMMARY_STRING ${PLSSVM_SYCL_BACKEND_SUMMARY_STRINGS})
message(STATUS "${SUMMARY_STRING}")
endforeach()
list(APPEND PLSSVM_BACKEND_NAME_LIST "sycl")
endif()


########################################################################################################################
## generate man pages ##
########################################################################################################################
string(REPLACE ";" "|" PLSSVM_PLATFORM_NAME_LIST "${PLSSVM_PLATFORM_NAME_LIST}")
string(REPLACE ";" "|" PLSSVM_BACKEND_NAME_LIST "${PLSSVM_BACKEND_NAME_LIST}")
string(REPLACE ";" "|" PLSSVM_SYCL_BACKEND_NAME_LIST "${PLSSVM_SYCL_BACKEND_NAME_LIST}")
if(TARGET ${PLSSVM_SYCL_BACKEND_LIBRARY_NAME})
set(PLSSVM_SYCL_IMPLEMENTATION_TYPE_MANPAGE_ENTRY "
.TP
.B --sycl_implementation_type
choose the SYCL implementation to be used in the SYCL backend: ${PLSSVM_SYCL_BACKEND_NAME_LIST} (default: automatic)
")
set(PLSSVM_SYCL_KERNEL_INVOCATION_TYPE_MANPAGE_ENTRY "
.TP
.B --sycl_kernel_invocation_type
choose the kernel invocation type when using SYCL as backend: automatic|nd_range|hierarchical (default: automatic)
")
endif()
set(PLSSVM_SYCL_MANPAGE_ENTRY "${PLSSVM_SYCL_KERNEL_INVOCATION_TYPE_MANPAGE_ENTRY}${PLSSVM_SYCL_IMPLEMENTATION_TYPE_MANPAGE_ENTRY}")
configure_file(
${CMAKE_CURRENT_SOURCE_DIR}/docs/plssvm-train.1.in
${CMAKE_CURRENT_SOURCE_DIR}/docs/plssvm-train.1
@ONLY
)
set(PLSSVM_SYCL_MANPAGE_ENTRY "${PLSSVM_SYCL_IMPLEMENTATION_TYPE_MANPAGE_ENTRY}")
configure_file(
${CMAKE_CURRENT_SOURCE_DIR}/docs/plssvm-predict.1.in
${CMAKE_CURRENT_SOURCE_DIR}/docs/plssvm-predict.1
@ONLY
)


########################################################################################################################
## add support for `make install` ##
########################################################################################################################
Expand Down
8 changes: 3 additions & 5 deletions docs/plssvm-predict.1 → docs/plssvm-predict.1.in
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,13 @@ plssvm-predict is a utility to predict the labels of a data set using a LIBSVM m

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

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

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

.TP
.B -q, --quiet
Expand Down
12 changes: 3 additions & 9 deletions docs/plssvm-train.1 → docs/plssvm-train.1.in
Original file line number Diff line number Diff line change
Expand Up @@ -41,19 +41,13 @@ set the tolerance of termination criterion (default: 0.001)

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

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

.TP
.B --sycl_kernel_invocation_type
choose the kernel invocation type when using SYCL as backend: automatic|nd_range|hierarchical

.TP
.B --sycl_implementation_type
choose the SYCL implementation to be used in the SYCL backend: automatic|dpcpp|hipsycl
@PLSSVM_SYCL_MANPAGE_ENTRY@

.TP
.B -q, --quiet
Expand Down
3 changes: 3 additions & 0 deletions src/plssvm/backends/SYCL/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,9 @@ target_compile_definitions(${PLSSVM_BASE_LIBRARY_NAME} PRIVATE PLSSVM_HAS_SYCL_B
list(APPEND PLSSVM_TARGETS_TO_INSTALL "${PLSSVM_SYCL_BACKEND_LIBRARY_NAME}")
set(PLSSVM_TARGETS_TO_INSTALL ${PLSSVM_TARGETS_TO_INSTALL} PARENT_SCOPE)

# set manpage string
set_local_and_parent(PLSSVM_SYCL_BACKEND_NAME_LIST "automatic;${PLSSVM_SYCL_BACKEND_FOUND_IMPLEMENTATIONS}")


# generate summary string
include(${PROJECT_SOURCE_DIR}/cmake/assemble_summary_string.cmake)
Expand Down

0 comments on commit 15e1cb8

Please sign in to comment.