From: miha-q <> Date: Mon, 4 Mar 2024 23:01:59 +0000 (-0500) Subject: Mon Mar 4 06:01:59 PM EST 2024 X-Git-Url: http://www.foleosoft.com/?a=commitdiff_plain;h=b44daa37f498b8f0547383dfa3be101caabc6bf1;p=QAnsel.git Mon Mar 4 06:01:59 PM EST 2024 --- diff --git a/src/QAnsel.c b/src/QAnsel.c index 4a2b69a..d78dac9 100644 --- a/src/QAnsel.c +++ b/src/QAnsel.c @@ -7,13 +7,12 @@ #include "display.c" #include "chacha20.c" #define QUBITS_MAX 14 -//#define SPEED_TEST unsigned char HIDDEN_VARIABLE = 0; FILE* RANDOM_FILE; #define GPU_ENABLED unsigned char USE_GPU = 1; unsigned char USE_THREADS = 1; -#define SPEED_TEST +//#define SPEED_TEST typedef struct { @@ -229,21 +228,22 @@ void qansel_instruction(cpx_mtx_t* stateVector, unsigned char qubitCount, QInstr us2 = get_time(); printf("\tBare: %lu\n", us2 - us1); #else - if (USE_GPU && 0) - { - cpx_mtx_knk_metal(tmp.ptr, filter.ptr, gate.ptr, filter.rows, filter.cols, gate.rows, gate.cols); - } - else if (USE_THREADS) - { +// if (USE_GPU && 0) +// { +// cpx_mtx_knk_metal(tmp.ptr, filter.ptr, gate.ptr, filter.rows, filter.cols, gate.rows, gate.cols); +// } +// else if (USE_THREADS) +// { +// cpx_mtx_knk_threads(tmp.ptr, filter.ptr, gate.ptr, filter.rows, filter.cols, gate.rows, gate.cols); +// } +// else +// { +// cpx_mtx_knk(tmp.ptr, filter.ptr, gate.ptr, filter.rows, filter.cols, gate.rows, gate.cols); +// } + cpx_mtx_knk_threads(tmp.ptr, filter.ptr, gate.ptr, filter.rows, filter.cols, gate.rows, gate.cols); - } - else - { - cpx_mtx_knk(tmp.ptr, filter.ptr, gate.ptr, filter.rows, filter.cols, gate.rows, gate.cols); - } #endif - free(filter.ptr); filter.ptr = tmp.ptr; filter.rows = tmp.rows; @@ -268,18 +268,7 @@ void qansel_instruction(cpx_mtx_t* stateVector, unsigned char qubitCount, QInstr us2 = get_time(); printf("\tBare: %lu\n", us2 - us1); #else - if (USE_GPU) - { cpx_mtx_dot_metal(tmp.ptr, stateVector->ptr, filter.ptr, stateVector->rows, stateVector->cols, filter.rows, filter.cols); - } - else if (USE_THREADS) - { - cpx_mtx_dot_threads(tmp.ptr, stateVector->ptr, filter.ptr, stateVector->rows, stateVector->cols, filter.rows, filter.cols); - } - else - { - cpx_mtx_dot(tmp.ptr, stateVector->ptr, filter.ptr, stateVector->rows, stateVector->cols, filter.rows, filter.cols); - } #endif free(stateVector->ptr); stateVector->ptr = tmp.ptr;