From: miha-q <> Date: Sun, 3 Mar 2024 02:50:31 +0000 (-0500) Subject: Sat Mar 2 09:50:31 PM EST 2024 X-Git-Url: http://www.foleosoft.com/?a=commitdiff_plain;h=4d28580c99d9f91f390268f8f24413bfac3f8f53;p=QAnsel.git Sat Mar 2 09:50:31 PM EST 2024 --- diff --git a/Makefile b/Makefile index 8da1edc..98f736b 100644 --- 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 index 0000000..369c9dd Binary files /dev/null and b/src/.gpu_mmul.cl.tmp differ diff --git a/src/gpu.c b/src/gpu.c index 433c992..a412614 100644 --- 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");