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
1da569d0
Commit
1da569d0
authored
3 years ago
by
Markus Holzer
Browse files
Options
Downloads
Patches
Plain Diff
Fixed vectorisation tests
parent
3cc4797c
No related branches found
No related tags found
1 merge request
!98
Generalisation of Relaxation rate setter
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
lbmpy/lbstep.py
+1
-1
1 addition, 1 deletion
lbmpy/lbstep.py
lbmpy_tests/test_vectorization.py
+19
-11
19 additions, 11 deletions
lbmpy_tests/test_vectorization.py
with
20 additions
and
12 deletions
lbmpy/lbstep.py
+
1
−
1
View file @
1da569d0
...
...
@@ -22,7 +22,7 @@ class LatticeBoltzmannStep:
velocity_data_name
=
None
,
density_data_name
=
None
,
density_data_index
=
None
,
compute_velocity_in_every_step
=
False
,
compute_density_in_every_step
=
False
,
velocity_input_array_name
=
None
,
time_step_order
=
'
stream_collide
'
,
flag_interface
=
None
,
alignment_if_vectorized
=
64
,
fixed_loop_sizes
=
True
,
fixed_relaxation_rates
=
True
,
alignment_if_vectorized
=
64
,
fixed_loop_sizes
=
True
,
timeloop_creation_function
=
TimeLoop
,
lbm_config
=
None
,
lbm_optimisation
=
None
,
config
=
None
,
**
method_parameters
):
...
...
This diff is collapsed.
Click to expand it.
lbmpy_tests/test_vectorization.py
+
19
−
11
View file @
1da569d0
import
numpy
as
np
import
pytest
from
dataclasses
import
replace
import
pystencils
as
ps
from
lbmpy
import
LBMOptimisation
from
pystencils.backends.simd_instruction_sets
import
get_supported_instruction_sets
from
lbmpy.scenarios
import
create_lid_driven_cavity
...
...
@@ -43,26 +48,29 @@ def test_lbm_vectorization(instruction_set, aligned_and_padding, nontemporal, do
size2
=
(
666
,
34
)
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
"
)
ldc1_ref
=
create_lid_driven_cavity
(
size1
,
relaxation_rate
=
relaxation_rate
)
ldc1_ref
.
run
(
time_steps
)
ldc2_ref
=
create_lid_driven_cavity
(
size2
,
relaxation_rate
=
relaxation_rate
)
ldc2_ref
.
run
(
time_steps
)
optimization
=
{
'
double_precision
'
:
double_precision
,
'
vectorization
'
:
vectorization_options
,
'
cse_global
'
:
True
,
}
print
(
"
Vectorization test, double precision {}, vectorization {
}, fixed loop sizes {}
"
.
format
(
double_precision
,
vectorization_options
,
fixed_loop_sizes
)
)
ldc1
=
create_lid_driven_cavity
(
size1
,
relaxation_rate
=
relaxation_rate
,
optimization
=
optimization
,
fixed_loop_sizes
=
fixed_loop_sizes
)
data_type
=
"
float64
"
if
double_precision
else
"
float32
"
config
=
ps
.
CreateKernelConfig
(
data_type
=
data_type
,
cpu_vectorize_info
=
vectorization_options
)
lbm_optimisation
=
LBMOptimisation
(
cse_global
=
True
)
print
(
f
"
Vectorization test, double precision
{
double_precision
}
, vectorization
{
vectorization_options
}
,
"
f
"
fixed loop sizes
{
fixed_loop_sizes
}
"
)
ldc1
=
create_lid_driven_cavity
(
size1
,
relaxation_rate
=
relaxation_rate
,
fixed_loop_sizes
=
fixed_loop_sizes
,
config
=
config
,
lbm_optimisation
=
lbm_optimisation
)
ldc1
.
run
(
time_steps
)
np
.
testing
.
assert_almost_equal
(
ldc1_ref
.
velocity
[:,
:],
ldc1
.
velocity
[:,
:])
optimi
z
ation
[
'
split
'
]
=
True
ldc2
=
create_lid_driven_cavity
(
size2
,
relaxation_rate
=
relaxation_rate
,
optimization
=
optimization
,
fixed_loop_sizes
=
fixed_loop_sizes
)
lbm_
optimi
s
ation
=
replace
(
lbm_optimisation
,
split
=
True
)
ldc2
=
create_lid_driven_cavity
(
size2
,
relaxation_rate
=
relaxation_rate
,
fixed_loop_sizes
=
fixed_loop_sizes
,
config
=
config
,
lbm_optimisation
=
lbm_optimisation
)
ldc2
.
run
(
time_steps
)
np
.
testing
.
assert_almost_equal
(
ldc2_ref
.
velocity
[:,
:],
ldc2
.
velocity
[:,
:])
...
...
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