From 77475d4fda11855845af55da86a9988a54466910 Mon Sep 17 00:00:00 2001 From: miha-q <> Date: Mon, 4 Mar 2024 17:48:27 -0500 Subject: [PATCH] Mon Mar 4 05:48:27 PM EST 2024 --- src/QAnsel.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) 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; -- 2.39.5