After using Transducers.jl operations in a script and then switching to @threads
SOMETIMES I get an error.
Sorry for the vagueness, but it's all I have now and I still didn't manage to reproduce the error.
All I know is that sometimes this fails on the Threads.@threads
objs = tcollect([dosomething(x) for x in X ])
Threads.@threads for s in eachindex(objs)
dosomethingelse(...)
end
The error looks as the following:
Initially I thought this was related to Makie but after googling "Could not load glyph" it appears other people also had problems with this when multiprocessing.
Has something similar ever been an issue to you?
Makie does not support multithreading. Unpredictable behavior is expected.
Plotting packages tend to use a lot of globals. Too many, in my opinion. Some of this is kind of understandable because they are usually aspiring to a very convenient user interface and they want to avoid burdening the user with handling objects they probably don't care about.
Yeah, plotting packages and web frameworks take liberties with global variables and it's for the worse.
At least web frameworks know they'll be run in a shared-almost-nothing, usually single-threaded environment
Often that's true, though it's at least partly a consequence of being designed that way. And mutable global state isn't generally to my taste even in single-threaded environments.
Web frameworks seem super goddamn weird to me. I had a number of complaints about Oxygen.jl and only later did I realize that the things I was complaining about were common web framework stuff (among them: inexplicably excessive use of globals).
Thankfully there are a lot of web frameworks out there, including some that share my design sensibilities.
Oh, I was thinking about frontend libraries. I agree that having global variable state in server/backend ones is far less optimal, given those often run with a _high_ degree of both concurrency and parallelism
that sounds reasonable. thanks. it's a pity though. Actually what's happening inside @threads
is not generating the figures but saving them to the disk.
pretty much anything you do involving Makie should be assumed to be thread-unsafe.
Last updated: Nov 22 2024 at 04:41 UTC