# A Neural Network-Inspired Matrix Formulation of Chemical Kinetics for Acceleration on GPUs
## Appendix C Performance Comparison with Non-Matrix Approaches
Overall, Figure 10a is a useful baseline because it resembles the impact of sending a CPU-type approach directly to the GPU without any underlying algorithmic changes. Note that Figure 10a is demonstrative and is not expected to be GPU-optimal, because: (1) the kernel launch overhead is high; and (2) there are many distributed global memory access points and conditional statements scattered throughout the kernel. The algorithms in Figure 10b,c are fissioned representations of Figure 10a--the single large kernel of Figure 10a has been effectively decomposed into a set of smaller kernels, each playing an isolated role in the source term evaluation. The approach in Figure 10b is the conventional analog to the matrix-based approach in Figure 10c: the multidimensional threading advantages provided by the data structures in Section 2.2 are retained, with the key difference being the matrix-based calculations (i.e., GEMMs) for the rate constants and net production rate evaluations are not utilized. In summary, the advantages of the matrix-based approach (Figure 10c) can be assessed by directly comparing its performance with the Figure A3b algorithm, and the advantages of the fissioning approach for this particular problem can be assessed by comparing the algorithms in both Figure A3b,c with that of Figure A3a. Figure A4 shows the GPU source term evaluation times obtained from the respective algorithms in Figure A3. Note that the matrix-based algorithm times in Figure A4c come from the dense cuBLAS GEMM routines and are identical to those shown previously in Figure 4.  
It is apparent that the conventional unfissioned algorithm (Figure A4a) observes significantly altered saturation and compute trends when compared to the fissioned counterparts. Due to the fact each thread directly iterates over a reaction loop, the unfissioned algorithm is characterized by roughly vertical shifts of the compute time curve in proportion to the increase in \(N_{R}\) for the entire set of \(N_{C}\), not just in the saturated regime. This ultimately means that the unfissioned algorithm becomes prohibitively slow as the mechanism size increases for all values of \(N_{C}\). This is due not only to the increased arithmetic, but also to the increase in inefficient global memory transactions performed by each thread as the mechanism size increases. For example, for the class-C mechanisms, Figure 14a shows a smaller relative increase in compute time with an increase in \(N_{C}\)--this implies that the execution time is dominated by inefficient memory accesses and high kernel launch overhead (i.e., non-arithmetic operations). The deviation of the saturation point trends in with respect to the fissioned algorithms in Figure 14b,c likely stems from the same cause, but requires further investigation. The trends in Figure 14b,c are very similar--the characteristic approach to the saturation point is retained by the conventional fissioned algorithm. The effect of transitioning from the conventional fissioned approach to the matrix-based fissioned approach is better visualized in Figure 15, which shows the speedup provided by the matrix formulation (time in Figure 14b divided by time in Figure 14c). The speedup curves show how the matrix-based approach gives increasingly higher performance boosts as both the mechanism size and number of cells increases. Interestingly, for the smaller class-A mechanisms, the conventional non-matrix algorithm is more efficient (speedup of 0.5, or roughly twice as fast) in the pre-saturated regime. This likely comes from the additional expensive arithmetic operations, such as element-wise exponentiations and logarithms, present in the matrix-form that are avoided in the conventional evaluation--essentially, for cases where the speedup is below unity, the cost of these additional complexities is not offset by the efficiency of the linear algebra routines. As the GPU saturates, this effect is diminished, and the performance boost provided by the matrix-based algorithm is recovered even for small mechanisms.