Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump redGrapes to C++17 #56

Merged
merged 2 commits into from
Jan 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 0 additions & 7 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ endif()
#########################################################
# Installation
#########################################################
option(redGrapes_USE_INTERNAL_OPTIONAL "use akrzemi's optional library for c++14" ON)

include(GNUInstallDirs)
set(CMAKE_INSTALL_CMAKEDIR "${CMAKE_INSTALL_LIBDIR}/cmake/redGrapes"
Expand All @@ -33,12 +32,6 @@ install(DIRECTORY "${redGrapes_SOURCE_DIR}/redGrapes"
FILES_MATCHING PATTERN "*.hpp"
)

# install third-party libraries
if(redGrapes_USE_INTERNAL_OPTIONAL)
install(DIRECTORY "${redGrapes_SOURCE_DIR}/share/thirdParty/akrzemi/optional/include/akrzemi"
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
)
endif()

# Version file
include(CMakePackageConfigHelpers)
Expand Down
5 changes: 2 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

<hr>

RedGrapes is a C++14 framework for declaratively creating and scheduling task-graphs, based on a high-level resource description.
RedGrapes is a C++17 framework for declaratively creating and scheduling task-graphs, based on a high-level resource description.

### Motivation

Expand Down Expand Up @@ -154,10 +154,9 @@ Its conceptual design is based on a [whitepaper by A. Huebl, R. Widera, and A. M

### Dependencies

RedGrapes requires a compiler supporting the C++14 standard.
RedGrapes requires a compiler supporting the C++17 standard.
RedGrapes further depends on the following libraries:

* [optional for C++14](https://github.com/akrzemi1/Optional) by [Andrzej Krzemienski](https://github.com/akrzemi1)
* [ConcurrentQueue](https://github.com/cameron314/concurrentqueue) by [Cameron Desrochers](https://moodycamel.com)
* [spdlog](https://github.com/gabime/spdlog)
* [{fmt}](https://fmt.dev)
Expand Down
6 changes: 3 additions & 3 deletions examples/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,22 +29,22 @@ set(EXAMPLE_NAMES

foreach(examplename ${EXAMPLE_NAMES})
add_executable(${examplename} ${examplename}.cpp)
target_compile_features(${examplename} PUBLIC cxx_std_14)
target_compile_features(${examplename} PUBLIC cxx_std_${redGrapes_CXX_STANDARD})
target_link_libraries(${examplename} PRIVATE redGrapes)
target_link_libraries(${examplename} PRIVATE Threads::Threads)
endforeach()

if(MPI_FOUND)
add_executable(mpi mpi.cpp)
target_compile_features(mpi PUBLIC cxx_std_14)
target_compile_features(mpi PUBLIC cxx_std_${redGrapes_CXX_STANDARD})
target_link_libraries(mpi PRIVATE redGrapes)
target_link_libraries(mpi PRIVATE Threads::Threads)
target_link_libraries(mpi PRIVATE MPI::MPI_CXX)
endif()

if(LAPACK_FOUND AND LAPACKE_LIB)
add_executable(cholesky cholesky.cpp)
target_compile_features(cholesky PUBLIC cxx_std_14)
target_compile_features(cholesky PUBLIC cxx_std_${redGrapes_CXX_STANDARD})
target_link_libraries(cholesky PRIVATE redGrapes)
target_link_libraries(cholesky PRIVATE Threads::Threads)
target_link_libraries(cholesky PRIVATE LAPACK::LAPACK ${LAPACKE_LIB})
Expand Down
2 changes: 1 addition & 1 deletion redGrapes/redGrapes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ namespace redGrapes
SPDLOG_TRACE("create child space = {}", (void*) task_space.get());
current_task->children = task_space;

std::unique_lock<std::shared_timed_mutex> wr_lock(current_task->space->active_child_spaces_mutex);
std::unique_lock<std::shared_mutex> wr_lock(current_task->space->active_child_spaces_mutex);
current_task->space->active_child_spaces.push_back(task_space);
}

Expand Down
2 changes: 1 addition & 1 deletion redGrapes/sync/spinlock.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ namespace redGrapes
alignas(64) std::atomic<unsigned> reader_count;
alignas(64) std::atomic<bool> write;
#else
std::shared_timed_mutex m;
std::shared_mutex m;
#endif

SpinLock()
Expand Down
2 changes: 1 addition & 1 deletion redGrapes/task/task_space.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ namespace redGrapes
unsigned depth;
Task* parent;

std::shared_timed_mutex active_child_spaces_mutex;
std::shared_mutex active_child_spaces_mutex;
std::vector<std::shared_ptr<TaskSpace>> active_child_spaces;

virtual ~TaskSpace();
Expand Down
54 changes: 29 additions & 25 deletions redGrapesConfig.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ cmake_minimum_required(VERSION 3.18.0)
include(CMakeFindDependencyMacro)

project(redGrapes VERSION 0.1.0)
set(CMAKE_CXX_STANDARD 14)

find_package(Boost 1.62.0 REQUIRED COMPONENTS context)
find_package(fmt REQUIRED)
Expand Down Expand Up @@ -39,31 +38,37 @@ else()
message(STATUS "Found hwloc")
endif()

if( NOT TARGET redGrapes )
add_library(redGrapes
${CMAKE_CURRENT_LIST_DIR}/redGrapes/resource/resource.cpp
${CMAKE_CURRENT_LIST_DIR}/redGrapes/resource/resource_user.cpp
${CMAKE_CURRENT_LIST_DIR}/redGrapes/dispatch/thread/execute.cpp
${CMAKE_CURRENT_LIST_DIR}/redGrapes/dispatch/thread/cpuset.cpp
${CMAKE_CURRENT_LIST_DIR}/redGrapes/dispatch/thread/worker.cpp
${CMAKE_CURRENT_LIST_DIR}/redGrapes/dispatch/thread/worker_pool.cpp
${CMAKE_CURRENT_LIST_DIR}/redGrapes/scheduler/event.cpp
${CMAKE_CURRENT_LIST_DIR}/redGrapes/scheduler/event_ptr.cpp
${CMAKE_CURRENT_LIST_DIR}/redGrapes/scheduler/default_scheduler.cpp
${CMAKE_CURRENT_LIST_DIR}/redGrapes/task/property/graph.cpp
${CMAKE_CURRENT_LIST_DIR}/redGrapes/task/task_space.cpp
${CMAKE_CURRENT_LIST_DIR}/redGrapes/task/queue.cpp
${CMAKE_CURRENT_LIST_DIR}/redGrapes/memory/allocator.cpp
${CMAKE_CURRENT_LIST_DIR}/redGrapes/memory/bump_allocator.cpp
${CMAKE_CURRENT_LIST_DIR}/redGrapes/sync/cv.cpp
${CMAKE_CURRENT_LIST_DIR}/redGrapes/util/trace.cpp
${CMAKE_CURRENT_LIST_DIR}/redGrapes/redGrapes.cpp
)
set(redGrapes_CXX_STANDARD_DEFAULT "17")
# Check whether redGrapes_CXX_STANDARD has already been defined as a non-cached variable.
if(DEFINED redGrapes)
set(redGrapes_CXX_STANDARD_DEFAULT ${redGrapes_CXX_STANDARD})
endif()

target_compile_features(redGrapes PUBLIC
cxx_std_14
)
set(redGrapes_CXX_STANDARD ${redGrapes_CXX_STANDARD_DEFAULT} CACHE STRING "C++ standard version")
set_property(CACHE redGrapes_CXX_STANDARD PROPERTY STRINGS "17;20")

if( NOT TARGET redGrapes )
add_library(redGrapes
${CMAKE_CURRENT_LIST_DIR}/redGrapes/resource/resource.cpp
${CMAKE_CURRENT_LIST_DIR}/redGrapes/resource/resource_user.cpp
${CMAKE_CURRENT_LIST_DIR}/redGrapes/dispatch/thread/execute.cpp
${CMAKE_CURRENT_LIST_DIR}/redGrapes/dispatch/thread/cpuset.cpp
${CMAKE_CURRENT_LIST_DIR}/redGrapes/dispatch/thread/worker.cpp
${CMAKE_CURRENT_LIST_DIR}/redGrapes/dispatch/thread/worker_pool.cpp
${CMAKE_CURRENT_LIST_DIR}/redGrapes/scheduler/event.cpp
${CMAKE_CURRENT_LIST_DIR}/redGrapes/scheduler/event_ptr.cpp
${CMAKE_CURRENT_LIST_DIR}/redGrapes/scheduler/default_scheduler.cpp
${CMAKE_CURRENT_LIST_DIR}/redGrapes/task/property/graph.cpp
${CMAKE_CURRENT_LIST_DIR}/redGrapes/task/task_space.cpp
${CMAKE_CURRENT_LIST_DIR}/redGrapes/task/queue.cpp
${CMAKE_CURRENT_LIST_DIR}/redGrapes/memory/allocator.cpp
${CMAKE_CURRENT_LIST_DIR}/redGrapes/memory/bump_allocator.cpp
${CMAKE_CURRENT_LIST_DIR}/redGrapes/sync/cv.cpp
${CMAKE_CURRENT_LIST_DIR}/redGrapes/util/trace.cpp
${CMAKE_CURRENT_LIST_DIR}/redGrapes/redGrapes.cpp
)
target_compile_features(redGrapes PUBLIC cxx_std_${redGrapes_CXX_STANDARD})
endif()

target_include_directories(redGrapes PUBLIC
$<BUILD_INTERFACE:${redGrapes_SOURCE_DIR}>
Expand All @@ -77,7 +82,6 @@ target_link_libraries(redGrapes PUBLIC spdlog::spdlog)
target_link_libraries(redGrapes PUBLIC ${HWLOC})

set(redGrapes_INCLUDE_DIRS ${redGrapes_CONFIG_INCLUDE_DIR} ${CMAKE_CURRENT_LIST_DIR})
set(redGrapes_INCLUDE_DIRS ${redGrapes_INCLUDE_DIRS} "${CMAKE_CURRENT_LIST_DIR}/share/thirdParty/akrzemi/optional/include")
set(redGrapes_INCLUDE_DIRS ${redGrapes_INCLUDE_DIRS} "${CMAKE_CURRENT_LIST_DIR}/share/thirdParty/cameron314/concurrentqueue/include")
set(redGrapes_INCLUDE_DIRS ${redGrapes_INCLUDE_DIRS} ${HWLOC_INCLUDE_DIR})

Expand Down
Loading
Loading