Docsity

Parallel Implementation of Angular Correlation Function for Astronomical Data, Study Guides, Projects, Research of Electrical and Electronics Engineering

Partial preview of the text

Download Parallel Implementation of Angular Correlation Function for Astronomical Data and more Study Guides, Projects, Research Electrical and Electronics Engineering in PDF only on Docsity!

T P A C F

(Two-Point Angular Correlation Function)

Scott Bai, Ali Hussain, Gene Wu, Nicolas Zea

Outline

  • TPACF Defined
  • Parallelism in TPACF
  • Single-Precision Issues
  • Implementation Version 1
  • Implementation Version 2
  • Performance Comparisons
  • Conclusion

TPACF Defined

  • Inputs
    • One set of spherical coordinates representing astronomical bodies, with M data points
    • N randomly generated sets of spherical coordinates with M data points each

TPACF Defined

  • DD: data points correlated with self
  • DR: data points correlated with a random set
  • RR: set of random points correlated with self

[1] 2pacf Project Application Information Sheet.pdf

[1]

1

2 1 0

1 (^0) 

   

  

  R

R

n i i

n R i i

RR

n DD DR

   

Parallelism in TPACF

  • Conversion of data points
  • All dot products of DD, DR, and RR are independent both within data sets and across data set pairs
  • The creation of histograms is difficult because we need to load a bin value from shared memory, increment the value, and store the value back without losing values due to thread-scheduling race conditions

Single-Precision Issues

  • The gold code relies on double precision floating point values to represent both the coordinates of the data points, the bin boundaries of the histograms, and the bin count within the histograms
  • At least 41 bits of fixed-point precision are required to reproduce the results of the gold code with complete accuracy.
  • Only single point precision is supported in CUDA for now

Implementation Version 1

  • Two kernel functions
  • One kernel processes the data
    • Each call correlates one DD, DR, or RR
    • One call for DD
    • N calls for DRs, one for each R; similarly for Rrs
    • MxM coordinate pairs to correlate in each call
    • Autocorrelations (DD, RRs) treated like any others - does twice as much work as neccessary

Implementation Version 1

  • Each warp generates a histogram using synchronization technique from class slides - Each block coalesces its warp histograms into one output histogram
  • Second kernel function is called multiple times to coalesce histograms generated by first kernel - Summation is by binary tree, similar to scan - log(x) iterations, where x is num of blocks used in first kernel function

Implementation Version 2

  • Exploit Parallelism between data sets
  • 1 kernel call
  • 201 blocks ( 1 DD, 100 DR, 100 RR) with

100 random datasets

  • Each DR block does (number of elements)^2

calculations

  • DD and RR around half that

Implementation Version 2

  • Calculations left on CPU
    • Conversion of data points from Spherical to Cartesian coordinates
    • Summing of DR and RR sets for omega function calculation
  • Done due to relatively small number of

calculations performed (for summing only 100 summations for N=100 random sets) versus high overhead

Implementation Version 2: Advantages

  • Easier to program
  • Less overall code (1 vs 2 kernels)
  • Reduced overhead:
    • Single kernel call
    • Fewer histograms to coalesce

Implementation Version 2: Disadvantages

  • Handling of larger values slightly more

difficult

  • Higher register usage (approaching SM limit)
  • Only one block can be resident on an SM at a

time

  • Parallelism does not scale

Histogram Performance

  • Performance depends on number of histogram binning conflicts (needing to rewrite bin info)
  • More histograms per warp = less binning conflicts
  • For 10 datasets and 2048 points:
    • 280ms for 1 histogram per warp
    • 200ms for 2 histograms per warp
    • 150ms for 4 histograms per warp
    • 115ms for 8 histograms per warp*
    • 100ms for ideal zero conflict scenario
  • Effects of conflicts mitigated
    • Kernel failed to run in feature rich version, most likely due to too high register usage

Final Results

  • Implementation 2 easily achieves speedup, 1

only for large datasets

  • But only when bin counts fit within 30 bits of precision (full data set results in overflow)
  • DD/DR/RR values are not exact though
  • Particularly in lower bins, difference from gold code varies, but stays within 10%
  • Upper bins exact or <1% difference
  • Due to GPU floating point implementation differences (emulation is exact)