Skip to content

Commit

Permalink
Improve cmake variable names
Browse files Browse the repository at this point in the history
  • Loading branch information
G-071 committed Aug 22, 2023
1 parent 4ba470a commit be37508
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 18 deletions.
32 changes: 16 additions & 16 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@ set(CPPUDDLE_VERSION_STRING "${CPPUDDLE_VERSION_MAJOR}.${CPPUDDLE_VERSION_MINOR}
option(CPPUDDLE_WITH_CUDA "Enable CUDA tests/examples" OFF)
option(CPPUDDLE_WITH_MULTIGPU_SUPPORT "Enables experimental MultiGPU support" OFF)
option(CPPUDDLE_WITH_KOKKOS "Enable KOKKOS tests/examples" OFF)
set(CPPUDDLE_WITH_NUMBER_GPUS "1" CACHE STRING "Number of GPUs that will be used. Should match the number of GPUs used when using the maximum number of HPX worker threads. Should be 1 for non-HPX builds.")
set(CPPUDDLE_WITH_MAX_NUMBER_GPUS "1" CACHE STRING "Number of GPUs that will be used. Should match the number of GPUs used when using the maximum number of HPX worker threads. Should be 1 for non-HPX builds.")
# HPX-related options
option(CPPUDDLE_WITH_HPX "Enable basic HPX integration and examples" OFF)
option(CPPUDDLE_WITH_HPX_AWARE_ALLOCATORS "Enable HPX-aware allocators for even better HPX integration" ON)
set(CPPUDDLE_WITH_HPX_MUTEX OFF CACHE BOOL
"Use HPX spinlock mutex instead of std::mutex")
set(CPPUDDLE_WITH_MAX_NUMBER_WORKERS "128" CACHE STRING "Max number of workers threads supported. Should match the intended number of HPX workers or be 1 in non-HPX builds.")
set(CPPUDDLE_WITH_NUMBER_BUCKETS "128" CACHE STRING "Number of internal recycle buckets buffer type. Should ideally match the intended number of HPX workers or be 1 in non-HPX builds.")
# Test-related options
option(CPPUDDLE_WITH_COUNTERS "Turns on allocations counters. Useful for extended testing" OFF)
option(CPPUDDLE_WITH_TESTS "Build tests/examples" OFF)
Expand Down Expand Up @@ -69,10 +69,10 @@ if(CPPUDDLE_WITH_NUMBER_GPUS GREATER 1)
endif()
endif()

if(CPPUDDLE_WITH_MAX_NUMBER_WORKERS GREATER 1)
if(CPPUDDLE_WITH_NUMBER_BUCKETS GREATER 1)
if(NOT CPPUDDLE_WITH_HPX_AWARE_ALLOCATORS)
message(FATAL_ERROR " CPPUDDLE_WITH_HPX_AWARE_ALLOCATORS=ON is required for Multi-Worker build! \
Either turn it on or configure with CPPUDDLE_WITH_MAX_NUMBER_WORKERS=1 !")
Either turn it on or configure with CPPUDDLE_WITH_NUMBER_BUCKETS=1 !")
endif()
endif()

Expand Down Expand Up @@ -164,15 +164,15 @@ if (CPPUDDLE_WITH_HPX)
if(CPPUDDLE_WITH_HPX_AWARE_ALLOCATORS)
message(INFO " Compiling with HPX-aware allocators!")
target_compile_definitions(buffer_manager INTERFACE "CPPUDDLE_HAVE_HPX_AWARE_ALLOCATORS")
target_compile_definitions(buffer_manager INTERFACE "CPPUDDLE_MAX_NUMBER_GPUS=${CPPUDDLE_WITH_NUMBER_GPUS}")
target_compile_definitions(buffer_manager INTERFACE "CPPUDDLE_MAX_NUMBER_WORKERS=${CPPUDDLE_WITH_MAX_NUMBER_WORKERS}")
target_compile_definitions(buffer_manager INTERFACE "CPPUDDLE_HAVE_MAX_NUMBER_GPUS=${CPPUDDLE_WITH_MAX_NUMBER_GPUS}")
target_compile_definitions(buffer_manager INTERFACE "CPPUDDLE_HAVE_NUMBER_BUCKETS=${CPPUDDLE_WITH_NUMBER_BUCKETS}")
else()
target_compile_definitions(buffer_manager INTERFACE "CPPUDDLE_MAX_NUMBER_GPUS=1")
target_compile_definitions(buffer_manager INTERFACE "CPPUDDLE_MAX_NUMBER_WORKERS=1")
target_compile_definitions(buffer_manager INTERFACE "CPPUDDLE_HAVE_MAX_NUMBER_GPUS=1")
target_compile_definitions(buffer_manager INTERFACE "CPPUDDLE_HAVE_NUMBER_BUCKETS=1")
endif()
else()
target_compile_definitions(buffer_manager INTERFACE "CPPUDDLE_MAX_NUMBER_GPUS=1")
target_compile_definitions(buffer_manager INTERFACE "CPPUDDLE_MAX_NUMBER_WORKERS=1")
target_compile_definitions(buffer_manager INTERFACE "CPPUDDLE_HAVE_MAX_NUMBER_GPUS=1")
target_compile_definitions(buffer_manager INTERFACE "CPPUDDLE_HAVE_NUMBER_BUCKETS=1")
endif()
if (CPPUDDLE_WITH_COUNTERS)
target_compile_definitions(buffer_manager INTERFACE "CPPUDDLE_HAVE_COUNTERS")
Expand All @@ -187,15 +187,15 @@ if (CPPUDDLE_WITH_HPX)
target_compile_definitions(stream_manager INTERFACE "CPPUDDLE_HAVE_HPX")
if(CPPUDDLE_WITH_HPX_AWARE_ALLOCATORS)
target_compile_definitions(stream_manager INTERFACE "CPPUDDLE_HAVE_HPX_AWARE_ALLOCATORS")
target_compile_definitions(stream_manager INTERFACE "CPPUDDLE_MAX_NUMBER_GPUS=${CPPUDDLE_WITH_NUMBER_GPUS}")
target_compile_definitions(stream_manager INTERFACE "CPPUDDLE_MAX_NUMBER_WORKERS=${CPPUDDLE_WITH_MAX_NUMBER_WORKERS}")
target_compile_definitions(stream_manager INTERFACE "CPPUDDLE_HAVE_MAX_NUMBER_GPUS=${CPPUDDLE_WITH_MAX_NUMBER_GPUS}")
target_compile_definitions(stream_manager INTERFACE "CPPUDDLE_HAVE_NUMBER_BUCKETS=${CPPUDDLE_WITH_NUMBER_BUCKETS}")
else()
target_compile_definitions(stream_manager INTERFACE "CPPUDDLE_MAX_NUMBER_GPUS=1")
target_compile_definitions(stream_manager INTERFACE "CPPUDDLE_MAX_NUMBER_WORKERS=1")
target_compile_definitions(stream_manager INTERFACE "CPPUDDLE_HAVE_MAX_NUMBER_GPUS=1")
target_compile_definitions(stream_manager INTERFACE "CPPUDDLE_HAVE_NUMBER_BUCKETS=1")
endif()
else()
target_compile_definitions(stream_manager INTERFACE "CPPUDDLE_MAX_NUMBER_GPUS=1")
target_compile_definitions(stream_manager INTERFACE "CPPUDDLE_MAX_NUMBER_WORKERS=1")
target_compile_definitions(stream_manager INTERFACE "CPPUDDLE_HAVE_MAX_NUMBER_GPUS=1")
target_compile_definitions(stream_manager INTERFACE "CPPUDDLE_HAVE_NUMBER_BUCKETS=1")
endif()
if (CPPUDDLE_WITH_COUNTERS)
target_compile_definitions(stream_manager INTERFACE "CPPUDDLE_HAVE_COUNTERS")
Expand Down
4 changes: 2 additions & 2 deletions include/detail/config.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,9 @@ using aggregation_mutex_t = std::mutex;

// Thread and MultiGPU configuration
//
constexpr size_t number_instances = CPPUDDLE_MAX_NUMBER_WORKERS;
constexpr size_t number_instances = CPPUDDLE_HAVE_NUMBER_BUCKETS;
static_assert(number_instances >= 1);
constexpr size_t max_number_gpus = CPPUDDLE_MAX_NUMBER_GPUS;
constexpr size_t max_number_gpus = CPPUDDLE_HAVE_MAX_NUMBER_GPUS;
#ifndef CPPUDDLE_HAVE_HPX
static_assert(max_number_gpus == 1, "Non HPX builds do not support multigpu");
#endif
Expand Down

0 comments on commit be37508

Please sign in to comment.