Results 1 to 2 of 2

Thread: programming help needed

  1. #1
    Junior Member
    Join Date
    Aug 2012
    Posts
    2

    programming help needed

    i want to implement BWT in openCL my host code is givin no error but the output is giveing some junk values. I think the problem is in kernel code. I want to implement it data parallel that is each thread will do bwt on individual string . please help....my kernel code is attached
    Code :
    #include<stdlib.h>
    #define BWT_SIZE=1024;
    _kernel void bwt(_global uchar *bwt_buf, _global uchar *bwt_out_buf, _global uint nread, _global index_of_origin){
    uint i, last_index=BWT_SIZE, index_table[BWT_SIZE]
    //get the index of the current element
     
            int id = get_global_id(0);
            for(i=0;i<nread;i++)
                    {
                            index_table[i]=i;
                    }
                    qsort(index_table,nread,sizeof(int),(int(*)(const void *,const void *))bwt_comp);
                    last_index=nread;
                    for(i=0;i<nread;i++)
                            {
                                    if(index_table[i]==0){
                                    bwt_out_buf[i]=bwt_buf[nread-1];        
                                    last_index=i;
                                    }
                                    bwt_out_buf[id]=bwt_buf[index_table[i]-1];
                            }
                    index_of_origin=last_index;                     
    int bwt_comp(uint *a, uint *b)
    {
            register int a1=*a,b1=*b,tmp=a1;
            if ( bwt_buf[a1] != bwt_buf[b1] ) {
                    if ( bwt_buf[a1] > bwt_buf[b1] )
                    return 1;}
                    else return -1;
            else {
                    do {
                            if ( bwt_buf[++a1 == nread? a1 = 0 : a1]
                                            != bwt_buf[++b1 == nread? b1 = 0 : b1] ) {
                                    if ( bwt_buf[a1] > bwt_buf[b1] ) return 1;
                                    else return -1;
                            }
                    } while ( a1 != tmp );

  2. #2

    Re: programming help needed

    Did you have an OpenCL question, or are you just looking for help with debugging your serial C code? If it's the latter you might find more help on a more general forum e.g. Stack Exchange.

Similar Threads

  1. opencl programming
    By nandhini in forum OpenCL
    Replies: 11
    Last Post: 02-09-2012, 04:03 PM
  2. Programming with as little bloat as possible
    By jaredangus in forum OpenGL ES general technical discussions
    Replies: 2
    Last Post: 03-12-2009, 03:21 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •