Re: [fluid-dev] parallel loading of soundfont samples

2020-10-28 Thread Hamish Moffatt
On 29/10/20 12:50 am, Marcus Weseloh wrote: Hi, Am Mi., 28. Okt. 2020 um 13:10 Uhr schrieb Ceresa Jean-Jacques : Now we should try the suggested test to run 2 fluidsynth console applications (a1, a2) at the same time (not sequencially) and measure the total time. That's a really good idea to

Re: [fluid-dev] parallel loading of soundfont samples

2020-10-28 Thread Marcus Weseloh
Am Mi., 28. Okt. 2020 um 20:11 Uhr schrieb Tom M. via fluid-dev : > 1. The samplecache is guarded by a mutex that prevents naïve > parallelization. Yes, and that is a difficult lock to remove, I think. But as a quick check for a possible speedup factor with parallel loading, your branch is a good

Re: [fluid-dev] parallel loading of soundfont samples

2020-10-28 Thread Ceresa Jean-Jacques
>Currently, there are two problems: 1. The samplecache is guarded by a mutex >that prevents naïve parallelization. 2. If we relax that mutex we get a >strange race condition,... The whole fluid_samplecache_load() need to be atomic and isn't thread safe without the mutex -get_samplecache_entry(

Re: [fluid-dev] parallel loading of soundfont samples

2020-10-28 Thread Tom M. via fluid-dev
An idea to parallelize loading would be to use openMP Tasks. I've made a quick'n dirty implementation of that: https://github.com/FluidSynth/fluidsynth/tree/parallelize-sf3-loading Currently, there are two problems: 1. The samplecache is guarded by a mutex that prevents naïve parallelization. 2.

Re: [fluid-dev] parallel loading of soundfont samples

2020-10-28 Thread Ceresa Jean-Jacques
Hi, >So it looks like parallel loading would be beneficial. Yes, as we notice that with 1 or 2 simultaneous loading the total time is quite the same (6,1s   6,6s) However with 3 and 4 simultaneous loading we see that the total time doesn't stay constant but is growing (8,8s and 10,4s), probaly

Re: [fluid-dev] parallel loading of soundfont samples

2020-10-28 Thread Marcus Weseloh
Hi again, just to highlight the much faster speed of SF2 loading, here is the previous test run again, but this time with the same Soundfont in SF2 format (converted with Polyphone). The resulting SF2 is 204 MB (SF3 was 40MB): $ time ./test.sh 1 real 0m0,366s user 0m0,093s sys 0m0,163s $ time ./

Re: [fluid-dev] parallel loading of soundfont samples

2020-10-28 Thread Marcus Weseloh
Hi, Am Mi., 28. Okt. 2020 um 13:10 Uhr schrieb Ceresa Jean-Jacques : > Now we should try the suggested test to run 2 fluidsynth console applications > (a1, a2) at the same time (not sequencially) and measure the total time. That's a really good idea to quickly test if parallel loading has merit.

Re: [fluid-dev] parallel loading of soundfont samples

2020-10-28 Thread Ceresa Jean-Jacques
Hi, >The SF3 files are taking ~5 seconds each to load. The SF2 files take >400-500ms, despite being 7-10x the size, so the bottleneck is not disk I/O.   Ok, assuming one SF3 file x taking 5 seconds to load using one fluidsynth console application a1. Now we should try the suggested test to ru