Re: [PyCUDA] PyCUDA+OpenGL and core dump

2010-10-31 Thread Andreas Kloeckner
On Sat, 30 Oct 2010 13:04:03 +0200, Tomasz Rybak bogom...@post.pl wrote:
 Hello.
 I have been trying to create some OpenGL examples for PyCUDA
 and found program that segfaults.
 I cannot debug it fully as the last 8 functions are from
 NVIDIA libraries.
 The last known function in the trace is cuda::context::detach.
 
 Error is present on GTX460 (Fermi) and ION (9400M),
 on PyCUDA with my patch and without it.
 
 System information:
 Debian 64-bit, kernel 2.6.32, drivers 256.53, CUDA 3.1.
 PyCUDA from git.
 
 Can someone look at program and stack trace and tell whether
 there is some obvious mistake I am missing?
 If not, I think I will report upstream bug to NVIDIA.

Doesn't appear to crash with 260.24. (3.2RC available from Nvidia if you
sign up for their developer program) Haven't tried 3.2rc2.

Andreas



pgpUGSN1nR9ui.pgp
Description: PGP signature
___
PyCUDA mailing list
PyCUDA@tiker.net
http://lists.tiker.net/listinfo/pycuda


Re: [PyCUDA] PyCUDA+OpenGL and core dump

2010-10-31 Thread Andreas Kloeckner
On Sun, 31 Oct 2010 16:07:29 -0400, Andreas Kloeckner li...@informa.tiker.net 
wrote:
 On Sat, 30 Oct 2010 13:04:03 +0200, Tomasz Rybak bogom...@post.pl wrote:
  Hello.
  I have been trying to create some OpenGL examples for PyCUDA
  and found program that segfaults.
  I cannot debug it fully as the last 8 functions are from
  NVIDIA libraries.
  The last known function in the trace is cuda::context::detach.
  
  Error is present on GTX460 (Fermi) and ION (9400M),
  on PyCUDA with my patch and without it.
  
  System information:
  Debian 64-bit, kernel 2.6.32, drivers 256.53, CUDA 3.1.
  PyCUDA from git.
  
  Can someone look at program and stack trace and tell whether
  there is some obvious mistake I am missing?
  If not, I think I will report upstream bug to NVIDIA.
 
 Doesn't appear to crash with 260.24. (3.2RC available from Nvidia if you
 sign up for their developer program) Haven't tried 3.2rc2.

I lied. It does crash when you close the window.
(2.6.35, amd64, 260.24, 3.2rc)

Andreas


pgpl0DQRWAHlA.pgp
Description: PGP signature
___
PyCUDA mailing list
PyCUDA@tiker.net
http://lists.tiker.net/listinfo/pycuda


Re: [PyCUDA] OpenGL and new functions

2010-10-31 Thread Andreas Kloeckner
Hi Tomasz,

first of all, thanks for sending this patch! Much appreciated. Comments
below.

On Fri, 29 Oct 2010 19:20:17 +0200, Tomasz Rybak bogom...@post.pl wrote:
 The biggest problem is that IMO (I might be wrong - do
 not know PyCUDA to such intimate details) it introduces
 non-backward-compatible change.

Why do this? Why not introduce a new interface and leave the old one in
place? That way, we can compile both interfaces as long as they're
available, and it's up to the user which one to use. We shouldn't be in
the business of imposing API use restrictions on PyCUDA users.

 I have split BufferObject into two:
 BufferObject responsible for buffers (VBO, etc.)
 ImageObject responsible for textures, etc.
 
 Previously BufferObject was responsible for both those
 cases - now anyone who wants to use CUDA on images
 must use ImageObject (which is API-breaking change).

Can you explain the reasoning for this split? A brief glance over the
code didn't seem to reveal many differences. If nothing else, they
should probably inherit from a common base that absorbs the shared code.

Also, I noticed that your use of cudaGrahpicsXXX flags with
cuGrahpicsGLRegisterBuffer() is likely erroneous, as is visible in this
bit of documentation. There are equivalent CU_... flags which we should
use instead. See docs here (or in the header):

http://developer.download.nvidia.com/compute/cuda/3_0-Beta1/toolkit/docs/online/group__CUGL_ge148ed92fe0728be19c9281302b5922c.html

Also fishy: image_object, if it is different code, should probably be
using cuGraphicsGLRegisterImage() (rather than ... Buffer()).

 I also attach problem sample code (Qt+OpenGL+PyCUDA)
 that uses new BufferObject.
 I have checked and it works after applying my patch;
 I only had to change initialisation to get program
 using VBO running after applying my patch.

I still don't like that we need to change the init sequence--why is this
necessary?

 I have not checked ImageObject.
 
 I have also started writing documentation for new pycuda.gl
 functions.
 
 I have removed gl_init as documentation says that cuGLInit()
 is deprecated and is not doing anything (Reference 4.41.4.1).

Again, as above, we shouldn't be making API use decisions for our
users. I assume it did do something at some point in the past, so as
long as feasible we should still wrap it.

 Instead I have created gl_select_device; this function however
 must be called as the first (before all other CUDA functions),
 is cuda*, not cu* function, does not cooperate with
 CUDAPP_CALL_GUARDED - so I do not know what to do with it.
 I was not able to test it - I do not have setup with two devices.

As above, I don't like mixing in cuda* (run-time API) functionality with
cu* (driver API) functionality.

 Other problems:
 
 Function pycuda.tools.get_default_device is depreciated,
 but pycuda.gl.autoinit uses it. I have changed autoinit
 to use Device(0), but it is not elegant and should be changed.



 
 Function pycuda.tools.make_default_context contains
 repeated code checking for presence of CUDA device:
 
 def make_default_context():
 ndevices = cuda.Device.count()
 if ndevices == 0:
 errmsg = No CUDA enabled device found. Please check your
 installation.
 raise RuntimeError, errmsg
 
 ndevices = cuda.Device.count()
 if ndevices == 0:
 raise RuntimeError(No CUDA enabled device found. 
 Please check your installation.)
 
 Why? Is that omission, or does this double checking serve
 some purpose?

Whoops. Fixed.

Andreas


pgpWcF3ZFrtNT.pgp
Description: PGP signature
___
PyCUDA mailing list
PyCUDA@tiker.net
http://lists.tiker.net/listinfo/pycuda