Arcane  v3.14.10.0
Documentation développeur
Chargement...
Recherche...
Aucune correspondance
ArcaneThreadMisc.h
1// -*- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature -*-
2//-----------------------------------------------------------------------------
3// Copyright 2000-2022 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/* ArcaneThreadMisc.h (C) 2000-2021 */
9/* */
10/* Fonctions diverses pour les threads. */
11/*---------------------------------------------------------------------------*/
12#ifndef ARCANE_PARALLEL_THREAD_ARCANETHREADMISC_H
13#define ARCANE_PARALLEL_THREAD_ARCANETHREADMISC_H
14/*---------------------------------------------------------------------------*/
15/*---------------------------------------------------------------------------*/
16
17#include "arcane/parallel/thread/ArcaneThread.h"
18
19#include <thread>
20
21#if defined(__x86_64__)
22#include <immintrin.h> // Pour _mm_pause()
23#endif
24
25/*---------------------------------------------------------------------------*/
26/*---------------------------------------------------------------------------*/
27
28namespace Arcane
29{
30
31/*---------------------------------------------------------------------------*/
32/*---------------------------------------------------------------------------*/
39inline void
40arcaneDoCPUPause(Int32 count)
41{
42 bool is_done = false;
43#if defined(__x86_64__)
44 while (count > 0) {
45 _mm_pause();
46 --count;
47 }
48 is_done = true;
49#elif defined (__aarch64__)
50 while (count > 0) {
51 __asm__ __volatile__("yield" ::: "memory");
52 --count;
53 }
54 is_done = true;
55#else
56 ARCANE_UNUSED(count);
57#endif
58 if (!is_done)
59 std::this_thread::yield();
60}
61
62/*---------------------------------------------------------------------------*/
63/*---------------------------------------------------------------------------*/
64
65} // End namespace Arcane
66
67/*---------------------------------------------------------------------------*/
68/*---------------------------------------------------------------------------*/
69
70#endif
71
Lecteur des fichiers de maillage via la bibliothèque LIMA.
Definition Lima.cc:120
-*- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature -*-
void arcaneDoCPUPause(Int32 count)
Utilise l'instruction 'pause' du CPU si possible.