QMCPACK
ScopedProfiler.h
Go to the documentation of this file.
1
#ifndef QMCPLUSPLUS_SCOPEDPROFILER_H
2
#define QMCPLUSPLUS_SCOPEDPROFILER_H
3
4
#include "config.h"
5
#if defined(ENABLE_CUDA) && !defined(QMC_CUDA2HIP)
6
#include "
CUDA/CUDAruntime.hpp
"
7
#include <cuda_profiler_api.h>
8
#endif
9
#ifdef USE_VTUNE_API
10
#include <ittnotify.h>
11
#endif
12
13
namespace
qmcplusplus
14
{
15
16
//non-nested
17
class
ScopedProfiler
18
{
19
public
:
20
ScopedProfiler
(
bool
active) :
active_
(active)
21
{
22
if
(
active_
)
23
{
24
#if defined(ENABLE_CUDA) && !defined(QMC_CUDA2HIP)
25
cudaErrorCheck
(cudaProfilerStart(),
"cudaProfilerStart failed!"
);
26
#endif
27
#ifdef USE_VTUNE_API
28
__itt_resume();
29
#endif
30
}
31
}
32
33
~ScopedProfiler
()
34
{
35
if
(
active_
)
36
{
37
#if defined(ENABLE_CUDA) && !defined(QMC_CUDA2HIP)
38
cudaErrorCheck
(cudaProfilerStop(),
"cudaProfilerStop failed!"
);
39
#endif
40
#ifdef USE_VTUNE_API
41
__itt_pause();
42
#endif
43
}
44
}
45
46
bool
isActive
()
const
{
return
active_
; }
47
private
:
48
const
bool
active_
;
49
};
50
}
51
#endif
qmcplusplus::ScopedProfiler::isActive
bool isActive() const
Definition:
ScopedProfiler.h:46
qmcplusplus
helper functions for EinsplineSetBuilder
Definition:
Configuration.h:43
qmcplusplus::ScopedProfiler::~ScopedProfiler
~ScopedProfiler()
Definition:
ScopedProfiler.h:33
qmcplusplus::ScopedProfiler::active_
const bool active_
Definition:
ScopedProfiler.h:48
CUDAruntime.hpp
handle CUDA/HIP runtime selection.
qmcplusplus::ScopedProfiler::ScopedProfiler
ScopedProfiler(bool active)
Definition:
ScopedProfiler.h:20
qmcplusplus::ScopedProfiler
Definition:
ScopedProfiler.h:17
qmcplusplus::cudaErrorCheck
cudaErrorCheck(cudaMemcpyAsync(dev_lu.data(), lu.data(), sizeof(decltype(lu)::value_type) *lu.size(), cudaMemcpyHostToDevice, hstream), "cudaMemcpyAsync failed copying log_values to device")
src
Utilities
ScopedProfiler.h
Generated on Fri Jun 28 2024 10:45:29 for QMCPACK by
1.8.14