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
0db23372
Commit
0db23372
authored
6 years ago
by
Daniel Maier
Browse files
Options
Downloads
Patches
Plain Diff
jacobi-2d: new error checking
parent
bd45239a
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
codes/jacobi-2d/jacobi-2d.c
+20
-17
20 additions, 17 deletions
codes/jacobi-2d/jacobi-2d.c
with
20 additions
and
17 deletions
codes/jacobi-2d/jacobi-2d.c
+
20
−
17
View file @
0db23372
...
...
@@ -58,6 +58,26 @@ 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_2D
(
A
,
N
,
N
,
n
,
n
))
{
int
i
;
double
err
=
0
;
double
*
accurate
=
&
_binary_data_bin_start
;
double
*
test
=
&
(
A
[
0
][
0
]);
/* calculate the mean squared error */
for
(
i
=
0
;
i
<
n
*
n
;
i
++
)
{
err
+=
(
accurate
[
i
]
-
test
[
i
])
*
(
accurate
[
i
]
-
test
[
i
]);
}
err
/=
n
*
n
;
printf
(
"error: %f
\n
"
,
err
);
}
/* Main computational kernel. The whole function will be timed,
including the call and return. */
...
...
@@ -83,23 +103,6 @@ void kernel_jacobi_2d(int tsteps,
}
extern
double
_binary_data_bin_start
;
extern
double
_binary_data_bin_end
;
static
void
calc_error
(
int
n
,
DATA_TYPE
POLYBENCH_2D
(
A
,
N
,
N
,
n
,
n
))
{
int
i
;
double
err
=
0
;
double
*
accurate
=
&
_binary_data_bin_start
;
for
(
i
=
0
;
i
<
n
*
n
;
i
++
)
{
err
+=
(
accurate
[
i
]
-
A
[
0
][
i
])
*
(
accurate
[
i
]
-
A
[
0
][
i
]);
}
printf
(
"error: %f
\n
"
,
err
);
}
int
main
(
int
argc
,
char
**
argv
)
{
/* Retrieve problem size. */
...
...
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