parallel processing - *** glibc detected *** ./PatMatch: double free or corruption (out): 0x00007fff202798d0 *** -
i have written opencl programme implement pattern matching algorithm. input, programme takes 2 two-dimensional arrays of characters. first array list of strings row corresponds string. same holds sec array, used hold list of patterns. @ end of each row null-terminator('\0') appended indicate end of string while string beingness processed in kernel.
each work item matches single string every patterns , keeps record of number of patterns matched, , count written global buffer.
the programme seems run end , prints number of matches in each string. when programme terminates error message couldn't figure out why?
i couldn't proceed further, need help. below i've listed kernel function used , error message.
thanks.
error message memory map.
*** glibc detected *** ./patmatch: double free or corruption (out): 0x00007fff202798d0 *** ======= backtrace: ========= /lib64/libc.so.6[0x377c47247f] /lib64/libc.so.6(cfree+0x4b)[0x377c4728db] ./patmatch[0x4016b6] /lib64/libc.so.6(__libc_start_main+0xf4)[0x377c41d9b4] ./patmatch[0x400d99] ======= memory map: ======== 00400000-00402000 r-xp 00000000 fd:00 41583479 /home/haileyesus/spd/patmatch 00601000-00602000 rw-p 00001000 fd:00 41583479 /home/haileyesus/spd/patmatch 06e10000-0749e000 rw-p 06e10000 00:00 0 [heap] 4063c000-4063d000 ---p 4063c000 00:00 0 ........ ffffffffff600000-ffffffffffe00000 ---p 00000000 00:00 0 [vsyscall] aborted
i have single kernel function , 1 string manipulation non-kernel function.
__global char* strstr(__global char *haystack, __global char *needle) { if(!*needle) homecoming haystack; __global char *tempstr = haystack; while(*tempstr) { __global char *pos = tempstr; __global char *tempneedle = needle; while(*tempstr && &tempneedle && *tempstr == *tempneedle) { tempstr++; tempneedle++; } if(!*tempneedle) homecoming pos; tempstr = pos + 1; } homecoming '\0'; } __kernel void matchpatterns_v1(__global char *strings, __global char *patterns, __global int *matchcount,int strcount, int strlength, int patcount, int patlength) { int id = get_global_id(0); int rowindex = id*strlength; int i, matches = 0; __global char *pos = strings; __global char *temp = strings; __global char *pat = patterns; for(i = 0; < patcount; i++) { temp = &strings[rowindex]; pat = &patterns[i*patlength]; while(pos != '\0') { pos = strstr(temp, pat); if(pos != '\0') { matches++; temp = pos + patlength; } } } matchcount[id] = matches; }
parallel-processing opencl
No comments:
Post a Comment