Hey all- I’m working on a rather large machine learning project that entails using a C++ main to call functions written in Julia. In addition the regular pain of who manages what variables and how to translate between bitwise variable representations, one issue that has come up is that we plan to parallelize the C++ code. This will entail having multiple C++ threads, all of which need to call the same Julia precompiled library.
Is this possible? Is Julia re-entrant, for lack of a better word?
The answer seems to be no, according to the linked post from the answer above, that is embedding two or more instances of Julia not supported.
Before that link, I wanted to find out for myself, can be fun to see what you can figure out yourself, and to help you. There’s nothing definitive I could find in the docs, and looking at the source code is going down quite the rabbit-hole.
What I found, but not sure the meaning of:
The docs state you should use jl_init. jl_init__threading was deleted then brought back, so I’m very curious what it’s for:
I’m pretty sure you would only initialize Julia once, and then it’s unclear where you go from there. Julia has threads now. There might be some workaround, other than letting Julia “drive”, which is supported, letting Julia take care of threading.
[Github tells me Julia is (partially) written in PHP. That’s of course not true, it only detects PHP from the .inc file.]