freeResolution and syz are not thread-safe
Nobody has claimed this yet.
- Dominant language
- Macaulay2
- Stars
- 435
- Forks
- 297
- Avg merge
- 4d 20h
- Merged PRs (30d)
- 11
Description
Many operations rely on computing resolutions or syzygies, so naturally these two not being thread-safe makes lots of Macaulay2 un-parallelizable.
I came across this because I wanted to compute Ext of a single module against several different modules, which involves computing resolutions of the same module for each call to Ext. Here's a simpler example to try out:
S = kk[x,y,z];
M = truncate(5, S^1);
f = i -> schedule(freeResolution, M);
apply(2, f)
taskResult \ oo
class \ oo
Result:
i4 : apply(2, f)
o4 = {<<task, created>>, <<task, created>>}
o4 : List
i5 : /home/linuxbrew/.linuxbrew/Cellar/macaulay2/1.25.06_2/share/Macaulay2/Complexes/FreeResolutions.m2:91:17:(2):[3]: error: key not found in hash table:
isComputable (of class Symbol)
/home/linuxbrew/.linuxbrew/Cellar/macaulay2/1.25.06_2/share/Macaulay2/Core/methods.m2:154:98:(1):[2]: --back trace--
/home/linuxbrew/.linuxbrew/Cellar/macaulay2/1.25.06_2/share/Macaulay2/Core/option.m2:17:14:(1):[1]: --back trace--
/home/linuxbrew/.linuxbrew/Cellar/macaulay2/1.25.06_2/share/Macaulay2/Core/option.m2:17:14:(1): --back trace--
C-c C-c^C
i5 : taskResult \ oo
21 35 15
o5 = {S <-- S <-- S , }
0 1 2
o5 : List
i6 : class \ oo
o6 = {Complex, Nothing}
o6 : List
Similarly, running syz gens M several times in parallel causes crashes in threads:
i4 : apply(5, i -> schedule(syz, gens M))
o4 = {<<task, running>>, <<task, running>>, <<task, created>>, <<task, created>>, <<task, created>>}
o4 : List
i5 : -- SIGSEGV
-- SIGSEGV
-- SIGSEGV handler called a second time, aborting
*--* stack trace, pid:
Process M2 exited abnormally with code 2
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the parallel freeResolution and syz examples, then inspect Complexes/FreeResolutions.m2:91 and the referenced Core/methods.m2 and Core/option.m2 paths. Determine why concurrent calls access shared state unsafely. Done means repeated parallel calls complete without errors or crashes and produce the same results as serial calls.
Written by the indexing model from the issue text.
Assessment
- Domain
- backend, performance
- Issue type
- Bug
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100