Compare commits

..

No commits in common. "158923d4e35a91d2be4dc46101e15a9077ec8409" and "8d915c7984ed2ab23c33dbaf2a569ed5a7a3d4fd" have entirely different histories.

2 changed files with 26 additions and 67 deletions

View file

@ -10,25 +10,6 @@
#include "logging.h" #include "logging.h"
unsigned long int
nchoosek(int n, int k)
{
if (k == 0 || k == n) return 1;
if (k == 1) return n;
unsigned long int result = 1;
if (k > n - k) {
k = n - k;
}
for (int i = 0; i < k; i++) {
result = result * (n - i) / (i + 1);
}
return result;
}
int int
ccubes_init(struct ccubes_context *ctx, ccubes_init(struct ccubes_context *ctx,
int k, int k,
@ -133,14 +114,14 @@ err:
int int
ccubes_alloc(struct ccubes_context *ctx, ccubes_alloc(struct ccubes_context *ctx,
real *nofvalues, /* IN: RC */ const real *nofvalues, /* IN: RC */
real *ON_set, /* IN: RC */ const real *ON_set, /* IN: RC */
real *OFF_set, /* IN: RC */ const real *OFF_set, /* IN: RC */
unsigned int *p_implicants_pos, /* IN: RC */ const unsigned int *p_implicants_pos, /* IN: RC */
unsigned int *p_implicants_val, /* IN: RC */ const unsigned int *p_implicants_val, /* IN: RC */
int *last_index, /* IN: RC */ const int *last_index, /* IN: RC */
int *p_covered, /* IN: RC */ const int *p_covered, /* IN: RC */
int *p_pichart_pos, /* IN: RC */ const int *p_pichart_pos, /* IN: RC */
bool *coverage, /* OUT: RW */ bool *coverage, /* OUT: RW */
unsigned int *fixed_bits, /* OUT: RW */ unsigned int *fixed_bits, /* OUT: RW */
unsigned int *value_bits, /* OUT: RW */ unsigned int *value_bits, /* OUT: RW */
@ -295,8 +276,8 @@ ccubes_run(struct ccubes_context *ctx)
} }
rc = clEnqueueNDRangeKernel(ctx->clctx->gpu_queue, ctx->ccubes_task, rc = clEnqueueNDRangeKernel(ctx->clctx->gpu_queue, ctx->ccubes_task,
1, NULL, &ctx->gws, NULL, 1, NULL, ctx->gws, NULL,
0, NULL, NULL); 0, NULL, &ev_ksvd[1]);
if (rc != CL_SUCCESS) { if (rc != CL_SUCCESS) {
log_error("clccubes", "NDRange failed (%d)", rc); log_error("clccubes", "NDRange failed (%d)", rc);
goto err; goto err;
@ -347,7 +328,7 @@ err:
return rc; return rc;
} }
int void
ccubes_unmap(struct ccubes_context *ctx) ccubes_unmap(struct ccubes_context *ctx)
{ {
int rc = 0; int rc = 0;
@ -389,18 +370,18 @@ ccubes(int k,
int value_bit_width, int value_bit_width,
int pichart_words, int pichart_words,
int estimPI, int estimPI,
real *nofvalues, /* IN: RC */ const real *nofvalues, /* IN: RC */
real *ON_set, /* IN: RC */ const real *ON_set, /* IN: RC */
real *OFF_set, /* IN: RC */ const real *OFF_set, /* IN: RC */
unsigned int *p_implicants_pos, /* IN: RC */ const unsigned int *p_implicants_pos, /* IN: RC */
unsigned int *p_implicants_val, /* IN: RC */ const unsigned int *p_implicants_val, /* IN: RC */
int *last_index, /* IN: RC */ const int *last_index, /* IN: RC */
int *p_covered, /* IN: RC */ const int *p_covered, /* IN: RC */
int *p_pichart_pos, /* IN: RC */ const int *p_pichart_pos, /* IN: RC */
bool *coverage, /* OUT: RW */ bool *coverage, /* OUT: RW */
unsigned int *fixed_bits, /* OUT: RW */ unsigned int *fixed_bits, /* OUT: RW */
unsigned int *value_bits, /* OUT: RW */ unsigned int *value_bits, /* OUT: RW */
unsigned int *pichart_values /* OUT: RW */ unsigned int *pichart_values /* OUT: RW */
) )
{ {
int rc = 0; int rc = 0;
@ -444,7 +425,8 @@ ccubes(int k,
coverage, coverage,
fixed_bits, fixed_bits,
value_bits, value_bits,
pichart_values); pichart_values
)
if (rc != CL_SUCCESS) { if (rc != CL_SUCCESS) {
log_error("clccubes", "ccubes_alloc failed (%d)", rc); log_error("clccubes", "ccubes_alloc failed (%d)", rc);
goto err; goto err;

View file

@ -1,8 +1,6 @@
#ifndef CLccubes_H__ #ifndef CLccubes_H__
#define CLccubes_H__ #define CLccubes_H__
#include <stdbool.h>
#include "cl_setup.h" #include "cl_setup.h"
#ifndef _MSC_VER #ifndef _MSC_VER
@ -28,7 +26,6 @@ struct ccubes_context {
int implicant_words; int implicant_words;
int value_bit_width; int value_bit_width;
int pichart_words; int pichart_words;
int estimPI;
/* INPUTS */ /* INPUTS */
cl_mem nofvalues; cl_mem nofvalues;
@ -56,27 +53,7 @@ struct ccubes_context {
size_t gws; /* global work size */ size_t gws; /* global work size */
}; };
int ccubes(int k, int ccubes(void);
int ninputs,
int posrows,
int negrows,
int implicant_words,
int value_bit_width,
int pichart_words,
int estimPI,
real *nofvalues, /* IN: RC */
real *ON_set, /* IN: RC */
real *OFF_set, /* IN: RC */
unsigned int *p_implicants_pos, /* IN: RC */
unsigned int *p_implicants_val, /* IN: RC */
int *last_index, /* IN: RC */
int *p_covered, /* IN: RC */
int *p_pichart_pos, /* IN: RC */
bool *coverage, /* OUT: RW */
unsigned int *fixed_bits, /* OUT: RW */
unsigned int *value_bits, /* OUT: RW */
unsigned int *pichart_values /* OUT: RW */
);
int int
clccubes(struct ccubes_context *ccubesctx, cl_mem alpha0, cl_mem G, size_t signals, clccubes(struct ccubes_context *ccubesctx, cl_mem alpha0, cl_mem G, size_t signals,