hkHardwareInfo and threads quick questions

hkHardwareInfo and threads quick questions

imagem de Luis Eduardo

  Hi,

  I have noticed that the class:  hkHardwareInfo has only one member: m_numThreads

  My PC is a i7 quad core hyperthreaded but even than, when i use the class above, it says m_numThreads = 4.

  Is this rigth? I mean, Havok can only use 1 thread per real processors instead of, at least, 1 thread for the real ones and 1 for the simulated hyperthreaded ones?

  Going a little further:

  Why can't i create a LOT more threads per CPU?   Say.. 50 threads x 4 cores.  Is it because it would not make much diference in the end?

  A lot further now :)

  I have the impression that Havok has the consoles (xbox and ps3) as the primary target because it worked very good with PPU/SPUS but i have not seem anything about the PPUs of the PCs like Cuda(nvidia) or StreamProcessor (ati).  Is there a way to use hkHardwareInfo and get the numThreads saying that all my cuda-cores are available as threads? :P

  Are Havok planning to use OpenCL or any GPGPU computation in the near future?

  thanks for any clarification and sorry for the questioning-machine-gun! Hope nobody get mad  ;)

  - Luis

5 posts / 0 new
Último post
Para obter mais informações sobre otimizações de compiladores, consulte Aviso sobre otimizações.
imagem de havok_David

Hey Luis,

Physics, being a CPU intensive Task does not really benefit from hyperthreading (or using a LOT more threads) that is why we are not considering hyperthreading when computing the number of worker threads that we will be creating. We are instead leaving them to the OS to use on background tasks. However, you could very well implement your own thread pool and use as many threads as you need (ie.: which would be more or less useful, given the application you are working on) to process Havok jobs.
As for Havok using Cuda/OpenCL/GPGPU computing, we are currently doing some R&D on that. We haven't yet seen much need from our customers to support them and it is somewhat application-specific: would you be ready to give up GPU time? And possibly on tasks that would better be performed on CPU? If yes, we should try to figure what code would suit the GPU better than the CPU, re-optimize that code for GPU-use and re-evaluate what algorithm exactly should run on which processor. So Supporting Cuda/OpenCL/GPGPU Computing is not something that will be implemented in the very near future...

Let me know if you have any other questions or want some clarifications on the above,

Cheers,
David.

David G. Developer Support Engineer Havok www.havok.com
imagem de havok_David

Note: This is the same reply as the first one I submitted. This is just to TEST that this reply goes through....

Hey Luis,

Physics, being a CPU intensive Task does not really benefit from hyperthreading (or using a LOT more threads) that is why we are not considering hyperthreading when computing the number of worker threads that we will be creating. We are instead leaving them to the OS to use on background tasks. However, you could very well implement your own thread pool and use as many threads as you need (ie.: which would be more or less useful, given the application you are working on) to process Havok jobs.
As for Havok using Cuda/OpenCL/GPGPU computing, we are currently doing some R&D on that. We haven't yet seen much need from our customers to support them and it is somewhat application-specific: would you be ready to give up GPU time? And possibly on tasks that would better be performed on CPU? If yes, we should try to figure what code would suit the GPU better than the CPU, re-optimize that code for GPU-use and re-evaluate what algorithm exactly should run on which processor. So Supporting Cuda/OpenCL/GPGPU Computing is not something that will be implemented in the very near future...

Let me know if you have any other questions or want some clarifications on the above,

Cheers,
David.

David G. Developer Support Engineer Havok www.havok.com
imagem de Luis Eduardo

hehe the test was ok. I did saw two replys ;)
but the forum is little weird. Not easy to use and some paths to the same place work with diferent behavior... well.. nevermind.

About the answer, in my case i would exchange a lot of GPU time to the physics because i am doing a simulation tool, not a game. The 3D isn't the highest priority.

Thanks for your answer, David. Much appreciated!

cheers,
- Luis

imagem de dark_sylinc

Quote:

Luis Eduardo wrote:

  Why can't i create a LOT more threads per CPU?   Say.. 50 threads x 4 cores.  Is it because it would not make much diference in the end?


You can. But there is no performance benefit. In fact, it will probably slowdown.
When there are more threads than cores, it is known as "over subscription".
When there's over subscription, there's a lot of CPU cycles going to overhead from context switching. Also if they all share data, locks, etc; you risk into going to resource starvation, false cache sharing, threads waiting for threads who can't complete their job timely because other threads are wasting the CPUs time, etc.

Quote:

Luis Eduardo wrote:

  A lot further now :)

  I have the impression that Havok has the consoles (xbox and ps3) as the primary target because it worked very good with PPU/SPUS but i have not seem anything about the PPUs of the PCs like Cuda(nvidia) or StreamProcessor (ati).

Are Havok planning to use OpenCL or any GPGPU computation in the near future?


While I can't talk about Havok's future because I don't work there (I think there was a dead project about porting Havok to GPGPU back then like in 2008); I can tell you that there's a huge difference between PPUs and Cuda*/OpenCL*; and it is bus transfers and sync operations.
PPUs are designed to interoperate with their CPU (whithin certain limits); while GPUs are a lot more constrained on that aspect. Sending the input to the GPU and then retrieving the results could take long enough to counter the benefits. Also the current state of the GPUs don't allow enough flexibility to offload as many algorithms as it can be done with the PPUs.

Note there has been remarkable improvements this year. The new NVIDIA*'s TESLA* K20 ([url=http://blogs.nvidia.com/2012/09/how-tesla-k20-speeds-up-quicksort-a-fami...) promises a lot. Also the CPU/GPU hybrids such as AMD* Fusion* & Intel's Sandy Bridge, removing a lot of overhead of sending data to/from the GPU; could be a game changer.

Last but not least: Looking at the time budget in my game, physics take less than 5ms (10ms under a VERY heavy load); while Graphics at least triple that time. So, taking GPU time from rendering to dedicate it to Physics simulation doesn't seem like a good idea; unless you're using Physics for Scientific research.
Using GPGPU may become useful for doing soft-body physics; which isn't something where Havok doesn't focus much.

Matias N. Goldberg Intel Havok Physics Innovation Contest Winner * Most Innovative Use of Physics in a Game (2nd Place) * Best Physics Knowledge Base Entry (2nd Place)

Faça login para deixar um comentário.