Skip to content

Commit

Permalink
Fix examples for GPU backends
Browse files Browse the repository at this point in the history
  • Loading branch information
adityapb authored and prabhuramachandran committed Aug 20, 2020
1 parent 6564888 commit 453db71
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion pysph/base/device_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -600,7 +600,7 @@ def empty_clone(self, props=None):
prop_type = dtype_to_ctype(src_arr.dtype)
prop_default = self._particle_array.default_values[prop_name]
result_array.add_property(name=prop_name,
type=prop_type,
type='double' if prop_type == 'float' else prop_type,
default=prop_default,
stride=stride)

Expand Down
6 changes: 3 additions & 3 deletions pysph/examples/_db_geometry.py
Original file line number Diff line number Diff line change
Expand Up @@ -396,11 +396,11 @@ def create_particles(self, **kwargs):

pa.rho[:] = self.rho0

nf = fluid.num_real_particles
nb = boundary.num_real_particles
nf = fluid.get_number_of_particles()
nb = boundary.get_number_of_particles()

if self.with_obstacle:
no = obstacle.num_real_particles
no = obstacle.get_number_of_particles()
print(
"3D dam break with %d fluid, %d boundary, %d obstacle particles" %
(nf, nb, no))
Expand Down
4 changes: 4 additions & 0 deletions pysph/examples/cube.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,10 @@ def create_particles(self):

print("Number of particles:", x.size)
fluid.set_lb_props( list(fluid.properties.keys()) )

if fluid.gpu:
fluid.gpu.push()

return [fluid]


Expand Down

0 comments on commit 453db71

Please sign in to comment.