Line data Source code
1 1 : // Distributed under the MIT License.
2 : // See LICENSE.txt for details.
3 :
4 : /// \file
5 : /// This file should be included in each file which defines a singleton
6 : /// parallel component; doing so ensures that the correct charm++ chares are
7 : /// defined for executables that use that parallel component.
8 :
9 : #pragma once
10 :
11 : #include "Parallel/Algorithms/AlgorithmSingletonDeclarations.hpp"
12 : #include "Parallel/ArrayIndex.hpp"
13 : #include "Parallel/DistributedObject.hpp"
14 :
15 : /*!
16 : * \ingroup ParallelGroup
17 : * \brief A Spectre algorithm object that wraps a single element charm++ array
18 : * chare.
19 : *
20 : * \details Charm++ does offer a distributed object called a singleton, however
21 : * we don't use this for a few reasons:
22 : *
23 : * 1. Charm++ singletons cannot be (easily) placed on particular processors.
24 : * Typically we will want singletons on their own processors.
25 : * 2. Charm++ singletons don't participate in load balancing.
26 : * 3. Charm++ singletons don't participate in checkpoint/restart when restarted
27 : * on a different number of procs.
28 : *
29 : * For implementation details, see AlgorithmArray.
30 : */
31 : template <typename ParallelComponent, typename SpectreArrayIndex>
32 1 : class AlgorithmSingleton
33 : : public Parallel::DistributedObject<
34 : ParallelComponent,
35 : typename ParallelComponent::phase_dependent_action_list> {
36 0 : using algorithm = Parallel::Algorithms::Singleton;
37 :
38 : public:
39 : using Parallel::DistributedObject<
40 : ParallelComponent, typename ParallelComponent::
41 : phase_dependent_action_list>::DistributedObject;
42 : };
43 :
44 0 : #define CK_TEMPLATES_ONLY
45 : #include "Parallel/Algorithms/AlgorithmSingleton.def.h"
46 : #undef CK_TEMPLATES_ONLY
|