Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
patapon
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
David Coulette
patapon
Commits
7c8ba864
Commit
7c8ba864
authored
Dec 06, 2017
by
helluy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
this case works on nvidia but not with a larger mesh
parent
2c9cf8f6
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
8 deletions
+11
-8
lbm_cl.py
lbm_cl.py
+10
-7
lbm_kernels.cl
lbm_kernels.cl
+1
-1
No files found.
lbm_cl.py
View file @
7c8ba864
...
...
@@ -25,8 +25,8 @@ _n = 4 * _m
_ivplot
=
0
# grid size
_nx
=
256
_ny
=
256
_nx
=
1024
_ny
=
1024
_Lx
=
1
_Ly
=
1
...
...
@@ -43,7 +43,7 @@ _Tmax = 2.
def
solve_ocl
(
m
=
_m
,
n
=
_n
,
nx
=
_nx
,
ny
=
_ny
,
Tmax
=
_Tmax
,
Lx
=
_Lx
,
Ly
=
_Ly
,
animate
=
Fals
e
,
animate
=
Tru
e
,
interactive
=
True
,
precision
=
"single"
):
...
...
@@ -94,8 +94,7 @@ def solve_ocl(m = _m, n = _n, nx = _nx, ny = _ny,
mf
=
cl
.
mem_flags
# compile OpenCL C program
prg
=
cl
.
Program
(
ctx
,
source
).
build
(
options
=
"-cl-strict-aliasing
\
-cl-fast-relaxed-math"
)
prg
=
cl
.
Program
(
ctx
,
source
).
build
(
options
=
""
)
# create OpenCL buffers
fn_gpu
=
cl
.
Buffer
(
ctx
,
mf
.
READ_WRITE
,
...
...
@@ -111,6 +110,9 @@ def solve_ocl(m = _m, n = _n, nx = _nx, ny = _ny,
event
=
prg
.
init_sol
(
queue
,
(
nx
*
ny
,
),
(
32
,
),
fn_gpu
)
event
.
wait
()
event
=
prg
.
init_sol
(
queue
,
(
nx
*
ny
,
),
(
32
,
),
fnp1_gpu
)
event
.
wait
()
# number of animation frames
nbplots
=
100
itermax
=
int
(
np
.
floor
(
Tmax
/
dt
))
...
...
@@ -130,7 +132,6 @@ def solve_ocl(m = _m, n = _n, nx = _nx, ny = _ny,
print
(
"start OpenCL computations..."
)
while
t
<
Tmax
:
t
=
t
+
dt
iter
=
iter
+
1
#event = prg.time_step(queue, (nx * ny, ), (32, ), wn_gpu, wnp1_gpu)
event
=
prg
.
time_step
(
queue
,
(
nx
*
ny
,
),
(
64
,
),
fn_gpu
,
fnp1_gpu
)
#event = prg.time_step(queue, (nx * ny, ), (32, ), wn_gpu, wnp1_gpu, wait_for = [event])
...
...
@@ -153,6 +154,8 @@ def solve_ocl(m = _m, n = _n, nx = _nx, ny = _ny,
else
:
print
(
title
,
end
=
'
\r
'
)
iter
=
iter
+
1
# copy OpenCL data to CPU and return the results
cl
.
enqueue_copy
(
queue
,
fn_cpu
,
fn_gpu
).
wait
()
...
...
@@ -162,7 +165,7 @@ def solve_ocl(m = _m, n = _n, nx = _nx, ny = _ny,
if
__name__
==
'__main__'
:
# gpu solve
wplot_gpu
=
solve_ocl
(
animate
=
False
)
wplot_gpu
=
solve_ocl
()
#print(np.sum(wplot_gpu[:, _ivplot, :, :],axis=0))
plt
.
clf
()
#plt.imshow(np.sum(wplot_gpu[:, _ivplot, :, :],axis=0), vmin=0, vmax=1)
...
...
lbm_kernels.cl
View file @
7c8ba864
#
pragma
OPENCL
EXTENSION
cl_khr_fp64
:
enable
//
#pragma
OPENCL
EXTENSION
cl_khr_fp64
:
enable
#
define
real
_real_
...
...
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