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
9657490e
Commit
9657490e
authored
Oct 09, 2017
by
Robert Kimball
Committed by
Adam Procter
Oct 09, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
make static 'next item' counters thread safe by making them atomic (#186)
parent
2d05276d
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
8 additions
and
6 deletions
+8
-6
function.cpp
src/ngraph/function.cpp
+2
-2
function.hpp
src/ngraph/function.hpp
+2
-1
node.cpp
src/ngraph/node.cpp
+2
-2
node.hpp
src/ngraph/node.hpp
+2
-1
No files found.
src/ngraph/function.cpp
View file @
9657490e
...
...
@@ -20,7 +20,7 @@
using
namespace
std
;
using
namespace
ngraph
;
size_t
Function
::
m_next_instance_id
=
0
;
atomic
<
size_t
>
Function
::
m_next_instance_id
(
0
)
;
Function
::
Function
(
const
std
::
shared_ptr
<
Node
>&
result
,
const
std
::
shared_ptr
<
ValueType
>&
result_type
,
...
...
@@ -31,7 +31,7 @@ Function::Function(const std::shared_ptr<Node>& result,
,
m_name
(
name
)
,
m_result_type
(
result_type
)
,
m_ordered_ops_valid
(
false
)
,
m_instance_id
(
m_next_instance_id
++
)
,
m_instance_id
(
m_next_instance_id
.
fetch_add
(
1
)
)
{
size_t
i
=
0
;
for
(
auto
parameter
:
parameters
)
...
...
src/ngraph/function.hpp
View file @
9657490e
...
...
@@ -14,6 +14,7 @@
#pragma once
#include <atomic>
#include <initializer_list>
#include <list>
#include <memory>
...
...
@@ -68,7 +69,7 @@ namespace ngraph
Function
(
const
Function
&
)
=
delete
;
Function
(
const
Function
&&
)
=
delete
;
static
s
ize_t
m_next_instance_id
;
static
s
td
::
atomic
<
size_t
>
m_next_instance_id
;
size_t
m_instance_id
;
};
}
src/ngraph/node.cpp
View file @
9657490e
...
...
@@ -17,12 +17,12 @@
using
namespace
std
;
using
namespace
ngraph
;
size_t
Node
::
m_next_instance_id
=
0
;
atomic
<
size_t
>
Node
::
m_next_instance_id
(
0
)
;
Node
::
Node
(
const
std
::
vector
<
shared_ptr
<
Node
>>&
arguments
,
shared_ptr
<
ValueType
>
value_type
)
:
m_arguments
(
arguments
)
,
m_value_type
(
value_type
)
,
m_instance_id
(
m_next_instance_id
++
)
,
m_instance_id
(
m_next_instance_id
.
fetch_add
(
1
)
)
,
m_is_output
(
false
)
{
// Add this node as a user of each argument.
...
...
src/ngraph/node.hpp
View file @
9657490e
...
...
@@ -14,6 +14,7 @@
#pragma once
#include <atomic>
#include <set>
#include <string>
#include <unordered_set>
...
...
@@ -114,7 +115,7 @@ namespace ngraph
std
::
multiset
<
Node
*>
m_users
;
std
::
string
m_name
;
size_t
m_instance_id
;
static
s
ize_t
m_next_instance_id
;
static
s
td
::
atomic
<
size_t
>
m_next_instance_id
;
std
::
deque
<
descriptor
::
Input
>
m_inputs
;
std
::
deque
<
descriptor
::
Output
>
m_outputs
;
bool
m_is_output
;
...
...
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