]> foleosoft.com Git - QAnsel.git/commitdiff
Sat Mar 2 09:50:31 PM EST 2024
authormiha-q <>
Sun, 3 Mar 2024 02:50:31 +0000 (21:50 -0500)
committermiha-q <>
Sun, 3 Mar 2024 02:50:31 +0000 (21:50 -0500)
Makefile
src/.gpu_mmul.cl.tmp [new file with mode: 0644]
src/gpu.c

index 8da1edc683b1e6c9c269f37356fe2ac85bc97a47..98f736b838f169d8000acd9aa9cefe431fa78622 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,5 +1,9 @@
+
 all:
-       cd src && \
-       xxd -i gpu_mmul.cl | sed -e 's/unsigned int/const size_t/' -e 's/unsigned char/const char/' > gpu_mmul.cl.c && \
-       gcc QAnsel.c -g -o ../bin/QAnsel -lm -I/usr/include/SDL2 -D_REENTRANT -lSDL2 -lOpenCL -pthread
+       mv src/gpu_mmul.cl src/.gpu_mmul.cl
+       bash -c 'echo -ne "$$(cat src/.gpu_mmul.cl)\x00" > src/gpu_mmul.cl'
+       xxd -i src/gpu_mmul.cl | sed -e 's/unsigned int.*[;]//' -e 's/unsigned char/const char/' > src/gpu_mmul.cl.c
+       mv src/.gpu_mmul.cl src/gpu_mmul.cl
+
+       gcc src/QAnsel.c -g -o bin/QAnsel -lm -I/usr/include/SDL2 -D_REENTRANT -lSDL2 -lOpenCL -pthread
        rm -f src/*.cl.c
\ No newline at end of file
diff --git a/src/.gpu_mmul.cl.tmp b/src/.gpu_mmul.cl.tmp
new file mode 100644 (file)
index 0000000..369c9dd
Binary files /dev/null and b/src/.gpu_mmul.cl.tmp differ
index 433c9923bdd7acbd22d36c3692b08b1229d4b2f9..a412614f5233f9734636c46a4089e30992733ef0 100644 (file)
--- a/src/gpu.c
+++ b/src/gpu.c
@@ -125,7 +125,7 @@ void GPU_mmul(double* ptrR, double* ptrA, double* ptrB, size_t rowsA, size_t col
        #ifdef GPU_DEBUG
        printf("Line %d.\n", __LINE__);
        #endif
-       cl_program program = clCreateProgramWithSource(GPU_context, 1, (const char**)(&gpu_mmul_cl), &gpu_mmul_cl_len, &err);
+       cl_program program = clCreateProgramWithSource(GPU_context, 1, (const char**)(&src_gpu_mmul_cl), NULL, &err);
        if (err != CL_SUCCESS)
        {
                fprintf(stderr, "GPU fatal error: clCreateProgramWithSource() failed.\n");