# HG changeset patch # User Tatsuki IHA # Date 1500762512 -32400 # Node ID 783017f6dfbefa4b1b3b563f6366c15d3deace0a # Parent 2744cb933ebc0f1e27bd4a704c38df5c1b404658 Running bitonicSort diff -r 2744cb933ebc -r 783017f6dfbe src/parallel_execution/examples/bitonicSort.cbc --- a/src/parallel_execution/examples/bitonicSort.cbc Sun Jul 23 07:01:14 2017 +0900 +++ b/src/parallel_execution/examples/bitonicSort.cbc Sun Jul 23 07:28:32 2017 +0900 @@ -174,6 +174,7 @@ srand((unsigned) time(NULL)); } if (output->loopCounter == GET_SIZE(output->array)){ + printf("created Array\n"); output->loopCounter = 0; goto meta(context, next); } diff -r 2744cb933ebc -r 783017f6dfbe src/parallel_execution/examples/swap.cbc --- a/src/parallel_execution/examples/swap.cbc Sun Jul 23 07:01:14 2017 +0900 +++ b/src/parallel_execution/examples/swap.cbc Sun Jul 23 07:28:32 2017 +0900 @@ -4,15 +4,13 @@ __code bitonicSwap(struct SortArray* inputArray, struct Integer* block, struct Integer* first, struct Integer* i, __code next(struct SortArray* output, ...)) { struct SortArray* output = *O_output; int position = i->value/block->value; - int index = i->value+block->value*position; - block->value = (first->value == 1)? ((block->value<<1)*(position+1))-(index%block->value)-1 : index+block->value; + int index1 = i->value+block->value*position; + int index2 = (first->value == 1)? ((block->value<<1)*(position+1))-(index1%block->value)-1 : index1+block->value; struct Integer** array = inputArray->array; - printf("block:%d\n", block->value); - printf("index:%d\n", index); - if (array[block->value] < array[index]) { - struct Integer *tmp = array[index]; - array[index] = array[block->value]; - array[block->value] = tmp; + if (array[index2]->value < array[index1]->value) { + struct Integer *tmp = array[index1]; + array[index1] = array[index2]; + array[index2] = tmp; } output->array = array; *O_output = output;