aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSam Anthony <sam@samanthony.xyz>2025-04-28 13:37:13 -0400
committerSam Anthony <sam@samanthony.xyz>2025-04-28 13:37:13 -0400
commit093ffe93d0ab486229e36b2a97466ddd51e9fd0e (patch)
treeeef2a270868f020121790e5b4c61f342d97c6e9a
parent3d5fa4bf8f69cfd10fe849ba56d4c2321e6e598d (diff)
downloadvolute-093ffe93d0ab486229e36b2a97466ddd51e9fd0e.zip
parallelize compressor filter with openmp
-rw-r--r--Makefile4
-rw-r--r--widget.c5
2 files changed, 6 insertions, 3 deletions
diff --git a/Makefile b/Makefile
index 6ba8c06..3673140 100644
--- a/Makefile
+++ b/Makefile
@@ -1,5 +1,5 @@
-CFLAGS = -std=c99 -I ./ -Wall -Wextra -pedantic -Wno-deprecated-declarations -D_XOPEN_SOURCE=700L
-LDFLAGS = -lSDL2 -lSDL2_ttf -lm
+CFLAGS = -std=c99 -I ./ -fopenmp -Wall -Wextra -pedantic -Wno-deprecated-declarations -D_XOPEN_SOURCE=700L
+LDFLAGS = -lSDL2 -lSDL2_ttf -lm -fopenmp
SRC = main.c microui.c renderer.c widget.c ui.c unit.c engine.c compressor.c eprintf.c cwalk.c toml.c util.c
OBJ = ${SRC:.c=.o}
diff --git a/widget.c b/widget.c
index faf57cb..79e6028 100644
--- a/widget.c
+++ b/widget.c
@@ -3,6 +3,8 @@
#include <stdlib.h>
#include <string.h>
+#include <omp.h>
+
#include "microui.h"
#include "unit.h"
#include "compressor.h"
@@ -245,8 +247,8 @@ sc_filter(w_Select_Compressor *select) {
series = select->series_filter;
model = select->model_filter;
- /* TODO: parallelize */
select->nfiltered = 0;
+ #pragma omp parallel for ordered
for (i = 0; i < select->n; i++) {
comp = &select->comps[i];
@@ -258,6 +260,7 @@ sc_filter(w_Select_Compressor *select) {
continue;
}
+ #pragma omp ordered
select->filtered[select->nfiltered++] = i;
}
}