Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
hysop
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
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
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
particle_methods
hysop
Commits
37eecfaf
Commit
37eecfaf
authored
10 years ago
by
Jean-Matthieu Etancelin
Browse files
Options
Downloads
Patches
Plain Diff
Update to single precision patch. Fix gpu advection test
parent
819320f2
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
HySoP/hysop/gpu/tests/test_advection_randomVelocity.py
+32
-48
32 additions, 48 deletions
HySoP/hysop/gpu/tests/test_advection_randomVelocity.py
with
32 additions
and
48 deletions
HySoP/hysop/gpu/tests/test_advection_randomVelocity.py
+
32
−
48
View file @
37eecfaf
...
@@ -40,12 +40,10 @@ def assertion_2D_withPython(scal, velo, advec, advec_py):
...
@@ -40,12 +40,10 @@ def assertion_2D_withPython(scal, velo, advec, advec_py):
velo_d
=
velo
.
discreteFields
.
values
()[
0
]
velo_d
=
velo
.
discreteFields
.
values
()[
0
]
scal_d
.
data
[
0
][...]
=
npw
.
asrealarray
(
scal_d
.
data
[
0
][...]
=
npw
.
asrealarray
(
np
.
random
.
random
(
scal_d
.
data
[
0
].
shape
))
np
.
random
.
random
(
scal_d
.
data
[
0
].
shape
))
velo_d
.
data
[
0
][...]
=
npw
.
ones
(
scal_d
.
data
[
0
].
shape
)
velo_d
.
data
[
0
][...]
=
np
.
asarray
(
#velo_d.data[0][...] = np.asarray(
np
.
random
.
random
(
scal_d
.
data
[
0
].
shape
))
/
(
2.
*
scal_d
.
resolution
[
0
])
# np.random.random(scal_d.data[0].shape)) / (2. * scal_d.resolution[0])
velo_d
.
data
[
1
][...]
=
np
.
asarray
(
velo_d
.
data
[
1
][...]
=
npw
.
ones
(
scal_d
.
data
[
0
].
shape
)
np
.
random
.
random
(
scal_d
.
data
[
0
].
shape
))
/
(
2.
*
scal_d
.
resolution
[
1
])
#velo_d.data[1][...] = np.asarray(
# np.random.random(scal_d.data[0].shape)) / (2. * scal_d.resolution[1])
scal_d
.
toDevice
()
scal_d
.
toDevice
()
velo_d
.
toDevice
()
velo_d
.
toDevice
()
...
@@ -69,15 +67,12 @@ def assertion_3D_withPython(scal, velo, advec, advec_py):
...
@@ -69,15 +67,12 @@ def assertion_3D_withPython(scal, velo, advec, advec_py):
velo_d
=
velo
.
discreteFields
.
values
()[
0
]
velo_d
=
velo
.
discreteFields
.
values
()[
0
]
scal_d
.
data
[
0
][...]
=
npw
.
asrealarray
(
scal_d
.
data
[
0
][...]
=
npw
.
asrealarray
(
np
.
random
.
random
(
scal_d
.
data
[
0
].
shape
))
np
.
random
.
random
(
scal_d
.
data
[
0
].
shape
))
velo_d
.
data
[
0
][...]
=
npw
.
ones
(
scal_d
.
data
[
0
].
shape
)
velo_d
.
data
[
0
][...]
=
npw
.
zeros_like
(
#npw.zeros_like(
scal_d
.
data
[
0
])
/
(
2.
*
scal_d
.
resolution
[
0
])
# scal_d.data[0]) / (2. * scal_d.resolution[0])
velo_d
.
data
[
1
][...]
=
npw
.
zeros_like
(
velo_d
.
data
[
1
][...]
=
npw
.
ones
(
scal_d
.
data
[
0
].
shape
)
scal_d
.
data
[
0
])
/
(
2.
*
scal_d
.
resolution
[
1
])
#npw.zeros_like(
velo_d
.
data
[
2
][...]
=
npw
.
zeros_like
(
# scal_d.data[0]) / (2. * scal_d.resolution[1])
scal_d
.
data
[
0
])
/
(
2.
*
scal_d
.
resolution
[
2
])
velo_d
.
data
[
2
][...]
=
npw
.
ones
(
scal_d
.
data
[
0
].
shape
)
#npw.zeros_like(
# scal_d.data[0]) / (2. * scal_d.resolution[2])
scal_d
.
toDevice
()
scal_d
.
toDevice
()
velo_d
.
toDevice
()
velo_d
.
toDevice
()
...
@@ -103,14 +98,14 @@ def test_2D_m6_1k():
...
@@ -103,14 +98,14 @@ def test_2D_m6_1k():
advec
=
Advection
(
velo
,
scal
,
discretization
=
d2d
,
advec
=
Advection
(
velo
,
scal
,
discretization
=
d2d
,
method
=
{
TimeIntegrator
:
RK2
,
method
=
{
TimeIntegrator
:
RK2
,
Interpolation
:
Linear
,
Interpolation
:
Linear
,
Remesh
:
L
2_1
,
Remesh
:
L
4_2
,
Support
:
'
gpu_2k
'
,
Support
:
'
gpu_2k
'
,
Splitting
:
'
o2
'
}
Splitting
:
'
o2
'
}
)
)
advec_py
=
Advection
(
velo
,
scal
,
discretization
=
d2d
,
advec_py
=
Advection
(
velo
,
scal
,
discretization
=
d2d
,
method
=
{
TimeIntegrator
:
RK2
,
method
=
{
TimeIntegrator
:
RK2
,
Interpolation
:
Linear
,
Interpolation
:
Linear
,
Remesh
:
L
2_1
,
Remesh
:
L
4_2
,
Support
:
''
,
Support
:
''
,
Splitting
:
'
o2
'
},
Splitting
:
'
o2
'
},
)
)
...
@@ -699,13 +694,10 @@ def test_rectangular_domain2D():
...
@@ -699,13 +694,10 @@ def test_rectangular_domain2D():
scal_d
=
scal
.
discreteFields
.
values
()[
0
]
scal_d
=
scal
.
discreteFields
.
values
()[
0
]
velo_d
=
velo
.
discreteFields
.
values
()[
0
]
velo_d
=
velo
.
discreteFields
.
values
()[
0
]
scal_d
.
data
[
0
][...]
=
npw
.
asrealarray
(
np
.
random
.
random
(
scal_d
.
data
[
0
].
shape
))
scal_d
.
data
[
0
][...]
=
npw
.
asrealarray
(
np
.
random
.
random
(
scal_d
.
data
[
0
].
shape
))
velo_d
.
data
[
0
][...]
=
npw
.
ones
(
scal_d
.
data
[
0
].
shape
)
velo_d
.
data
[
0
][...]
=
np
.
asarray
(
#np.asarray(
np
.
random
.
random
(
velo_d
.
data
[
0
].
shape
))
/
(
2.
*
scal_d
.
resolution
[
0
])
# np.random.random(velo_d.data[0].shape)) / (2. * scal_d.resolution[0])
velo_d
.
data
[
1
][...]
=
np
.
asarray
(
velo_d
.
data
[
1
][...]
=
npw
.
ones
(
scal_d
.
data
[
0
].
shape
)
np
.
random
.
random
(
velo_d
.
data
[
1
].
shape
))
/
(
2.
*
scal_d
.
resolution
[
1
])
#np.asarray(
# np.random.random(velo_d.data[1].shape)) / (2. * scal_d.resolution[1])
scal_d
.
toDevice
()
scal_d
.
toDevice
()
velo_d
.
toDevice
()
velo_d
.
toDevice
()
...
@@ -746,15 +738,12 @@ def test_rectangular_domain3D():
...
@@ -746,15 +738,12 @@ def test_rectangular_domain3D():
scal_d
=
scal
.
discreteFields
.
values
()[
0
]
scal_d
=
scal
.
discreteFields
.
values
()[
0
]
velo_d
=
velo
.
discreteFields
.
values
()[
0
]
velo_d
=
velo
.
discreteFields
.
values
()[
0
]
scal_d
.
data
[
0
][...]
=
npw
.
asrealarray
(
np
.
random
.
random
(
scal_d
.
data
[
0
].
shape
))
scal_d
.
data
[
0
][...]
=
npw
.
asrealarray
(
np
.
random
.
random
(
scal_d
.
data
[
0
].
shape
))
velo_d
.
data
[
0
][...]
=
npw
.
ones
(
scal_d
.
data
[
0
].
shape
)
velo_d
.
data
[
0
][...]
=
npw
.
asrealarray
(
#npw.asrealarray(
np
.
random
.
random
(
velo_d
.
data
[
0
].
shape
))
/
(
2.
*
scal_d
.
resolution
[
0
])
# np.random.random(velo_d.data[0].shape)) / (2. * scal_d.resolution[0])
velo_d
.
data
[
1
][...]
=
npw
.
asrealarray
(
velo_d
.
data
[
1
][...]
=
npw
.
ones
(
scal_d
.
data
[
0
].
shape
)
np
.
random
.
random
(
velo_d
.
data
[
1
].
shape
))
/
(
2.
*
scal_d
.
resolution
[
1
])
#npw.asrealarray(
velo_d
.
data
[
2
][...]
=
npw
.
asrealarray
(
# np.random.random(velo_d.data[1].shape)) / (2. * scal_d.resolution[1])
np
.
random
.
random
(
velo_d
.
data
[
2
].
shape
))
/
(
2.
*
scal_d
.
resolution
[
2
])
velo_d
.
data
[
2
][...]
=
npw
.
ones
(
scal_d
.
data
[
0
].
shape
)
#npw.asrealarray(
# np.random.random(velo_d.data[2].shape)) / (2. * scal_d.resolution[2])
scal_d
.
toDevice
()
scal_d
.
toDevice
()
velo_d
.
toDevice
()
velo_d
.
toDevice
()
...
@@ -796,12 +785,10 @@ def test_vector_2D():
...
@@ -796,12 +785,10 @@ def test_vector_2D():
velo_d
=
velo
.
discreteFields
.
values
()[
0
]
velo_d
=
velo
.
discreteFields
.
values
()[
0
]
scal_d
.
data
[
0
][...]
=
npw
.
asrealarray
(
np
.
random
.
random
(
scal_d
.
data
[
0
].
shape
))
scal_d
.
data
[
0
][...]
=
npw
.
asrealarray
(
np
.
random
.
random
(
scal_d
.
data
[
0
].
shape
))
scal_d
.
data
[
1
][...]
=
npw
.
asrealarray
(
np
.
random
.
random
(
scal_d
.
data
[
1
].
shape
))
scal_d
.
data
[
1
][...]
=
npw
.
asrealarray
(
np
.
random
.
random
(
scal_d
.
data
[
1
].
shape
))
velo_d
.
data
[
0
][...]
=
npw
.
ones
(
scal_d
.
data
[
0
].
shape
)
velo_d
.
data
[
0
][...]
=
npw
.
asarray
(
#npw.asarray(
np
.
random
.
random
(
velo_d
.
data
[
0
].
shape
))
/
(
2.
*
scal_d
.
resolution
[
0
])
# np.random.random(velo_d.data[0].shape)) / (2. * scal_d.resolution[0])
velo_d
.
data
[
1
][...]
=
npw
.
asarray
(
velo_d
.
data
[
1
][...]
=
npw
.
ones
(
scal_d
.
data
[
0
].
shape
)
np
.
random
.
random
(
velo_d
.
data
[
1
].
shape
))
/
(
2.
*
scal_d
.
resolution
[
1
])
#npw.asarray(
# np.random.random(velo_d.data[1].shape)) / (2. * scal_d.resolution[1])
scal_d
.
toDevice
()
scal_d
.
toDevice
()
velo_d
.
toDevice
()
velo_d
.
toDevice
()
...
@@ -850,15 +837,12 @@ def test_vector_3D():
...
@@ -850,15 +837,12 @@ def test_vector_3D():
np
.
random
.
random
(
scal_d
.
data
[
0
].
shape
))
np
.
random
.
random
(
scal_d
.
data
[
0
].
shape
))
scal_d
.
data
[
2
][...]
=
npw
.
asrealarray
(
scal_d
.
data
[
2
][...]
=
npw
.
asrealarray
(
np
.
random
.
random
(
scal_d
.
data
[
0
].
shape
))
np
.
random
.
random
(
scal_d
.
data
[
0
].
shape
))
velo_d
.
data
[
0
][...]
=
npw
.
ones
(
scal_d
.
data
[
0
].
shape
)
velo_d
.
data
[
0
][...]
=
npw
.
asrealarray
(
#npw.asrealarray(
np
.
random
.
random
(
velo_d
.
data
[
0
].
shape
))
/
(
2.
*
scal_d
.
resolution
[
0
])
# np.random.random(velo_d.data[0].shape)) / (2. * scal_d.resolution[0])
velo_d
.
data
[
1
][...]
=
npw
.
asrealarray
(
velo_d
.
data
[
1
][...]
=
npw
.
ones
(
scal_d
.
data
[
0
].
shape
)
np
.
random
.
random
(
velo_d
.
data
[
1
].
shape
))
/
(
2.
*
scal_d
.
resolution
[
1
])
#npw.asrealarray(
velo_d
.
data
[
2
][...]
=
npw
.
asrealarray
(
# np.random.random(velo_d.data[1].shape)) / (2. * scal_d.resolution[1])
np
.
random
.
random
(
velo_d
.
data
[
2
].
shape
))
/
(
2.
*
scal_d
.
resolution
[
2
])
velo_d
.
data
[
2
][...]
=
npw
.
ones
(
scal_d
.
data
[
0
].
shape
)
#npw.asrealarray(
# np.random.random(velo_d.data[2].shape)) / (2. * scal_d.resolution[2])
scal_d
.
toDevice
()
scal_d
.
toDevice
()
velo_d
.
toDevice
()
velo_d
.
toDevice
()
...
...
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