NewtonSetThreadsCount

From Newton Wiki
Jump to: navigation, search

NewtonSetThreadsCount

void NewtonSetThreadsCount (const NewtonWorld* const newtonWorld, int threads)

Usage

Sets the number of threads used for calculating the physics when an update is invoked for the world.

Parameters

  • const NewtonWorld* newtonWorld - pointer to the world for which the number of threads has to be set.
  • int threads - the number of threads to be used.

Return

  • Nothing.

Description

Sets the number of threads used for calculating the physics when an update is invoked for the world.

Using more threads will decrease the amount of time needed by Newton to do the physics integration. However, the performance does not perfectly scale with increased amount of processing threads, the speed of calculations even decreases after a threshold value.

To achieve optimum performance the number of threads shall not be higher than the number of processors and/or cores.

Remarks

  • The maximum number of threaded is set on initialization to the maximum number
  • of CPU in the system.
  • fixme: this appears to be wrong. It is set to 1.

See also

NewtonGetThreadsCount