pypr/pysph

AttributeError: 'pysph.base.nnps_base.NeighborCache' object has no attribute 'get_neighbors_gpu'

ckesanapalli opened this issue · 2 comments

Hi Guys,

I am simulating a sloshing tank in pysph and it is working on CPU and OpenMP.
but when I tried to run using OpenCL
python .\sloshing_tank.py --opencl

Then I encounter the following error,

Using h = 0.002600
SISPH dt = 0.000100
Choose platform:
[0] <pyopencl.Platform 'NVIDIA CUDA' at 0x17cfbcd2d10>
[1] <pyopencl.Platform 'Intel(R) OpenCL' at 0x17cfbcd10e0>
Choice [0]:0
Set the environment variable PYOPENCL_CTX='0' to avoid being asked again.
OpenCL code written to C:\Users\kccho\.pysph\source\py3.7-win-amd64\generated.cl
Traceback (most recent call last):
  File ".\sloshing_tank.py", line 434, in <module>
    app.run()
  File "C:\Users\kccho\anaconda3\envs\pysph\lib\site-packages\pysph\solver\application.py", line 1535, in run        
    self._create_particles(self.create_particles)
  File "C:\Users\kccho\anaconda3\envs\pysph\lib\site-packages\pysph\solver\application.py", line 903, in _create_particles
    self.particles = particle_factory(*args, **kw)
  File ".\sloshing_tank.py", line 374, in create_particles
    self.scheme.setup_properties([fluid, boundary])
  File "C:\Users\kccho\anaconda3\envs\pysph\lib\site-packages\pysph\sph\scheme.py", line 202, in setup_properties    
    self.scheme.setup_properties(particles, clean)
  File "D:\Research\SPH\PySPH\HPRC_PySPH\para_tolerance_13_w_0_2\tolerance_0_010\sisph.py", line 1459, in setup_properties
    self._get_normals(pa)
  File "D:\Research\SPH\PySPH\HPRC_PySPH\para_tolerance_13_w_0_2\tolerance_0_010\sisph.py", line 1113, in _get_normals
    seval.evaluate()
  File "C:\Users\kccho\anaconda3\envs\pysph\lib\site-packages\pysph\tools\sph_evaluator.py", line 53, in evaluate    
    self.func_eval.compute(t, dt)
  File "C:\Users\kccho\anaconda3\envs\pysph\lib\site-packages\pysph\sph\acceleration_eval.py", line 232, in compute  
    self.c_acceleration_eval.compute(t, dt)
  File "C:\Users\kccho\anaconda3\envs\pysph\lib\site-packages\pysph\sph\acceleration_eval_gpu_helper.py", line 286, in compute
    self._call_kernel(info, extra_args)
  File "C:\Users\kccho\anaconda3\envs\pysph\lib\site-packages\pysph\sph\acceleration_eval_gpu_helper.py", line 234, in _call_kernel
    cache.get_neighbors_gpu()
AttributeError: 'pysph.base.nnps_base.NeighborCache' object has no attribute 'get_neighbors_gpu'

As mentioned earlier to install pyopencl first and then install pysph, I did the same

pip uninstall pysph
pip install pyopencl
pip install -r requirements.txt
python setup.py develop

But I am still enclosing the issue. Can anyone tell me how to resolve this issue?

This is not quite a bug in pysph, it is a problem with your sisph.py file which is using an SPHEvaluator and using a CPU NNPS instead of a GPU one. In any case this could be improved in the SPH Evaluator and I will take a look this weekend. For now you could edit sisph.py and change the _get_normals method and pass a suitable NNPS to the evaluator. Also I am not sure the 2D performance is going to be very good with OpenCL.

Got it. Thanks for your suggestion.