 |
Forums |
Admin Discussion Forums: help Start New Thread
By: Jason Grimes
RE: Problem with enqueue_write_buffer [ reply ] 2010-08-27 20:59
|
Hi Seiya,
I received the final word on this issue from Nvidia. According to them it's expected behavior, in that any device that has a compute capability less then 1.3 does not support the cl_khr_fp64 extension.
I confirmed this by writing my own little opencl info program and got these results:
Found 2 Devices
0
Name - GeForce GTX 480
Extensions - cl_khr_byte_addressable_store cl_khr_icd cl_khr_gl_sharing cl_nv_compiler_options cl_nv_device_attribute_query cl_nv_pragma_unroll cl_khr_global_int32_base_atomics cl_khr_global_int32_extended_atomics cl_khr_local_int32_base_atomics cl_khr_local_int32_extended_atomics cl_khr_fp64
OpenCL Version - OpenCL C 1.1
1
Name - GeForce 9400 GT
Extensions - cl_khr_byte_addressable_store cl_khr_icd cl_khr_gl_sharing cl_nv_compiler_options cl_nv_device_attribute_query cl_nv_pragma_unroll cl_khr_global_int32_base_atomics cl_khr_global_int32_extended_atomics
OpenCL Version - OpenCL C 1.0
So it looks like any OpenCL 1.0 device is not going to have double precision support. I'm guessing this applies to all pre-200 series cards per Nvidia hardware. I hope this helps some.
Jason
|
By: Jason Grimes
RE: Problem with enqueue_write_buffer [ reply ] 2010-08-26 23:36
|
Hi Seiya,
I got a response from Nvidia. I had some old double precision test code I was playing with still in the kernel. I still had the cl_khr_fp64 pragma enabled in the program. I'm guessing that now that fermi supports hardware double precision that it either broke the emulated doubles or the driver no longer supports the emulator. Once I removed the pragma the kernel compiles and runs on the 9400GT.
Jason
|
By: Jason Grimes
RE: Problem with enqueue_write_buffer [ reply ] 2010-08-26 00:30
|
Hi Seiya,
Thank you, that worked. I have put in a bug report about the 9400GT to Nvidia and I will let you know what they say about it. I have abandoned the ATI card, at least until they get their drivers figured out. :(
If you need someone to test new versions of Ruby-OpenCL, just let me know. I have no problem helping you test it.
Jason
|
By: Seiya Nishizawa
RE: Problem with enqueue_write_buffer [ reply ] 2010-08-26 00:11
|
Hi Jason,
Though the second argument of OpenCL::Context.new must be an array of devices,
it could be an array of length one.
You can create a context with one device such as
context1 = OpenCL::Context.new( nil, devices[1..1] ).
Seiya
|
By: Jason Grimes
RE: Problem with enqueue_write_buffer [ reply ] 2010-08-25 20:25
|
Hi Seiya,
I have tested out the SVN version and it worked once I removed the 9400GT from the devices array. Is there a function to create the context without sending a device array to Context.new(), basically create it for an individual device? It would be nice to be able to do something like:
context1 = OpenCL::Context.new( nil, devices[1] )
In this way have a little more control over the context creation.
Jason
|
By: Seiya Nishizawa
RE: Problem with enqueue_write_buffer [ reply ] 2010-08-25 05:36
|
Dear Jason,
There was a bug that compile error message of only the first device (Program#devices[0]) was output.
I fixed it and commit to SVN.
If your context has both GTX480 and 9400GT and the 9400GT is the first device, the error message was output even if compiling for GTX480 was succeeded.
If so, you should remove GT4800 from your context, or rescue the exception.
If not so, could you send me the script?
(seiya _at_ rubyforge . org)
Seiya
|
By: Jason Grimes
RE: Problem with enqueue_write_buffer [ reply ] 2010-08-25 00:21
|
Hi Seiya,
I'm following through with a bug report to Nvidia about the 158.19 driver but I wanted to make sure I have everything correct. I went ahead and reinstalled the driver and copied all of the opencl1.1 header files into /usr/include/CL. I downloaded the 0.7 version and ran extconf with the following options:
ruby extconf.rb --with-OpenCL-include=/usr/include/CL --with-OpneCL-lib=/usr/lib64
Ran make and then did make install as root. This should be the correct method to install, right? I recompiled the C++ version of the program that I wrote and it works ok on the GTX480, but when I run it on the 9400GT I get the same error as the ruby version "Error in clBuildProgram(-42)". Which is the invalid binary error.
It appears that the driver does not work with the older 9400GT card. Although when I modify the Ruby code to point to either the 9400GT or the GTX480 I get the same error. Does this point to the bindings, or is it still with the driver?
Thanks,
Jason
|
By: Jason Grimes
RE: Problem with enqueue_write_buffer [ reply ] 2010-08-24 04:34
|
Hi Seiya,
Looks like my problem was with the beta version of the Nvidia OpenCL 1.1 driver. I downgraded and everything is working again. I still have not had any luck getting the ATI card to work. The problem is most likely that I just don't know enough about Xorg to make it work. Or the ATI drivers just don't work yet. I will try again when the new ATI drivers are finalized and out.
Jason
|
By: Jason Grimes
RE: Problem with enqueue_write_buffer [ reply ] 2010-08-23 20:35
|
Hi Seiya,
I tested the narray fix in SVN and it worked great, no problems.
I have been trying to get a separate instance of X to run on the ATI card, but no luck so far. I even have a monitor pugged into it. I'm still going to try to get it up and running though. I will let you know if I find the right combination. Thanks,
Jason
|
By: Jason Grimes
RE: Problem with enqueue_write_buffer [ reply ] 2010-08-21 04:41
|
Hi Seiya,
The only problem I have with the ruby-opencl/samples is with narray. I was not able to compile with the narray option, but it still wanted it. I installed narray using gem and I modified the scripts with require "rubygems" and they appear to work fine. With device_query.rb I can see both nvidia GPUs and the CPUs via the ATI driver, but no ATI GPU. I tried many of the nvidia sdk demos and if they did not use opengl then they ran fine. The ones that use opengl all crash with a seg fault. It's starting to look like my driver installs are the problem. I think they did run at one point, but I have made so many changes I don't know when they stopped working.
My script uses OpenCL::Program.create_with_source so I don't know why it's reporting that error. I am going to have to clean up my driver installs and see if it helps any. Do you want to see my code (it requires ruby-gtk2 and builder to work)? The code worked fine before the upgrade so I'm assuming it has to be the driver installs.
I'm going to remove the ATI card and just get the system up and running on the nvidia cards. Then I can re-install the ATI card and hopefully find the point of failure or get it working.
Thank you for your help,
Jason
|
By: Seiya Nishizawa
RE: Problem with enqueue_write_buffer [ reply ] 2010-08-21 04:07
|
Hi Jason
A system having nvidia and amd GPUs is what I want to setup,
but at this moment my system has only nvidia GPU.
Anyway,
do demos included in nvidia sdk work well?
And do samples of ruby-opencl/samples/*rb work?
In your script,
do you create program with OpenCL::Context#create_program_with_binary?
The OpenCL Reference Pages says that
clBuildProgram called in OpenCL::Program#build
returns CL_INVALID_BINARY only when the program is created with clCreateProgramWithBinary, which is called in the create_program_with_binary method.
Seiya
|
By: Jason Grimes
RE: Problem with enqueue_write_buffer [ reply ] 2010-08-21 02:08
|
Hi Seiya,
I have installed 0.6 but it's not working for me. I'm not sure if it's 0.6's fault though, I have been upgrading my system and that might be the reason. I have a new computer with 3 GPUs installed, a nVidia GTX-480, a nVidia 9400-GT, and a ATI HD5870. I have been trying to get all of them to play nice with each other, but I haven't had much luck. Ruby-opencl-0.4 was working fine before the upgrade, now it's getting the same error as 0.6.
/usr/lib/ruby/site_ruby/1.8/opencl.rb:268:in `_build': INVALID BINARY: error code is -42 (RuntimeError)
from /usr/lib/ruby/site_ruby/1.8/opencl.rb:268:in `build'
from ./opencl-ifs.rb:268
: Considering profile 'compute_20' for gpu='sm_20' in 'cuModuleLoadDataEx_8'
I have loaded both of the OpenCL version 1.1 drivers for the cards.
nVidia - 258.19 OpenCL 1.1 CUDA 3.2.1
ATI - OpenCL 1.1 ATI-Stream-v2.2, fglrx-8.753.1
Both of these drivers are in beta at this time, so it's very likely there are problems with them. I might be setting up OpenCL incorrectly too now that the drivers are using ICD. The OS is Fedora 13.
Have you tried this type of set up before? I'm trying to build a good OpenCL test/development system.
Jason
|
By: Jason Grimes
RE: Problem with enqueue_write_buffer [ reply ] 2010-08-18 20:46
|
Hi Seiya,
No problem. :) Your last fix worked great, and I haven't had any issues so far. Thank you for providing the bindings for Ruby, it has been really fun to play around with OpenCL. Are you going to support OpenCL 1.1?
Jason
P.S. I sent this as an email and thought I should put it here too.
|
By: Seiya Nishizawa
RE: Problem with enqueue_write_buffer [ reply ] 2010-08-18 03:02
|
Hi Jason
Sorry for my really late reply.
You might already have solved the problem.
I'm not sure which the cause of the problem was on ruby-opencl or opencl device implementation itself,
but at least at this moment on my PC, it works well.
The test code that I tested is the followings.
========= TEST CODE FROM HERE =========
require "opencl"
platform = OpenCL::Platform.get_platforms[0]
devices = OpenCL::Device.get_devices(platform, OpenCL::Device::TYPE_ALL)
context = OpenCL::Context.new(nil, devices)
cmd_queue = OpenCL::CommandQueue.new(context, devices[0], 0)
n = 18
xform = OpenCL::VArray.new(OpenCL::VArray::FLOAT, n)
for i in 0...n
xform[i] = rand
end
memobj = OpenCL::Buffer.new(context,
OpenCL::Mem::READ_WRITE | OpenCL::Mem::COPY_HOST_PTR,
:host_ptr => xform)
str, event = cmd_queue.enqueue_read_buffer(memobj, OpenCL::TRUE)
res = OpenCL::VArray.to_va(OpenCL::VArray::FLOAT, str)
for i in 0...n
printf "%d, %f, %f\n", i, xform[i], res[i]
end
for i in 0...n
xform[i] = rand
end
cmd_queue.enqueue_write_buffer(memobj, OpenCL::TRUE, xform)
str, event = cmd_queue.enqueue_read_buffer(memobj, OpenCL::TRUE)
res = OpenCL::VArray.to_va(OpenCL::VArray::FLOAT, str)
for i in 0...n
printf "%d, %f, %f\n", i, xform[i], res[i]
end
========= TEST CODE TO HERE =========
|
By: Jason Grimes
Problem with enqueue_write_buffer [ reply ] 2010-02-25 04:09
|
First I just wanted to say that the bindings are working very well for me. I'm writing an IFS fractal generator and it is working much faster then with the CPU alone.
The problem I'm having is that I can set up a memory object and pass it on to the GPU with the kernel using enqueue_NDrange_kernal and everything works great. But when I try to change the values of that same memory buffer, the new values do not get set and the buffer is filled with what appears to be random numbers. To test I first pulled the current numbers from the GPU with enqueue_read_buffer. Here is the list:
-0.726155579090118
-0.289840072393417
-0.706543147563934
-0.833026707172394
-0.51837831735611
0.388869941234589
-0.318528085947037
-0.00522966729477048
-0.0147170554846525
-0.259334653615952
-0.958710312843323
-0.817415952682495
0.175983726978302
-0.612519025802612
0.486481755971909
0.897284030914307
-0.903537273406982
0.0941789746284485
I then changed them in the host side array to this:
-0.212400704622269
-0.316341459751129
0.297761172056198
0.877491056919098
-0.155886888504028
0.343398749828339
-0.197375297546387
0.685064077377319
-0.758881092071533
-0.297949492931366
0.158080086112022
-0.419233858585358
0.024456525221467
-0.174385711550713
-0.569777965545654
0.645003318786621
-0.518262326717377
0.13399101793766
Then I wrote the new numbers to the GPU and then read them out again. Here are the results:
2.05158704754918e-37
0.0
1.66583491579679e-37
0.0
0.0
0.0
-4.72242644469279e+37
4.59163467805313e-41
NaN
NaN
-4.72249134840352e+37
4.59163467805313e-41
0.0
0.0
0.0
0.0
6.03623046232865e-39
0.0
The buffer was created using the following code:
$xform = OpenCL::VArray.new( OpenCL::VArray::FLOAT, 18 )
$memobjs[1] = OpenCL::Buffer.new($context,
OpenCL::Mem::READ_WRITE | OpenCL::Mem::COPY_HOST_PTR,
:host_ptr => $xform)
The buffer write was done with this command:
$cmd_queue.enqueue_write_buffer( $memobjs[1],
OpenCL::TRUE,
$xform )
Thank you,
Jason
|
|
 |