[translation:ERROR] Exception: 'no_release_gil' function can release the GIL
Why ? I cannot seem to open a file anywhere within assembly.py. When I use "NOT_RPYTHON"in method open_file then I cannot use it in functions like assemble_loop because it's NOT_RPYTHON. Happens when I call the following function in x86/assembly.py: def open_file(self): self.vtune_file = open('.\vtune.log', 'w') self.fixup_target_tokens(rawstart) self.materialize_done(rawstart, full_size, "loop%d" % looptoken.number) self.open_file() [translation:ERROR] Exception: 'no_release_gil' function can release the GIL: <function assemble_loop at 0x0000000070d4d2e0>[GilAnalyzer] analyze_direct_call((rpython.rtyper.lltypesystem.rffi:3)ccall_fopen__arrayPtr_arrayPtr): True[GilAnalyzer] analyze_direct_call((rpython.rtyper.lltypesystem.rffi:236)fopen__arrayPtr_arrayPtr_star_2): True[GilAnalyzer] analyze_direct_call((rpython.rlib.rfile:154)create_file): True[translation] start debugger...> /opt/vtune_pypy/rpython/translator/backendopt/gilanalysis.py(51)analyze()-> " %s\n%s" % (func, err.getvalue()))(Pdb+) print func<function assemble_loop at 0x0000000070d4d2e0>(Pdb+)
Same error with this version :def open_vtune_file(self): from rpython.rlib.streamio import open_file_as_stream self.vtune_file = open_file_as_stream('.\vtune.log', 'w') On Thursday, December 22, 2016 2:58 PM, Shubha Ramani <shubharamani@yahoo.com> wrote: Why ? I cannot seem to open a file anywhere within assembly.py. When I use "NOT_RPYTHON"in method open_file then I cannot use it in functions like assemble_loop because it's NOT_RPYTHON. Happens when I call the following function in x86/assembly.py: def open_file(self): self.vtune_file = open('.\vtune.log', 'w') self.fixup_target_tokens(rawstart) self.materialize_done(rawstart, full_size, "loop%d" % looptoken.number) self.open_file() [translation:ERROR] Exception: 'no_release_gil' function can release the GIL: <function assemble_loop at 0x0000000070d4d2e0>[GilAnalyzer] analyze_direct_call((rpython.rtyper.lltypesystem.rffi:3)ccall_fopen__arrayPtr_arrayPtr): True[GilAnalyzer] analyze_direct_call((rpython.rtyper.lltypesystem.rffi:236)fopen__arrayPtr_arrayPtr_star_2): True[GilAnalyzer] analyze_direct_call((rpython.rlib.rfile:154)create_file): True[translation] start debugger...> /opt/vtune_pypy/rpython/translator/backendopt/gilanalysis.py(51)analyze()-> " %s\n%s" % (func, err.getvalue()))(Pdb+) print func<function assemble_loop at 0x0000000070d4d2e0>(Pdb+)
Hi, On 22 December 2016 at 23:58, Shubha Ramani via pypy-dev <pypy-dev@python.org> wrote:
[translation:ERROR] Exception: 'no_release_gil' function can release the GIL: <function assemble_loop at 0x0000000070d4d2e0>
assemble_loop() is marked as no_release_gil because things can get subtly wrong if it releases the GIL in the middle of making machine code and another thread reaches assemble_loop() too. For debugging output, use debug_print(). If you really want to write a custom file, then you need to define and use the C functions open(), write() and close() in a way that calling them won't release the GIL. Alternatively, you can remove @rgc.no_release_gil on assemble_loop() and hope that the crashes you get are very rare. Or, stick everything on the AsmInfo() instance returned by assemble_loop(), and dump that info later. A bientôt, Armin.
participants (2)
-
Armin Rigo
-
Shubha Ramani