Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Y
YAC
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD 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
dkrz-sw
YAC
Commits
74cdc0c0
Commit
74cdc0c0
authored
8 years ago
by
Moritz Hanke
Browse files
Options
Downloads
Patches
Plain Diff
adds new reduce operation COMM_OP_OR
parent
343ef047
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/communicator.c
+37
-0
37 additions, 0 deletions
src/communicator.c
src/communicator.h
+1
-0
1 addition, 0 deletions
src/communicator.h
with
38 additions
and
0 deletions
src/communicator.c
+
37
−
0
View file @
74cdc0c0
...
...
@@ -531,4 +531,41 @@ static void comm_op_sum(void * invec, void * inoutvec, unsigned count,
}
}
static
void
comm_op_or_uint
(
void
*
a
,
void
*
b
)
{
*
(
unsigned
*
)
b
=
*
(
unsigned
*
)
a
|
*
(
unsigned
*
)
b
;
}
static
void
comm_op_or_int
(
void
*
a
,
void
*
b
)
{
*
(
int
*
)
b
=
*
(
int
*
)
a
|
*
(
int
*
)
b
;
}
static
void
comm_op_or_byte
(
void
*
a
,
void
*
b
)
{
*
(
char
*
)
b
=
*
(
char
*
)
a
|
*
(
char
*
)
b
;
}
static
void
comm_op_or
(
void
*
invec
,
void
*
inoutvec
,
unsigned
count
,
enum
yac_comm_data_type
type
)
{
struct
{
size_t
size
;
void
(
*
func
)(
void
*
a
,
void
*
b
);
}
comm_op_or
[
3
]
=
{{.
size
=
sizeof
(
unsigned
),
.
func
=
comm_op_or_uint
},
{.
size
=
sizeof
(
int
),
.
func
=
comm_op_or_int
},
{.
size
=
sizeof
(
char
),
.
func
=
comm_op_or_byte
}},
this_comm_op_or
;
switch
(
type
)
{
default
:
yac_internal_abort_message
(
"ERROR(comm_op_or): unsupported or "
"invalid data type"
,
__FILE__
,
__LINE__
);
case
(
COMM_UINT
):
this_comm_op_or
=
comm_op_or
[
0
];
break
;
case
(
COMM_INT
):
this_comm_op_or
=
comm_op_or
[
1
];
break
;
case
(
COMM_BYTE
):
this_comm_op_or
=
comm_op_or
[
2
];
break
;
};
for
(
unsigned
i
=
0
;
i
<
count
;
++
i
)
{
this_comm_op_or
.
func
(
invec
,
inoutvec
);
invec
=
(
char
*
)
invec
+
this_comm_op_or
.
size
;
inoutvec
=
(
char
*
)
inoutvec
+
this_comm_op_or
.
size
;
}
}
extern
func_comm_op
COMM_OP_SUM
=
comm_op_sum
;
extern
func_comm_op
COMM_OP_OR
=
comm_op_or
;
This diff is collapsed.
Click to expand it.
src/communicator.h
+
1
−
0
View file @
74cdc0c0
...
...
@@ -82,6 +82,7 @@ typedef void (*func_comm_op)(void * invec, void * inoutvec, unsigned count,
enum
yac_comm_data_type
type
);
extern
func_comm_op
COMM_OP_SUM
;
extern
func_comm_op
COMM_OP_OR
;
/**! priorities used by \ref yac_comm_recv_callback\n
* (highest priority needs to have lowest numerical value)
...
...
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