changeset 380:783017f6dfbe

Running bitonicSort
author Tatsuki IHA <innparusu@cr.ie.u-ryukyu.ac.jp>
date Sun, 23 Jul 2017 07:28:32 +0900
parents 2744cb933ebc
children b81492c74d2b
files src/parallel_execution/examples/bitonicSort.cbc src/parallel_execution/examples/swap.cbc
diffstat 2 files changed, 7 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- 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);
     }
--- 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;