Arcane  v3.14.10.0
Documentation utilisateur
Chargement...
Recherche...
Aucune correspondance
Partitioner.cc
1// -*- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature -*-
2//-----------------------------------------------------------------------------
3// Copyright 2000-2023 CEA (www.cea.fr) IFPEN (www.ifpenergiesnouvelles.com)
4// See the top-level COPYRIGHT file for details.
5// SPDX-License-Identifier: Apache-2.0
6//-----------------------------------------------------------------------------
7/*---------------------------------------------------------------------------*/
8/* Partitioner.cc (C) 2000-2024 */
9/* */
10/* Algorithme de partitionnement de liste. */
11/*---------------------------------------------------------------------------*/
12/*---------------------------------------------------------------------------*/
13
14#include "arcane/accelerator/Partitioner.h"
15
16/*---------------------------------------------------------------------------*/
17/*---------------------------------------------------------------------------*/
18
19namespace Arcane::Accelerator::impl
20{
21
22/*---------------------------------------------------------------------------*/
23/*---------------------------------------------------------------------------*/
24
25GenericPartitionerBase::
26GenericPartitionerBase(const RunQueue& queue)
27: m_queue(queue)
28{
29}
30
31/*---------------------------------------------------------------------------*/
32/*---------------------------------------------------------------------------*/
33
34Int32 GenericPartitionerBase::
35_nbFirstPart() const
36{
37 m_queue.barrier();
38 return m_host_nb_list1_storage[0];
39}
40
41/*---------------------------------------------------------------------------*/
42/*---------------------------------------------------------------------------*/
43
44SmallSpan<const Int32> GenericPartitionerBase::
45_nbParts() const
46{
47 m_queue.barrier();
48 return m_host_nb_list1_storage.to1DSmallSpan();
49}
50
51/*---------------------------------------------------------------------------*/
52/*---------------------------------------------------------------------------*/
53
54void GenericPartitionerBase::
55_allocate()
56{
57 eMemoryRessource r = eMemoryRessource::HostPinned;
58 if (m_host_nb_list1_storage.memoryRessource() != r)
59 m_host_nb_list1_storage = NumArray<Int32, MDDim1>(r);
60 // Il faut deux valeurs pour la version qui décompose la liste en trois
61 // parties
62 m_host_nb_list1_storage.resize(2);
63}
64
65/*---------------------------------------------------------------------------*/
66/*---------------------------------------------------------------------------*/
67
68} // namespace Arcane::Accelerator::impl
69
70/*---------------------------------------------------------------------------*/
71/*---------------------------------------------------------------------------*/
eMemoryRessource
Liste des ressources mémoire disponibles.