cython.parallel.threadid unavailable in function arguments
See original GitHub issueIt looks like this is a valid cython code.
from cython import parallel
x = parallel.threadid()
print(x)
But this is not.
from cython import parallel
print(parallel.threadid())
This might be just a symptom of a larger issue. Many things are not possible with the cython module when compiled with cython, compared to when run with python. Like accessing its module
object.
import cython
x = cython
Issue Analytics
- State:
- Created 3 years ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
Using Parallelism — Cython 3.0.0a11 documentation
Variables that are private in the parallel block are unavailable after the parallel block. Example with thread-local buffers. Pure Python Cython. from cython....
Read more >Prange slowing down Cython loop - Stack Overflow
I was planning to set up a monte carlo framework with a pipeline structure: basic rand >> random variable >> function of random...
Read more >Parallel computing in Cython - threads - Neal Hughes
How to run multiple threads in Cython. ... The perfect use case is applying a function element wise over a large array.
Read more >Using Parallelism - Cython 0.19.1 Documentation
Variables that are private in the parallel block are unavailable after the parallel block. Example with thread-local buffers: from cython.parallel import ...
Read more >Using Parallelism - 《Cython 3.0 Documentation》 - 书栈网
cython.parallel. prange ([start,] stop[, step][, nogil=False][, schedule=None[, chunksize=None]][, num_threads=None]) · This function can be used ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
print(parallel.threadid())
looks like a bug.Not being able to assign the
cython
module isn’t. The Cython module isn’t really a proper module, should really only becimported
(a compile-time action), and doesn’t have an actual module object associated with it. It can beimported
so it’s possible to write pure-Python code with optional Cython features.If you were able to assign the cython module then people would do things like:
Suddenly you’ve made the choice of whether
C
is acdef
or regular class a runtime decision rather than a compile-time decision…Thanks for the output. I’m quite puzzled by it though. When I compare the .c file from tests/run/parallel.pyx (i.e. the two tests that are failing) with and without my PR the only differences are due to the extra test I added. If I revert the extra test I added then
diff
tells me that they’re identical.So I don’t know I’m afraid… I guess the PR should be treated with caution because of what you say but I really don’t understand where the differences could be coming from.