Open davidbp opened 8 years ago
The statement
energy = pv.ElementExp(-W)
only instantiates a proxy element, so 'energy' does not hold the values of the operation, but merely encodes the operation exp(-W)
. Try
energy = pv.ElementExp(-W).execute()
and then the last line should evaluate correctly. (You can verify the object's type by e.g. type(energy)
)
Thank you Karl,
You are right. I'm sorry for the questions. I'm still getting used to the library. ( It seems to be similar to theano. where the .execute in pyviennacl behaves similar to theano's .eval() )
I just found an estrange behaviour.
class ElementDiv(Node)
| Represents the elementwise multiplication of one object by another of the
| same type.
nevertheless I get...
import numpy as np
import pyviennacl as pv
### THIS PRODUCES NANS
ones = pv.Matrix(np.ones([800,100], dtype="float32"))
pv.ElementDiv(ones, ones).execute()
array([[ 1., 1., 1., ..., 1., 1., 1.],
[ 1., 1., 1., ..., 1., 1., 1.],
[ 1., 1., 1., ..., 1., 1., 1.],
...,
[ 1., 1., 1., ..., nan, nan, nan],
[ 1., 1., 1., ..., nan, nan, nan],
[ 1., 1., 1., ..., nan, nan, nan]], dtype=float32)
### THIS DOES NOT PRODUCE NANS
ones = pv.Matrix(np.ones([800, 800], dtype="float32"))
pv.ElementDiv(ones, ones).execute()
array([[ 1., 1., 1., ..., 1., 1., 1.],
[ 1., 1., 1., ..., 1., 1., 1.],
[ 1., 1., 1., ..., 1., 1., 1.],
...,
[ 1., 1., 1., ..., 1., 1., 1.],
[ 1., 1., 1., ..., 1., 1., 1.],
[ 1., 1., 1., ..., 1., 1., 1.]], dtype=float32)
Thanks for reporting this odd behavior. Could you please tell me which OpenCL device and which version of PyViennaCL (the released 1.0.3 or built from repo) you are using?
I can tell my PyViennaCL version is 1.0.3 from
import pyviennacl as pv
>>> pv.__version__
'1.0.3
>>> pyviennacl.__viennacl_version__
'1.5.2'
I don't know how to tell you which device I'm using. What command can I use to tell you?
@karlrupp do you have any idea why this might happen? Do you get the same behaviour?
@davidbp: Thanks for the reminder. I just tried to reproduce the error with PyViennaCL 1.0.3 as well as by directly running the routines in ViennaCL 1.5.2, 1.6.0, 1.6.2, and 1.7.0. Unfortunately, however, I could not reproduce the issue.
Could you briefly describe the hardware available on your machine? Do you have a discrete GPU? If so, which model? This should help me with reproducing the problem. Thanks!
@karlrupp, How do you set the context? In pyopencl in the same machine, it appears I can use CPU or 2 gpus. This is what I see:
python test_pyopencl.py
Choose platform:
[0] <pyopencl.Platform 'Apple' at 0x7fff0000>
Choice [0]:0
Choose device(s):
[0] <pyopencl.Device 'Intel(R) Xeon(R) CPU E5-1620 v2 @ 3.70GHz' on 'Apple' at 0xffffffff>
[1] <pyopencl.Device 'ATI Radeon HD - FirePro D300 Compute Engine' on 'Apple' at 0x1021c00>
[2] <pyopencl.Device 'ATI Radeon HD - FirePro D300 Compute Engine' on 'Apple' at 0x2021c00>
I don't know how can I set context in pyviennacl.
@karlrupp, to ensure it was not my apple machine I tried the same posted code in an ubuntu 14.04 lts. I got the exact same results. With pyviennacl.version : 1.0.3
As far as I know, the 1.0.3 release version does not provide the option of setting the device through Python. The latest code in the repository, however, does.
I'll keep trying to reproduce the issue, please allow for a couple of hours.
Success: I was accidentally using a newer version than 1.0.3 for my first tests. With a fresh build of PyViennaCL 1.0.3 I can reproduce the issue.
Given that the issue disappears with the developer version of PyViennaCL, could you please try that? If you encounter any issues, please let me know.
Hello,
I've was adding a couple of Matrix objects (of the same shape) and stumbled upon an error. Maybe you can give me a hint about what is wrong in my code:
It returned:
ERROR 2015-11-15 02:02:58,128 pyviennacl.pycore 2844 execute EXCEPTION EXECUTING: Assign(Matrix, Add(ElementExp(Mul(Matrix, HostScalar)=>Matrix)=>Matrix, Matrix)=>Matrix)=>NoResult .... RuntimeError: ViennaCL: Internal error: The scheduler encountered a problem with the operation provided: Cannot deal with unary operations on vectors