diff --git a/docs/CMakeLists.txt b/docs/CMakeLists.txt index 423b44a49c63..e839b0b9c8fb 100644 --- a/docs/CMakeLists.txt +++ b/docs/CMakeLists.txt @@ -58,7 +58,6 @@ set(doxygen_dependencies "${PROJECT_SOURCE_DIR}/hpx/lcos/when_some.hpp" "${PROJECT_SOURCE_DIR}/hpx/lcos/wait_each.hpp" "${PROJECT_SOURCE_DIR}/hpx/lcos/when_each.hpp" - "${PROJECT_SOURCE_DIR}/hpx/util/checkpoint.hpp" "${PROJECT_SOURCE_DIR}/hpx/util/debugging.hpp" "${PROJECT_SOURCE_DIR}/hpx/util/pack_traversal.hpp" "${PROJECT_SOURCE_DIR}/hpx/util/pack_traversal_async.hpp" @@ -260,6 +259,8 @@ create_symbolic_link("${PROJECT_SOURCE_DIR}/examples" "${CMAKE_CURRENT_BINARY_DIR}/examples") create_symbolic_link("${PROJECT_SOURCE_DIR}/tests" "${CMAKE_CURRENT_BINARY_DIR}/tests") +create_symbolic_link("${PROJECT_SOURCE_DIR}/libs" + "${CMAKE_CURRENT_BINARY_DIR}/libs") hpx_source_to_doxygen(hpx_autodoc DEPENDENCIES ${doxygen_dependencies}) diff --git a/docs/sphinx/manual/miscellaneous.rst b/docs/sphinx/manual/miscellaneous.rst index bdcf32005dd5..e96845369748 100644 --- a/docs/sphinx/manual/miscellaneous.rst +++ b/docs/sphinx/manual/miscellaneous.rst @@ -150,133 +150,6 @@ Utilities in |hpx| In order to ease the burden of programming in |hpx| we have provided several utilities to users. The following section documents those facilies. -.. _checkpoint: - -Checkpoint ----------- - -A common need of users is to periodically backup an application. This practice -provides resiliency and potential restart points in code. We have developed the -concept of a ``checkpoint`` to support this use case. - -Found in ``hpx/util/checkpoint.hpp``, ``checkpoint``\ s are defined as objects -which hold a serialized version of an object or set of objects at a particular -moment in time. This representation can be stored in memory for later use or it -can be written to disk for storage and/or recovery at a later point. In order to -create and fill this object with data we use a function called -``save_checkpoint``. In code the function looks like this:: - - hpx::future hpx::util::save_checkpoint(a, b, c, ...); - -``save_checkpoint`` takes arbitrary data containers such as int, double, float, -vector, and future and serializes them into a newly created ``checkpoint`` -object. This function returns a ``future`` to a ``checkpoint`` containing the -data. Let us look a simple use case below:: - - using hpx::util::checkpoint; - using hpx::util::save_checkpoint; - - std::vector vec{1,2,3,4,5}; - hpx::future save_checkpoint(vec); - -Once the future is ready the checkpoint object will contain the ``vector`` -``vec`` and its five elements. - -It is also possible to modify the launch policy used by ``save_checkpoint``. -This is accomplished by passing a launch policy as the first argument. It is -important to note that passing ``hpx::launch::sync`` will cause -``save_checkpoint`` to return a ``checkpoint`` instead of a ``future`` to a -``checkpoint``. All other policies passed to ``save_checkpoint`` will return a -``future`` to a ``checkpoint``. - -Sometimes ``checkpoint`` s must be declared before they are used. -``save_checkpoint`` allows users to move pre-created ``checkpoint`` s into the -function as long as they are the first container passing into the function (In -the case where a launch policy is used, the ``checkpoint`` will immediately -follow the launch policy). An example of these features can be found below: - -.. literalinclude:: ../../tests/unit/util/checkpoint.cpp - :language: c++ - :lines: 27-38 - -Now that we can create ``checkpoint`` s we now must be able to restore the -objects they contain into memory. This is accomplished by the function -``restore_checkpoint``. This function takes a ``checkpoint`` and fills its data -into the containers it is provided. It is important to remember that the -containers must be ordered in the same way they were placed into the -``checkpoint``. For clarity see the example below: - -.. literalinclude:: ../../tests/unit/util/checkpoint.cpp - :language: c++ - :lines: 41-49 - -The core utility of ``checkpoint`` is in its ability to make certain data -persistent. Often this means that the data is needed to be stored in an object, -such as a file, for later use. For these cases we have provided two solutions: -stream operator overloads and access iterators. - -We have created the two stream overloads -``operator<<`` and ``operator>>`` to stream data -out of and into ``checkpoint``. You can see an -example of the overloads in use below: - -.. literalinclude:: ../../tests/unit/util/checkpoint.cpp - :language: c++ - :lines: 176-186 - -This is the primary way to move data into and out of a ``checkpoint``. It is -important to note, however, that users should be cautious when using a stream -operator to load data an another function to remove it (or vice versa). Both -``operator<<`` and ``operator>>`` rely on a ``.write()`` and a ``.read()`` -function respectively. In order to know how much data to read from the -``std::istream``, the ``operator<<`` will write the size of the ``checkpoint`` -before writing the ``checkpoint`` data. Correspondingly, the ``operator>>`` will -read the size of the stored data before reading the data into new instance of -``checkpoint``. As long as the user employs the ``operator<<`` and -``operator>>`` to stream the data this detail can be ignored. - -.. important:: - - Be careful when mixing ``operator<<`` and ``operator>>`` with other - facilities to read and write to a ``checkpoint``. ``operator<<`` writes and - extra variable and ``operator>>`` reads this variable back separately. Used - together the user will not encounter any issues and can safely ignore this - detail. - -Users may also move the data into and out of a ``checkpoint`` using the exposed -``.begin()`` and ``.end()`` iterators. An example of this use case is -illustrated below. - -.. literalinclude:: ../../tests/unit/util/checkpoint.cpp - :language: c++ - :lines: 129-150 - -Checkpointing Components ------------------------- - -``save_checkpoint`` and ``restore_checkpoint`` are also able to store components -inside ``checkpoint``s. This can be done in one of two ways. First a client of -the component can be passed to ``save_checkpoint``. When the user wishes to -resurrect the component she can pass a client instance to ``restore_checkpoint``. - -This technique is demonstrated below: - -.. literalinclude:: ../../tests/unit/util/checkpoint.cpp - :language: c++ - :lines: 143-144 - -The second way a user can save a component is by passing a ``shared_ptr`` to the -component to ``save_checkpoint``. This component can be resurrected by creating -a new instance of the component type and passing a ``shared_ptr`` to the new -instance to ``restore_checkpoint``. An example can be found below: - -This technique is demonstrated below: - -.. literalinclude:: ../../tests/unit/util/checkpoint.cpp - :language: c++ - :lines: 113-126 - - .. _iostreams: The |hpx| I/O-streams component diff --git a/examples/1d_stencil/CMakeLists.txt b/examples/1d_stencil/CMakeLists.txt index 4e337a52e1c6..1b78efd6f639 100644 --- a/examples/1d_stencil/CMakeLists.txt +++ b/examples/1d_stencil/CMakeLists.txt @@ -10,7 +10,6 @@ set(example_programs 1d_stencil_2 1d_stencil_3 1d_stencil_4 - 1d_stencil_4_checkpoint 1d_stencil_4_parallel 1d_stencil_5 1d_stencil_6 @@ -42,7 +41,6 @@ set(1d_stencil_1_PARAMETERS THREADS_PER_LOCALITY 4) set(1d_stencil_2_PARAMETERS THREADS_PER_LOCALITY 4) set(1d_stencil_3_PARAMETERS THREADS_PER_LOCALITY 4) set(1d_stencil_4_PARAMETERS THREADS_PER_LOCALITY 4) -set(1d_stencil_4_checkpoint_PARAMETERS THREADS_PER_LOCALITY 4) set(1d_stencil_4_parallel_PARAMETERS THREADS_PER_LOCALITY 4) set(1d_stencil_5_PARAMETERS THREADS_PER_LOCALITY 4) set(1d_stencil_6_PARAMETERS THREADS_PER_LOCALITY 4) diff --git a/libs/CMakeLists.txt b/libs/CMakeLists.txt index 37ed3b2c510e..9bf57d0f73a0 100644 --- a/libs/CMakeLists.txt +++ b/libs/CMakeLists.txt @@ -16,6 +16,7 @@ set(HPX_LIBS assertion basic_execution cache + checkpoint collectives compute compute_cuda @@ -104,6 +105,7 @@ foreach(lib ${HPX_LIBS}) set(MODULE_FORCE_LINKING_INCLUDES "${MODULE_FORCE_LINKING_INCLUDES}#include \n") + set(MODULE_FORCE_LINKING_CALLS "${MODULE_FORCE_LINKING_CALLS}\n ${lib}::force_linking();") @@ -114,9 +116,9 @@ foreach(lib ${HPX_LIBS}) endforeach() configure_file( - "${PROJECT_SOURCE_DIR}/cmake/templates/modules.cpp.in" - "${CMAKE_BINARY_DIR}/libs/modules.cpp" - @ONLY) + "${PROJECT_SOURCE_DIR}/cmake/templates/modules.cpp.in" + "${CMAKE_BINARY_DIR}/libs/modules.cpp" + @ONLY) configure_file( "${PROJECT_SOURCE_DIR}/cmake/templates/config_defines_strings_modules.hpp.in" diff --git a/libs/all_modules.rst b/libs/all_modules.rst index 471e10dbf6d3..d2802125c5ff 100644 --- a/libs/all_modules.rst +++ b/libs/all_modules.rst @@ -19,6 +19,7 @@ All modules /libs/assertion/docs/index.rst /libs/basic_execution/docs/index.rst /libs/cache/docs/index.rst + /libs/checkpoint/docs/index.rst /libs/collectives/docs/index.rst /libs/compute/docs/index.rst /libs/compute_cuda/docs/index.rst diff --git a/libs/checkpoint/CMakeLists.txt b/libs/checkpoint/CMakeLists.txt new file mode 100644 index 000000000000..bcccf80778bb --- /dev/null +++ b/libs/checkpoint/CMakeLists.txt @@ -0,0 +1,34 @@ +# Copyright (c) 2019 The STE||AR-Group +# +# SPDX-License-Identifier: BSL-1.0 +# Distributed under the Boost Software License, Version 1.0. (See accompanying +# file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + +cmake_minimum_required(VERSION 3.3.2 FATAL_ERROR) + +list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake") + +# Default location is $HPX_ROOT/libs/checkpoint/include +set(checkpoint_headers + hpx/checkpoint/checkpoint.hpp + ) + +# Default location is $HPX_ROOT/libs/checkpoint/include_compatibility +set(checkpoint_compat_headers + hpx/util/checkpoint.hpp + ) + +set(checkpoint_sources) + +include(HPX_AddModule) +add_hpx_module(checkpoint + COMPATIBILITY_HEADERS ON + DEPRECATION_WARNINGS + FORCE_LINKING_GEN + GLOBAL_HEADER_GEN ON + SOURCES ${checkpoint_sources} + HEADERS ${checkpoint_headers} + COMPAT_HEADERS ${checkpoint_compat_headers} + DEPENDENCIES hpx_serialization + CMAKE_SUBDIRS examples tests +) diff --git a/libs/checkpoint/README.rst b/libs/checkpoint/README.rst new file mode 100644 index 000000000000..9ae912824102 --- /dev/null +++ b/libs/checkpoint/README.rst @@ -0,0 +1,16 @@ + +.. + Copyright (c) 2019 The STE||AR-Group + + SPDX-License-Identifier: BSL-1.0 + Distributed under the Boost Software License, Version 1.0. (See accompanying + file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + +========== +checkpoint +========== + +This library is part of HPX. + +Documentation can be found `here +`__. diff --git a/libs/checkpoint/docs/index.rst b/libs/checkpoint/docs/index.rst new file mode 100644 index 000000000000..ac81f5ae9b13 --- /dev/null +++ b/libs/checkpoint/docs/index.rst @@ -0,0 +1,136 @@ +.. + Copyright (c) 2019 The STE||AR-Group + + SPDX-License-Identifier: BSL-1.0 + Distributed under the Boost Software License, Version 1.0. (See accompanying + file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + +.. _libs_checkpoint: + +========== +checkpoint +========== + +A common need of users is to periodically backup an application. This practice +provides resiliency and potential restart points in code. We have developed the +concept of a ``checkpoint`` to support this use case. + +Found in ``hpx/util/checkpoint.hpp``, ``checkpoint``\ s are defined as objects +which hold a serialized version of an object or set of objects at a particular +moment in time. This representation can be stored in memory for later use or it +can be written to disk for storage and/or recovery at a later point. In order to +create and fill this object with data we use a function called +``save_checkpoint``. In code the function looks like this:: + + hpx::future hpx::util::save_checkpoint(a, b, c, ...); + +``save_checkpoint`` takes arbitrary data containers such as int, double, float, +vector, and future and serializes them into a newly created ``checkpoint`` +object. This function returns a ``future`` to a ``checkpoint`` containing the +data. Let us look a simple use case below:: + + using hpx::util::checkpoint; + using hpx::util::save_checkpoint; + + std::vector vec{1,2,3,4,5}; + hpx::future save_checkpoint(vec); + +Once the future is ready the checkpoint object will contain the ``vector`` +``vec`` and its five elements. + +It is also possible to modify the launch policy used by ``save_checkpoint``. +This is accomplished by passing a launch policy as the first argument. It is +important to note that passing ``hpx::launch::sync`` will cause +``save_checkpoint`` to return a ``checkpoint`` instead of a ``future`` to a +``checkpoint``. All other policies passed to ``save_checkpoint`` will return a +``future`` to a ``checkpoint``. + +Sometimes ``checkpoint`` s must be declared before they are used. +``save_checkpoint`` allows users to move pre-created ``checkpoint`` s into the +function as long as they are the first container passing into the function (In +the case where a launch policy is used, the ``checkpoint`` will immediately +follow the launch policy). An example of these features can be found below: + +.. literalinclude:: ../../../../libs/tests/unit/checkpoint.cpp + :language: c++ + :lines: 27-38 + +Now that we can create ``checkpoint`` s we now must be able to restore the +objects they contain into memory. This is accomplished by the function +``restore_checkpoint``. This function takes a ``checkpoint`` and fills its data +into the containers it is provided. It is important to remember that the +containers must be ordered in the same way they were placed into the +``checkpoint``. For clarity see the example below: + +.. literalinclude:: ../../../../libs/tests/unit/checkpoint.cpp + :language: c++ + :lines: 41-49 + +The core utility of ``checkpoint`` is in its ability to make certain data +persistent. Often this means that the data is needed to be stored in an object, +such as a file, for later use. For these cases we have provided two solutions: +stream operator overloads and access iterators. + +We have created the two stream overloads +``operator<<`` and ``operator>>`` to stream data +out of and into ``checkpoint``. You can see an +example of the overloads in use below: + +.. literalinclude:: ../../../../libs/tests/unit/checkpoint.cpp + :language: c++ + :lines: 176-186 + +This is the primary way to move data into and out of a ``checkpoint``. It is +important to note, however, that users should be cautious when using a stream +operator to load data an another function to remove it (or vice versa). Both +``operator<<`` and ``operator>>`` rely on a ``.write()`` and a ``.read()`` +function respectively. In order to know how much data to read from the +``std::istream``, the ``operator<<`` will write the size of the ``checkpoint`` +before writing the ``checkpoint`` data. Correspondingly, the ``operator>>`` will +read the size of the stored data before reading the data into new instance of +``checkpoint``. As long as the user employs the ``operator<<`` and +``operator>>`` to stream the data this detail can be ignored. + +.. important:: + + Be careful when mixing ``operator<<`` and ``operator>>`` with other + facilities to read and write to a ``checkpoint``. ``operator<<`` writes and + extra variable and ``operator>>`` reads this variable back separately. Used + together the user will not encounter any issues and can safely ignore this + detail. + +Users may also move the data into and out of a ``checkpoint`` using the exposed +``.begin()`` and ``.end()`` iterators. An example of this use case is +illustrated below. + +.. literalinclude:: ../../../../libs/tests/unit/checkpoint.cpp + :language: c++ + :lines: 129-150 + +Checkpointing Components +------------------------ + +``save_checkpoint`` and ``restore_checkpoint`` are also able to store components +inside ``checkpoint``s. This can be done in one of two ways. First a client of +the component can be passed to ``save_checkpoint``. When the user wishes to +resurrect the component she can pass a client instance to ``restore_checkpoint``. + +This technique is demonstrated below: + +.. literalinclude:: ../../../../libs/tests/unit/checkpoint.cpp + :language: c++ + :lines: 143-144 + +The second way a user can save a component is by passing a ``shared_ptr`` to the +component to ``save_checkpoint``. This component can be resurrected by creating +a new instance of the component type and passing a ``shared_ptr`` to the new +instance to ``restore_checkpoint``. An example can be found below: + +This technique is demonstrated below: + +.. literalinclude:: ../../../../libs/tests/unit/checkpoint.cpp + :language: c++ + :lines: 113-126 + + + diff --git a/examples/1d_stencil/1d_stencil_4_checkpoint.cpp b/libs/checkpoint/examples/1d_stencil_4_checkpoint.cpp similarity index 97% rename from examples/1d_stencil/1d_stencil_4_checkpoint.cpp rename to libs/checkpoint/examples/1d_stencil_4_checkpoint.cpp index 2388464b9021..3cb2866cacd5 100644 --- a/examples/1d_stencil/1d_stencil_4_checkpoint.cpp +++ b/libs/checkpoint/examples/1d_stencil_4_checkpoint.cpp @@ -17,16 +17,15 @@ // scalability on SMP machines. // // In this variation of stencil we use the save_checkpoint and -// revive_checkpint functions to back up the state of the applicaton -// every n timesteps. +// revive_checkpint functions to back up the state of the application +// every n time steps. // #include #include -#include +#include #include -#include #include @@ -176,7 +175,7 @@ struct backup } else { - hpx::cout << "Error opening file!" << std::endl; + std::cout << "Error opening file!" << std::endl; } file_archive.close(); } @@ -274,11 +273,12 @@ struct stepper using hpx::dataflow; using hpx::util::unwrapping; - // Set up Checkpointing - std::size_t num_c = nt / cp; //Number of checkpoints to be made - hpx::cout << "Number of checkpoints to be made: " << num_c << std::endl; + // Set up Check-pointing + std::size_t num_c = nt / cp; // Number of checkpoints to be made + std::cout << "Number of checkpoints to be made: " << num_c << std::endl; std::vector v_file_names(num_c, fn); std::vector container; + // Initialize checkpoint file names for (std::size_t i = 0; i < num_c; i++) { @@ -286,6 +286,7 @@ struct stepper v_file_names[i] + "_" + std::to_string((i + 1) * cp); container.push_back(backup(v_file_names[i], np)); } + // Container to wait on all held futures std::vector> backup_complete; diff --git a/libs/checkpoint/examples/CMakeLists.txt b/libs/checkpoint/examples/CMakeLists.txt new file mode 100644 index 000000000000..175d5835e094 --- /dev/null +++ b/libs/checkpoint/examples/CMakeLists.txt @@ -0,0 +1,44 @@ +# Copyright (c) 2019 The STE||AR-Group +# +# SPDX-License-Identifier: BSL-1.0 +# Distributed under the Boost Software License, Version 1.0. (See accompanying +# file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + +if (HPX_WITH_EXAMPLES) + add_hpx_pseudo_target(examples.modules.checkpoint) + add_hpx_pseudo_dependencies(examples.modules examples.modules.checkpoint) + if (HPX_WITH_TESTS AND HPX_WITH_TESTS_EXAMPLES AND HPX_CHECKPOINT_WITH_TESTS) + add_hpx_pseudo_target(tests.examples.modules.checkpoint) + add_hpx_pseudo_dependencies(tests.examples.modules tests.examples.modules.checkpoint) + endif() +else() + return() +endif() + +set(example_programs) + +set(example_programs ${example_programs} + 1d_stencil_4_checkpoint + ) + +set(1d_stencil_4_checkpoint_PARAMETERS THREADS_PER_LOCALITY 4) + +foreach(example_program ${example_programs}) + set(sources + ${example_program}.cpp) + + source_group("Source Files" FILES ${sources}) + + # add example executable + add_hpx_executable(${example_program} + INTERNAL_FLAGS + SOURCES ${sources} + ${${example_program}_FLAGS} + FOLDER "Examples/Modules/Checkpoint") + + add_hpx_example_target_dependencies("modules.checkpoint" ${example_program}) + + if(HPX_WITH_TESTS AND HPX_WITH_TESTS_EXAMPLES) + add_hpx_example_test("modules.checkpoint" ${example_program} ${${example_program}_PARAMETERS}) + endif() +endforeach() diff --git a/libs/checkpoint/examples/print_time_results.hpp b/libs/checkpoint/examples/print_time_results.hpp new file mode 100644 index 000000000000..8e078e754306 --- /dev/null +++ b/libs/checkpoint/examples/print_time_results.hpp @@ -0,0 +1,76 @@ +// Copyright (c) 2014 Hartmut Kaiser +// Copyright (c) 2014 Patricia Grubel +// +// SPDX-License-Identifier: BSL-1.0 +// Distributed under the Boost Software License, Version 1.0. (See accompanying +// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + +#ifndef HPX_STENCIL_PRINT_TIME_HPP +#define HPX_STENCIL_PRINT_TIME_HPP + +#include + +#include +#include +#include +#include + +/////////////////////////////////////////////////////////////////////////////// +void print_time_results(std::uint32_t num_localities, + std::uint64_t num_os_threads, std::uint64_t elapsed, std::uint64_t nx, + std::uint64_t np, std::uint64_t nt, bool header) +{ + if (header) + std::cout << "Localities,OS_Threads,Execution_Time_sec," + "Points_per_Partition,Partitions,Time_Steps\n" + << std::flush; + + std::string const locs_str = hpx::util::format("{},", num_localities); + std::string const threads_str = hpx::util::format("{},", num_os_threads); + std::string const nx_str = hpx::util::format("{},", nx); + std::string const np_str = hpx::util::format("{},", np); + std::string const nt_str = hpx::util::format("{} ", nt); + + hpx::util::format_to(std::cout, + "{:-6} {:-6} {:.14g}, {:-21} {:-21} {:-21}\n", locs_str, threads_str, + elapsed / 1e9, nx_str, np_str, nt_str) + << std::flush; +} + +/////////////////////////////////////////////////////////////////////////////// +void print_time_results(std::uint64_t num_os_threads, std::uint64_t elapsed, + std::uint64_t nx, std::uint64_t np, std::uint64_t nt, bool header) +{ + if (header) + std::cout << "OS_Threads,Execution_Time_sec," + "Points_per_Partition,Partitions,Time_Steps\n" + << std::flush; + + std::string const threads_str = hpx::util::format("{},", num_os_threads); + std::string const nx_str = hpx::util::format("{},", nx); + std::string const np_str = hpx::util::format("{},", np); + std::string const nt_str = hpx::util::format("{} ", nt); + + hpx::util::format_to(std::cout, "{:-21} {:.14g}, {:-21} {:-21} {:-21}\n", + threads_str, elapsed / 1e9, nx_str, np_str, nt_str) + << std::flush; +} + +void print_time_results(std::uint64_t num_os_threads, std::uint64_t elapsed, + std::uint64_t nx, std::uint64_t nt, bool header) +{ + if (header) + std::cout << "OS_Threads,Execution_Time_sec," + "Grid_Points,Time_Steps\n" + << std::flush; + + std::string const threads_str = hpx::util::format("{},", num_os_threads); + std::string const nx_str = hpx::util::format("{},", nx); + std::string const nt_str = hpx::util::format("{} ", nt); + + hpx::util::format_to(std::cout, "{:-21} {:10.12}, {:-21} {:-21}\n", + threads_str, elapsed / 1e9, nx_str, nt_str) + << std::flush; +} + +#endif diff --git a/hpx/util/checkpoint.hpp b/libs/checkpoint/include/hpx/checkpoint/checkpoint.hpp similarity index 100% rename from hpx/util/checkpoint.hpp rename to libs/checkpoint/include/hpx/checkpoint/checkpoint.hpp diff --git a/libs/checkpoint/include_compatibility/hpx/util/checkpoint.hpp b/libs/checkpoint/include_compatibility/hpx/util/checkpoint.hpp new file mode 100644 index 000000000000..b283f240895c --- /dev/null +++ b/libs/checkpoint/include_compatibility/hpx/util/checkpoint.hpp @@ -0,0 +1,19 @@ +// Copyright (c) 2019 Ste||ar Group +// +// SPDX-License-Identifier: BSL-1.0 +// Distributed under the Boost Software License, Version 1.0. (See accompanying +// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + +#include +#include +#include + +#if defined(HPX_CHECKPOINT_HAVE_DEPRECATION_WARNINGS) +#if defined(HPX_MSVC) +#pragma message("The header hpx/util/checkpoint.hpp is deprecated, \ + please include hpx/checkpoint/checkpoint.hpp instead") +#else +#warning "The header hpx/util/checkpoint.hpp is deprecated, \ + please include hpx/checkpoint/checkpoint.hpp instead" +#endif +#endif diff --git a/libs/checkpoint/tests/CMakeLists.txt b/libs/checkpoint/tests/CMakeLists.txt new file mode 100644 index 000000000000..d8861f790966 --- /dev/null +++ b/libs/checkpoint/tests/CMakeLists.txt @@ -0,0 +1,43 @@ +# Copyright (c) 2019 The STE||AR-Group +# +# SPDX-License-Identifier: BSL-1.0 +# Distributed under the Boost Software License, Version 1.0. (See accompanying +# file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + +include(HPX_Message) +include(HPX_Option) + +if (NOT HPX_WITH_TESTS AND HPX_TOP_LEVEL) + hpx_set_option(HPX_CHECKPOINT_WITH_TESTS VALUE OFF FORCE) + return() +endif() +if (NOT HPX_CHECKPOINT_WITH_TESTS) + hpx_info(" Tests for checkpoint disabled") + return() +endif() + +if (HPX_WITH_TESTS_UNIT) + add_hpx_pseudo_target(tests.unit.modules.checkpoint) + add_hpx_pseudo_dependencies(tests.unit.modules tests.unit.modules.checkpoint) + add_subdirectory(unit) +endif() + +if (HPX_WITH_TESTS_REGRESSIONS) + add_hpx_pseudo_target(tests.regressions.modules.checkpoint) + add_hpx_pseudo_dependencies(tests.regressions.modules tests.regressions.modules.checkpoint) + add_subdirectory(regressions) +endif() + +if (HPX_WITH_TESTS_BENCHMARKS) + add_hpx_pseudo_target(tests.performance.modules.checkpoint) + add_hpx_pseudo_dependencies(tests.performance.modules tests.performance.modules.checkpoint) + add_subdirectory(performance) +endif() + +if (HPX_WITH_TESTS_HEADERS) + add_hpx_header_tests( + modules.checkpoint + HEADERS ${checkpoint_headers} + HEADER_ROOT ${PROJECT_SOURCE_DIR}/include + DEPENDENCIES hpx_checkpoint) +endif() diff --git a/libs/checkpoint/tests/performance/CMakeLists.txt b/libs/checkpoint/tests/performance/CMakeLists.txt new file mode 100644 index 000000000000..e050627465c9 --- /dev/null +++ b/libs/checkpoint/tests/performance/CMakeLists.txt @@ -0,0 +1,5 @@ +# Copyright (c) 2019 The STE||AR-Group +# +# SPDX-License-Identifier: BSL-1.0 +# Distributed under the Boost Software License, Version 1.0. (See accompanying +# file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) diff --git a/libs/checkpoint/tests/regressions/CMakeLists.txt b/libs/checkpoint/tests/regressions/CMakeLists.txt new file mode 100644 index 000000000000..85718aa8464e --- /dev/null +++ b/libs/checkpoint/tests/regressions/CMakeLists.txt @@ -0,0 +1,6 @@ +# Copyright (c) 2019 The STE||AR-Group +# +# SPDX-License-Identifier: BSL-1.0 +# Distributed under the Boost Software License, Version 1.0. (See accompanying +# file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + diff --git a/libs/checkpoint/tests/unit/CMakeLists.txt b/libs/checkpoint/tests/unit/CMakeLists.txt new file mode 100644 index 000000000000..0ff6c80db4f3 --- /dev/null +++ b/libs/checkpoint/tests/unit/CMakeLists.txt @@ -0,0 +1,28 @@ +# Copyright (c) 2019 The STE||AR-Group +# +# SPDX-License-Identifier: BSL-1.0 +# Distributed under the Boost Software License, Version 1.0. (See accompanying +# file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + +set(tests + checkpoint + checkpoint_component +) + +foreach(test ${tests}) + set(sources ${test}.cpp) + + source_group("Source Files" FILES ${sources}) + + add_hpx_executable(${test}_test + INTERNAL_FLAGS + SOURCES ${sources} + ${${test}_FLAGS} + DEPENDENCIES hpx_checkpoint hpx_testing + EXCLUDE_FROM_ALL + FOLDER "Tests/Unit/Modules/Checkpoint/") + + add_hpx_unit_test("modules.checkpoint" ${test} ${${test}_PARAMETERS}) + +endforeach() + diff --git a/tests/unit/util/checkpoint.cpp b/libs/checkpoint/tests/unit/checkpoint.cpp similarity index 98% rename from tests/unit/util/checkpoint.cpp rename to libs/checkpoint/tests/unit/checkpoint.cpp index 4c75f2cfce13..7a6392b33de3 100644 --- a/tests/unit/util/checkpoint.cpp +++ b/libs/checkpoint/tests/unit/checkpoint.cpp @@ -9,8 +9,9 @@ // #include + +#include #include -#include #include #include @@ -224,5 +225,5 @@ int main() // Cleanup std::remove("test_file_10.txt"); - return 0; + return hpx::util::report_errors(); } diff --git a/tests/unit/util/checkpoint_component.cpp b/libs/checkpoint/tests/unit/checkpoint_component.cpp similarity index 97% rename from tests/unit/util/checkpoint_component.cpp rename to libs/checkpoint/tests/unit/checkpoint_component.cpp index 8d2b82f84f2f..15f4af9d897c 100644 --- a/tests/unit/util/checkpoint_component.cpp +++ b/libs/checkpoint/tests/unit/checkpoint_component.cpp @@ -8,13 +8,12 @@ // restore_checkpoint with components. #include + +#include #include -#include #include #include -#include -#include #include #include #include @@ -149,5 +148,5 @@ int main() HPX_TEST(D.get_data().get() == E.get_data().get()); - return 0; + return hpx::util::report_errors(); } diff --git a/libs/compute/tests/regressions/CMakeLists.txt b/libs/compute/tests/regressions/CMakeLists.txt index 90b800b884d6..f9d3aaf21d1e 100644 --- a/libs/compute/tests/regressions/CMakeLists.txt +++ b/libs/compute/tests/regressions/CMakeLists.txt @@ -24,7 +24,7 @@ foreach(test ${tests}) ${${test}_FLAGS} EXCLUDE_FROM_ALL HPX_PREFIX ${HPX_BUILD_PREFIX} - FOLDER "Tests/Regressions/Compute") + FOLDER "Tests/Regressions/Modules/Compute") target_include_directories(${test}_test SYSTEM PRIVATE ${CUDA_INCLUDE_DIRS}) add_hpx_regression_test("modules.compute" ${test} ${${test}_PARAMETERS}) diff --git a/libs/compute/tests/unit/CMakeLists.txt b/libs/compute/tests/unit/CMakeLists.txt index fa94f9b58304..530553beb20f 100644 --- a/libs/compute/tests/unit/CMakeLists.txt +++ b/libs/compute/tests/unit/CMakeLists.txt @@ -21,7 +21,7 @@ foreach(test ${tests}) ${${test}_FLAGS} EXCLUDE_FROM_ALL HPX_PREFIX ${HPX_BUILD_PREFIX} - FOLDER "Tests/Unit/Compute/Host") + FOLDER "Tests/Unit/Modules/Compute/Host") target_include_directories(${test}_test SYSTEM PRIVATE ${CUDA_INCLUDE_DIRS}) add_hpx_unit_test("modules.compute" ${test} ${${test}_PARAMETERS}) diff --git a/libs/compute_cuda/examples/CMakeLists.txt b/libs/compute_cuda/examples/CMakeLists.txt index b7c2b91aa0b9..e160e8e3834d 100644 --- a/libs/compute_cuda/examples/CMakeLists.txt +++ b/libs/compute_cuda/examples/CMakeLists.txt @@ -78,7 +78,7 @@ foreach(example_program ${example_programs}) INTERNAL_FLAGS SOURCES ${sources} ${${example_program}_FLAGS} - FOLDER "Examples/Compute/CUDA") + FOLDER "Examples/Modules/Compute/CUDA") add_hpx_example_target_dependencies("modules.compute_cuda" ${example_program}) diff --git a/libs/compute_cuda/tests/performance/CMakeLists.txt b/libs/compute_cuda/tests/performance/CMakeLists.txt index 8c06c49e585e..fdf9a9984850 100644 --- a/libs/compute_cuda/tests/performance/CMakeLists.txt +++ b/libs/compute_cuda/tests/performance/CMakeLists.txt @@ -29,7 +29,7 @@ foreach(benchmark ${benchmarks}) ${${benchmark}_FLAGS} EXCLUDE_FROM_ALL HPX_PREFIX ${HPX_BUILD_PREFIX} - FOLDER "Benchmarks/Modules/ComputeCuda") + FOLDER "Benchmarks/Modules/Compute/Cuda") add_hpx_performance_test("modules.compute_cuda" ${benchmark} ${${benchmark}_PARAMETERS}) endforeach() diff --git a/libs/compute_cuda/tests/unit/CMakeLists.txt b/libs/compute_cuda/tests/unit/CMakeLists.txt index a4b3e865d449..0fa05c6f1fd8 100644 --- a/libs/compute_cuda/tests/unit/CMakeLists.txt +++ b/libs/compute_cuda/tests/unit/CMakeLists.txt @@ -38,7 +38,7 @@ foreach(test ${tests}) ${${test}_FLAGS} EXCLUDE_FROM_ALL HPX_PREFIX ${HPX_BUILD_PREFIX} - FOLDER "Tests/Unit/Compute/CUDA") + FOLDER "Tests/Unit/Modules/Compute/CUDA") add_hpx_unit_test("modules.compute_cuda" ${test} ${${test}_PARAMETERS}) endforeach() diff --git a/libs/create_library_skeleton.py b/libs/create_library_skeleton.py index ca6126178d0d..cf4587eea312 100755 --- a/libs/create_library_skeleton.py +++ b/libs/create_library_skeleton.py @@ -69,8 +69,10 @@ list(APPEND CMAKE_MODULE_PATH "${{CMAKE_CURRENT_SOURCE_DIR}}/cmake") +# Default location is $HPX_ROOT/libs/{lib_name}/include set({lib_name}_headers) +# Default location is $HPX_ROOT/libs/{lib_name}/include_compatibility set({lib_name}_compat_headers) set({lib_name}_sources) diff --git a/tests/unit/util/CMakeLists.txt b/tests/unit/util/CMakeLists.txt index 696023350eb2..febec8185b19 100644 --- a/tests/unit/util/CMakeLists.txt +++ b/tests/unit/util/CMakeLists.txt @@ -7,8 +7,6 @@ set(tests any_serialization bind_action - checkpoint - checkpoint_component config_entry pack_traversal pack_traversal_async @@ -31,7 +29,6 @@ if(HWLOC_FOUND) set(parse_affinity_options_PARAMETERS THREADS_PER_LOCALITY 2) endif() -set(checkpoint_component_FLAGS COMPONENT_DEPENDENCIES iostreams) set(serialize_buffer_PARAMETERS LOCALITIES 2 THREADS_PER_LOCALITY 2) foreach(test ${tests})