## 5 Gaussian Mixture Model Modeling Using Data-Parallel Primitives
### Improvement of the Shared Memory Environment
The resolution is 64 \(\times\) 64 \(\times\) 64 and each grid point is a three-variant vector. * Dataset 3 is dark matter density ensemble data with 1000 ensemble members. The resolution of each ensemble member is 64 \(\times\) 64 \(\times\) 64 and each grid point is a scalar value. The dataset1 is provided by Scivis Contest 2004 and can be downloaded from its website [39]. Dataset2 and dataset3 are produced by Nyx simulation. The simulation can be downloaded from its official website [40], and we run the simulation by ourselves to generate dataset2 and dataset3. For datasets 1 and 2, we subdivide them into several sub-blocks according to the given block size, and calculate a distribution from samples in each sub-block. As datasets 1 and 2 have different resolutions, we have different block size settings for these two datasets. We subdivide dataset 1 into blocks with block sizes of 8, 16, 32, and

Figure 15: In this example, two 3-variate GMMs are modeled at the same time, and each GMM has two Gaussian components. The level of parallelism is \(2*2*3*(1+3)/2=24\) when the optimization introduced in this section is applied. 64, and subdivide dataset 2 into block sizes of 2, 4, 8, and 16. For dataset 3, we calculate a distribution from samples across all ensemble members at the same grid points. Therefore, we will compute 64 \(\times\) 64 \(\times\) 64 distributions, and each distribution is calculated from 1000 samples. ### Performance Analysis of the Algorithms

Tables 1 and 2 show the speedup of the proposed histogram and GMM modeling algorithms using a different number of threads on CPU and GPU. We use the execution time for single thread CPU of each dataset as the baseline to calculate the speedup of different settings. When we use two cores, the speedup of both the algorithms and all datasets is almost doubled. When we use 18 cores, the worst speedup of the histogram modeling algorithm is 13.30 times and the worst speedup of the GMM modeling algorithm is 14.74 times. Therefore, both the proposed algorithms have good scalability from using two cores to 18 cores on the CPU. We also test the same algorithms on one NVIDIA(r) Tesla(r) V100 SXM2 GPU. As the GPU has a much more extensive computing thread, we gain 48-98x speedup on histogram modeling and 71-460x speedup on GMM modeling for different datasets. ### Parameter Analysis of the Algorithms

#### 6.2.1 Histogram

Figure 16 shows the results of the three datasets using 16 3.0 GHz cores to run the parallel histogram modeling algorithm. We can observe that both different block sizes and bin counts have an impact on the execution time. If the block size is smaller or bin count is larger, the execution time will increase. If the block size is smaller (the number of sets increases) or the number of bins is larger, we will have more unique 1D indices (keys) in the array at Line 14 of Algorithm 2. Therefore, more threads are required when the ReduceByKey primitive merges elements with the same key. If the number of samples required to be parallelized is greater than the number of available threads, the execution time will increase. \begin{table}
\begin{tabular}{l l l l} \hline \hline
**Computing Node** & **Dataset 1** & **Dataset 2** & **Dataset 3** \\ \hline
1-core CPU & 1 & 1 & 1 \\
2-core CPU & 1.985425841 & 1.988104127 & 2.001024069 \\
4-core CPU & 3.8213887 & 3.84097158 & 3.888216077 \\
8-core CPU & 7.162903579 & 7.223857685 & 7.471058016 \\
16-core CPU & 12.47168401 & 12.56068722 & 13.72269326 \\
18-core CPU & 13.30148627 & 13.55864188 & 14.22243753 \\ GPU & 98.5314432 & 37.02952644 & 48.27058739 \\ \hline \hline \end{tabular}
\end{table} 
Table 1: Speedup of our proposed parallel multi-set histogram modeling algorithm.