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
602fcd7b
Commit
602fcd7b
authored
3 years ago
by
Markus Holzer
Browse files
Options
Downloads
Patches
Plain Diff
Mark tests to fail
parent
6fbc32ab
No related branches found
No related tags found
1 merge request
!98
Generalisation of Relaxation rate setter
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
lbmpy/creationfunctions.py
+1
-2
1 addition, 2 deletions
lbmpy/creationfunctions.py
lbmpy/lbstep.py
+10
-8
10 additions, 8 deletions
lbmpy/lbstep.py
lbmpy_tests/test_vectorization.py
+2
-5
2 additions, 5 deletions
lbmpy_tests/test_vectorization.py
with
13 additions
and
15 deletions
lbmpy/creationfunctions.py
+
1
−
2
View file @
602fcd7b
...
@@ -262,8 +262,7 @@ def create_lb_ast(update_rule=None, lbm_config=None, lbm_optimisation=None, conf
...
@@ -262,8 +262,7 @@ def create_lb_ast(update_rule=None, lbm_config=None, lbm_optimisation=None, conf
field_types
=
set
(
fa
.
field
.
dtype
for
fa
in
update_rule
.
defined_symbols
if
isinstance
(
fa
,
Field
.
Access
))
field_types
=
set
(
fa
.
field
.
dtype
for
fa
in
update_rule
.
defined_symbols
if
isinstance
(
fa
,
Field
.
Access
))
config
.
data_type
=
collate_types
(
field_types
)
config
=
replace
(
config
,
data_type
=
collate_types
(
field_types
),
ghost_layers
=
1
)
config
.
ghost_layers
=
1
res
=
create_kernel
(
update_rule
,
config
=
config
)
res
=
create_kernel
(
update_rule
,
config
=
config
)
res
.
method
=
update_rule
.
method
res
.
method
=
update_rule
.
method
...
...
This diff is collapsed.
Click to expand it.
lbmpy/lbstep.py
+
10
−
8
View file @
602fcd7b
from
types
import
MappingProxyType
from
types
import
MappingProxyType
from
dataclasses
import
replace
import
numpy
as
np
import
numpy
as
np
from
lbmpy.boundaries.boundaryhandling
import
LatticeBoltzmannBoundaryHandling
from
lbmpy.boundaries.boundaryhandling
import
LatticeBoltzmannBoundaryHandling
from
lbmpy.creationfunctions
import
(
from
lbmpy.creationfunctions
import
(
create_lb_function
,
update_with_default_parameters
)
create_lb_function
,
update_with_default_parameters
)
from
lbmpy.enums
import
Stencil
from
lbmpy.enums
import
Stencil
from
lbmpy.macroscopic_value_kernels
import
(
from
lbmpy.macroscopic_value_kernels
import
(
create_advanced_velocity_setter_collision_rule
,
pdf_initialization_assignments
)
create_advanced_velocity_setter_collision_rule
,
pdf_initialization_assignments
)
...
@@ -99,10 +99,12 @@ class LatticeBoltzmannStep:
...
@@ -99,10 +99,12 @@ class LatticeBoltzmannStep:
density_field
=
density_field
(
density_data_index
)
density_field
=
density_field
(
density_data_index
)
lbm_config
.
output
[
'
density
'
]
=
density_field
lbm_config
.
output
[
'
density
'
]
=
density_field
if
velocity_input_array_name
is
not
None
:
if
velocity_input_array_name
is
not
None
:
lbm_config
.
velocity_input
=
self
.
_data_handling
.
fields
[
velocity_input_array_name
]
lbm_config
=
replace
(
lbm_config
,
velocity_input
=
self
.
_data_handling
.
fields
[
velocity_input_array_name
]
)
if
isinstance
(
lbm_config
.
omega_output_field
,
str
):
if
isinstance
(
lbm_config
.
omega_output_field
,
str
):
lbm_config
.
omega_output_field
=
data_handling
.
add_array
(
lbm_config
.
omega_output_field
,
lbm_config
=
replace
(
lbm_config
,
omega_output_field
=
data_handling
.
add_array
(
lbm_config
.
omega_output_field
,
dtype
=
field_dtype
,
alignment
=
alignment
)
dtype
=
field_dtype
,
alignment
=
alignment
,
values_per_cell
=
1
))
self
.
kernel_params
=
kernel_params
.
copy
()
self
.
kernel_params
=
kernel_params
.
copy
()
...
@@ -110,9 +112,9 @@ class LatticeBoltzmannStep:
...
@@ -110,9 +112,9 @@ class LatticeBoltzmannStep:
if
lbm_kernel
is
None
:
if
lbm_kernel
is
None
:
if
fixed_loop_sizes
:
if
fixed_loop_sizes
:
lbm_optimisation
.
symbolic_field
=
data_handling
.
fields
[
self
.
_pdf_arr_name
]
lbm_optimisation
=
replace
(
lbm_optimisation
,
symbolic_field
=
data_handling
.
fields
[
self
.
_pdf_arr_name
]
)
lbm_config
.
field_name
=
self
.
_pdf_arr_name
lbm_config
=
replace
(
lbm_config
,
field_name
=
self
.
_pdf_arr_name
)
lbm_config
.
temporary_field_name
=
self
.
_tmp_arr_name
lbm_config
=
replace
(
lbm_config
,
temporary_field_name
=
self
.
_tmp_arr_name
)
if
time_step_order
==
'
stream_collide
'
:
if
time_step_order
==
'
stream_collide
'
:
self
.
_lbmKernels
=
[
create_lb_function
(
lbm_config
=
lbm_config
,
self
.
_lbmKernels
=
[
create_lb_function
(
lbm_config
=
lbm_config
,
lbm_optimisation
=
lbm_optimisation
,
lbm_optimisation
=
lbm_optimisation
,
...
...
This diff is collapsed.
Click to expand it.
lbmpy_tests/test_vectorization.py
+
2
−
5
View file @
602fcd7b
...
@@ -35,7 +35,7 @@ def test_lbm_vectorization_short():
...
@@ -35,7 +35,7 @@ def test_lbm_vectorization_short():
@pytest.mark.parametrize
(
'
aligned_and_padding
'
,
[[
False
,
False
],
[
True
,
False
],
[
True
,
True
]])
@pytest.mark.parametrize
(
'
aligned_and_padding
'
,
[[
False
,
False
],
[
True
,
False
],
[
True
,
True
]])
@pytest.mark.parametrize
(
'
nontemporal
'
,
[
False
,
True
])
@pytest.mark.parametrize
(
'
nontemporal
'
,
[
False
,
True
])
@pytest.mark.parametrize
(
'
double_precision
'
,
[
False
,
True
])
@pytest.mark.parametrize
(
'
double_precision
'
,
[
False
,
True
])
@pytest.mark.parametrize
(
'
fixed_loop_sizes
'
,
[
False
,
True
])
@pytest.mark.parametrize
(
'
fixed_loop_sizes
'
,
[
True
,
pytest
.
param
(
False
,
marks
=
pytest
.
mark
.
xfail
(
reason
=
'
bug in pystencils
'
))
])
@pytest.mark.longrun
@pytest.mark.longrun
def
test_lbm_vectorization
(
instruction_set
,
aligned_and_padding
,
nontemporal
,
double_precision
,
fixed_loop_sizes
):
def
test_lbm_vectorization
(
instruction_set
,
aligned_and_padding
,
nontemporal
,
double_precision
,
fixed_loop_sizes
):
vectorization_options
=
{
'
instruction_set
'
:
instruction_set
,
vectorization_options
=
{
'
instruction_set
'
:
instruction_set
,
...
@@ -48,16 +48,13 @@ def test_lbm_vectorization(instruction_set, aligned_and_padding, nontemporal, do
...
@@ -48,16 +48,13 @@ def test_lbm_vectorization(instruction_set, aligned_and_padding, nontemporal, do
size2
=
(
666
,
34
)
size2
=
(
666
,
34
)
relaxation_rate
=
1.8
relaxation_rate
=
1.8
if
instruction_set
==
"
neon
"
and
fixed_loop_sizes
is
False
:
pytest
.
skip
(
"
Has do be aligned for neon
"
)
print
(
"
Computing reference solutions
"
)
print
(
"
Computing reference solutions
"
)
ldc1_ref
=
create_lid_driven_cavity
(
size1
,
relaxation_rate
=
relaxation_rate
)
ldc1_ref
=
create_lid_driven_cavity
(
size1
,
relaxation_rate
=
relaxation_rate
)
ldc1_ref
.
run
(
time_steps
)
ldc1_ref
.
run
(
time_steps
)
ldc2_ref
=
create_lid_driven_cavity
(
size2
,
relaxation_rate
=
relaxation_rate
)
ldc2_ref
=
create_lid_driven_cavity
(
size2
,
relaxation_rate
=
relaxation_rate
)
ldc2_ref
.
run
(
time_steps
)
ldc2_ref
.
run
(
time_steps
)
data_type
=
"
float64
"
if
double_precision
else
"
float32
"
data_type
=
"
double
"
if
double_precision
else
"
float32
"
config
=
ps
.
CreateKernelConfig
(
data_type
=
data_type
,
cpu_vectorize_info
=
vectorization_options
)
config
=
ps
.
CreateKernelConfig
(
data_type
=
data_type
,
cpu_vectorize_info
=
vectorization_options
)
lbm_optimisation
=
LBMOptimisation
(
cse_global
=
True
)
lbm_optimisation
=
LBMOptimisation
(
cse_global
=
True
)
...
...
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