Arcane  v3.14.10.0
Documentation développeur
Chargement...
Recherche...
Aucune correspondance
HyodaPapi.cc
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 * HyodaProf.cc (C) 2000-2013 *
9 *****************************************************************************/
10#include "arcane/IMesh.h"
11#include "arcane/IApplication.h"
12#include "arcane/IParallelMng.h"
13#include "arcane/ISubDomain.h"
14#include "arcane/IServiceLoader.h"
15#include "arcane/IServiceMng.h"
16#include "arcane/ServiceRegisterer.h"
17#include "arcane/IServiceFactory.h"
18#include "arcane/ServiceBuilder.h"
19#include "arcane/AbstractService.h"
20
21#include "arcane/utils/String.h"
23#include "arcane/utils/ITraceMng.h"
24#include "arcane/utils/IProfilingService.h"
25#include "arcane/utils/PlatformUtils.h"
26
27#include "arcane/std/ProfilingInfo.h"
28#if 0
29#include <set>
30#ifdef ARCANE_HAS_PACKAGE_LIBUNWIND
31#define UNW_LOCAL_ONLY
32#include <libunwind.h>
33#include <stdio.h>
34#endif
35#ifdef __GNUG__
36#include <cxxabi.h>
37#endif
38#if defined(ARCANE_OS_LINUX)
39#define ARCANE_CHECK_MEMORY_USE_MALLOC_HOOK
40#include <execinfo.h>
41#include <dlfcn.h>
42#endif
43#endif
44
45#include <arcane/hyoda/Hyoda.h>
46#include <arcane/hyoda/HyodaArc.h>
47#include <arcane/hyoda/HyodaTcp.h>
48#include <arcane/hyoda/HyodaPapi.h>
49
50/*---------------------------------------------------------------------------*/
51/*---------------------------------------------------------------------------*/
52
53ARCANE_BEGIN_NAMESPACE
54
55/*---------------------------------------------------------------------------*/
56/*---------------------------------------------------------------------------*/
57
58HyodaPapi::
59HyodaPapi(Hyoda *hd,IApplication *app,ITraceMng *tm):
60 TraceAccessor(tm),
61 m_hyoda(hd),
62 m_app(app),
63 m_sub_domain(NULL),
64 m_papi(NULL),
65 m_tcp(NULL){
66}
67
68HyodaPapi::~HyodaPapi()
69{
70 if (!m_papi)
71 return;
72 m_papi->stopProfiling();
73 debug()<<"\33[7m[HyodaPapi::~HyodaPapi]\33[m";
74 delete m_papi;
75 //m_papi->printInfos(false);
76}
77
78
79void HyodaPapi::initialize(ISubDomain *sd, HyodaTcp *tcp)
80{
81 if (m_papi){
82 ServiceBuilder<IProfilingService> sb(m_app);
83 m_papi = sb.createInstance("PapiProfilingService", SB_AllowNull);
84 }
85 if (!m_papi) return;
86 m_sub_domain=sd;
87 m_tcp=tcp;
88 debug()<<"\33[7m[HyodaPapi::HyodaPapi] PAPI INIitializes\33[m";
89 m_papi->initialize();
90}
91
92void HyodaPapi::start(void){
93 if (!m_papi) return;
94 debug()<<"\33[7m[HyodaPapi::HyodaPapi] PAPI STARTS profiling\33[m";
95 m_papi->startProfiling();
96}
97
98void HyodaPapi::stop(void){
99 if (!m_papi) return;
100 debug()<<"\33[7m[HyodaPapi::HyodaPapi] PAPI STOPS profiling\33[m";
101 m_papi->stopProfiling();
102}
103
104
105// ****************************************************************************
106// * PAPI_TOT_CYC 0x8000003b Yes No Total cycles
107// * PAPI_RES_STL 0x80000039 Yes No Cycles stalled on any resource
108// * PAPI_FP_INS 0x80000034 Yes No Floating point instructions
109// ****************************************************************************
110void HyodaPapi::dump(void){
111 if (!m_papi) return;
112 pkt.clear();
113 pkt.add((Int64)0xb80dd1a3ul); // Header
114 pkt.add((Int64)0); // Size
115 //m_papi->printInfos();
116 m_papi->getInfos(pkt);
117 debug()<<"\33[7m[HyodaPapi::dump] pkt size is "<<pkt.size()<<"\33[m";
118 pkt[1]=pkt.size()-1;
119 // Seul, le rang zéro s'occupe du packet
120 if (m_sub_domain->parallelMng()->commRank()!=0) return;
121 m_tcp->send((char*)pkt.unguardedBasePointer(), pkt.size()<<3);
122 m_tcp->waitForAcknowledgment();
123}
124
125/*---------------------------------------------------------------------------*/
126/*---------------------------------------------------------------------------*/
127
128ARCANE_END_NAMESPACE
129
130/*---------------------------------------------------------------------------*/
131/*---------------------------------------------------------------------------*/
Fichier de configuration d'Arcane.
Lecteur des fichiers de maillage via la bibliothèque LIMA.
Definition Lima.cc:120