Discussion:
[PyCUDA] Handle Error in CUDA Kernel
Rana, Sanjay
2017-06-19 19:17:20 UTC
Permalink
Hello,

Are there any examples out there on ways to catch and handle errors in the CUDA Kernel code ?
I have seen examples for CUDA programming in C/C++ but not so many for pycuda.

Thanks,

Sanjay Rana | Design Directorate
Rural Payments Agency | Room 200 | North Gate House | Reading | RG1 1AF
Jabber: 02077642065 | ext. 42065 | Email: ***@rpa.gsi.gov.uk<mailto:***@rpa.gsi.gov.uk>
Follow us on Twitter @Ruralpay
************************************************************************************
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the system manager.

This footnote also confirms that this email message has been swept by
Cisco ESA for the presence of computer viruses.
************************************************************************************
Andreas Kloeckner
2017-06-20 16:56:54 UTC
Permalink
Post by Rana, Sanjay
Are there any examples out there on ways to catch and handle errors in the CUDA Kernel code ?
I have seen examples for CUDA programming in C/C++ but not so many for pycuda.
Could you point us towards those examples? That would make it easier to
understand what you mean by "catch and handle errors". In addition,
please describe what happens when you do the equivalent thing in PyCUDA.

Andreas
Rana, Sanjay
2017-06-20 18:45:34 UTC
Permalink
Hi Andreas

Thanks. I was thinking of something like the following:

https://stackoverflow.com/questions/14038589/what-is-the-canonical-way-to-check-for-errors-using-the-cuda-runtime-api

I haven't really tried this because mainly being a newbie into C++ and pycuda really. Hence I was looking for examples where in errors arising in the kernel were being handled and, so for example in case of batch processing of lots of images, recover from occasional crash in few images and reset the various initialisation parameters and continue on. Apologies if this comes across as mumbo jumbo..


Sanjay Rana | Design Directorate
Rural Payments Agency | Room 200 | North Gate House | Reading | RG1 1AF
Jabber: 02077642065 | ext. 42065 | Email: ***@rpa.gsi.gov.uk
Follow us on Twitter @Ruralpay

-----Original Message-----
From: Andreas Kloeckner [mailto:***@informa.tiker.net]
Sent: 20 June 2017 17:57
To: Rana, Sanjay; ***@tiker.net
Subject: Re: [PyCUDA] Handle Error in CUDA Kernel
Post by Rana, Sanjay
Are there any examples out there on ways to catch and handle errors in the CUDA Kernel code ?
I have seen examples for CUDA programming in C/C++ but not so many for pycuda.
Could you point us towards those examples? That would make it easier to understand what you mean by "catch and handle errors". In addition, please describe what happens when you do the equivalent thing in PyCUDA.

Andreas

______________________________________________________________________
This email has been scanned by the Symantec Email Security.cloud service.
For more information please visit http://www.symanteccloud.com ______________________________________________________________________
************************************************************************************
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the system manager.

This footnote also confirms that this email message has been swept by
Cisco ESA for the presence of computer viruses.
************************************************************************************
Rana, Sanjay
2017-06-21 10:46:44 UTC
Permalink
Hi Andreas,

PS. Another example of using a macro for handling error inside the kernel code in C++ dev environment but am yet to see someone use it in pycuda.

https://codeyarns.com/2011/03/02/cuda-assertion-in-kernel-code/


Sanjay Rana | Design Directorate
Rural Payments Agency | Room 200 | North Gate House | Reading | RG1 1AF
Jabber: 02077642065 | ext. 42065 | Email: ***@rpa.gsi.gov.uk
Follow us on Twitter @Ruralpay


-----Original Message-----
From: Rana, Sanjay
Sent: 20 June 2017 19:46
To: 'Andreas Kloeckner'; ***@tiker.net
Subject: RE: [PyCUDA] Handle Error in CUDA Kernel

Hi Andreas

Thanks. I was thinking of something like the following:

https://stackoverflow.com/questions/14038589/what-is-the-canonical-way-to-check-for-errors-using-the-cuda-runtime-api

I haven't really tried this because mainly being a newbie into C++ and pycuda really. Hence I was looking for examples where in errors arising in the kernel were being handled and, so for example in case of batch processing of lots of images, recover from occasional crash in few images and reset the various initialisation parameters and continue on. Apologies if this comes across as mumbo jumbo..


Sanjay Rana | Design Directorate
Rural Payments Agency | Room 200 | North Gate House | Reading | RG1 1AF
Jabber: 02077642065 | ext. 42065 | Email: ***@rpa.gsi.gov.uk Follow us on Twitter @Ruralpay

-----Original Message-----
From: Andreas Kloeckner [mailto:***@informa.tiker.net]
Sent: 20 June 2017 17:57
To: Rana, Sanjay; ***@tiker.net
Subject: Re: [PyCUDA] Handle Error in CUDA Kernel
Post by Rana, Sanjay
Are there any examples out there on ways to catch and handle errors in the CUDA Kernel code ?
I have seen examples for CUDA programming in C/C++ but not so many for pycuda.
Could you point us towards those examples? That would make it easier to understand what you mean by "catch and handle errors". In addition, please describe what happens when you do the equivalent thing in PyCUDA.

Andreas

______________________________________________________________________
This email has been scanned by the Symantec Email Security.cloud service.
For more information please visit http://www.symanteccloud.com ______________________________________________________________________
************************************************************************************
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the system manager.

This footnote also confirms that this email message has been swept by
Cisco ESA for the presence of computer viruses.
************************************************************************************
Andreas Kloeckner
2017-06-21 11:23:20 UTC
Permalink
Post by Rana, Sanjay
PS. Another example of using a macro for handling error inside the kernel code in C++ dev environment but am yet to see someone use it in pycuda.
https://codeyarns.com/2011/03/02/cuda-assertion-in-kernel-code/
The in-kernel error checks boil down to printf(), which should just
work. Explicit error checks in host code are unnecessary, as PyCUDA
automatically translates those to Python exceptions which you can catch
as usual.

HTH,
Andreas

_______________________________________________
PyCUDA mailing list

Loading...