하이퍼 스레딩으로 시뮬레이션을 실행하면 런타임이 두 배로 늘어납니다.

StackOverflow https://stackoverflow.com/questions/8416370

문제

python / numpy / cython으로 작성된 시뮬레이션을 사용합니다. 여러 시뮬레이션 실행에 대한 평균을 내야하므로 다중 처리 모듈을 사용하여 모든 개별 시뮬레이션 실행을 일괄 적으로 실행합니다.

사무실에는 HT가있는 i7-920 워크 스테이션이 있습니다.집에는 i5-560이 없습니다. 사무실의 각 배치에서 시뮬레이션 인스턴스를 두 배로 늘릴 수 있고 실행 시간을 절반으로 줄일 수 있다고 생각했습니다.놀랍게도 각 개별 인스턴스의 실행 시간은 가정용 워크 스테이션에 걸리는 시간에 비해 두 배가되었습니다.즉, 가정에서 3 개의 시뮬레이션 인스턴스를 병렬로 실행하는 데는 8 분이 걸리고 사무실에서 6 개의 인스턴스를 실행하는 데는 약 15 분이 걸립니다.'cat / proc / cpuinfo'를 사용하여 'siblings'= 8 및 'cpu cores'= 4를 확인 했으므로 HT가 활성화되었습니다.

저는 "총 실행 시간의 보존"법칙에 대해 알지 못합니다 (과학적인 관점에서 볼 때 꽤 흥미로울 수 있습니다 :)). 여기 누군가를 뛰어 넘는 것은이 수수께끼에 대해 약간의 빛을 비춰 줄 수 있습니다.

도움이 되었습니까?

해결책

컨텍스트 전환이 6 개의 대량 계산 프로세스와 4 개의 실제 코어로 인해 더 많은 오버 헤드를 생성 할 수 있습니다.프로세스가 cpu-ressources를 놓고 경쟁하면 비효율적 인 cpu-caches를 사용할 수 있습니다.

6 코어 대신 4 개만 활성화하면 결과는 어떻습니까?

다른 팁

Hyperthreading may be good for some kinds of workload. Intense numeric computations is not one of these - when you want to do some number crunching you better turn off hyperthreading. What hyperthreading gives one is "free context switching" between tasks, but the CPU has only so many execution units.

In this case, it can make things worse, because the O.S. can't know which processes are running on separate cores (where they'd get full performance), and which are on the same core, just on different "hyperthreads".

(Actually, I'd bet the Linux kernel can provide a way for one to have fine control over that, but Python's multiprocessing module will just launch extra-processes which will use default resource allocation).

Bottomline: turn HT off if you can - at least you will make full use of the 4 cores.

The others have pretty much given you an insight on the problem, I just want to contribute by linking this article that explains a bit more about how HT works and what are the implications for the performance of a multithreaded program: http://software.intel.com/en-us/articles/performance-insights-to-intel-hyper-threading-technology/

with my HP workstation(16 cores/cpu,using hyper-threading comes to 32 processors), turning hyper-threading on even broke python when I run the numerical simulation,the error code is 0x000005 this puzzled me a long time until I turned HT off,and the simulation works well! maybe you could check and compare the run-time for both HT is on and off

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top