Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
H
HPC Benchmark Game
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
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
Dorian Stoll
HPC Benchmark Game
Commits
490029a9
Verified
Commit
490029a9
authored
9 months ago
by
Dorian Stoll
Browse files
Options
Downloads
Patches
Plain Diff
rodinia-srad: julia: Convert to threads
parent
a8994fc5
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
src/benchmarks/rodinia-srad/julia/srad.jl
+12
-13
12 additions, 13 deletions
src/benchmarks/rodinia-srad/julia/srad.jl
with
12 additions
and
13 deletions
src/benchmarks/rodinia-srad/julia/srad.jl
+
12
−
13
View file @
490029a9
#!/usr/bin/env julia
#!/usr/bin/env julia
using
Printf
using
Random
const
OUTPUT
=
haskey
(
ENV
,
"OUTPUT"
)
const
OUTPUT
=
haskey
(
ENV
,
"OUTPUT"
)
function
usage
()
function
usage
()
...
@@ -47,22 +50,20 @@ function main(args)
...
@@ -47,22 +50,20 @@ function main(args)
jW
[
1
]
=
1
jW
[
1
]
=
1
jE
[
cols
]
=
cols
jE
[
cols
]
=
cols
dN
::
SharedArray
{
Float32
,
2
}
=
SharedArray
(
Float32
,
(
rows
,
cols
)
)
dN
::
Matrix
{
Float32
}
=
zeros
(
rows
,
cols
)
dS
::
SharedArray
{
Float32
,
2
}
=
SharedArray
(
Float32
,
(
rows
,
cols
)
)
dS
::
Matrix
{
Float32
}
=
zeros
(
rows
,
cols
)
dW
::
SharedArray
{
Float32
,
2
}
=
SharedArray
(
Float32
,
(
rows
,
cols
)
)
dW
::
Matrix
{
Float32
}
=
zeros
(
rows
,
cols
)
dE
::
SharedArray
{
Float32
,
2
}
=
SharedArray
(
Float32
,
(
rows
,
cols
)
)
dE
::
Matrix
{
Float32
}
=
zeros
(
rows
,
cols
)
println
(
"Randomizing the input matrix"
)
println
(
"Randomizing the input matrix"
)
srand
(
7
)
Random
.
seed!
(
7
)
I
=
rand
(
Float32
,
rows
,
cols
)
I
=
rand
(
Float32
,
rows
,
cols
)
J
::
SharedArray
{
Float32
,
2
}
=
SharedArray
(
Float32
,(
rows
,
cols
),
init
=
J
->
J
[
Base
.
localindexes
(
J
)]
=
exp
.
(
I
[
Base
.
localindexes
(
J
)])
)
J
=
exp
.
(
I
)
c
::
SharedArray
{
Float32
,
2
}
=
SharedArray
(
Float32
,
(
rows
,
cols
)
)
c
::
Matrix
{
Float32
}
=
zeros
(
rows
,
cols
)
println
(
"Start the SRAD main loop"
)
println
(
"Start the SRAD main loop"
)
tic
()
sum
::
Float32
=
0
sum
::
Float32
=
0
sum2
::
Float32
=
0
sum2
::
Float32
=
0
for
iter
in
1
:
niter
for
iter
in
1
:
niter
...
@@ -80,7 +81,7 @@ function main(args)
...
@@ -80,7 +81,7 @@ function main(args)
varROI
::
Float32
=
(
sum
/
size_R
)
-
meanROI
*
meanROI
varROI
::
Float32
=
(
sum
/
size_R
)
-
meanROI
*
meanROI
q0sqr
::
Float32
=
varROI
/
(
meanROI
*
meanROI
)
q0sqr
::
Float32
=
varROI
/
(
meanROI
*
meanROI
)
@sync
@parallel
for
i
in
1
:
size
(
J
,
1
)
Threads
.
@threads
for
i
in
1
:
size
(
J
,
1
)
for
j
in
size
(
J
,
2
)
for
j
in
size
(
J
,
2
)
Jc
=
J
[
i
,
j
]
Jc
=
J
[
i
,
j
]
...
@@ -113,7 +114,7 @@ function main(args)
...
@@ -113,7 +114,7 @@ function main(args)
end
end
end
end
@sync
@parallel
for
i
in
1
:
size
(
J
,
1
)
Threads
.
@threads
for
i
in
1
:
size
(
J
,
1
)
for
j
in
1
:
size
(
J
,
2
)
for
j
in
1
:
size
(
J
,
2
)
# diffusion coefficient
# diffusion coefficient
cN
=
c
[
i
,
j
]
cN
=
c
[
i
,
j
]
...
@@ -130,8 +131,6 @@ function main(args)
...
@@ -130,8 +131,6 @@ function main(args)
end
end
end
end
toc
()
println
(
"Computation done"
)
println
(
"Computation done"
)
if
OUTPUT
if
OUTPUT
...
...
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