[m-users.] Segmentation fault when executing in parallel
Volker Wysk
post at volker-wysk.de
Sat Jun 12 00:14:06 AEST 2021
Hi
I'm trying to parallelize my program, like this:
:- pred parallel(pred(T,U), list(T), list(U)).
:- mode parallel(in(pred(in,out) is det), in, out) is det.
parallel(_, [], []).
parallel(Pred, [T|Ts], [U|Us]) :-
Pred(T, U)
&
parallel(Pred, Ts, Us).
I'm compiling it like this:
mmc -j8 -E --make --parallel \
-lposix \
--grade asm_fast.par.gc.stseg.mm \
mtt
I try to run it with two threads (calling parallel with a list of two
elements, see above). Then I get this runtime error:
*** Mercury runtime: caught segmentation violation ***
cause: unknown
PC at signal: 140069552275084 (7f647be83e8c)
address involved: (nil)
This may have been caused by a stack overflow, due to unbounded recursion.
exiting from signal handler
Segmentation fault (core dumped)
When I use only one thread, then it works fine. When running it with eight
threads, I get this:
Mercury runtime: memory zone pnegstack#36 overflowed
Mercury runtime: memory zone pnegstack#36 overflowed
Mercury runtime: memory zone pnegstack#36 overflowed
Mercury runtime: memory zone pnegstack#36 overflowed
Mercury runtime: memory zone pnegstack#36 overflowed
Mercury runtime: memory zone pnegstack#36 overflowed
Mercury runtime: memory zone pnegstack#36 overflowed
Mercury runtime: memory zone pnegstack#36 overflowed
PC at signal: 139982380928544 (7f5030170e20)
PC at signal: 139982380928544 (7f5030170e20)
PC at signal: 139982380928544 (7f5030170e20)
PC at signal: 139982380928544 (7f5030170e20)
PC at signal: 139982380928544 (7f5030170e20)
PC at signal: 139982380928544 (7f5030170e20)
PC at signal: 139982380928544 (7f5030170e20)
PC at signal: 139982380928544 (7f5030170e20)
This may have been caused by a stack overflow, due to unbounded recursion.
This may have been caused by a stack overflow, due to unbounded recursion.
This may have been caused by a stack overflow, due to unbounded recursion.
This may have been caused by a stack overflow, due to unbounded recursion.
This may have been caused by a stack overflow, due to unbounded recursion.
This may have been caused by a stack overflow, due to unbounded recursion.
This may have been caused by a stack overflow, due to unbounded recursion.
Note that there's no segmentation fault in this case.
What's going wrong? Is this a compiler bug?
Cheers,
Volker
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: This is a digitally signed message part
URL: <http://lists.mercurylang.org/archives/users/attachments/20210611/48e91608/attachment.sig>
More information about the users
mailing list