From: miha-q <> Date: Mon, 4 Mar 2024 22:48:27 +0000 (-0500) Subject: Mon Mar 4 05:48:27 PM EST 2024 X-Git-Url: http://www.foleosoft.com/?a=commitdiff_plain;h=77475d4fda11855845af55da86a9988a54466910;p=QAnsel.git Mon Mar 4 05:48:27 PM EST 2024 --- diff --git a/src/QAnsel.c b/src/QAnsel.c index 7d2236c..4a2b69a 100644 --- a/src/QAnsel.c +++ b/src/QAnsel.c @@ -13,6 +13,7 @@ FILE* RANDOM_FILE; #define GPU_ENABLED unsigned char USE_GPU = 1; unsigned char USE_THREADS = 1; +#define SPEED_TEST typedef struct { @@ -267,8 +268,18 @@ 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;