Skip to content

Commit 6cbe9b8

Browse files
authored
Merge pull request #4 from eth-cscs/misc-cleanup
Clean up a few minor typos and other details
2 parents 707964a + ea5f9fb commit 6cbe9b8

File tree

4 files changed

+18
-14
lines changed

4 files changed

+18
-14
lines changed

CMakeLists.txt

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,17 @@
66
# Please, refer to the LICENSE file in the root directory.
77
# SPDX-License-Identifier: BSD-3-Clause
88

9+
# General project setup
910
cmake_minimum_required(VERSION 3.22)
1011

1112
project(whip VERSION 0.1.0 LANGUAGES CXX)
1213

1314
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${PROJECT_SOURCE_DIR}/cmake")
1415

15-
set(WHIP_BACKEND "CUDA" CACHE STRING "${description}")
16+
set(whip_backend_description "Backend to use (CUDA or HIP)")
17+
set(WHIP_BACKEND "CUDA" CACHE STRING "${whip_backend_description}")
1618
set_property(CACHE WHIP_BACKEND PROPERTY TYPE STRING)
17-
set_property(CACHE WHIP_BACKEND PROPERTY HELPSTRING "The backend to use...")
19+
set_property(CACHE WHIP_BACKEND PROPERTY HELPSTRING "${whip_backend_description}")
1820
set(whip_valid_backends CUDA HIP)
1921
set_property(CACHE WHIP_BACKEND PROPERTY STRINGS "${whip_valid_backends}")
2022

@@ -46,6 +48,7 @@ elseif(WHIP_BACKEND STREQUAL "HIP")
4648
target_link_libraries(whip INTERFACE hip::host)
4749
endif()
4850

51+
# Generate whip header
4952
set(whip_types_section "// Types")
5053
whip_add_type(whip_types_section device_prop DeviceProp_t CUDA_OVERRIDE cudaDeviceProp)
5154
whip_add_type(whip_types_section dim3 dim3 CUDA_OVERRIDE dim3 HIP_OVERRIDE dim3)
@@ -106,6 +109,7 @@ whip_add_function(whip_functions_section stream_get_flags "stream_t stream;unsig
106109
whip_add_function(whip_functions_section stream_ready "stream_t stream" StreamQuery QUERY)
107110
whip_add_function(whip_functions_section stream_synchronize "stream_t stream" StreamSynchronize)
108111

112+
# Install whip
109113
write_basic_package_version_file("${PROJECT_BINARY_DIR}/whip-config-version.cmake" VERSION ${PROJECT_VERSION} COMPATIBILITY AnyNewerVersion)
110114
configure_file("${PROJECT_SOURCE_DIR}/cmake/whip.hpp.in" "${PROJECT_BINARY_DIR}/include/whip.hpp")
111115

README.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -24,25 +24,25 @@ that:
2424
whip lightly wraps CUDA and HIP functions. Function wrappers:
2525

2626
- Are C++ lambdas to easily allow passing templated functions (like
27-
`cuda/hipMemcpy`) into higher order functions.
27+
`cudaMemcpy/hipMemcpy`) into higher order functions.
2828
- Check the return codes from wrapped functions and throw a `whip::exception` on
2929
failure.
3030

3131
Wrapped types, errors, and functions have the same names as in CUDA and HIP,
3232
with the `cuda/hip` prefix removed and the name changed to `snake_case`. For
33-
example `cuda/hipMemcpy` is wrapped by a `whip::error_t whip::memcpy(auto* dst,
34-
const auto*, std::size_t size_bytes, whip::memcpy_kind)` function. All
33+
example `cudaMemcpy/hipMemcpy` is wrapped by a `whip::error_t whip::memcpy(auto*
34+
dst, const auto*, std::size_t size_bytes, whip::memcpy_kind)` function. All
3535
functionality is available in the `whip` namespace.
3636

3737
There are two main exceptions to the above rules:
3838

39-
- The functions `cuda/hipEventQuery` and `cuda/hipStreamQuery` are expected to
40-
fail under normal circumstances. The wrappers in whip (respectively
41-
`whip::event_ready` and `whip::stream_ready`) return instead a bool indicating
42-
readiness.
43-
The wrappers throw an exception in all other cases.
44-
- `cuda/hipGetLastError` is called `whip::check_last_error` instead of
45-
`whip::get_last_error` because it throws on failure as other wrappers do.
39+
- The functions `cudaEventQuery/hipEventQuery` and
40+
`cudaStreamQuery/hipStreamQuery` are expected to fail under normal
41+
circumstances. The wrappers in whip (respectively `whip::event_ready` and
42+
`whip::stream_ready`) return instead a bool indicating readiness. The
43+
wrappers throw an exception in all other cases.
44+
- `cudaGetLastError/hipGetLastError` is called `whip::check_last_error` instead
45+
of `whip::get_last_error` because it throws on failure as other wrappers do.
4646

4747
# Usage
4848

cmake/whip-config.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,5 @@ set(WHIP_BACKEND @WHIP_BACKEND@)
1919
if(WHIP_BACKEND STREQUAL "CUDA")
2020
find_dependency(CUDAToolkit)
2121
elseif(WHIP_BACKEND STREQUAL "HIP")
22-
find_package(hip)
22+
find_dependency(hip)
2323
endif()

cmake/whip_helpers.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ function(whip_add_function var wrapper params wrapped)
5959
string(REPLACE ";" ", " wrapper_definition_params "${params}")
6060
set(wrapper_definition "${wrapper}(${wrapper_definition_params})")
6161

62-
# Transform parameter list into somethig usable in the call to the wrapped
62+
# Transform parameter list into something usable in the call to the wrapped
6363
# function: replace semicolons with commas and keep only the variable names
6464
set(wrapped_call_args)
6565
foreach(param ${params})

0 commit comments

Comments
 (0)