TERR vs. R Performance in Spotfire: A Comparison for Parallel Computations.

TERR vs. R Performance in Spotfire: A Comparison for Parallel Computations.

book

Article ID: KB0137708

calendar_today

Updated On:

Products Versions
Spotfire Enterprise Runtime for R All

Description

Key Findings

  • The choice of data structure significantly impacts performance in both TERR and R.
  • Increasing the number of CPUs (tested with 1, 2, and 5) generally leads to faster computations for parallel operations in both environments.
  • A single parallel loop with an ordinary nested loop consistently outperformed nested parallel loops for the tested computations in both TERR and R.

Performance by Data Structure

data.frame

When using data.frame objects:

  • TERR was faster than R across all tested data sizes.
  • This advantage held true regardless of the number of CPUs used or whether single or nested parallel loops were employed.

matrix

When using matrix objects:

  • R was faster than TERR across all tested data sizes.
  • This performance advantage for R was consistent across all CPU counts and loop configurations.
  • Importantly, using a matrix was the fastest method overall for computing mutual information, for both TERR and R.

data.table

When using data.table objects:

  • R was faster than TERR across all data sizes.
  • Increasing the number of CPUs for parallel computations brought TERR's performance closer to R's but did not surpass it.

Parallel Processing Observations

  • CPU Scaling: For both TERR and R, utilizing more CPUs (e.g., 2 or 5 CPUs compared to 1 CPU) in parallel computations resulted in reduced computation times.
  • Loop Structure: Employing a single parallel loop with a standard (non-parallel) loop nested inside it was found to be more efficient than using nested parallel loops for both TERR and R across all tested scenarios.

Potential data.table and OpenMP Interaction in TERR

The data.table package includes its own parallel processing capabilities leveraging OpenMP. Since TERR is also configured to use OpenMP, it is suspected that a conflict or interaction between TERR's OpenMP implementation and data.table's internal OpenMP usage might be a contributing factor to TERR's slower performance when specifically using data.table objects.

  • Analysis Document: parallel_TERR_vs_R.html (Contains the detailed analysis of the results)
  • Timing Data: time_all.rds (R object containing the raw timing data)

Environment

All

Resolution

The findings from this comparison suggest the following strategies for achieving optimal performance in parallel computations:

  • When working with tabular data where data.frame semantics are sufficient, TERR may offer a speed advantage.

  • For matrix-based computations, R generally performs better, and using a matrix data structure is the most efficient approach overall in both TERR and R.

  • When using data.table objects, R currently demonstrates better performance. Consider this if data.table specific features and performance are critical.

  • Regardless of the environment (TERR or R) or data structure, prefer a single parallel loop with a standard nested loop over nested parallel loops for the type of computations tested, as it yields better performance.

  • To reduce computation time, leverage multiple CPUs for parallel tasks whenever possible.

Issue/Introduction

This article summarizes a performance comparison between Spotfire Enterprise Runtime for R (TERR) and open-source R, focusing on parallel computations with varying numbers of CPUs and different data object types. The analysis involved timing computations for mutual information using both nested parallel loops and single parallel loops with a standard nested loop.

Attachments

parallel_TERR_vs_R.html get_app
time_all.rds get_app