Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
H
How Approximation Affects Parallelization
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Issue analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Nathanael Sandy
How Approximation Affects Parallelization
Commits
1b91328b
Commit
1b91328b
authored
6 years ago
by
Daniel Maier
Browse files
Options
Downloads
Patches
Plain Diff
trisolv calc_error
parent
e227ced8
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
codes/trisolv/data.bin
+0
-0
0 additions, 0 deletions
codes/trisolv/data.bin
codes/trisolv/data.o
+0
-0
0 additions, 0 deletions
codes/trisolv/data.o
codes/trisolv/trisolv.c
+32
-0
32 additions, 0 deletions
codes/trisolv/trisolv.c
with
32 additions
and
0 deletions
codes/trisolv/data.bin
0 → 100644
+
0
−
0
View file @
1b91328b
File added
This diff is collapsed.
Click to expand it.
codes/trisolv/data.o
0 → 100644
+
0
−
0
View file @
1b91328b
File added
This diff is collapsed.
Click to expand it.
codes/trisolv/trisolv.c
+
32
−
0
View file @
1b91328b
...
...
@@ -59,6 +59,36 @@ void print_array(int n,
POLYBENCH_DUMP_FINISH
;
}
extern
double
_binary_data_bin_start
;
extern
double
_binary_data_bin_end
;
static
void
calc_error
(
int
n
,
DATA_TYPE
POLYBENCH_1D
(
x
,
N
,
n
))
{
int
i
;
double
err
=
0
;
double
*
accurate
=
&
_binary_data_bin_start
;
double
*
test
=
x
;
for
(
i
=
0
;
i
<
n
;
i
++
)
{
if
(
fabs
(
accurate
[
i
]
-
test
[
i
])
>
0
.
0
)
{
double
e
;
if
(
fabs
(
accurate
[
i
])
>
0
.
0
)
{
e
=
fabs
((
accurate
[
i
]
-
test
[
i
])
/
accurate
[
i
]);
}
else
{
e
=
fabs
(
accurate
[
i
]
-
test
[
i
]);
}
/* clamp error to max 1 */
if
(
e
>
1
)
e
=
1
;
err
+=
e
;
}
}
err
/=
n
;
printf
(
"error: %f
\n
"
,
err
);
}
/* Main computational kernel. The whole function will be timed,
including the call and return. */
...
...
@@ -111,6 +141,8 @@ int main(int argc, char** argv)
by the function call in argument. */
polybench_prevent_dce
(
print_array
(
n
,
POLYBENCH_ARRAY
(
x
)));
calc_error
(
n
,
POLYBENCH_ARRAY
(
x
));
/* Be clean. */
POLYBENCH_FREE_ARRAY
(
L
);
POLYBENCH_FREE_ARRAY
(
x
);
...
...
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