Embedded Python - Sharing memory among scripts, threads
Hi, I have a multi-threaded C++ software app that embeds Python. When multi-threading (native system threads) it is possible that multiple instances of a Python script are active. I have a requirement to 'share' some data values between these script instances (e.g. counters, file handles etc). I notice that 'global' variables are NOT visible or shared among these script instances. Does Python offer a solution to this ? What are my options ? Thanks for helping. Alan -- http://mail.python.org/mailman/listinfo/python-list
Re: Embedded Python - Sharing memory among scripts, threads
Any ideas? -- http://mail.python.org/mailman/listinfo/python-list
Urgent: Embedding Python question please
Hi, I am embedding Python into a multi-threaded C++ application runnig on Solaris and need urgent clarification on the embedding architecture and its correct usage (as I am experience weird behaviors). Can anyone clarify: - if Python correctly supports multiple sub-interpreters (Py_NewInterpreter) ? - if Python correctly supports multiple thread states per sub-interpreter (PyThreadState_New) ? and the "real" question: - what is the rationale for choosing one of: [a] one sub-interpreter with many thread states [b] many sub-interpreters with one thread state each [c] many sub-interpreters with many threas states each Thanks for helping Alan -- http://mail.python.org/mailman/listinfo/python-list
Urgent problem: Embedding Python questions....
Hi, I am embedding Python into a multi-threaded C++ application runnig on Solaris and need urgent clarification on the embedding architecture and its correct usage (as I am experience weird behaviors). Can anyone clarify: - if Python correctly supports multiple sub-interpreters (Py_NewInterpreter) ? - if Python correctly supports multiple thread states per sub-interpreter (PyThreadState_New) ? and the "real" question: - what is the rationale for choosing one of: [a] one sub-interpreter with many thread states [b] many sub-interpreters with one thread state each [c] many sub-interpreters with many threas states each Thanks for helping Alan -- http://mail.python.org/mailman/listinfo/python-list
Urgent: Embedding Python problems - advice sought
Hi, I am embedding Python into a multi-threaded C++ application running on Solaris and need urgent clarification on the embedding architecture and its correct usage (as I am experience weird behaviors). Can anyone clarify: - if Python correctly supports multiple sub-interpreters (Py_NewInterpreter) ? - if Python correctly supports multiple thread states per sub-interpreter (PyThreadState_New) ? and the "real" question: - what is the rationale for choosing one of: [a] one sub-interpreter with many thread states [b] many sub-interpreters with one thread state each [c] many sub-interpreters with many threas states each Thanks for helping Alan -- http://mail.python.org/mailman/listinfo/python-list
Re: Urgent: Embedding Python problems - advice sought
Does anyone have advice on other groups, sites etc that has knowledge of this subject ? Thanks -- http://mail.python.org/mailman/listinfo/python-list
Re: Urgent: Embedding Python problems - advice sought
Thanks Michael. I will look into the areas you have suggested... Alan -- http://mail.python.org/mailman/listinfo/python-list
GIL, threads and scheduling - performance cost
Hi all, Wondering if a GIL lock/unlock causes a re-schedule/contect swap when embedding Python in a multi-threaded C/C++ app on Unix ? If so, do I have any control or influence on this re-scheduling ? The app suffers from serious performance degradation (compared to pure c/C++) and high context switches that I suspect the GIL unlocking may be aggravating ? Thanks for any help. Alan -- http://mail.python.org/mailman/listinfo/python-list
Re: GIL, threads and scheduling - performance cost
Merci Pierre, Yes I agree and plan to move more to C/C++ and releasing the GIL when entering C/C++. I also need to understand my original question re GIL and rescheduling. I fear that lock/unlock too often is also causing delays due to context switching. BTW do you have any hints/comments on SWIG/BOOST etc to glue PY and C/C++ ? Alan -- http://mail.python.org/mailman/listinfo/python-list
Python:C++ interfacing. Tool selection recommendations
Hi, I am embedding Python with a C++ app and need to provide the Python world with access to objects & data with the C++ world. I am aware or SWIG, BOOST, SIP. Are there more? I welcome comments of the pros/cons of each and recommendations on when it appropriate to select one over the others. Thanks in advance. Alan -- http://mail.python.org/mailman/listinfo/python-list
Re: Python:C++ interfacing. Tool selection recommendations
Thanks to all for your postings. Seems like a spread of opinions here. I guess SWIG, SIP & BOOST are all valid options which I need to vaidate in turn Alan -- http://mail.python.org/mailman/listinfo/python-list
Clarity: GIL, processes and CPUs etc
I have been reading many of the posting on the GIL and impact on threading etc. I have found is confusing and would welcome some clarity on this. I understand that embedding the interpreter in a C/C++ application limits it to one CPU. If the application is multi-threaded (system threads) in will not use additional CPUs as the interpreter is tied to one CPU courtesy of the GIL. True or False? I understand that forking or running multiple process instances of the above application would make use of multiple CPUs. This is because each process would have its own interpreter and GIL that is independent of any other process. True or False? Can anyone clarify the above? Thanks A -- http://mail.python.org/mailman/listinfo/python-list
SWIG and Python incompatibilities?
Hi all, Has anyone experienced issues incompatible versions of the above? On solaris, we are experiencing suspect crashes & memory leaks? How do I determine which versions are proven to be compatible/incompatible etc? Thanks for helping. Alan -- http://mail.python.org/mailman/listinfo/python-list
Re: SWIG and Python incompatibilities?
Thanks Steve! appreciate the response. -- http://mail.python.org/mailman/listinfo/python-list
M2Crypto SSL memory leaks - fixes or alternatives ??
Hi folks, I notice that M2Crypto (a python wrap of OpenSSL) leaks (haemorrhages) memory significantly and affects my long running app very badly. Does anyone know of fixes to this problem? Does anyone recommmend alternatives to M2C ? e.g pyopenssl. I notice that Guido Van Rossum has flamed about this in the past but I am not aware of any resolutions. Thanks Alan -- http://mail.python.org/mailman/listinfo/python-list
Embedding Python in Multi-threading App. Any Guidelines, Hints, Recipes ??
Hi, I am embedding Python into a multi-threaded application running on Solaris. Python will enable end users to customize and re-program many aspects of the application. I expect that the C++ application will be natively multi-threaded and will embed multiple Python sub-interpreters. Called Python scripts may in turn call back into the C++ application via SWIG wrappers of C++ objects. I need advice and/or pointers to relevant documentation on the subject if available please. In particular, I need advice on the necessary housekeeping (set/reset of GIL, PyThreadStates, PyInterpreterStates etc etc) to invoke a sub-interpreter from a native thread. A native thread may call a number of sub-interpreters in sequence or recursively (due to call backs) and I cannot find specific information on this subject area. Many thanks in advance. Alan -- http://mail.python.org/mailman/listinfo/python-list
Embedding: many interpreters OR one interpreter with many thread states ?
Hi, Does anyone know the reasoning or pros/cons for either (in a multi-threaded C++ app): - creating many sub-interpreters (Py_NewInterpreter) with a thread state each Or - creating one interpreter with many thread states (PyThreadState_New) When do I choose one approach over the other and why ? Thanks Alan -- http://mail.python.org/mailman/listinfo/python-list
How to determine your pthread in Python?
Does anyone know how to determine the pthread or native thread identifier while in Python ? FYI I have a multi-threaded C++ app on Solaris that embeds the Python interpreter. While in the interpreter I need to determine its actual running thread id. FYI2 The python interpreter is not firing off extra threads via the python threading classes etc. Thanks Alan -- http://mail.python.org/mailman/listinfo/python-list
