Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
lbmpy
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
Model registry
Operate
Environments
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
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
pycodegen
lbmpy
Commits
68f909ee
Commit
68f909ee
authored
4 years ago
by
Michael Kuron
Browse files
Options
Downloads
Patches
Plain Diff
Check if fluctuating LB compiles when vectorized
parent
a6e35ca6
No related branches found
No related tags found
1 merge request
!82
Check if fluctuating LB compiles when vectorized
Pipeline
#32335
failed
4 years ago
Stage: test
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
lbmpy_tests/test_fluctuating_lb.py
+46
-3
46 additions, 3 deletions
lbmpy_tests/test_fluctuating_lb.py
with
46 additions
and
3 deletions
lbmpy_tests/test_fluctuating_lb.py
+
46
−
3
View file @
68f909ee
...
@@ -6,6 +6,10 @@ from lbmpy.creationfunctions import *
...
@@ -6,6 +6,10 @@ from lbmpy.creationfunctions import *
from
lbmpy.macroscopic_value_kernels
import
macroscopic_values_setter
from
lbmpy.macroscopic_value_kernels
import
macroscopic_values_setter
import
numpy
as
np
import
numpy
as
np
from
lbmpy.moments
import
is_bulk_moment
,
is_shear_moment
,
get_order
from
lbmpy.moments
import
is_bulk_moment
,
is_shear_moment
,
get_order
from
pystencils.rng
import
PhiloxTwoDoubles
import
pytest
from
pystencils.backends.simd_instruction_sets
import
get_supported_instruction_sets
def
single_component_maxwell
(
x1
,
x2
,
kT
,
mass
):
def
single_component_maxwell
(
x1
,
x2
,
kT
,
mass
):
...
@@ -54,7 +58,7 @@ def add_pressure_output_to_collision_rule(collision_rule, pressure_field):
...
@@ -54,7 +58,7 @@ def add_pressure_output_to_collision_rule(collision_rule, pressure_field):
collision_rule
.
main_assignments
=
collision_rule
.
main_assignments
+
pressure_ouput
collision_rule
.
main_assignments
=
collision_rule
.
main_assignments
+
pressure_ouput
def
get_fluctuating_lb
(
size
=
None
,
kT
=
None
,
omega_shear
=
None
,
omega_bulk
=
None
,
omega_odd
=
None
,
omega_even
=
None
,
rho_0
=
None
,
target
=
None
):
def
get_fluctuating_lb
(
size
=
None
,
kT
=
None
,
omega_shear
=
None
,
omega_bulk
=
None
,
omega_odd
=
None
,
omega_even
=
None
,
rho_0
=
None
,
target
=
None
,
cpu_vectorize_info
=
None
):
# Parameters
# Parameters
stencil
=
get_stencil
(
'
D3Q19
'
)
stencil
=
get_stencil
(
'
D3Q19
'
)
...
@@ -81,7 +85,8 @@ def get_fluctuating_lb(size=None, kT=None, omega_shear=None, omega_bulk=None, om
...
@@ -81,7 +85,8 @@ def get_fluctuating_lb(size=None, kT=None, omega_shear=None, omega_bulk=None, om
collision_rule
=
create_lb_collision_rule
(
collision_rule
=
create_lb_collision_rule
(
method
,
method
,
fluctuating
=
{
fluctuating
=
{
'
temperature
'
:
kT
'
temperature
'
:
kT
,
'
rng_node
'
:
PhiloxTwoDoubles
,
},
},
optimization
=
{
'
cse_global
'
:
True
}
optimization
=
{
'
cse_global
'
:
True
}
)
)
...
@@ -98,7 +103,7 @@ def get_fluctuating_lb(size=None, kT=None, omega_shear=None, omega_bulk=None, om
...
@@ -98,7 +103,7 @@ def get_fluctuating_lb(size=None, kT=None, omega_shear=None, omega_bulk=None, om
{
'
density
'
:
rho
,
'
velocity
'
:
u
})
{
'
density
'
:
rho
,
'
velocity
'
:
u
})
opts
=
{
'
cpu_openmp
'
:
True
,
opts
=
{
'
cpu_openmp
'
:
True
,
'
cpu_vectorize_info
'
:
None
,
'
cpu_vectorize_info
'
:
cpu_vectorize_info
,
'
target
'
:
dh
.
default_target
}
'
target
'
:
dh
.
default_target
}
# Compile kernels
# Compile kernels
...
@@ -242,3 +247,41 @@ def test_point_force(target="cpu"):
...
@@ -242,3 +247,41 @@ def test_point_force(target="cpu"):
momentum
,
introduced_momentum
+
0.5
*
point_force
,
atol
=
1E-10
)
momentum
,
introduced_momentum
+
0.5
*
point_force
,
atol
=
1E-10
)
dh
.
cpu_arrays
[
"
force
"
][
force_pos
[
0
],
dh
.
cpu_arrays
[
"
force
"
][
force_pos
[
0
],
force_pos
[
1
],
force_pos
[
2
]]
=
np
.
zeros
(
3
)
force_pos
[
1
],
force_pos
[
2
]]
=
np
.
zeros
(
3
)
@pytest.mark.skipif
(
not
get_supported_instruction_sets
(),
reason
=
"
No vector instruction sets supported
"
)
@pytest.mark.parametrize
(
'
assume_aligned
'
,
(
True
,
False
))
@pytest.mark.parametrize
(
'
assume_inner_stride_one
'
,
(
True
,
False
))
@pytest.mark.parametrize
(
'
assume_sufficient_line_padding
'
,
(
True
,
False
))
def
test_vectorization
(
assume_aligned
,
assume_inner_stride_one
,
assume_sufficient_line_padding
):
method
=
create_mrt_orthogonal
(
stencil
=
get_stencil
(
'
D2Q9
'
),
compressible
=
True
,
weighted
=
True
,
relaxation_rate_getter
=
rr_getter
)
collision_rule
=
create_lb_collision_rule
(
method
,
fluctuating
=
{
'
temperature
'
:
sp
.
Symbol
(
"
kT
"
),
'
rng_node
'
:
PhiloxTwoDoubles
,
'
block_offsets
'
:
(
0
,
0
),
},
optimization
=
{
'
cse_global
'
:
True
}
)
collision
=
create_lb_update_rule
(
collision_rule
=
collision_rule
,
stencil
=
method
.
stencil
,
method
=
method
,
compressible
=
True
,
kernel_type
=
'
collide_only
'
)
opts
=
{
'
cpu_openmp
'
:
False
,
'
cpu_vectorize_info
'
:
{
'
instruction_set
'
:
get_supported_instruction_sets
()[
0
],
'
assume_aligned
'
:
assume_aligned
,
'
assume_inner_stride_one
'
:
assume_inner_stride_one
,
'
assume_sufficient_line_padding
'
:
assume_sufficient_line_padding
,
},
'
target
'
:
'
cpu
'
}
code
=
ps
.
create_kernel
(
collision
,
**
opts
)
code
.
compile
()
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