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
cd081a59
Commit
cd081a59
authored
Dec 06, 2017
by
helluy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
up
parent
7c8ba864
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
4 deletions
+7
-4
lbm_cl.py
lbm_cl.py
+5
-3
lbm_kernels.cl
lbm_kernels.cl
+2
-1
No files found.
lbm_cl.py
View file @
cd081a59
...
@@ -25,8 +25,8 @@ _n = 4 * _m
...
@@ -25,8 +25,8 @@ _n = 4 * _m
_ivplot
=
0
_ivplot
=
0
# grid size
# grid size
_nx
=
1024
_nx
=
256
_ny
=
1024
_ny
=
256
_Lx
=
1
_Lx
=
1
_Ly
=
1
_Ly
=
1
...
@@ -113,6 +113,7 @@ def solve_ocl(m = _m, n = _n, nx = _nx, ny = _ny,
...
@@ -113,6 +113,7 @@ def solve_ocl(m = _m, n = _n, nx = _nx, ny = _ny,
event
=
prg
.
init_sol
(
queue
,
(
nx
*
ny
,
),
(
32
,
),
fnp1_gpu
)
event
=
prg
.
init_sol
(
queue
,
(
nx
*
ny
,
),
(
32
,
),
fnp1_gpu
)
event
.
wait
()
event
.
wait
()
queue
.
finish
()
# number of animation frames
# number of animation frames
nbplots
=
100
nbplots
=
100
itermax
=
int
(
np
.
floor
(
Tmax
/
dt
))
itermax
=
int
(
np
.
floor
(
Tmax
/
dt
))
...
@@ -133,9 +134,10 @@ def solve_ocl(m = _m, n = _n, nx = _nx, ny = _ny,
...
@@ -133,9 +134,10 @@ def solve_ocl(m = _m, n = _n, nx = _nx, ny = _ny,
while
t
<
Tmax
:
while
t
<
Tmax
:
t
=
t
+
dt
t
=
t
+
dt
#event = prg.time_step(queue, (nx * ny, ), (32, ), wn_gpu, wnp1_gpu)
#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
,
),
fn_gpu
,
fnp1_gpu
)
#event = prg.time_step(queue, (nx * ny, ), (32, ), wn_gpu, wnp1_gpu, wait_for = [event])
#event = prg.time_step(queue, (nx * ny, ), (32, ), wn_gpu, wnp1_gpu, wait_for = [event])
event
.
wait
()
event
.
wait
()
queue
.
finish
()
elapsed
+=
1e-9
*
(
event
.
profile
.
end
-
event
.
profile
.
start
)
elapsed
+=
1e-9
*
(
event
.
profile
.
end
-
event
.
profile
.
start
)
# exchange buffer references for avoiding a copy
# exchange buffer references for avoiding a copy
fn_gpu
,
fnp1_gpu
=
fnp1_gpu
,
fn_gpu
fn_gpu
,
fnp1_gpu
=
fnp1_gpu
,
fn_gpu
...
...
lbm_kernels.cl
View file @
cd081a59
...
@@ -26,6 +26,7 @@ __constant int dir[4][2] = { {-1, 0}, {1, 0},
...
@@ -26,6 +26,7 @@ __constant int dir[4][2] = { {-1, 0}, {1, 0},
__constant
real
ds[4]
=
{
_DY,
_DY,
_DX,
_DX
}
;
__constant
real
ds[4]
=
{
_DY,
_DY,
_DX,
_DX
}
;
//
physical
flux
of
the
hyperbolic
system
//
physical
flux
of
the
hyperbolic
system
/*
void
flux_phy
(
const
real
*w,
const
real*
vnorm,
real*
flux
)
{
*/
/*
void
flux_phy
(
const
real
*w,
const
real*
vnorm,
real*
flux
)
{
*/
/*
real
vdotn
=
_VX
*
vnorm[0]
+
_VY
*
vnorm[1]
; */
/*
real
vdotn
=
_VX
*
vnorm[0]
+
_VY
*
vnorm[1]
; */
...
@@ -74,7 +75,7 @@ void flux_phy(const real *W, const real *vn, real *flux) {
...
@@ -74,7 +75,7 @@ void flux_phy(const real *W, const real *vn, real *flux) {
void
w2f
(
const
real
*w,
real
*f
)
{
void
w2f
(
const
real
*w,
real
*f
)
{
for
(
int
d
=
0
; d < 4; d++){
for
(
int
d
=
0
; d < 4; d++){
real
flux[_M]
;
real
flux[_M]
;
real
vnorm[2]
=
{
dir[d][0],
dir[d][1]}
;
real
vnorm[2]
=
{
(
real
)
dir[d][0],
(
real
)
dir[d][1]}
;
flux_phy
(
w,
vnorm,
flux
)
;
flux_phy
(
w,
vnorm,
flux
)
;
for
(
int
iv
=
0
; iv < _M; iv++){
for
(
int
iv
=
0
; iv < _M; iv++){
f[d
*
_M
+
iv]
=
w[iv]
/
4
+
flux[iv]
/
2
/
_LAMBDA
;
f[d
*
_M
+
iv]
=
w[iv]
/
4
+
flux[iv]
/
2
/
_LAMBDA
;
...
...
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