Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
N
ngraph
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
ngraph
Commits
d6be21dc
Unverified
Commit
d6be21dc
authored
Mar 07, 2020
by
Robert Kimball
Committed by
GitHub
Mar 07, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Distributed debug print cleanup (#4403)
* remove code * Cleanup * cleanup * cleanup * Fix build error
parent
7848f18d
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
7 additions
and
104 deletions
+7
-104
distributed.hpp
src/ngraph/distributed.hpp
+0
-1
null.cpp
src/ngraph/distributed/null.cpp
+0
-6
null.hpp
src/ngraph/distributed/null.hpp
+0
-1
main.cpp
src/ngraph/frontend/ATen/operators/test/main.cpp
+0
-1
log.cpp
src/ngraph/log.cpp
+0
-62
log.hpp
src/ngraph/log.hpp
+0
-17
allreduce.cpp
src/ngraph/runtime/cpu/builder/allreduce.cpp
+7
-12
main.cpp
test/main.cpp
+0
-4
No files found.
src/ngraph/distributed.hpp
View file @
d6be21dc
...
...
@@ -60,7 +60,6 @@ namespace ngraph
virtual
const
std
::
string
&
get_name
()
const
=
0
;
virtual
int
get_size
()
=
0
;
virtual
int
get_rank
()
=
0
;
virtual
void
log_print
(
const
std
::
string
&
timestamp
,
const
std
::
vector
<
char
>&
buf
)
=
0
;
virtual
void
all_reduce
(
void
*
in
,
void
*
out
,
...
...
src/ngraph/distributed/null.cpp
View file @
d6be21dc
...
...
@@ -35,12 +35,6 @@ int ngraph::distributed::Null::get_rank()
return
0
;
}
void
ngraph
::
distributed
::
Null
::
log_print
(
const
std
::
string
&
timestamp
,
const
std
::
vector
<
char
>&
buf
)
{
std
::
cout
<<
timestamp
<<
": "
<<
std
::
string
(
buf
.
data
())
<<
"
\n
"
;
}
void
ngraph
::
distributed
::
Null
::
all_reduce
(
void
*
,
void
*
,
element
::
Type_t
,
reduction
::
Type
,
size_t
)
{
throw
ngraph_error
(
"Distributed Library not supported/mentioned"
);
...
...
src/ngraph/distributed/null.hpp
View file @
d6be21dc
...
...
@@ -30,7 +30,6 @@ namespace ngraph
const
std
::
string
&
get_name
()
const
override
;
int
get_size
()
override
;
int
get_rank
()
override
;
void
log_print
(
const
std
::
string
&
timestamp
,
const
std
::
vector
<
char
>&
buf
)
override
;
void
all_reduce
(
void
*
in
,
void
*
out
,
element
::
Type_t
element_type
,
...
...
src/ngraph/frontend/ATen/operators/test/main.cpp
View file @
d6be21dc
...
...
@@ -56,7 +56,6 @@ int main(int argc, char** argv)
int
rc
=
RUN_ALL_TESTS
();
auto
elapsed
=
std
::
chrono
::
duration_cast
<
std
::
chrono
::
milliseconds
>
(
std
::
chrono
::
system_clock
::
now
()
-
start
);
NGRAPH_DEBUG_PRINT
(
"[MAIN] Tests finished: Time: %d ms Exit code: %d"
,
elapsed
.
count
(),
rc
);
return
rc
;
}
src/ngraph/log.cpp
View file @
d6be21dc
...
...
@@ -70,65 +70,3 @@ LogHelper::~LogHelper()
}
// Logger::log_item(m_stream.str());
}
#if defined(__linux) || defined(__APPLE__)
std
::
string
ngraph
::
get_timestamp
()
{
// get current time
auto
now
=
std
::
chrono
::
system_clock
::
now
();
// get number of nanoseconds for the current second
// (remainder after division into seconds)
auto
ns
=
std
::
chrono
::
duration_cast
<
std
::
chrono
::
nanoseconds
>
(
now
.
time_since_epoch
())
%
1000000
;
// convert to std::time_t in order to convert to std::tm (broken time)
auto
timer
=
std
::
chrono
::
system_clock
::
to_time_t
(
now
);
// convert to broken time
char
buffer
[
256
];
buffer
[
0
]
=
0
;
std
::
tm
*
bt
=
std
::
localtime
(
&
timer
);
if
(
bt
)
{
strftime
(
buffer
,
sizeof
(
buffer
),
"%H:%M:%S"
,
bt
);
}
std
::
ostringstream
timestamp
;
timestamp
<<
buffer
;
timestamp
<<
'.'
<<
std
::
setfill
(
'0'
)
<<
std
::
setw
(
3
)
<<
ns
.
count
();
return
timestamp
.
str
();
}
void
ngraph
::
LogPrintf
(
const
char
*
fmt
,
...)
{
va_list
args1
;
va_start
(
args1
,
fmt
);
va_list
args2
;
va_copy
(
args2
,
args1
);
#if defined(__GNUC__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wformat-nonliteral"
#endif
std
::
vector
<
char
>
buf
(
1
+
std
::
vsnprintf
(
nullptr
,
0
,
fmt
,
args1
));
va_end
(
args1
);
std
::
vsnprintf
(
buf
.
data
(),
buf
.
size
(),
fmt
,
args2
);
#if defined(__GNUC__)
#pragma GCC diagnostic pop
#endif
va_end
(
args2
);
get_distributed_interface
()
->
log_print
(
get_timestamp
(),
buf
);
}
// This function will be executed only once during startup (loading of the DSO)
static
bool
CheckLoggingLevel
()
{
if
(
getenv_bool
(
"NGRAPH_DISABLE_LOGGING"
))
{
return
true
;
}
return
false
;
}
bool
ngraph
::
DISABLE_LOGGING
=
CheckLoggingLevel
();
#endif
src/ngraph/log.hpp
View file @
d6be21dc
...
...
@@ -169,21 +169,4 @@ namespace ngraph
#define NGRAPH_DEBUG \
::ngraph::NullLogger {}
#endif
#if defined(__linux) || defined(__APPLE__)
std
::
string
get_timestamp
();
void
LogPrintf
(
const
char
*
fmt
,
...);
extern
bool
DISABLE_LOGGING
;
#define NGRAPH_DEBUG_PRINT(fmt, ...) \
do \
{ \
if (!ngraph::DISABLE_LOGGING) \
{ \
ngraph::LogPrintf(fmt, __VA_ARGS__); \
} \
} while (0)
#else
#define NGRAPH_DEBUG_PRINT(fmt, ...)
#endif
}
src/ngraph/runtime/cpu/builder/allreduce.cpp
View file @
d6be21dc
...
...
@@ -42,18 +42,13 @@ namespace ngraph
auto
reduce_type
=
allreduce
->
get_reduce_type
();
auto
external_function_name
=
external_function
->
get_function_name
();
NGRAPH_DEBUG_PRINT
(
"AllReduce Queued[%d]: Function: %s Node: %s %s Size: "
"%d"
,
call_seq
,
external_function_name
.
c_str
(),
node
->
get_name
().
c_str
(),
// if provenance_tags is set in nGraph once and only once, it will print the tag
// name otherwise, it will print the get_friendly_name
node
->
get_provenance_tags
().
size
()
==
1
?
(
*
(
node
->
get_provenance_tags
()).
begin
()).
c_str
()
:
node
->
get_friendly_name
().
c_str
(),
count
);
NGRAPH_DEBUG
<<
"AllReduce Queued["
<<
call_seq
<<
"]: Function: "
<<
external_function_name
<<
" Node: "
<<
node
->
get_name
()
<<
" "
<<
(
node
->
get_provenance_tags
().
size
()
==
1
?
(
*
(
node
->
get_provenance_tags
()).
begin
())
:
node
->
get_friendly_name
())
<<
" Size: "
<<
count
;
auto
functor
=
[
&
,
count
,
reduce_type
,
data_type
,
arg_buffer_index
,
out_buffer_index
](
...
...
test/main.cpp
View file @
d6be21dc
...
...
@@ -63,11 +63,7 @@ int main(int argc, char** argv)
ngraph
::
runtime
::
ngmlir
::
initializeNGraphMLIR
();
#endif
auto
start
=
std
::
chrono
::
system_clock
::
now
();
int
rc
=
RUN_ALL_TESTS
();
auto
elapsed
=
std
::
chrono
::
duration_cast
<
std
::
chrono
::
milliseconds
>
(
std
::
chrono
::
system_clock
::
now
()
-
start
);
NGRAPH_DEBUG_PRINT
(
"[MAIN] Tests finished: Time: %d ms Exit code: %d"
,
elapsed
.
count
(),
rc
);
return
rc
;
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment