aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPaul Duncan <pabs@pablotron.org>2019-02-05 11:36:31 -0500
committerPaul Duncan <pabs@pablotron.org>2019-02-05 11:36:31 -0500
commit2116f5055fd044fd79f36b346044817d827d7651 (patch)
tree9c61709fb666d1b064cb10bfafa0b9a07936ee18 /src
parent42a5ea32a5bbba10b112a601ea8f34412842f1c3 (diff)
downloadkmeans-2116f5055fd044fd79f36b346044817d827d7651.tar.bz2
kmeans-2116f5055fd044fd79f36b346044817d827d7651.zip
use omp for init-kmeans, increase default set size (kmeans-c4-1e5 real: ~20s)
Diffstat (limited to 'src')
-rw-r--r--src/km-init-kmeans.c1
-rw-r--r--src/main.c2
2 files changed, 2 insertions, 1 deletions
diff --git a/src/km-init-kmeans.c b/src/km-init-kmeans.c
index f0c1b5f..b2a24af 100644
--- a/src/km-init-kmeans.c
+++ b/src/km-init-kmeans.c
@@ -13,6 +13,7 @@ sum_distance_squared(
float r = 0;
// sum squared distances
+ #pragma omp parallel for reduction(+:r)
for (size_t i = 0; i < set->num_rows; i++) {
const float * const vals = km_set_get_row(set, i);
r += distance_squared(set->shape.num_floats, floats, vals);
diff --git a/src/main.c b/src/main.c
index bc8c1f1..386af16 100644
--- a/src/main.c
+++ b/src/main.c
@@ -92,7 +92,7 @@ load_on_shape(
// D("shape: %zu floats, %zu ints", shape->num_floats, shape->num_ints);
// init set
- if (!km_set_init(set, shape, 100)) {
+ if (!km_set_init(set, shape, 1000)) {
die("km_set_init() failed");
}