Mentions légales du service
Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
O
orwl
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Jens Gustedt
orwl
Commits
99b72f52
Commit
99b72f52
authored
8 years ago
by
Jens Gustedt
Browse files
Options
Downloads
Patches
Plain Diff
avoid the use of a mutex
parent
3690826f
Branches
master_com
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
include/orwl_affinity.h
+1
-1
1 addition, 1 deletion
include/orwl_affinity.h
lib/orwl_affinity.c
+3
-16
3 additions, 16 deletions
lib/orwl_affinity.c
with
4 additions
and
17 deletions
include/orwl_affinity.h
+
1
−
1
View file @
99b72f52
...
...
@@ -45,7 +45,7 @@ ORWL_DECLARE_ENV(ORWL_AFFINITY_BINDING);
**/
typedef
struct
o_rwl_dependency
o_rwl_dependency
;
struct
o_rwl_dependency
{
size_t
nb
;
/*!< number of neigboors */
_Atomic
(
size_t
)
nb
;
/*!< number of neigboors */
size_t
loc_ids
[
O_RWL_MAX_DEPENDENCY
];
/*!< location id of neigboors */
};
...
...
This diff is collapsed.
Click to expand it.
lib/orwl_affinity.c
+
3
−
16
View file @
99b72f52
...
...
@@ -32,11 +32,6 @@ static o_rwl_dependency(*communications)[] = 0;
**/
static
double
*
locations
=
0
;
/**
** @brief mutex to manage concurent writes on communications
**/
static
mtx_t
communications_lock
;
/**
** @brief mutex to manage concurent writes on o_rw_locations
**/
...
...
@@ -79,11 +74,6 @@ static int dependency_init(void) {
P99_THROW_ASSERT
(
EINVAL
,
op_nb
);
communications
=
P99_CALLOC
(
o_rwl_dependency
,
op_nb
*
op_nb
);
if
(
mtx_init
(
&
communications_lock
,
mtx_plain
))
{
report
(
1
,
"smutex communications init failed"
);
return
1
;
}
if
(
loc_total
)
{
locations
=
P99_CALLOC
(
double
,
loc_total
);
}
...
...
@@ -120,7 +110,6 @@ static void dependency_print(void) {
static
int
dependency_destroy
(
void
)
{
mtx_destroy
(
&
locations_lock
);
mtx_destroy
(
&
communications_lock
);
free
(
communications
);
free
(
locations
);
return
0
;
...
...
@@ -188,7 +177,7 @@ static int build_affinity(tm_affinity_mat_t** aff_mat) {
for
(
size_t
j
=
0
;
j
<
op_nb
;
j
++
)
{
if
(
com_mat
[
i
][
j
].
nb
)
{
for
(
size_t
s
=
0
;
s
<
com_mat
[
i
][
j
].
nb
;
s
++
)
{
//
/ NOTE: put
1 if there is dependency
but
location_size is 0
///
//
add
1 if there is
a
dependency
, even if
location_size is 0
double
increment
=
locations
[
com_mat
[
i
][
j
].
loc_ids
[
s
]];
mat
[
i
][
j
]
+=
increment
?
increment
:
1
;
}
...
...
@@ -364,10 +353,8 @@ int orwl_dependency_set(size_t loc_src, size_t loc_dst, size_t location_id) {
size_t
src
=
((
loc_src
-
loc_offs
)
/
loc_task
)
*
op_task
;
size_t
dst
=
((
loc_dst
-
loc_offs
)
/
loc_task
)
*
op_task
;
if
(
src
<
op_nb
&&
dst
<
op_nb
)
{
P99_MUTUAL_EXCLUDE
(
communications_lock
)
{
com_mat
[
src
][
dst
].
loc_ids
[
com_mat
[
src
][
dst
].
nb
]
=
location_id
;
com_mat
[
src
][
dst
].
nb
+=
1
;
}
size_t
nb
=
atomic_fetch_add
(
&
com_mat
[
src
][
dst
].
nb
,
1
);
com_mat
[
src
][
dst
].
loc_ids
[
nb
]
=
location_id
;
}
return
0
;
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment