cgru icon indicating copy to clipboard operation
cgru copied to clipboard

multi-thread for-loop in hasTickets

Open ultra-sonic opened this issue 11 months ago • 2 comments

Hey Timur,

we are still chasing performance over here at RISE and I think we have spotted a part of the afserver code that can potentially be mutli-threaded easily.

I am talking about the for-loop in the hasTickets function over here: https://github.com/CGRU/cgru/blob/a1b60c5ad70dca24ef67f02549449106784fd02b/afanasy/src/server/renderaf.cpp#L801

This is one of the largest bottlenecks in the performance analysis from @sebastianelsner in #592

what do you think?

cheers Oli

ultra-sonic avatar Mar 21 '24 08:03 ultra-sonic

Hello, Oli! If most time solving finds out tickets and this is read-only function, we can try to slit solving on reading and writing sections. Launch several threads to solve (for the entire solve and to read and to write) and block writing secions to run only by thie one thread at the same time. Yes, this is the easiest way, i think.

timurhai avatar Mar 25 '24 11:03 timurhai

we have just tried using OpenMP to multithread the hasTickets function but it seems that the overhead of spawning new threads is bigger than the benefit that the multi-threading would give.

Another solution could be a thread-pool to mitigate the overhead of frequent thread creation and destruction, especially with small task sizes.

Do you think this is a viable way to go?

cheers Oli

ultra-sonic avatar Apr 08 '24 13:04 ultra-sonic