]> foleosoft.com Git - QAnsel.git/commitdiff
Mon Mar 4 05:48:27 PM EST 2024
authormiha-q <>
Mon, 4 Mar 2024 22:48:27 +0000 (17:48 -0500)
committermiha-q <>
Mon, 4 Mar 2024 22:48:27 +0000 (17:48 -0500)
src/QAnsel.c

index 7d2236cfe5dbffa20876d79ebf0138fc78d3c008..4a2b69a5e06882c964a9cce490bbe472c0dfc991 100644 (file)
@@ -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;