mzed / RapidLib

RapidLib is a lightweight library for interactive machine learning.
https://mzed.github.io/RapidLib/
BSD 3-Clause "New" or "Revised" License
23 stars 3 forks source link

runParallel() on Bela #20

Open mzed opened 2 years ago

mzed commented 2 years ago

Jake Armitage reported the following:

root@bela:~/RapidLib# ./rapidLibTest
----- Bayes test passed.
----- DTW empty test passed.
----- DTW test passed.
----- Multilayer tests skipped.
before: 20.14
----- Regression run exceptions passed.
----- Regression train exceptions passed.
knn before: 20
error: bad input size: 0
error: bad input size: 6
----- KNN run exceptions passed.
----- KNN get/set K passed.
----- What is this test?
----- Single thread DTW tests passed.
19.3254
0
rapidLibTest: /root/RapidLib/test/rapidLibTest.cpp:402: int main(int, const char **): Assertion `myDTW.runParallel(seriesTwo) == "second series"' failed.
Aborted
mzed commented 2 years ago

This is failing on the second test of runParallel(). I see I've commented out another test on line 411, which makes me think this method needs some attention in general.

jarmitage commented 2 years ago

With https://github.com/mzed/RapidLib/blob/e2c8872d1ddd8b2042945d114ab380a6f1628333/test/rapidLibTest.cpp#L403 commented out:

root@bela:~/RapidLib# ./rapidLibTest
----- Bayes test passed.
----- DTW empty test passed.
----- DTW test passed.
----- Multilayer tests skipped.
before: 20.14
----- Regression run exceptions passed.
----- Regression train exceptions passed.
knn before: 20
error: bad input size: 0
error: bad input size: 6
----- KNN run exceptions passed.
----- KNN get/set K passed.
----- What is this test?
----- Single thread DTW tests passed.
19.3254
0
----- Parallel DTW tests passed.
0
1.79769e+308
----- DTW single label passed.
----- DTW parallel single label CRASHES!!!!.
----- DTW stats pass .
mincost 0.5
maxcost 1.58114
mzed commented 2 years ago

That's good news, I guess.

This might be a challenge to fix. It seems like threading isn't working properly, but I don't have an easy way to reproduce the problem here. I wonder if there's a race condition that's being exposed by the specifics of your setup. I'd be curious to know what myDTW.runParallel(seriesTwo) is returning in the line that was commented out. I don't have a Bela. Is there any way I could borrow one to do some debugging?

Apart from parallel DTW, things look fine. So, if you don't need that then you can probably ignore the problem. Honestly, I haven't been too excited by DTW for real-time control. There are probably better series classification algorithms for many musical use cases.