Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
David Coulette
patapon
Commits
9780cdf8
Commit
9780cdf8
authored
Nov 19, 2017
by
ph
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add transport solver
parent
c6abce65
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
6 deletions
+9
-6
transport_cl.py
transport_cl.py
+9
-6
No files found.
transport_cl.py
View file @
9780cdf8
...
...
@@ -17,8 +17,8 @@ _m = 1
_wbord
=
0.
# grid size
_nx
=
512
_ny
=
512
_nx
=
1024
_ny
=
1024
Lx
=
1.
Ly
=
1.
...
...
@@ -110,14 +110,18 @@ def solve_ocl(m = _m, nx = _nx, ny = _ny, Tmax = _Tmax, dx = _dx, dy = _dy,
# OpenCL init
ctx
=
cl
.
create_some_context
()
queue
=
cl
.
CommandQueue
(
ctx
,
properties
=
cl
.
command_queue_properties
.
PROFILING_ENABLE
)
mf
=
cl
.
mem_flags
# compile OpenCL C program
prg
=
cl
.
Program
(
ctx
,
source
).
build
()
# create OpenCL buffers
wn_gpu
=
cl
.
Buffer
(
ctx
,
mf
.
READ_WRITE
,
size
=
(
nx
*
ny
*
np
.
dtype
(
'float32'
).
itemsize
))
wnp1_gpu
=
cl
.
Buffer
(
ctx
,
mf
.
READ_WRITE
,
size
=
(
nx
*
ny
*
np
.
dtype
(
'float32'
).
itemsize
))
prg
=
cl
.
Program
(
ctx
,
source
).
build
()
# create a queue (for submitting opencl operations)
queue
=
cl
.
CommandQueue
(
ctx
,
properties
=
cl
.
command_queue_properties
.
PROFILING_ENABLE
)
# init data
event
=
prg
.
init_sol
(
queue
,
(
nx
*
ny
,
),
(
32
,
),
wn_gpu
)
...
...
@@ -125,11 +129,10 @@ def solve_ocl(m = _m, nx = _nx, ny = _ny, Tmax = _Tmax, dx = _dx, dy = _dy,
# number of animation frames
nbplots
=
10
itermax
=
int
(
np
.
floor
(
Tmax
/
dt
))
iterplot
=
int
(
itermax
/
nbplots
)
# time loop
on gpu
# time loop
t
=
0
iter
=
0
elapsed
=
0.
;
...
...
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