It works perfectly for any kind of integer declared or hard-coded, except when I do:
int idx = get_global_id(0)
itoa(idx,idx_str);
When I do that, it crashes on enqueReadBuffer with error -5, and I can’t figure out what is the problem, because -5 do not match neither of:
CL_INVALID_COMMAND_QUEUE
CL_INVALID_CONTEXT
CL_INVALID_MEM_OBJECT
CL_INVALID_VALUE
CL_INVALID_EVENT_WAIT_LIST
CL_MEM_OBJECT_ALLOCATION_FAILURE
CL_OUT_OF_HOST_MEMORY
I thought that could be overflow or something like that, but I’ve tried with a 999999999999999 and it overflows the int but the itoa didn’t crash, only printed a overflowed number.
Hard to say what the error might be without access to the actual kernel, but I can at least help you with the error value. All errors are listed in cl.h, which should be supplied with the OpenCL installation. Here you can find
#define CL_OUT_OF_RESOURCES -5
A way to translate for error codes to human-readable strings can be found at
Yes I’m sure, because before this i++, ‘i’ was incremented, so if it wasn’t negative, its ready to receive the ‘\0’. But the change that I did, do exactly the same that the previous code, but works… It’s OK for now:P
I know that is not equivalent, but for this case they are, because I don’t use ‘i’ anymore.
But take a look, if you copy paste wiki code and run it on CPU code or even in GPU code, but without passing get_global_id() size_t as parameter, it works well… The error its very very weird, as I said, I’ve tried to overflow the number manually and the itoa always worked, but when I started to call itoa(get_local_id(0)) it simply crashes… returning a OUT_OF_RESOURCES, what I thought that was a infinite loop somewhere… or an invalid access to an array position… don’t know, the run time error check does not help very much too:P
I tried everything, convert_to_int() and traditional casts…but nothing worked…