JuliaPy / JuliaPy/pyjulia

How to do multi-threading within julia when using pyjulia

Open
#438 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
893
Forks
101
PR merge metrics
No merged PRs in 30d

Description

In the documentation, it says

_PyJulia cannot be used in different threads since libjulia is not thread safe. However, you can use multiple threads
within Julia. For example, start IPython by JULIA_NUM_THREADS=4 ipython and then run:

.... code ...._

Question: is there a way to enable a multi-thread Julia in a python script so that I can run it from the command line? Something like python3 call_julia.py

Where call_julia.py is a python script like below:

import julia
from julia.api import Julia

### may be something magic happen here so that imported Julia is multi-threaded?

from julia import Main
jl = Julia(compiled_modules=False)

jl.eval('include("functions_defined_in_Julia.jl")')

def julia_model(parameters):
Main.parameters = parameters
x = jl.eval("julia_model(parameters)")
return x

Any thoughts? I have read through the documentation but still got no idea how to do it, thanks!

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.