Use redundant pointer. Indent. Outputs now identical with R.

This commit is contained in:
Paul Irofti 2025-03-29 14:52:36 +02:00
parent 0f47fc569f
commit 2bb176f813
2 changed files with 57 additions and 45 deletions

View file

@ -129,11 +129,15 @@ ccubes_task(int k,
/* work-group?: k in 1 to ninputs */ /* work-group?: k in 1 to ninputs */
/* total work: tasks in nchoosek for k in 1 to ninputs */ /* total work: tasks in nchoosek for k in 1 to ninputs */
size_t task = get_global_id(0); // size_t gws = get_global_size(0);
size_t gws = get_global_size(0);
// size_t goffset = task - gws; // size_t goffset = task - gws;
size_t goffset = get_global_offset(0); // size_t goffset = get_global_offset(0);
// size_t gid = task - goffset; // size_t gid = task - goffset;
// coverage[0] = 1;
// printf("task %d, gws %d, goffset %d, gid %d\n", task, gws, goffset, gid);
// return;
size_t task = get_global_id(0);
size_t gid = get_global_linear_id(); size_t gid = get_global_linear_id();
__global bool *redundant = &g_redundant[gid]; __global bool *redundant = &g_redundant[gid];
@ -142,10 +146,7 @@ ccubes_task(int k,
__global unsigned int *value_bits = &g_value_bits[gid * IMPLICANT_WORDS]; __global unsigned int *value_bits = &g_value_bits[gid * IMPLICANT_WORDS];
__global unsigned int *pichart_values = &g_pichart_values[gid * PICHART_WORDS]; __global unsigned int *pichart_values = &g_pichart_values[gid * PICHART_WORDS];
// coverage[0] = 1; *redundant = true;
// printf("task %d, gws %d, goffset %d, gid %d\n", task, gws, goffset, gid);
// return;
redundant = true;
int prevfoundPI = 0; int prevfoundPI = 0;
@ -153,6 +154,17 @@ ccubes_task(int k,
int x = 0; int x = 0;
int combination = task; int combination = task;
/* INIT */
for (int i = 0; i < POSROWS; i++)
coverage[i] = 0;
for (int i = 0; i < IMPLICANT_WORDS; i++) {
fixed_bits[i] = 0U;
value_bits[i] = 0U;
}
for (int i = 0; i < PICHART_WORDS; i++)
pichart_values[i] = 0U;
// fill the combination for the current task // fill the combination for the current task
for (int i = 0; i < k; i++) { for (int i = 0; i < k; i++) {
while (nchoosek(NINPUTS - (x + 1), k - (i + 1)) <= combination) { while (nchoosek(NINPUTS - (x + 1), k - (i + 1)) <= combination) {
@ -268,10 +280,10 @@ ccubes_task(int k,
// check if the current PI is not redundant // check if the current PI is not redundant
// bool redundant = false; // bool redundant = false;
redundant = false; *redundant = false;
int i = 0; int i = 0;
while (i < prevfoundPI && !redundant) { while (i < prevfoundPI && !*redundant) {
// /* // /*
// - ck contains the complexity level for each of the previously found non-redundant PIs // - ck contains the complexity level for each of the previously found non-redundant PIs
// - indx is a matrix containing the indexes of the columns where the values were stored // - indx is a matrix containing the indexes of the columns where the values were stored
@ -300,12 +312,12 @@ ccubes_task(int k,
} }
} }
redundant = is_subset; *redundant = is_subset;
i++; i++;
} }
if (redundant) continue; if (*redundant) continue;
// bool coverage[POSROWS]; // bool coverage[POSROWS];
int covsum = 0; int covsum = 0;
@ -326,7 +338,7 @@ ccubes_task(int k,
// verify row dominance // verify row dominance
int rd = 0; int rd = 0;
while (rd < last_index[covsum - 1] && !redundant) { while (rd < last_index[covsum - 1] && !*redundant) {
bool dominated = true; bool dominated = true;
for (int w = 0; w < PICHART_WORDS; w++) { for (int w = 0; w < PICHART_WORDS; w++) {
@ -336,11 +348,11 @@ ccubes_task(int k,
} }
} }
redundant = dominated; *redundant = dominated;
rd++; rd++;
} }
if (redundant) continue; if (*redundant) continue;
} }
} }
} }