Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
S
supercomputer_lab
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
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Gaurav Kukreja
supercomputer_lab
Commits
a2c0ce6e
Commit
a2c0ce6e
authored
May 02, 2012
by
Gaurav Kukreja
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Offset Calculation
Signed-off-by:
Gaurav Kukreja
<
mailme.gaurav@gmail.com
>
parent
eb2eef7a
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
6 deletions
+9
-6
relax_jacobi.c
heat-seq/relax_jacobi.c
+9
-6
No files found.
heat-seq/relax_jacobi.c
View file @
a2c0ce6e
...
...
@@ -46,6 +46,7 @@ double relax_jacobi_return_residual( double *u, double *utmp,
{
int
i
,
j
,
k
,
l
=
0
;
double
unew
,
diff
,
sum
=
0
.
0
;
unsigned
long
offset
;
//MODIFIED: exchanged the outer and the inner loop
for
(
i
=
1
;
i
<
sizey
-
2
+
Interleaving_Count
;
i
++
)
...
...
@@ -56,16 +57,18 @@ double relax_jacobi_return_residual( double *u, double *utmp,
{
if
(
k
==
0
)
break
;
if
(
k
>
sizey
-
2
)
continue
;
offset
=
k
*
sizex
+
j
;
//MODIFIED: storing the offset in a variable
u
[
k
*
sizex
+
j
]
=
utmp
[
k
*
sizex
+
j
];
utmp
[
k
*
sizex
+
j
]
=
0
.
25
*
(
u
[
k
*
sizex
+
j
-
1
]
+
// left-old
utmp
[
k
*
sizex
+
j
+
1
]
+
// right-new
u
[
k
*
sizex
+
j
-
sizex
]
+
// top-old
utmp
[
k
*
sizex
+
j
+
sizex
]);
// bottom-new
u
[
offset
]
=
utmp
[
offset
];
utmp
[
offset
]
=
0
.
25
*
(
u
[
offset
-
1
]
+
// left-old
utmp
[
offset
+
1
]
+
// right-new
u
[
offset
-
sizex
]
+
// top-old
utmp
[
offset
+
sizex
]);
// bottom-new
if
(
k
==
i
-
Interleaving_Count
+
1
)
{
diff
=
utmp
[
k
*
sizex
+
j
]
-
u
[
k
*
sizex
+
j
];
diff
=
utmp
[
offset
]
-
u
[
offset
];
sum
+=
diff
*
diff
;
}
}
...
...
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