Re: How to make a foreign function run as fast as possible in Windows?

2016-10-01 Thread jfong
Chris Angelico at 2016/10/1 11:25:03AM wrote: > What's it doing? Not every task can saturate the CPU - sometimes they > need the disk or network more. > This function has no I/O or similar activity, just pure data processing, and it takes less than 200 bytes of data area to work with. My CPU is

Re: How to make a foreign function run as fast as possible in Windows?

2016-09-30 Thread Chris Angelico
On Sat, Oct 1, 2016 at 11:27 AM, wrote: > At this moment my interest is how to make it runs at 100% core usage. Windows > task manager shows this function takes only ~70% usage, and the number varies > during its execution, sometimes even drop to 50%. > What's it doing?

Re: How to make a foreign function run as fast as possible in Windows?

2016-09-30 Thread jfong
Paul Moore at 2016/9/30 7:07:35PM wrote: > OK. So if your Python code only calls the function once, the problem needs to > be fixed in the external code (the assembly routine). But if you can split up > the task at the Python level to make multiple calls to the function, each to > do a part of

Re: How to make a foreign function run as fast as possible in Windows?

2016-09-30 Thread Paul Moore
On Thursday, 29 September 2016 02:23:13 UTC+1, jf...@ms4.hinet.net wrote: > Paul Moore at 2016/9/28 11:31:50PM wrote: > > Taking a step back from the more detailed answers, would I be right to > > assume that you want to call this external function multiple times from > > Python, and each call

Re: How to make a foreign function run as fast as possible in Windows?

2016-09-28 Thread jfong
Paul Moore at 2016/9/28 11:31:50PM wrote: > Taking a step back from the more detailed answers, would I be right to assume > that you want to call this external function multiple times from Python, and > each call could take days to run? Or is it that you have lots of calls to > make and each

Re: How to make a foreign function run as fast as possible in Windows?

2016-09-28 Thread jfong
eryk sun at 2016/9/28 1:05:32PM wrote: > In Unix, Python's os module may have sched_setaffinity() to set the > CPU affinity for all threads in a given process. > > In Windows, you can use ctypes to call SetProcessAffinityMask, > SetThreadAffinityMask, or SetThreadIdealProcessor (a hint for the >

Re: How to make a foreign function run as fast as possible in Windows?

2016-09-28 Thread Paul Moore
On Tuesday, 27 September 2016 02:49:08 UTC+1, jf...@ms4.hinet.net wrote: > This function is in a DLL. It's small but may run for days before complete. I > want it takes 100% core usage. Threading seems not a good idea for it shares > the core with others. Will the multiprocessing module do it?

Re: How to make a foreign function run as fast as possible in Windows?

2016-09-28 Thread alister
On Tue, 27 Sep 2016 19:13:51 -0700, jfong wrote: > eryk sun at 2016/9/27 11:44:49AM wrote: >> The threads of a process do not share a single core. The OS schedules >> threads to distribute the load across all cores > > hmmm... your answer overthrow all my knowledge about Python threads >

Re: How to make a foreign function run as fast as possible in Windows?

2016-09-27 Thread eryk sun
On Wed, Sep 28, 2016 at 2:13 AM, wrote: > If the load was distributed by the OS schedules across all cores, > does it means I can't make one core solely running a piece of codes > for me and so I have no contol on its performance? In Unix, Python's os module may have

Re: How to make a foreign function run as fast as possible in Windows?

2016-09-27 Thread Gene Heskett
On Tuesday 27 September 2016 22:13:51 jf...@ms4.hinet.net wrote: > eryk sun at 2016/9/27 11:44:49AM wrote: > > The threads of a process do not share a single core. The OS > > schedules threads to distribute the load across all cores > > hmmm... your answer overthrow all my knowledge about

Re: How to make a foreign function run as fast as possible in Windows?

2016-09-27 Thread jfong
eryk sun at 2016/9/27 11:44:49AM wrote: > The threads of a process do not share a single core. The OS schedules > threads to distribute the load across all cores hmmm... your answer overthrow all my knowledge about Python threads completely:-( I actually had ever considered using

Re: How to make a foreign function run as fast as possible in Windows?

2016-09-26 Thread eryk sun
On Tue, Sep 27, 2016 at 1:48 AM, wrote: > This function is in a DLL. It's small but may run for days before complete. I > want it > takes 100% core usage. Threading seems not a good idea for it shares the core > with others. Will the multiprocessing module do it? The

How to make a foreign function run as fast as possible in Windows?

2016-09-26 Thread jfong
This function is in a DLL. It's small but may run for days before complete. I want it takes 100% core usage. Threading seems not a good idea for it shares the core with others. Will the multiprocessing module do it? Any suggestion? Thanks ahead. --Jach --