From 1495453f7d8082cd0a45acfbfdbde81f6e0c76d3 Mon Sep 17 00:00:00 2001 From: Taylor Oxelgren Date: Thu, 12 Feb 2026 23:16:09 -0600 Subject: [PATCH] Fixed bug when freeing distanceArrays --- .gitignore | 14 +++++++++++++- README.md | 2 +- src/main.c | 6 ++++-- 3 files changed, 18 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index 4859388..a8f7ba2 100644 --- a/.gitignore +++ b/.gitignore @@ -2,4 +2,16 @@ esc-50-audio/ # executable -soundknn.exe \ No newline at end of file +soundknn.exe +cltest.exe + +# opencl lib +OpenCL.lib +CL/ + +#vscode stuff +.vscode + +#extrastuff +src/testcl.c +src/starterkernel.cl \ No newline at end of file diff --git a/README.md b/README.md index 55a0002..76738e7 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,7 @@ With loudnorm to try to improve performance by normalizing loudness Used for gathering the image data ## Building -`clang src/main.c -Iexternal -O3 -fopenmp -march=native -o soundknn.exe` +`clang src/main.c -Iexternal -Lexternal -lOpenCL -O3 -fopenmp -march=native -o soundknn.exe` ### Todo - [x] Load all images from directory diff --git a/src/main.c b/src/main.c index 0f95915..8f838d0 100644 --- a/src/main.c +++ b/src/main.c @@ -4,6 +4,8 @@ #include #include #include +#define CL_TARGET_OPENCL_VERSION 120 +#include #define STB_IMAGE_IMPLEMENTATION #include "stb_image.h" @@ -131,7 +133,7 @@ int main(){ time_t now = time(NULL); computeDistanceMatrixOMP(audioData, distanceArrays,nfiles, counter); - printf("Time it took to compute matrix: %lld\n seconds",time(NULL)-now); + printf("Time it took to compute matrix: %lld seconds\n",time(NULL)-now); // Searches for index of specific image char img[]="esc-50-audio/img/4-189838-A-22.png"; @@ -167,7 +169,7 @@ int main(){ } // Freeing memeing of distance arrays - for(int i=0;i<2000;i++){ + for(int i=0;i