These functions control session-wide settings that can increase processing speeds.

use_multicore(n_cores = NULL, verbose = TRUE)

use_disk(
  frames_to_disk = TRUE,
  dir_frames = paste0(tempdir(), "/moveVis"),
  n_memory_frames = NULL,
  verbose = TRUE
)

Arguments

n_cores

numeric, optional, number of cores to be used. If not defined, the number of cores will be detected automatically (n-1 cores will be used with n being the number of cores available).

verbose

logical, if TRUE, messages and progress information are displayed on the console (default).

frames_to_disk

logical, whether to use disk space for creating frames or not. If TRUE, frames will be written to dir_frames, clearing memory.

dir_frames

character, directory where to save frame during frames creating.

n_memory_frames

numeric, maximum number of frames allowed to be hold in memory. This number defines after how many frames memory should be cleared by writing frames in memory to disk.

Value

None. These functions are used for their side effects.

Details

use_multicore enables multi-core usage of moveVis by setting the maximum number of cores to be used. This can strongly increase the speed of creating frames.

use_disk enables the usage of disk space for creating frames. This can prevent memory overload when creating frames for very large animations.

For most tasks, moveVis is able to use multiple cores to increase computational times through parallelization. By default, multi-core usage is disabled. This function saves the number of cores that moveVis should use to the global option "moveVis.n_cores" that can be printed using getOption("moveVis.n_cores").

How much memory is needed to create frames depends on the frame resolution (number of pixels) and the number of frames. Depending on how much memory is available it can make sense to allow disk usage and set a maximum number of frames to be hold in memory that won't fill up the available memory completely.

moveVis uses the parallel package for parallelization.

Examples

# enable multi-core usage automatically
use_multicore()
#> Number of cores set to be used by moveVis: 2 out of 3

# define number of cores manually
use_multicore(n_cores = 2)
#> Number of cores set to be used by moveVis: 2 out of 3

# allow disk use with default directory
# and maxiumum of 50 frames in memory
use_disk(frames_to_disk = TRUE, n_memory_frames = 50)
#> Disk usage for creating frames enabled.
#> Directory: '/var/folders/24/8k48jl6d249_n_qfxwsl6xvm0000gn/T//RtmphgHUuQ/moveVis'
#> Maximum number of frames which will be hold in memory: 50