This project is read-only.

Math.Ceiling not working

Oct 11, 2012 at 10:35 AM

Hey all,


I'm very new to this but I've got the basics working now. I'm trying to run the following equation on the GPU but the math.ceiling function doesn't work:


b(tid) = (Math.Ceiling((a(tid) - RE) / radiussep) * radiussep + RE)


All other parts of the equation are calculated without issue. Radiussep and RE are just constants passed to the sub, a() is just an array of values as is b(). I'm running this in!


Any help on getting this working would be much appreciated! Thanks all! :D

Oct 11, 2012 at 10:20 PM

I don`t know, but it looks like Math.Ceiling does not exist on Cudafy. Cudafy translates your code to CUDA C, which may or may not have Math.Ceiling. I would suggest trying to make your own function that calculates that.

Oct 12, 2012 at 8:26 AM

Support for Math.Ceiling exists and appears to work just fine.  If using floats then I suggest using GMath instead of Math.  Can you show the generated file

Oct 12, 2012 at 9:59 AM
Edited Oct 13, 2012 at 5:48 PM

Hey guys,


Thanks for the help! I've just tried to re-write the code this morning and it worked without any hassle. Looks like I must have just had a bug in my code somewhere. I will try GMath though if that's likely to be better. What is it? 


Sorry for posting then fixing my own problem, I hate it when people do that!