Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
/*
* Distributed under the OSI-approved Apache License, Version 2.0. See
* accompanying file Copyright.txt for details.
*
* Transport.cpp
*
* Created on: Dec 5, 2016
* Author: wfg
*/
#include "Transport.h"
#include "adios2/ADIOSMPI.h"
namespace adios
{
Transport::Transport(const std::string type, const std::string library,
MPI_Comm mpiComm, const bool debugMode)
: m_Type(type), m_Library(library), m_MPIComm(mpiComm), m_DebugMode(debugMode)
{
MPI_Comm_rank(m_MPIComm, &m_RankMPI);
MPI_Comm_size(m_MPIComm, &m_SizeMPI);
}
void Transport::InitProfiler(const OpenMode openMode, const TimeUnit timeUnit)
{
m_Profiler.Timers.emplace(std::make_pair(
"open", profiling::Timer("open", TimeUnit::mus, m_DebugMode)));
if (openMode == OpenMode::Write || openMode == OpenMode::w)
{
m_Profiler.Timers.emplace(
"write", profiling::Timer("write", timeUnit, m_DebugMode));
m_Profiler.Bytes.emplace("write", 0);
}
else if (openMode == OpenMode::Append || openMode == OpenMode::a)
{
m_Profiler.Timers.emplace(
"append", profiling::Timer("append", timeUnit, m_DebugMode));
m_Profiler.Bytes.emplace("append", 0);
}
else if (openMode == OpenMode::Read || openMode == OpenMode::r)
{
m_Profiler.Timers.emplace(
"read", profiling::Timer("read", timeUnit, m_DebugMode));
m_Profiler.Bytes.emplace("read", 0);
}
m_Profiler.Timers.emplace(
"close", profiling::Timer("close", TimeUnit::mus, m_DebugMode));
m_Profiler.IsActive = true;
}
void Transport::SetBuffer(char * /*buffer*/, size_t /*size*/)
{
if (m_DebugMode == true)
{
std::invalid_argument("ERROR: " + m_Name + " transport type " + m_Type +
" using library " + m_Library +
" doesn't implement the SetBuffer function\n");
}
}
} // end namespace adios