AnsweredAssumed Answered

re-ordering opencl

Question asked by christa_bln on Jul 28, 2019
Latest reply on Jul 30, 2019 by christa_bln

I'd like to run this simple C-code in GPU with an OpenCL-kernel. Is is possible?

 

/* new re-order */
#include <stdio.h>

 

int main()
{int a[15]={7,8,0,4,13,1,14,5,10,2,3,11,12,6,9};
 int b[15];
 printf(input datas:  ");
 for (i=0;i<15;i++) printf("%3d",a[i]);
 printf("\n");
 for (i=0;i<15;i++) b[a[i]]=i;
 for (i=0;i<15;i++) printf("%3d",b[i]);
 printf("\n");
return 0;
}

 


// input datas :  7  8  0  4 13  1 14  5 10  2  3 11 12  6  9
// output datas:  2  5  9 10  3  7 13  0  1 14  8 11 12  4  6

Outcomes