0
votes

My input char array is 1024 and I have specified any local item size=32. My each workitem is working on 16 char, I have specified global item size=64. In my kernel I have calculated data_tid as follows.

int offset=16;
int gr_id=get_group_id(0);
int id = get_global_id(0);
int data_tid=(gr_id*32+id)*offset;

I am using NVIDIA Geforce 9800GT. My code is throwing floating point exception. I already seen that this is caused by global_size not divisible by local size but in my case it is divisible.

Can anyone please tell me where is the problem?

1
Do you have information about the line which throws the exception? // Does it also occur, if you execute an empty kernel? As you are working with 100% integers, this part of the code should not cause a FloatingPoint execption. Is there more code following? - Nippey

1 Answers

0
votes

You want to use get_local_id instead of get_global_id. The local id is the index of the work item in each group. The global id is the index of the work item in the entire range.

You could also directly use int data_tid = get_global_id(0) * offset;