![]() |
[QUOTE=rogue;535354]Since you are building on your own, you can comment out the code in the SharedMemoryItem.cpp class in the TryLock(), Lock(), and Release() methods and rebuild. This will only work if you have 1 worker.
If you have any debugging experience, a stack trace would be helpful.[/QUOTE] Mark, I've added debug printf to Lock() and found that in case of error return code is 35 (EDEADLK): [CODE]The pthread_mutex_lock() function may fail if: EDEADLK The current thread already owns the mutex. [/CODE]Commenting methods didn't help - source successfully compiled and ran but no sieve at all, only removed algebraic factors. |
[QUOTE=unconnected;535571]Mark, I've added debug printf to Lock() and found that in case of error return code is 35 (EDEADLK):
[CODE]The pthread_mutex_lock() function may fail if: EDEADLK The current thread already owns the mutex. [/CODE]Commenting methods didn't help - source successfully compiled and ran but no sieve at all, only removed algebraic factors.[/QUOTE] The offending code appears to be core/Worker.cpp, lines 164-167: [code] SetHasWorkToDo(); // ip_WorkerStatus->Release();[/code] The lock is being released [I]after[/I] the worker status is changed, so the first method ends up re-locking the mutex. Flipping the two commands fixed the error for me. |
[QUOTE=Happy5214;535574]The offending code appears to be core/Worker.cpp, lines 164-167:
[code] SetHasWorkToDo(); // ip_WorkerStatus->Release();[/code] The lock is being released [I]after[/I] the worker status is changed, so the first method ends up re-locking the mutex. Flipping the two commands fixed the error for me.[/QUOTE] Great catch, but the proper fix is to modify Worker.h. SetHasWorkToDo() should call ip_WorkerStatus->SetValueHaveLock(). This is because the method is called when the thread already has a lock on the ip_WorkerStatus object. This method releases that lock after it has built the collection of primes for the thread. I wonder why Windows doesn't catch this. |
[QUOTE=rogue;535619]Great catch, but the proper fix is to modify Worker.h. SetHasWorkToDo() should call ip_WorkerStatus->SetValueHaveLock(). This is because the method is called when the thread already has a lock on the ip_WorkerStatus object. This method releases that lock after it has built the collection of primes for the thread.
I wonder why Windows doesn't catch this.[/QUOTE] From the [URL="https://docs.microsoft.com/en-us/windows/win32/api/synchapi/nf-synchapi-entercriticalsection"]Microsoft documentation on EnterCriticalSection[/URL]: [QUOTE]After a thread has ownership of a critical section, it can make additional calls to [B]EnterCriticalSection[/B] or [URL="https://docs.microsoft.com/windows/desktop/api/synchapi/nf-synchapi-tryentercriticalsection"]TryEnterCriticalSection[/URL] without blocking its execution. This prevents a thread from deadlocking itself while waiting for a critical section that it already owns. The thread enters the critical section each time [B]EnterCriticalSection[/B] and [B]TryEnterCriticalSection[/B] succeed. A thread must call [URL="https://docs.microsoft.com/windows/desktop/api/synchapi/nf-synchapi-leavecriticalsection"]LeaveCriticalSection[/URL] once for each time that it entered the critical section.[/QUOTE]I take this to mean that repeated calls don't result in an error, unlike pthreads. |
[QUOTE=Happy5214;535629]From the [URL="https://docs.microsoft.com/en-us/windows/win32/api/synchapi/nf-synchapi-entercriticalsection"]Microsoft documentation on EnterCriticalSection[/URL]:
I take this to mean that repeated calls don't result in an error, unlike pthreads.[/QUOTE] :censored: Yet another reason to dislike Windows. Thanks for finding the reason. |
A suggestion: when using the -A (or the --applyandexit flag), assume that if there is no file given with -I, assume that the factors are given in a file called "factors.txt", or warn the user that the switch requires a file name to be given with -I to work.
|
[QUOTE=Dylan14;537181]A suggestion: when using the -A (or the --applyandexit flag), assume that if there is no file given with -I, assume that the factors are given in a file called "factors.txt", or warn the user that the switch requires a file name to be given with -I to work.[/QUOTE]
Seems reasonable |
I posted 1.9.6. I was sitting on it for a while as I forgot to post. Here are the changes:
[list][*]Fixed issue in srsieve2 where it crashes when starting a new sieve.[*]Fixed issue in srsieve2 where it finds an invalid factor and terminates.[*]Refactored logic for "single worker" and "rebuild" logic so they work more nicely together.[*]Fixed calculation of p/sec which is wrong after workers are recreated.[*]Feset factor stats whenever workers are created as the rate is inflated for lower p as far more terms are removed.[*]Fix issue with multiple threads which can cause program to hang.[*]Add support for ABC format to srsieve2.[/list] |
Silly question: Which is the preferred place to download from if I only care about the Windows (x64) binaries, not the source?
On [url]https://www.mersenneforum.org/rogue/mtsieve.html[/url] there is a file with 1.9.6 in its name. The version history on that html page does not go further than 1.7.3. On [url]https://sourceforge.net/projects/mtsieve/[/url] there is a file with 1.9.7 in its name. Does it include both source and binaries? Is this a "beta" or "unreleased" version? The README_MTSieve.txt file refers to the former of these two web sites. /JeppeSN |
[QUOTE=JeppeSN;543049]Silly question: Which is the preferred place to download from if I only care about the Windows (x64) binaries, not the source?
On [url]https://www.mersenneforum.org/rogue/mtsieve.html[/url] there is a file with 1.9.6 in its name. The version history on that html page does not go further than 1.7.3. On [url]https://sourceforge.net/projects/mtsieve/[/url] there is a file with 1.9.7 in its name. Does it include both source and binaries? Is this a "beta" or "unreleased" version? The README_MTSieve.txt file refers to the former of these two web sites. /JeppeSN[/QUOTE] Sorry about the confusion. 1.9.6 and 1.9.7 are the same. I misnamed it because the version in the changes.txt file was incorrect. The file is named incorrectly on the one webpage. I need to change that to point to sourceforge. |
I have found small error ( if we can call it error) In latest twinsieve release if we set -P 10000000 it only sieve up to 10007. I believe it has some connection with chunks ( number of worker or so) So that is nearly cosmetic error. On higher P limit everything is OK
Can you also add in info line cpu usage in percentage? |
| All times are UTC. The time now is 22:45. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2021, Jelsoft Enterprises Ltd.