FAQ/CPU Usage

From VFXPedia

< FAQ
Jump to: navigation, search

Contents

Strategies

A lot of Fusion is devoted towards making the most of multiprocessor systems. It tries hard to keep all the CPU cores busy crunching pixels. To this end, the whole application is heavily multithreaded, and applies numerous strategies to limit the amount of time CPUs are kept waiting for more data to process:

  • Tools will use a thread on each CPU to process scanlines in parallel, wherever practical. Nearly all image-processing tools can do this.
  • Comps may process multiple frames simultaneously. This requires more memory, but allows the CPUs to be kept busy rendering a frame while the previous frame is saved to disk and the next frame is being preloaded, all at the same time.
  • Comps can render branches in parallel, often allowing one layer to be processed while waiting for another layer to be loaded.
  • When loading images, many formats will preload the next chunk of data while the previous chunk is being decoded, which can help hide the time spent waiting for the disk or network.
  • Many other operations, such as image conversion and texture uploading, are also multithreaded.

Pitfalls

Despite all this, you may find your CPUs are sometimes still kept waiting for image data to process. For some comps, this is unavoidable by their nature, such as when a comp must load many layers from a network but does only simple operations to those frames. In this case, the comp is said to be I/O bound; the speed of the network is the limiting factor, and the CPUs can easily complete all their work in less time than it takes to load and save the frames. Also, some tasks are not easily dividable into separate operations, and thus do not benefit from additional CPUs. Notably, particle generation and geometry processing are processed on a single CPU, though the rendering of these into an image may use all cores.

Tips

However, most moderately complex comps place higher demands on the CPUs, and can benefit from the following tips:

  • Faster I/O: faster networks, file servers and local disks will of course help when your comp is I/O bound, but can also speed up other comps to varying degrees.
  • Enough memory: few things can slow down a render more than running out of memory. If Task manager's Performance tab shows very little Available Physical Memory and the disk is often busy, your CPUs may be spending most of their time waiting for chunks of RAM to be copied back and forth to the swap file. In this case, adding more RAM will certainly help, but often just lowering some of the settings in Preferences/Memory can sufficiently reduce the memory that Fusion requires.
  • Frames At Once: this powerful Prefs/Memory setting controls how many frames are being processed simultaneously. Setting it to values greater than 1 will result in Loaders immediately loading the next frame after the previous frame has been loaded and passed on to the next tool to be processed, which allows the CPUs to be kept busy while I/O is done simultaneously, and allows single-threaded operations like particles to be calculated alongside other single- or multi-threaded operations. The higher the value, the more frames are "in flight" at once. However, this value also multiplies the amount of memory being used, and may need to be reduced if you find your renders running out of RAM.
  • Simultaneous Branching: enabling this Prefs/Memory checkbox will allow different branches within a comp to be processed simultaneously, which also increases the number of images "in flight". It can give similar "I/O hiding" advantages to Frames At Once, even while working interactively on one frame at a time, and can similarly increase memory usage.

Bottlenecks

You may also encounter "bottlenecks". These are cases where the slowest part of a comp is unable to take advantage of all the CPUs, so that the CPU Usage can drop at this time. You can often identify a bottleneck by watching the green activity lights in the Flow View while rendering, and noting which tools are active the most when Task Manager indicates that CPUs aren't completely busy. Bottlenecks can often be alleviated by the Frames At Once and Simultaneous Branching settings described above, or sometimes by tweaking the tool in question.

A Note on Caching

By default, Fusion will use most available memory for caching frames, as described in the Caching FAQ. This caching process will not normally cause your machine to run out of RAM and start swapping; Fusion detects when available RAM is low, and automatically frees up as much of the cache as necessary. If your comp demands all available RAM, the cache will be completely empty.