in reply to Re^3: XS module in ithreads Perl much slower in threads::join after adding SvOBJECT_off
in thread XS module in ithreads Perl much slower in threads::join after adding SvOBJECT_off
Hi, etj
There is awesomeness with PDL 2.076 in better utilization of the L1/L2/L3 cache. That is something to be proud of and a moment of celebration. Unfortunately, 2.076 introduces an anomaly. IMHO try storing the $$.$tid somewhere. For PDL to be thread-safety friendly, it is important for cleanup to occur by the originating thread which instantiated the object.
I will update the MCE demonstrations with a user_begin block to work around the issue. This I can do safely, because the piddles are instantiated by the main thread; i.e. $$.tid == $$.0
Update: Looking at the code, MCE workers also form piddles for the Strassen demonstrations. So I cannot do this unless I save/check the thread ID.
user_begin => sub { # PDL 2.076 introduced a regression causing all threads to perform # piddle destruction. PDL cleanup should occur once, preferably by # the thread which instantiated the object. no warnings; sub PDL::DESTROY { 0; } },
Not able to do the above, I want to mention that the strassen_07_t.pl example works fine as is in the repo by removing the line introduced in PDL 2.076.
SvOBJECT_off((SV *)it->sv);
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^5: XS module in ithreads Perl much slower in threads::join after adding SvOBJECT_off
by marioroy (Prior) on Mar 01, 2022 at 08:39 UTC | |
by etj (Priest) on Mar 01, 2022 at 21:30 UTC | |
by marioroy (Prior) on Mar 02, 2022 at 22:14 UTC |