Skip to content

Commit

Permalink
Update to subpar 0.3.0 with the new function name.
Browse files Browse the repository at this point in the history
This also avoids moving the lambda into the TATAMI_CUSTOM_PARALLEL macro, which
might not be safe if the macro does things other than being a function alias.
  • Loading branch information
LTLA committed Aug 30, 2024
1 parent d8b555f commit bf119f0
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ option(KNNCOLLE_FETCH_EXTERN "Automatically fetch tatami's external dependencies
if(KNNCOLLE_FETCH_EXTERN)
add_subdirectory(extern)
else()
find_package(ltla_subpar 0.2.0 CONFIG REQUIRED)
find_package(ltla_subpar 0.3.0 CONFIG REQUIRED)
endif()

target_link_libraries(tatami INTERFACE ltla::subpar)
Expand Down
2 changes: 1 addition & 1 deletion cmake/Config.cmake.in
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
@PACKAGE_INIT@

include(CMakeFindDependencyMacro)
find_dependency(ltla_subpar 0.2.0 CONFIG REQUIRED)
find_dependency(ltla_subpar 0.3.0 CONFIG REQUIRED)

include("${CMAKE_CURRENT_LIST_DIR}/tatami_tatamiTargets.cmake")
2 changes: 1 addition & 1 deletion extern/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ include(FetchContent)
FetchContent_Declare(
subpar
GIT_REPOSITORY https://github.com/LTLA/subpar
GIT_TAG master # ^3.0.0
GIT_TAG master # ^0.3.0
)

FetchContent_MakeAvailable(subpar)
6 changes: 3 additions & 3 deletions include/tatami/utils/parallelize.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ namespace tatami {

/**
* Apply a function to a set of tasks in parallel, usually for iterating over a dimension of a `Matrix`.
* By default, this uses `subpar::parallelize()` internally, which uses OpenMP if available and `<thread>` otherwise.
* By default, this uses `subpar::parallelize_range()` internally, which uses OpenMP if available and `<thread>` otherwise.
* Advanced users can override the default parallelization mechanism by defining a `TATAMI_CUSTOM_PARALLEL` function-like macro.
* The macro should accept the `fun`, `tasks` and `threads` arguments as described below.
*
Expand All @@ -42,9 +42,9 @@ template<bool parallel_ = true, class Function_, typename Index_>
void parallelize(Function_ fun, Index_ tasks, int threads) {
if constexpr(parallel_) {
#ifdef TATAMI_CUSTOM_PARALLEL
TATAMI_CUSTOM_PARALLEL(std::move(fun), tasks, threads);
TATAMI_CUSTOM_PARALLEL(fun, tasks, threads);
#else
subpar::parallelize(threads, tasks, std::move(fun));
subpar::parallelize_range(threads, tasks, std::move(fun));
#endif
} else {
fun(0, 0, tasks);
Expand Down

0 comments on commit bf119f0

Please sign in to comment.