]> foleosoft.com Git - QAnsel.git/commitdiff
Thu Mar 7 05:31:47 PM EST 2024
authormiha-q <>
Thu, 7 Mar 2024 22:31:47 +0000 (17:31 -0500)
committermiha-q <>
Thu, 7 Mar 2024 22:31:47 +0000 (17:31 -0500)
src/.kernel.tmp.1
src/.kernel.tmp.2
src/QAnsel.c
src/complex.c
src/kernel.cl
src/kernel_cpu.cl
src/kernel_gpu.cl

index d4b4f0a0e562e79fa0962ded643676767c17c8fb..cf0af43028702a0d3dc2e3044669168dffabc616 100644 (file)
@@ -144,4 +144,5 @@ __kernel void kernel_knk_2x2
         }
 
     }
+
 }
index 55338c1b5cd82aef3e92b9504e55ecebae118520..b1fc0e00fe66ad65f940278535dc9e152ca289d6 100644 (file)
Binary files a/src/.kernel.tmp.2 and b/src/.kernel.tmp.2 differ
index 773edf0c69d1a00a61f5a6fe527cfff6a4445cb0..47434582d77d0a521f04f2eea967b93fe397d78d 100644 (file)
@@ -263,7 +263,7 @@ void qansel_instruction(cpx_mtx_t* stateVector, unsigned char qubitCount, QInstr
                }
                else
                {
-                       cpx_mtx_knk(tmp.ptr, filter.ptr, gate.ptr, filter.rows, filter.cols, gate.rows, gate.cols);
+                       cpx_mtx_knk_2x2(tmp.ptr, filter.ptr, gate.ptr, filter.rows, filter.cols, gate.rows, gate.cols);
                }
                #endif
 
index b1d783fab03cbf26443645be7e0414678f419bd5..0ab2a5cc89f06bc1594d4991ce2cd6b1e92bc140 100644 (file)
@@ -144,6 +144,20 @@ void cpx_mtx_knk(float* ptrR, float* ptrA, float* ptrB, int rowsA, int colsA, in
     }
 }
 
+
+void cpx_mtx_knk_2x2(float* ptrR, float* ptrA, float* ptrB, int rowsA, int colsA, int rowsB, int colsB)
+{
+       int rowsR = rowsA * rowsB;
+       int colsR = colsA * colsB;
+    for (int i = 0; i < rowsR / 2; i++)
+    {
+               for (int j = 0; j < colsR / 2; j++)
+               {
+                       kernel_knk_2x2(ptrR, ptrA, rowsA, colsA, ptrB[0], ptrB[1], ptrB[2], ptrB[3], ptrB[4], ptrB[5], ptrB[6], ptrB[7], i, j);
+               }
+    }
+}
+
 /*-----------------------------------------------------------------------------------*/
 /*THREADED*/
 /*-----------------------------------------------------------------------------------*/
@@ -621,7 +635,7 @@ void cpx_mtx_knk_metal_2x2(float* ptrR, float* ptrA, float* ptrB, int rowsA, int
        err = clSetKernelArg(kernel,11, sizeof(float), &gate7); gpuerr(clSetKernelArg);
 
        //Run the program
-       err = clEnqueueNDRangeKernel(cpx_mtx_command_queue, kernel, 1, NULL, (size_t[]){rowsR / 2, colsR / 2}, NULL, 0, NULL, NULL);
+       err = clEnqueueNDRangeKernel(cpx_mtx_command_queue, kernel, 2, NULL, (size_t[]){rowsR / 2, colsR / 2}, NULL, 0, NULL, NULL);
        gpuerr(clEnqueueNDRangeKernel);
 
        //Wait for completion
index a7f2cc547a5c8c05ed46056c18f1d23931d9b27e..cf07f6c1fb6e5263fff627e614be098a31aa5522 100644 (file)
@@ -154,4 +154,5 @@ __kernel void kernel_knk_2x2
         }
 
     }
+
 }
\ No newline at end of file
index ca2a9a809606bade217a8ad468cec462dfd3f90d..54a097557c9d48908fc90050cf9925e113b40e70 100644 (file)
@@ -149,4 +149,5 @@ void kernel_knk_2x2
         }
 
     }
+
 }
index 5525da99f270c7c2111f9c0416bc90661f61f853..9990611ea26f34f3e73cd606a1052f8862d0d140 100644 (file)
@@ -354,6 +354,6 @@ unsigned char kernel_gpu[] = {
   0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
   0x20, 0x20, 0x62, 0x72, 0x65, 0x61, 0x6b, 0x3b, 0x0a, 0x20, 0x20, 0x20,
   0x20, 0x20, 0x20, 0x20, 0x20, 0x7d, 0x0a, 0x0a, 0x20, 0x20, 0x20, 0x20,
-  0x7d, 0x0a, 0x7d, 0x00
+  0x7d, 0x0a, 0x0a, 0x7d, 0x00
 };
-unsigned int kernel_gpu_len = 4264;
+unsigned int kernel_gpu_len = 4265;