XXXX A Cross-Platform SpMV Framework on Many-Core Architectures 1

Size: px
Start display at page:

Download "XXXX A Cross-Platform SpMV Framework on Many-Core Architectures 1"

Transcription

1 XXXX A Cross-Platform SpMV Framework on Many-Core Architectures 1 YUNQUAN ZHANG, State Key Laboratory of Computer Architecture, Institute of Computing Technologies, Chinese Academy of Sciences. SHIGANG LI, State Key Laboratory of Computer Architecture, Institute of Computing Technologies, Chinese Academy of Sciences. SHENGEN YAN, SenseTime Group Limited. Department of Information Engineering, Chinese University of Hong Kong. HUIYANG ZHOU, Department of Electrical and Computer Engineering, North Carolina State University. Sparse matrix-vector multiplication (SpMV) is a key operation in engineering and scientific computing. Although the previous work has shown impressive progress in optimizing SpMV on many-core architectures, load imbalance and high memory bandwidth remain the critical performance bottlenecks. We present our novel solutions to these problems, for both GPUs and Intel MIC many-core architectures. First, we devise a new SpMV format, called blocked compressed common coordinate (BCCOO). BCCOO extends the blocked common coordinate (COO) by using bit flags to store the row indices to alleviate the bandwidth problem. We further improve this format by partitioning the matrix into vertical slices for better data locality. Then, to address the load imbalance problem, we propose a highly efficient matrix-based segmented sum/scan algorithm for SpMV, which eliminates global synchronization. At last, we introduce an auto-tuning framework to choose optimization parameters. Experimental results show that our proposed framework has a significant advantage over the existing SpMV libraries. In single-precision, our proposed scheme outperforms clspmv COCKTAIL format by 255% on average on AMD FirePro W8, and outperforms CUSPARSE V7. by 73.7% on average and outperforms CSR5 by 53.6% on average on GeForce Titan X; in double-precision, our proposed scheme outperforms CUSPARSE V7. by 34.% on average and outperforms CSR5 by 16.2% on average on Tesla K2, and has equivalent performance compared with CSR5 on Intel MIC. CCS Concepts: Computing methodologies Parallel computing methodologies; 1 Extension of Conference Paper. The additional contributions of this manuscript over the previously published work of S. Yan et al at PPoPP-214 include: 1. This paper extends our proposed BCCOO format for Intel Xeon Phi processors by introducing inner-block transpose (Section 3.2.2). 2. We propose a new segmented sum/scan strategy for Intel Xeon Phi processors to explore the potential performance of their 512-bit SIMD instructions (Section 3.2.2). 3. We present the experimental results on Intel Xeon Phi processor, and compare the performance with NVIDIA and AMD GPUs in the context of yaspmv (Section 6). 4. We also extend the yaspmv library to support double precision (Section 3.2.3) and present the experimental results in Section 6. The new material is more than one-third of our PPoPP-214 paper. Author s addresses: Y. Zhang, State Key Laboratory of Computer Architecture, Institute of Computing Technologies, Chinese Academy of Sciences, Beijing 119, China; S. Li ( corresponding author), State Key Laboratory of Computer Architecture, Institute of Computing Technologies, Chinese Academy of Sciences, Beijing 119, China, address: shigangli.cs@gmail.com; S. Yan ( corresponding author), SenseTime Group Limited. Department of Information Engineering, The Chinese University of Hong Kong, address: yanshengen@gmail.com; H. Zhou, Department of Electrical and Computer Engineering, North Carolina State University, Raleigh, NC. Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for components of this work owned by others than ACM must be honored. Abstracting with credit is permitted. To copy otherwise, or republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. Request permissions from permissions@acm.org. c 216 ACM /216/8-ARTXXXX $15. DOI: 1.1

2 XXXX:2 Y. Zhang et al. Additional Key Words and Phrases: SpMV, Segmented Scan, BCCOO, OpenCL, CUDA, GPU, Intel MIC, Parallel Algorithms ACM Reference Format: Yunquan Zhang, Shigang Li, Shengen Yan and Huiyang Zhou, 215. A Cross-Platform SpMV Framework on Many-Core Architectures. ACM Trans. Architec. Code Optim. x, x, Article XXXX (August 216), 25 pages. DOI: INTRODUCTION Sparse matrix-vector multiplication (SpMV) is a key linear algebra algorithm and is heavily used in many important application domains. Many-core architectures feature high computational throughput and memory access bandwidth, which are the promising targets to accelerate the workloads like SpMV. According to the granularity of each core, many-core architectures can be divided into two categories. The first is based on massive light cores, like NVIDIA and AMD GPUs, and high throughput is achieved by massive fine-grained parallelism. The second is based on many heavy cores, in which both coarse-grained and fine-grained parallelism are supported. Intel Many Integrated Core (Intel MIC) architecture belongs to the second category. This paper aims at proposing a high performance SpMV framework for these two kinds of many-core architectures. Although the sequential implementation of SpMV is straightforward, its parallel implementation is quite challenging, especially on many-core architectures. Firstly, since the non-zeros in a matrix may not be evenly distributed across different rows, the rowbased parallelization usually suffers from the load imbalance problem. This problem is more severe on GPU architectures, since the threads operate in the single-instruction multiple-thread (SIMT) manner and the execution time is literally determined by the slowest thread. Secondly, SpMV puts high pressure on the memory hierarchy. The matrix data exhibit poor data reuse, as each non-zero element is only used once for computing the corresponding dot product. Besides, the access pattern of the multiplied vector is irregular, due to the discontinuous locations of the non-zeros in each row. On GPUs, memory coalescing [Ueng et al. 28], namely all the threads in a warp access the consecutive memory address, is a key factor to achieve high memory bandwidth. However, irregular accesses will destroy memory coalescing, which makes the memory accesses serialized. There has been a lot of research on accelerating SpMV by many-core processors. To reduce the memory footprint size and fully exploit the performance of the many-core architectures, researcher have proposed a bunch of many-core-oriented storage formats, such as COO[Bell and Garland 29], ELLPACK [Bell and Garland 29], ELL-R [Vázquez et al. 211], SELL [Monakov et al. 21], BCSR and BELL [Choi et al. 21], ESB [Liu et al. 213], and SELL-C-σ [Kreutzer et al. 214]. On the other hand, the compressed sparse row (CSR) format is still dominant on traditional CPU architectures because of high performance and good compression. Recent research work [Daga and Greathouse 215], [Liu and Schmidt 215], [Greathouse and Daga 214] proposed new algorithms for CSR-based SpMV, which attempted to make the CSR format also achieve high performance on many-core architectures. Furthermore, given the d- ifferent features of target hardware platforms and different characteristics of sparse matrices, offline auto-tuning or benchmarking [Choi et al. 21], [Li et al. 215] is commonly used to improve the performance. Although previous work has achieved impressive performance improvement for SpMV, load imbalance and high memory bandwidth requirement remain the fundamental performance bottlenecks of SpMV. In this paper, we propose our novel solution to SpMV. Since the proposed solution is yet another SpMV framework, we name it as yaspmv. We first propose a new format for sparse matrices to alleviate the memory bandwidth pressure. Our new format is

3 A Cross-Platform SpMV Framework on Many-Core Architectures XXXX:3 referred to as blocked compressed common coordinate (BCCOO), as it is built upon the common coordinate (COO) format. The BCCOO format extends the COO format with blocking to reduce the size for both row and column index arrays. Then, it uses bitflags to drastically reduce the size of the row index array. To improve the data locality of the multiplied vector, we partition the sparse matrix into vertical slices and align the slices in a top-down manner. Such vertically-partitioned BCCOO is referred to as the BCCOO+ format. To address the load imbalance problem, we design a new highly optimized segmented scan/sum kernel for SpMV. In our approach, each thread processes the same number of consecutive non-zero blocks and performs sequential segmented scans/sums to generate partial sum results. Then, each workgroup/thread block will run the parallel segmented scan on the last partial sum results. When the final dot-product results require accumulating partial sums across multiple workgroups/thread blocks, adjacent synchronization [Yan et al. 213] is used to eliminate the overhead of global synchronization. To further improve the performance of our SpMV kernel, we also introduce an auto-tuning framework to explore optimization parameters for different sparse matrices and different platforms. The parameters to be tuned form a large search space. We prune the search space of the parameters using some heuristics and reduce the auto-tuning time to a few seconds. The yaspmv framework is implemented based on OpenCL [Stone et al. 21], which supports general purpose parallel programming on heterogeneous computing platforms, including GPUs and Intel MIC. Experimental results show that our proposed single format fits nearly all of the 2 sparse matrices used in the experiments. In single-precision, compared with the vendor-tuned library CUSPARSE V7., our proposed scheme achieves 73.7% on average on GeForce Titan X; compared with the clsp- MV [Su and Keutzer 212], which combines advantages of many existing formats, our proposed scheme achieves up to 195% and 7% on average on GTX68 GPUs, up to 2617% and 255% on average on AMD FirePro W8 GPUs; compared with CSR5 [Liu and Vinter 215], our proposed scheme achieves a performance gain of 53.6% on average on GeForce Titan X, and 14.9% on average on AMD FirePro W8. In double-precision, our proposed scheme outperforms CUSPARSE V7. by 34.% on average on Tesla K2; and outperforms CSR5 by 16.2% on average on Tesla K2, by 9.7% on average on AMD FirePro W8. On Intel MIC, our proposed scheme has almost equivalent performance compared with CSR5. The remainder of this paper is organized as follows. Section 2 presents our proposed BCCOO/BCCOO+ format for sparse matrices. Section 3 details our proposed customized matrix-based segmented scan/sum approach for SpMV. Section 4 summarizes our auto-tuning framework. The experimental methodology and the results are discussed in Sections 5 and 6, respectively. Section 7 addresses the related work. Section 8 concludes the paper. 2. THE BLOCK-BASED COMPRESSED COMMON COORDINATE (BCCOO) FORMAT Our proposed block-based compressed common coordinate (BCCOO) format builds upon the common coordinate (COO) format. In this section, we first present the COO format as the background, and then introduce the BCCOO format and its extension BCCOO+. We will use the sparse matrix in Figure 1 as an example COO Format The COO format is a widely used format for sparse matrices. It has explicit storage for the column and row indices for all non-zeros in a sparse matrix. For example, the matrix in Figure 1 can be represented with a row index array, a column index array, and a data value array, as shown in Figure 2.

4 2. The Block-based Compressed Common ero the blocks size of and the it row performs index array. sequential To hit rate for accessing the multiplied Coordinate (BCCOO) A Format ms to generate partial sum results. This a sparse matrix into vertical slices and Our proposed block-based compressed common coordinate orkload imbalance problem and reduces a top-down manner before applying the format builds upon the common coordinate (COO) format. ement on the row information associated uch vertical partition-based BCCOO is In this section, we first present the COO format as the Then, each workgroup/thread block will COO+ format. background and then introduce our BCCOO format and its gmented scan on the last partial sum XXXX:4 extension 2.1 COO BCCOO+ Format format. For illustration, we use the Y. Zhang et al. rom ad imbalance each of its problem, threads. we When revisit the the final matrix The COO in Eq. format 1 as a running is a widely example. used format for sparse matrices. ented require scan accumulating and design partial a new sums highly across It has explicit storage for the column and row indices for all ed groups/thread scan/sum kernel blocks, for SpMV. adjacent In our non-zeros in a sparse amatrix. For example, b c the matrix in ]is read used processes to eliminate the same the number overhead of of d e f Eq.1 can be A = represented with a row index array, a column ro blocks and it performs sequential g h i j tion. index array, and a data value array, as shown in Figure 1. ms to generate partial sum results. This k l m n o p orkload the performance imbalance problem of our SpMV and reduces kernel, 2.1 COO Format ment auto-tuning on the row framework information to associated explore Fig. 1. An example of sparse matrix. eters The COO format is a widely used format for sparse matrices. hen, each for different workgroup/thread sparse matrices block will and. It has explicit storage for the column and row indices for all gmented Such optimization scan on the parameters last partial include sum Row_index ure non-zeros in a sparse matrix. For example, the matrix in om cache each of for its multiplied threads. When vector, the whether final Col_index Eq.1 can be represented with a row index array, a column require se online accumulating or offline, partial the suitable sums across block index array, Value and a data value array, as shown in Figure 1. groups/thread posed BCCOO/BCCOO+ blocks, format, adjacent the ]is o blocks used to be eliminate processed the by overhead each thread, of Row_index Fig. 2. = The [ COO format of 2 matrix A ] ion. ads in a workgroup, the size of shared Col_index = [ ] d local memory in OpenCL[19]) The parallelization or strategy suitable with COO is segmented scan/reduction [Bell the performance of our SpMV kernel, 2.2 Value BCCOO = [a b Format c d e f g h i j k l m n o p] Our key extension to the CO d for intermediate partial and sums, Garland etc. As 29]. As highlighted in [Bell and Garland 29], [Su and Keutzer 212], auto-tuning framework to explore Our Figure proposed 1.The BCCOO COO format format of extends matrix A. the COO format in array to compress the row ind Figure 1.The COO format of matrix A. eters rm a for large different search sparse space, the matrices we advantage introducea of the COO format is that it does not suffer from the load imbalance. to Such reduce optimization the auto-tuning problem, parameters time include to a and few can achieve The parallelization consistent two ways. First, strategy performance we incorporate suitable over with different the block-based COO, as types shown of format in sparse to matrices. However, the The parallelization strategy suitable with COO, as shown in The bit flag array can be view previous key problem the COO work[1], of the format. COO In is segmented format block-based is that formats scan/reduction. it needs such to as explicitly blocked As store difference function being appli ure cache for multiplied vector, both whether row index previous work[1], is segmented scan/reduction. As n se a online set of or 2 offline, sparse the matrices suitable show block that highlighted highlighted and theellpack column in[1][16], in[1][16], index and blocked the the for advantage advantage every CSR[7], non-zero a non-zero ofthe ofthe COO COO element. block format format Therefore, is stored is is it has a difference value larger than the worst memory footprint consecutively. [Su and Keutzer This way, 212]. one block of data values will share 1s. Then, we flip 1s and s suc le posed format BCCOO/BCCOO+ fits nearly all of format, the sparse the that that it does it does the not not same suffer suffer row from index from the the and load load the imbalance same imbalance column problem problem index. and Therefore, and bit flag array represents a row study. blocks Compared to be processed to the by 2.2. each BCCOO vendor-tuned thread, Format can can achieve achieve the consistent storage consistent overhead performance performance of the over row over different index different array types and types of the of column value is the last non-zero in ads in a workgroup, the size of shared sparse sparse matrices. matrices. However, However, the the key key problem problem of the of the COO COO E V5., our proposed scheme The BCCOO achieves format extends index thearray COOcan format be significantly in two ways. reduced. First, For wematrix combine A the Eq. blockbased design or with format format the COO is is that 1, that format. if it a needs it block needs Into size block-based explicitly to of explicitly 2x2 store is used, formats, store both the both the blocked such row the row as index COO blocked index (BCOO) ELLPACK reason for such representation represents that it is not the d local memory in OpenCL[19]) ovement by upto 15% and 42% on for intermediate partial sums, and blocked etc. As CSR and [Choi and the the et column format al. column 21], index has index the one for index block for every arrays every ofnon-zero data and non-zero values the data data will element. value element. share array the shown same row partial sums for dot-product GPUs, up to 229% and 65% on average rm a large search space, we index introducea and the same Therefore, column in it has it Figure index. has the the 2. worst Therefore, worst memory memory the footprint[16]. footprint[16]. storage overhead of the row index eliminates the condition check. Compared to the clspmv[16], which to reduce the auto-tuning array time to and a few the column index array can be significantly reduced. Figure 3 shows the end of a row (see Section 3.2). blocked COO (BCOO) 2.2 BCCOO format Format of the matrix A in Figure 1 with the block size of 2 2. lossless compression on the ro Our proposed BCCOO format extends the COO format in information can be reconstruc n a set of 2 sparse matrices show that two ways. First, we incorporate the block-based format to accumulating the number of le format fits nearly all of the sparse the COO format. Row_index In block-based 1 1 formats 1 such as blocked format as blocked compressed study. Compared to the vendor-tuned ELLPACK and Col_index blocked 1 CSR[7], 3 2 a 3 non-zero block is stored A in Eq. 1, the BCCOO form V5., our proposed scheme achieves consecutively. This way, one block of data values will share the block size of 2x2. vement by upto 15% and 42% on the same row Value index and the same column index. Therefore, GPUs, up to 229% and 65% on average the storage overhead of the row index array and the column Compared to the BCOO for. Compared to the clspmv[16], which index array can be significantly reduced. For matrix A in Eq. column index array and the Fig. 3. The blocked COO format of matrix A with the block size of , if a block size of 2x2 is used, the blocked COO (BCOO) same. The row index array be Assuming that integers are From Figure 3, we can see that there are 5 non-zero blocks. Both the row index compression ratio of 32 is achi array and the( column ) index Figure array 2.The have blocked beencoo reduced format significantly. of matrix A with The the first block non-zero a size of 2x2. In our implementation, in orde 2 2 block is, and its block-based row index and column index are andto 1, d e check the end of the bit flag From Figure 2, we can ( see that ) there are 5 non-zero blocks. such that the length of the bit Both the row index array b c and the column index array have respectively. The next non-zero 2 2 block is, and its blocked-based row index working set (i.e., number of no been reduced significantly. f The first non-zero 2x2 block is of a workgroup. and column index are and 3, respectively. and its block-based Note that row index in Figure and column 3, we index use two are arrays rather than a single arrayto store the data value. For a block size with the height Similar to row-index arrays, w larger than 1, we put different and 1, respectively. The next non-zero 2x2 block is rows in different arrays, such that both the row index transmission required for c and column index can be used directly and its to blocked-based index the data row index each and of column the value index arrays. difference functions. In our Such data arrangement is also helpful for contiguous memory accesses. The samesegmented as difference function all the block-based formats, are the and BCOO 3, respectively. format may Note contain that Figure zero elements 2, we use two even ineach a segment being the work non-zero block. data value arrays rather than a single array in Figure 1. The way, there is no interreconstructing the column ind reason is that for a block size with the height larger than 1, we put different rows in different data value arrays such that array is stored using the sho both the row index and column index can be used directly to index the data in each of the value arrays.such data arrangement is also helpful for contiguous memory accesses. The overhead of the BCOO format, which is shared among all block-based formats, is the zeros in the data value array when a non-zero block contains zeros. regular integer type. If a dif range of a signed short, we re which means that the original be accessed for this particular i B

5 index the data in each of the value arrays.such data arrangement is also helpful for contiguous memory accesses. The overhead of the BCOO format, which is shared among all block-based formats, is the zeros in the data value array when a non-zero block contains zeros. range of a signed short, we rep which means that the original be accessed for this particular i A Cross-Platform SpMV Framework on Many-Core Architectures XXXX:5 B Bit Flag Col_index Value (a) BitFlag1 Fig. 4. The BCCOO format of matrix A with the block size of 2 2. Col_index1323 (un Our key extension to the Figure BCOO 3.The format BCCOO isformat to use of amatrix bit flag A with array the block to compress size of the Value row index array. We first calculate the difference 2x2. value of each pair of the adjacent elements in the row index array. If the difference value is not greater than 1, we set the corresponding bit in the bit flag array to the difference value. If the difference value is greater than 1, we set a corresponding number of 1s in the bit flag array. Then, we flip the bits of 1s and s in the bit flag array, such that a bit value of represents a row stop, namely, the corresponding block is the last non-zero block in the row. A bit value of 1 represents that the corresponding block is not the last non-zero block in a row. When calculating the partial sums, this representation can eliminate the row stop check for each non-zero block (see Section 3.2 for details). The row index information can be reconstructed from the bit flag array by accumulating the number of row stops. Thus, the row index array is compressed in a lossless manner. We refer to this format as blocked compressed COO (BCCOO). For matrix A in Figure 1, the BCCOO format with the block size of 2 2 is shown in Figure 4. Compared with the BCOO format shown in Figure 3, the column index array and the data value arrays remain the same. The row index array becomes a bit vector of 5 bits. Assuming that integers are used for row indices of BCOO format, BCCOO achieves a compression ratio of 32 for the row index array. In order to remove the control flow to check the end of the bit flag array, we pad it with bit 1, such that the length of the bit flag array is a multiple the number non-zero blocks processed by a workgroup. Similar to row-index arrays, we also try to reduce the data transmission overhead for the column index arrays using difference functions. Firstly, we logically partition the column index array into multiple segments, each of which is corresponding to the working set (i.e., the total non-zero blocks to be processed) of a thread. Then, we use way, there is no inter-thread dependency when reconstructing the column indices. The resulting a difference function on each segment of the column index array. In this way, there is no inter-thread difference way, dependency array there is is stored no when inter-thread using reconstructing the dependency short data the type when column instead reconstructing indices. of the regular The the resulting column integer indices. type. If The a difference resulting difference value array is stored using the short data type instead of the value difference is beyond array the range is stored of a using signed the short, short we data replace type instead it with of a the fixed regular value integer -1, which type. means If a difference that the type. If a difference value is beyond the range of a signed short, we replace it with a value is beyond the range of a signed short, we replace it with a fixed value -1, which means that the fixed value original -1, which column means index that array the needs original to be column accessed index for this array particular needsindex. to be accessed for this particular original index. column index array needs to be accessed for this particular index. B B (a) The vertically sliced and (a) rearranged matrix of(a) matrix A. BitFlag1 Bit Flag1 Col_index (uncompressed) Col_index (uncompressed) Value Value (b) The bit flag, column index, and data value (b) arrays. (b) Fig. 5. The BCCOO+ format of matrix A in Figure 1.

6 XXXX:6 referred to as the BCCOO+ format. In this format, we first partition a sparse matrix into vertical slices and then align the slices in a top-down manner. Then, we apply the BCCOO format on the vertically sliced and rearranged matrix with an exception on column indices. The column index array is generatedbased on the block coordinates in the original matrix rather than the transformed matrix as we tuning to determine either the BCCO should be used. 2.4 Auxiliary Information for SpM To facilitate the computation of information is computed and st Y. BCCOO/BCCOO+ Zhang et al. format. First, ba non-zeros that each thread will pro location of the first result generated need original column indices to locate the corresponding 2.3. BCCOO+ Format elements in the multiplied vector for dot-product operations. We also propose an extension to our BCCOO format to improve the locality row index of thethat the result belongs to. For matrix A in Eq. 1, the vertically sliced and rearranged accesses to the multiplied vector, referred to as the BCCOO+ format. In this as an format, example, in which each eleme we first partition matrix a sparse becomes matrix matrix into B in vertical Figure4a slices, if the and number then of align slice the simplify slices inthe a discussion, we assume th top-down manner. is 2 Next, and the weslice apply width theis BCCOO 4. The BCCOO+ format onformat the vertically-sliced of A is discussed and rearranged matrix. shown However, in Figure the4b column when the index block array size 2x2 is generated is used. based onlarger the block than 1, each row will be stor in Section 2.2, for a bloc coordinates in As theshown original in Figure matrix, 4, rather bit flag than array theencodes transformed that there matrix. is This array. isthe be-bccocause we need the only original one non-zero column block indices row to, locate row 1, the and corresponding row 2. Row 3, elements 6a. As in there are 16 non-zero data format of matrix multiplied vector for dot-product operations. For matrix A in Figure 1, the verticallysliced and rearranged matrix becomes matrix B in Figure 5(a), in which the number in contrast, contains 2 non-zero blocks. The column indices thread will process 4 non-zero block of slices is 2 andof the these sliceblocks, widthhowever, is 4. The BCCOO+ are determined format from of Amatrix is shown A in Figure row index 5(b) that the first result gen with the block size rather of than 2 2. matrix As shown B. Taking Figure the 5, 2x2 theblock bit flag g array h as encodes an belongs that there to. Such information can be is only one non-zero block in row, row 1, and row 2, and mtwo nnon-zero blocks operation in rowon the bitwise inverse of t 3. The column indices example, ofit these resides blocks, at column ( however, 2 in matrix ) are determined A,which is from why its matrix BCCOO A rather format. In this example, thr column index value is 2 as shown g h in Figure 4b. 4 non-zero data blocks A, B, C than matrix B. Taking the 2 2 block as an example, its column index value The benefit of BCCOO+ mformat n can be illustrated with computation result, i.e.,a *y, is par indicates that it matrix-vector resides column multiplication 2 in matrix between A. matrix A and vector y, the dot-product between row and th The benefit ofi.e., BCCOO+ A*y. Different format can rows bein illustrated the same vertical by theslice, matrix-vector e.g., slice multiplication the result entry is set to. Similarly, between matrix, A will and all vector use y[]~y[3]. y, namely, Similarly, A* y. Different all the rows rows in in the slice same 1 vertical next four slicenon-zero blocks E, F, G use the same segment of y to compute the dot-product. Thus, the temporal locality of vector y is improved will use y[4]~y[7] by BCCOO+. to compute However, the dot-product. since the BCCOO+ As the block still belongs to row, the entry for th format breaks the original matrixinto g h is set as. slices, is in the slice intermediate 1, it needs results to use of y[4]~y[7], each slice with need the to be combined to generate the final m nresults. For matrix A in Figure 1, the computation of A* y based on the BCCOO+ block format size isof shown 2x2, in its Figure column 6. index We can of see 2 provides that it isthe necessary to use a temporary buffer necessary to store information the intermediate for indexing results, y[4] and invoke y[5] from an the additional kernel A B C to combine them. vector Suppose y. the original matrix is divided into s slices and the length of F y is l. The size of the temporary buffer is calculated by s l sizeof(datatype). Extra C = H I memory overhead hurts the performance. Thus, the BCCOO+ format is not always K L M preferred over the BCCOO format. We resort to auto-tuning to determine either the BCCOO or BCCOO+ format should be used. A y = k l a y[] d e y[1] + y[2] g h y[3] m n b c y[4] f y[5] i j y[6] o p y[7] Bit Flag = [ Col_index = [ Value = [A B C D E F G H Fig. 6. Matrix-vector multiplication as a sum of the products between its vertical slices and the corresponding vector segments. Figure 5.Matrix-vector multiplication as a sum of the products between its vertical slices and the corresponding vector Bit Flag = [ segments Auxiliary Information for SpMV Result Entry: Since the BCCOO+ format breaks the original matrix into To facilitate the computation of SpMV, the following information is computed and s- tored along with slices, the BCCOO/BCCOO+ after performing the format. matrix-vector First, based multiplication on the number on of non-zeros that each thread each will slice, process, the intermediate we computeresults the location need to ofbe the combined first result to generated by each thread, namely, generate the the rowfinal index results. that the Using result our belongs running to. example We useof matrix C in Figure 7(a) as an example, matrix A in which Eq. 1, each the derivation element represents of A*y is shown a data in block. Figure To simplify the discussion, we assume 5.Therefore, the block when sizeusing is n 1. the As BCCOO+ discussed informat, Sectionit 2.2, is for a block size with the height larger than 1, each row will be stored in a separate value array. The BCCOO format of matrix C is shown in Figure 7(b). Assuming each thread processes 4 non-zero blocks, we will compute the row index of the first result generated by each thread. Such information can be computed by a scan operation on the bitwise inverse

7 2 non-zero blocks. blocks. The The column The column indices indices thread thread will will process process 4 non-zero 4 non-zero blocks, blocks, we will we we will compute will compute the the the r,, ever, are determined are determined from from A matrix matrix A A row row row index index that that the first the first result result generated generated by each by by each thread each thread with a scan ing the 2x2 block belongs belongs to. Such to. Such information information can be can computed be computed with with a scan a scan. Taking the 2x2 block as as an as an an operation operation on the on on bitwise the bitwise inverse inverse of the of bit the flag bit bit flag array flag array in the in in the the column 2 in in matrix 2 in matrix A,which A,which is is why why is why its its its BCCOO BCCOO format. format. In this In example, this example, thread thread processes processes the first the the first first s shown 2 as shown in in Figure in Figure 4b. 4b. 4b. 4 non-zero 4 4 non-zero data data blocks blocks A, A, B, B, C, C, and C, and D and and D D and its and first its its first first OO+ format format can can be can be illustrated be illustrated A Cross-Platform with with with computation SpMV computation Framework result, result, i.e.,a *y, on i.e.,a *y, Many-Core is part is is Architectures part of part the of of final the the final result final result result for for for XXXX:7 on ication n between between matrix matrix matrix A A and and A vector and vector vector y, y, y, the the dot-product the dot-product dot-product between between between row row row and the and and multiplied the the multiplied multiplied vector. vector. vector. So, So, So, n ws the in the same the same same vertical vertical vertical slice, slice, slice, e.g., of e.g., the e.g., slice slice bit slice flag the array the result the result result inentry the entry entry is BCCOO set is is to set set. format. to to Similarly,. Similarly,. Similarly, In this thread thread example, thread 1 processes 1 processes 1 processes thread the the processes the the first y[3]. Similarly, Similarly, all the all rows the rows in Similarly, all the rows 4slice in non-zero in slice 1 1 slice 1 data next next next blocks four four non-zero four A non-zero non-zero, B, blocks C, blocks and blocks E, D F,. E, E, The G, F, F, first and G, G, computation and H. As H. block As block and H. As result, E E block E namely, A *y[], compute the dot-product. the dot-product. As the is As part block the block of the still final belongs still result belongs to row for to the, row the dot-product, entry the entry for the for between first the first result row result of thread of and thread the 1 1 multiplied vector. pute the dot-product. As Thus, the block still belongs to row, the entry for the first result of thread 1 the result is set is as entry set. as. for thread is set to. Similarly, thread 1 processes the next needs, it needs to use to y[4]~y[7], use y[4]~y[7], with with the the is set as. needs to use y[4]~y[7], four with non-zero the blocks E, F, G, and H. As block E still belongs to row, the result olumn its column index index of 2 of provides 2 entry provides the forthe thread 1 is also set to. n olumn indexing for indexing y[4] y[4] and of 2 y[5] and provides y[5] from from the the the indexing y[4] and y[5] from the C C C (a) Sparse Matrix C. Bit Flag Bit Flag Bit Flag Col_index Col_index (uncompressed) (uncompressed) Col_index (uncompressed) Value Value Value (b) The BCCOO format of Matrix C. r tiplication multiplication as a sum as a of sum the of products the products Bit Flag Bit Flag s slices and and the corresponding the corresponding vector vector ltiplication as a sum of the products Bit Flag s and the corresponding vector Result Result Entry: Entry: at format breaks breaks the original the original matrix matrix into into (c) The location of the first result generated by each thread. Assume there ng e matrix-vector the matrix-vector multiplication multiplication on are four threads Result and Entry: each thread processes four non-zero 2 blocks. 3 te ediate results breaks results need the need original to be to combined be matrix combined to into to. sults. e Using matrix-vector Using our running our multiplication running example example of on of Fig. 7. Auxiliary information for SpMV. te ivation e derivation results of A*is need of A*is to shown be shown combined Figure Figure to. using Using the the BCCOO+ our BCCOO+ running format, example format, it is it of is 3. EFFICIENT MATRIX-BASED SEGMENTED SCAN/SUM FOR SPMV rivation of A*is shown in Figure For a sparse matrix stored in our BCCOO/BCCOO+ format, SpMV can be implemented in g the BCCOO+ format, it three is logical steps: (1) read the data value arrays and multiply them with the corresponding vector values indexed by the Col index array; (2) perform a customized matrix-based segmented scan/sum using the bit flag array; (3) combine the partial results, and write back the final results to global memory using the result entry array. In our proposed scheme, all these three steps are implemented in a single kernel so as to minimize the kernel invocation overhead Segmented Scans The segmented scan primitive scans multiple data segments that are stored together. A start flag array is typically used to identify the first element of a segment. We show an example of the inclusive segmented scan in Figure 8. Its start flag array is generated from the bit flag array of the BCCOO format in Figure 7. The output of the inclusive segment scan is the Result array in Figure 8. Note that for SpMV, the complete segmented scan results are not necessary. Actually, we only need the last sum of each segment, which is marked with underscores in the Result array. Thus, a more lightweight segmented sum can be used for SpMV. However, considering that a warp is the minimum scheduling unit for GPUs, segmented sum has almost equal computation to segmented scan when there are few non-zeros in each row. Besides, for segmented sum, it has to check whether the corresponding bit for each non-zero value is a row stop or not, which brings overhead. Thus, we consider both segmented scan and segmented sum to implement SpMV.

8 Second, we perform a quick check to see whether we can format in Figure 6.The output of the inclusive segment scan discussed be in saved. [8]. Second, The other each is a thread matrix-base will skip the parallel segmented scan operation at the workgroup is the Result array in Figure 7. Note that for SpMV, the which scan is proposed in a sequential to improve manner memory and ma eff level. It is the case when each thread in a workgroup complete segmented scan results are not necessary. Instead, overcome instead the of load a segmented imbalance scan, problem. which Ou encounters a row stop, which results in the segment size the last sum of each is sufficient, as marked with BCCOO/BCCOO+ format suits better with the m being 1 for the parallel segmented scan. results to keep. Also, note that segmented scan and we further customize it for S underscores in the Result array. In other words, for SpMV, 3. An Efficient Matrix-based Segmented Sum/Scan BCCOO/BCCOO+ format are diffe the segmented reduction/sum primitive can be used rather 3.2 A that Customized are used Matrix-based in typical segmented Segmented s XXXX:8 for SpMV than the segmented scan primitive. for Y. SpMV Zhang 7. Although et al. With a sparse matrix stored in our BCCOO/BCCOO+ the start flags can be de Per-thread we choose and to per-workgroup use the bit flags working since s format, SpMV can be implemented in three logical steps: (1) In our segmented sum/scan approach for SpM read the Input data value 3 2 arrays 2 1 and 4 2multiply them 1 with 3 1 the tell whether a segment ends from t non-zero blocks as well as the corresponding b corresponding vector values indexed by the Col_index array; flags were used, one needs to search Bit Flag and the column index array are divid (2) perform a segmented scan using the bit flag array from amongworkgroups. the end of the The current working segment. set of each It w our Start BCCOO/BCCOO+ Flag 1 format; 1 (3) 1 write 1 back the results to referred when to as the a workgroup-level non-zeros in tile, a row which span in global Result memory. 3 In 5 our 5 7 proposed scheme, all 4 these 5 8 9] three divided level evenly or workgroup-level among the threads tiles. within the steps are implemented in a single kernel so as to minimize The working Figure 7. An inclusive segmented scan with the start flags set Computing of a thread per-thread is referred and to as pe a the kernel invocation overhead. Fig. 8. An inclusive segmentedgenerated scan with from the start the flags bit flag generated array in from Figure the bit 6(a). flag array tile, inas Figure shown sums 7(b). in Figure 8. The benefits of us 3.1 Segmented Scans thread to process multiple consecutive non-zero Two main approaches The segmented have been scan proposed primitive scans to parallelize multiple data the segments segmented 16) scan are two-folds. primitive on GPUs. OneThread level isthat a tree-based are stored tile together. approach A start [Blelloch flag array is 1989], typically which used builds to flag a binary array (e.g., tree loading a single short type of d First, a single/few load(s) Thread level tile through different processing identify the stages. first element... Theof tree-based a segment. We approach show an example suffers from sufficient the load to provide imbalance problem. Furthermore, of inclusive itsegmented requiresscan workgroup-level in Figure 7. Its start synchronization flag to the between previous approaches, which load the all the bit flag information Non zeros stages as discussed array in [Dotsenko is generated et from al. 28]. the bit-flag The array other of the is a BCCOO matrix-based information... approach for every non-zero, significantban format in Figure 6.The output of the inclusive segment scan [Dotsenko et al. 28], which is proposed to improve memory efficiency be and saved. overcome Second, each thread will perform th is the Workgroup level Result array in tile Figure Workgroup level 7. Note that for SpMV, tile the scan in a sequential manner and may use a seg the load imbalance problem. Our proposed BCCOO/BCCOO+ format suits better with complete segmented scan results are not necessary. Instead, instead of a segmented scan, which has fewer the matrix-based segmented scan and we further customize it for SpMV. the last sum of each segment is sufficient, as marked with results to keep. Also, note that the bit fl underscores in the Result array. In other words, for SpMV, 3.2. Customized Matrix-based Segmented Scan/Sum for SpMV BCCOO/BCCOO+ format are different from th the segmented reduction/sum primitive can be used rather that are used in typical segmented scans as show Per-thread andthan per-workgroup the segmented working scan primitive. sets. In our segmented sum/scan 7. Although approach the start flags can be derived from for SpMV, the non-zero blocks, the bit flag array, and the column indexwe array choose are to use di-thvided evenly among workgroups. The working set of each workgroup is referred to as bit flags since it is straig Input tell whether a segment ends from the bit flags a workgroup-level tile, which in turn will be divided evenly among theflags threads were used, within the workgroup. The working set of a thread is referred to as a thread-level the end of tile, the current as segment. It would be m one needs to search for the next Bit Flag shown in Figure 9. For Start a thread-level Flag 1 tile, 1 a1single/few 1 load(s) from thewhen bit flag the non-zeros array in a row span across mul (such as loading a single Result short 3 type of8 data) will 9 2 be 4 4 sufficient 5 8 9] to provide level all or workgroup-level the bit tiles. flag information. Compared Figure 7. with An inclusive the previous segmented approaches, scan with the start which flags load the row Computing indexper-thread and per-workgrou information for every non-zero, generated significant from the bit bandwidth flag array in Figure will be 6(a). saved. sums Thread level tile Workgroup level tile Thread level tile... Non zeros Workgroup level tile... Fig. 9. Even workload distribution: each workgroup/thread block works on a workgroup-level tile; each thread works on a thread-level tile of non-zero blocks. Since a thread-level tile may contain row stops, each thread will write its last partial sum into a temporary array, called last partial sums. Then, a parallel segmented scan [Sengupta et al. 27] will be performed on this last partial sums array. The start flags of the last partial sums array are generated by each thread. We further perform a quick check to see whether we can skip the parallel segmented scan operation at the workgroup level. It is the case when each thread in a workgroup encounters a row stop, which results in the segment size being 1 for the parallel segmented scan. When the non-zeros in a row span multiple workgroups/thread blocks, we leverage the recently proposed adjacent synchronization [Yan et al. 213] for inter-workgroup communication, which eliminates global synchronization Computing the partial sums and the final results. We design three strategies to compute the intra-workgroup partial sums and get the final results. The first and the second strategies are designed for GPUs, and the third one is proposed especially for Inte MIC.

9 R8 + R6 R5 R4 + R2 + R3 R1 + R2 + R1 R R14 + R R14 R13 2 R11 R9 R6 R2 + R3 + R2 R1 R + R1 + R2 + R3 A Cross-Platform SpMV Framework on Many-Core Architectures XXXX:9 R + R1 + R2 + R3 R1 + R11 Strategy (1): In the first strategy, each thread has an array, called R1 + R11 intermediate sums, to keep all the intermediate sums of its thread-level tile. This intermediate last_partial_sums sums array array can be stored R4 in shared memory (also called local memory last_partial_sums array in OpenCL), registers, or split between R5 + R6 shared memory and registers. This strategy works well if most rows in a sparse matrix have very few non-zeros. For the matrix C R8 + R9 in Figure 7(a), the computation of the intra-workgroup partial sums is illustrated in R12 Figure 1, in which we assume + R13 that + R14 each + R15 thread-level write back to tile contains 4 non-zero blocks and there are 4 threads in a workgroup.... Eachglobal thread memory performs a sequential segmented scan, and stores the results in its intermediate sums array. Each thread uses the last partial sum to update the corresponding entry of the last partial sums array, which locates in the shared memory and can be accessed by all the threads in a workgroup. If the last element of a thread-level tile is a row stop, the last partial sum of this thread is, as shown by thread 3 in Figure 1. R12 + R thread [y [] y [2] y [4] y [6] ] thread 1 [y [7] y [3] y [6] y [1] ] thread 2 [y [3] y [5] y [1] y [2] ] thread 3 [y [3] y [5] y [6] y [7] ] [A' B' C' D'] [E' F' G' H'] [I' J' K' L'] [M' N' O' P'] [R R 1 R 2 R 3 ] [ ] serial scan [R 4 R 5 R 6 R 7 ] [ 1 1 ] serial scan [R 8 R 9 R 1 R 11 ] [ ] serial scan [R 12 R 13 R 14 R 15 ] [ ] serial scan R12 + R13 + R14 + R15 R12 + R13 + R14 R12 + R13 R12 R1 + R11 R1 R8 + R9 R8 R5 + R6 R5 R4 R + R1 + R2 + R3 R + R1 + R2 R + R1 R intermediate_sums intermediate_sums R + R1 + R2 + R3 R1 + R11 last_partial_sums array Fig. 1. Computing segmented scans: strategy (1), which uses per-thread buffers, namely, the intermediate sums arrays to store the intermediate sum results. Memory coalescing [Ueng et al. 28] is the key factor to achieve high bandwidth when accessing the data value array. We view the data value array as a 2-dimension array with the width as the thread-level tile size. Then, with a transpose operation, the threads in a warp will access the data in a row-by-row manner, thereby satisfying the memory coalescing requirement. We do the same thing to the Col index array. The transpose operation can be done either online or offline. With online approach, the threads in a warp read one tile at a time in a coalesced manner and multiply with the corresponding vector elements, then store the results in a shared memory buffer still in the row-based manner. Later on, when performing the segmented scan, the threads read the buffer in a column-based manner. If non-zeros in a row are close to each other, online transpose may achieve better performance due to the improved

10 XXXX:1 Y. Zhang et al. locality for the multiplied vector. We use online transpose for our first strategy. For offline transpose, the 2-dimension data value array is previously transposed during the format generation phase. Different from online transpose, offline transpose does not require a shared memory buffer for transposition. We will use offline transpose in strategy (2). ALGORITHM 1: Combining the partial sums for strategy (1) Input: res addr: the first result location of the thread. i: the local thread id. pre partial sum: the last partial sum of the previous workgroups. bit flag: the bit flag for the thread working set. work size: the thread working set size. Output: results[ ]: the final results after combining the partial sums. 1 float tmp =.; 2 for int n = ; n < work size; n++ do 3 if Is the n-th bit of bit flag a row stop? then 4 if Is the first row stop in the current thread? then 5 if Is the first row stop in the current workgroup? then 6 tmp = intermediat sums[n] + last partial sums[i 1] + pre partial sum; 7 else 8 tmp = intermediat sums[n] + last partial sums[i 1]; 9 1 else 11 tmp = intermediat sums[n]; 12 results[res addr++] = tmp; 13 Next, we need to combine the results in the per-thread intermediate sums arrays, the results in the per-workgroup last partial sums array, and also the results from other workgroups to generate the final output of SpMV. ALGORITHM 1 illustrates how to generate the final output for strategy (1). Each thread will go through its intermediate sums array. For each element, it checks whether the corresponding bit flag is a row stop (line 3). If not, it means the corresponding result has already been incorporated into the sum of the segment. For a row stop, a thread further checks whether it is the first stop in its thread-level tile (line 4). If not, it means the thread-level tile contains the complete segment and the corresponding result is the final result (line 11). In the example shown in Figure 1, for thread 1, the entry in its intermediate sums array containing (R5+R6) is such a case. If a row stop is the first in a thread-level tile (such as the entry containing R4 for thread 1 in Figure 1), there are two possibilities. One is that the segment spans multiple threads within a workgroup (line 7-8). Then, the last partial sums array of the workgroup will be used to retrieve the last partial sum of the previous threads. For example, the entry containing (R+R1+R2+R3) in the last partial sums array will be added to R4 of thread 1 in Figure 1. The other possibility is that the segment spans multiple threads across workgroups (line 5-6). In this case, we also need to accumulate the last partial sum results of the previous workgroups. We resort to adjacent synchronization to avoid global synchronization as discussed in Section At last, the final results is written back to global memory (line 12). Strategy (2): In our second strategy, we allocate a result cache in shared memory to only store the sum of each segment. This strategy works better for long segments and also benefits from efficient memory writes, as we can store the result cache to global memory in a coalesced way. With this strategy, the offline transpose is used to ensure coalesced memory reads from the data value array and the Col index array.

11 A Cross-Platform SpMV Framework on Many-Core Architectures XXXX:11 thread 1 y [5] y [5] ) (y [1] y [6] ) (y [2] y [7] )] )(J' T N' T )(K' T O' T )(L' T P' T )] R 9 R 13 ) (R 1 R 14 ) (R 11 R 15 )] ( 1) (1 1) (1 )] R1 R1 + R11 R12 R12 + R13 R12 + R13 + R14 R12 + R13 + R14 + R15 After performing the multiplication with vector elements, each thread carries out a segmented sum sequentially on its thread-level tile, using the bit flag array as the mask for the segments. All the segmented sums will be written to the result cache with the help of the result entry information generated along with the BCCOO format. thread thread 1 thread 2 thread 3 [y [] y [2] y [4] y [6] ] [y [7] y [3] y [6] y [1] ] [y [3] y [5] y [1] y [2] ] [y [3] y [5] y [6] y [7] ] [A' B' C' D'] [R R 1 R 2 R 3 ] [ ] serial sum R R + R1 R + R1 + R2 R + R1 + R2 + R3 [E' F' G' H'] [R 4 R 5 R 6 R 7 ] [ 1 1 ] serial sum R4 R5 R5 + R6 [R 8 R 9 R 1 R 11 ] [ ] serial sum R8 [I' J' K' L'] R8 + R9 R1 R1 + R11 [M' N' O' P'] [R 12 R 13 R 14 R 15 ] [ ] serial sum R12 R12 + R13 R12 + R13 + R14 R12 + R13 + R14 + R15 R + R1 + R2 + R3 R1 + R R15 write back to global memory last_partial_sums array R4 R5 + R6 R8 + R9 R12 + R13 + R14 + R15... result_cache Fig. 11. Computing segmented sum: strategy (2), which uses a per-workgroup result cache to store segmented sums. The dashed blocks mean that the intermediate sums are not stored. ad 1 y [6] y [1] ] G' H'] R 6 R 7 ] 1 ] rial an R5 + R6 Using the matrix C in Figure 7(a) as an example, strategy (2) is illustrated in Figure 11. We assume that each thread-level tile contains 4 non-zero blocks and there thread 2 thread are 4 3threads in a workgroup. The result entry information shown in Figure 7 is used [y [3] y [5] y [1] y [2] ] [y [3] for y [5] y updating [6] y [7] ] the result cache. For example, as shown in Figure 7, the result entry for thread 1 and thread 2 is and 2, respectively. Therefore, when thread 1 encounters [I' J' K' L'] [M' the N' O' first P'] row stop, it uses its current sum R4 to update the entry of the result cache. When thread 1 encounters the second row stop, it uses the sum R5+R6 to update the [R 8 R 9 R 1 R 11 ] [R 12 entry R 13 R 14 R1 15 of ] the result cache. In a sense, the result entry information partitions the result 1 1 cache ] among different threads in a workgroup. When the number of row stops in [ ] [ 1 serial aserial workgroup-level tile is larger than the result cache size, the extra segmented sums scan scan will be stored in the result array in global memory, which will be re-accessed later to generate the final outputs. The same as the first strategy, each thread also writes its last partial sum to the last partial sums array. To generate the start flags for the last partial sums array, in either strategy, each thread simply checks whether its bit flags contain a (namely a row R8 R8 + R9 R1 R1 + R11 R12 R12 + R13 R12 + R13 + R14 R12 + R13 + R14 + R15 intermediate_sums ay

12 XXXX:12 Y. Zhang et al. stop). If so, its last partial sum should be a start for a segment in the last partial sums array. For the examples in Figure 1 and Figure 11, the start flags are [, 1, 1, 1], since all threads except thread process a tile containing a row stop. After updating the last partial sums array, all the threads in the workgroup perform a parallel segmented scan [Sengupta et al. 27] on the last partial sums array using the start flags. In our example in Figure 1 or Figure 11, this parallel scan can be skipped since all the segment sizes are 1. ALGORITHM 2: Combining the partial sums for strategy (2) Input: res addr: the first result location of the thread. pre partial sum: the last partial sum of the previous workgroups. b res addr: the first result location of the current workgroup. cache len: the length of the result cache[ ]. cache end: the number of the cached results. workgroup size: the number of threads in a workgroup. Output: results[ ]: the final results after combining the partial sums. 1 int i = local thread id; 2 if i == then 3 result cache[] += pre partial sum; 4 5 workgroup-level-barrier(); 6 if i!= then 7 if Is there a row stop in the current thread? then 8 if res addr b res addr < cache len then 9 result cache[res addr b res addr] += last partial sums[i 1]; 1 else 11 results[res addr]+=last partial sums[i 1]; while i < cache end do 15 results[i + b res addr] = result cache[i] ; // Write back in a coalesced way. 16 i+=workgroup size; ALGORITHM 2 illustrates how to generate the final output for strategy (2). In s- trategy (2), there are no per-thread intermediate sum arrays. Instead, there is a perworkgroup result cache. For thread, it updates the entry of the result cache with the last partial sum from the previous workgroup (line 2-4). To avoid data race at the entry of the result cache, a workgroup-level synchronization is used (line 5). Each thread except thread first checks whether there are row stops in its thread-level tile (line 7). If so, it means that the thread has generated some partial sums corresponding to the row stops. Each thread only needs to process the partial sum at the first row stop (such as R4 in the result cache in Figure 11). For subsequent row stops in the thread, the partial sums in the result cache are already the complete segment sums. Next, each thread except thread adds the last partial sum from the previous thread to the partial sum at the first row stop, which is stored either in result cache (line 8-9) or in global memory (line 1-11). For example, R+R1+R2+R3 from the last partial sums array is added to R4 in the result cache in Figure 11). After the result cache is updated, it is written back to global memory in a memory-coalescing way (line 14-16). Strategy (3): Intel MIC and GPUs have different hardware architectures and different performance optimization tricks. Thus, we propose the third strategy specifically for MIC, as illustrated in Figure 12. To achieve high throughput on MIC based on OpenCL, two key points should be noticed. Firstly, the local memory in OpenCL, which

13 A Cross-Platform SpMV Framework on Many-Core Architectures XXXX:13 is usually used as a high performance shared buffer, has no corresponding hardware implementation in MIC. The data in local memory is actually put in the global memory of MIC, with extra software overhead. As illustrated in Figure 12, the intermediate sums are not stored, and therefore the local memory consumption is avoided. All the segmented sums will be written back to the global memory directly with the help of the result entry information. Besides, the last partial sums array is also stored in the global memory. thread [(y [] y [7] ) (y [2] y [3] ) (y [4] y [6] ) (y [6] y [1] )] [(A' T E' T )(B' T F' T )(C' T G' T )(D' T H' T )] [(R R 4 ) (R 1 R 5 ) (R 2 R 6 ) (R 3 R 7 )] [(1 ) (1 1) (1 ) (1 1)] R R + R1 R + R1 + R2 R + R1 + R2 + R3 R4 R5 R5 + R6 thread 1 [(y [3] y [3] ) (y [5] y [5] ) (y [1] y [6] ) (y [2] y [7] )] [(I' T M' T )(J' T N' T )(K' T O' T )(L' T P' T )] [(R 8 R 12 ) (R 9 R 13 ) (R 1 R 14 ) (R 11 R 15 )] [(1 1) ( 1) (1 1) (1 )] R8 R8 + R9 R1 R1 + R11 R12 R12 + R13 R12 + R13 + R14 R12 + R13 + R14 + R15 thread [y [] y [2] y [4] y [6] ] [A' B' C' D'] [R R 1 R 2 R 3 ] [ ] serial sum R R + R1 R + R1 + R2 R + R1 + R2 + R3 thread [y [7] y [3] y [6 [E' F' G' [R 4 R 5 R 6 [ 1 serial sum R4 R5 R5 + R6 R + R1 + R2 + R3 R1 + R11 last_partial_sums array R4 R5 + R6 R8 + R9 R + R1 + R2 + R3 R1 + R11 last_partial_sums array R12 + R13 + R14 + R15... write back to global memory Fig. 12. Computing segmented sum: strategy (3), proposed only for Intel MIC. The dashed blocks mean that the intermediate sums are not stored. Secondly, the 512-bit SIMD instruction in MIC should be fully utilized. To achieve this, besides the offline transpose for the data value array used in strategy (2), we conduct another inner-block transpose for thread thebccoo thread format. 1 Inthread Figure 2 12, A thread T means 3 the transposed block of A. After the inner-block [y [] y [2] y [4] y [6] ] transpose, [y [7] y [3] y [6] y [1] each ] [y [3] y thread [5] y [1] y [2] can ] [y [3] execute y [5] y [6] y [7] ] both the multiplication and addition operations in SpMV in a SIMD manner. The width of the SIMD instruction is decided[a' by B' C' the D'] width [E' F' ofg' each H'] block [I' J' K' (after L'] [M' transposition). N' O' P'] When the width of each block is small, the potential performance of the 512-bit SIMD instruction cannot be fully exploited. [R R However, 1 R 2 R 3 ] [R enlarging 4 R 5 R 6 R 7 ] the [R 8 R width 9 R 1 R 11 of ] [R each 12 R 13 block R 14 R 15 ] will [ ] [ 1 1 ] [ ] [ ] bring more zero elements, which reduces the sparse matrix compression efficiency. To solve this dilemma, we propose a method serial serial serial serial scan of workload scan coalescing. scan As shown scan in Figure 12, the workload of two threads in Figure 11 is coalesced to be done by one thread. Take thread in Figure 12 as an example, thread processes two non-zero blocks (i.e., A T and E T ) simultaneously, and thus the width of SIMD is doubled. The number of R R + R1 R + R1 + R2 R + R1 + R2 + R3 R1 + R11 R5 R4 intermediate_sums R + R1 + R2 + R3 R5 + R6 last_partial_sums array R8 R8 + R9 R1 R1 + R11 R12 R12 + R13 R12 + R13 + R14 R12 + R13 + R14 + R15 intermediate_sums

14 XXXX:14 Y. Zhang et al. threads, whose workload is coalesced to be done by one thread, is called bunch size in the following content. ALGORITHM 3: Combining the partial sums for strategy (3) Input: bunch size: the bunch size. i: the local thread id. res addr[ ]: the first result locations for all bunch size slices of the coalesced workload. pre partial sum: the last partial sum of the previous workgroups. Output: results[ ]: the final results after combining the partial sums. 1 int i = local thread id; 2 if i == then 3 results[res addr[]] += pre partial sum; 4 5 workgroup-level-barrier(); 6 if i!= then 7 if Is there a row stop in the -th slice of the coalesced workload? then 8 results[res addr[]] += last partial sums[i 1][bunch size 1]; 9 1 for int n = 1; n < bunch size; n++ do 11 if Is there a row stop in the n-th slice of the coalesced workload? then 12 results[res addr[n]] += last partial sums[i][n 1]; 13 ALGORITHM 3 illustrates how to generate the final output for strategy (3). In strategy (3), the intermediate results are written back to the global memory directly without being cached. Recall that there are total bunch size slices of workload coalesced to be done by one thread. For thread, it updates the entry of the result cache with the last partial sum from the previous workgroup (line 2-4). Each thread except thread first checks whether there are row stops in its -th slice of the coalesced workload. If so, the thread accumulates the last patrial sum (the partial sum of the (bunch size-1)-th slice workload of the last thread) to the corresponding result entry in global memory (line 7-8). For example, R+R1+R2+R3 from the last partial sums array is added to R4 in the global memory in Figure 12. Then, the current thread checks whether there are row stops in the n-th slice workload of its own, where n [1, bunch size 1]. If so, the current thread accumulates the partial sum of the (n-1)-th slice to the first result location of the n-th slice (line 11-12) Accumulating partial sums across workgroups. As discussed in Section 3.2.2, for segments spanning multiple workgroups, the partial sums should be accumulated across the workgroups. The last workgroup, which contains the row stop, needs to accumulate the partial sums of previous workgroups. Here, we make an implicit assumption that the workgroup-level tiles are distributed to workgroups in order. In other words, workgroup processes the first tile; workgroup 1 processes the second tile; etc. The current GPUs dispatch workgroups in order. Therefore, we can directly use the workgroup ids in the kernel. If a GPU dispatches workgroups out of order, workgroups can get such logic workgroup ids from global memory using atomic fetch-and-add operations. This approach incurs small performance overhead, less than 2% in our experiments. We use a global memory array Grp sum to accumulate partial sums across workgroups. We use another initialized Sync f lag array, whose elements have one-to-one correspondence to Grp sum elements, for synchronization. Workgroup updates the first entry Grp sum[] with its last partial sum, and then updates the corresponding element in the Sync flag array. For a subsequent workgroup with id X, if it does not contain a row stop, it waits for the entry Sync flag[x-1] to be updated by workgroup (X-1), and

15 A Cross-Platform SpMV Framework on Many-Core Architectures XXXX:15 then updates Grp sum[x] with the sum of its last partial sum and Grp sum[x-1]. If a workgroup contains a row stop, it breaks these chained updates and directly updates Grp sum[x] with its last partial sum. This approach is called adjacent synchronization [Yan et al. 213]. However, to use the approach of adjacent synchronization on some platforms (such as AMD GPUs) with cache enabled by default, atomic primitives have to be used to guarantee that each workgroup can access the latest values of Sync f lag[x-1] and Grp sum[x-1] once being updated by the previous workgroup. For single precision, we use the atomic primitive atomic xchg. However, there is no corresponding atomic primitives which directly support double precision. By enabling cl khr int64 base atomics, we can use the 64-bit atomic primitive atom xchg which only supports the types of long and ulong. Using the function as ulong(), we treat the values and variables of double type as ulong type, which can then be used in atom xchg. So far, we can use the atomic primitive on double-precision variables and values for adjacent synchronization without losing precision. 4. AUTO-TUNING FRAMEWORK As discussed in Sections 2 and 3, we propose BCCOO and BCCOO+ formats for sparse matrices, and three new strategies to compute segmented sums/scans for SpMV. To find the optimal solution for a sparse matrix, we build an offline auto-tuning framework to select the format, the computing strategy, and their associated parameters. Then, the OpenCL code is generated according to the selected parameters from this auto-tuning framework. We also use this framework to exploit the texture cache for the multiplied vector in single precision on GPUs. Another optimization is that we use the unsigned short data type for the col index array if the width of a sparse matrix is less than In this case, there is no need to further compress the col index array using the approach discussed in Section 2.2. The parameters that this framework explores for GPUs and MIC are listed in Table I and Table II respectively. Note that when strategy (1) is used to compute the segmented scan, the thread-level tile size is the size of the immediate sums array, which is the sum of the parameters, Reg size and ShM size. Besides, the strategy (3), which is proposed specifically for Intel MIC, includes bunch size as a tuning parameter. As shown in Table I and Table II, there are many parameters to tune, which form a relatively large search space. Although the framework mainly aims at iterative SpMV, we try to minimize the overhead of offline auto-tuning using the following optimizations. First, we use GPUs to accelerate the translation from the COO format to the BCCOO/BCCOO+ format. Second, we cache compiled kernels in a hash table so that they can reused for different matrices. Third, we prune the search space using the follow heuristics: (1) Since the memory footprint is highly dependent on block dimensions, we only select the block dimensions with the top 4 minimum memory footprints; (2) We always use the texture memory for the multiplied vector in single precision, and always use offline transpose; (3) We reduce the searching range of the result cache size for the second strategy; (4) We set the shared memory size as for the per-thread intermediate sums array for the first strategy; (5) We use the BCCOO+ format only when the width of the sparse matrix is larger than the height; (6) We reduce the searching range of the thread-level tile size according to the dimensions of the sparse matrix. With these optimizations, our auto-tuning framework only runs 28 iterations of SpMV on average for the 2 sparse matrices in our study (shown in Table III). The average auto-tuning time is 3.6 seconds on average for the 2 sparse matrices on a machine with an Intel(R) Xeon(R) 2.2GHz (only one core is used) and an NVIDIA GTX68 GPU. Compared with the optimal results obtained from an exhaustive search of the parameters listed in Table I, our auto-tuning results are identical to the optimal

16 in the kernel. If a GPU dispatches Vertical slice number 1, 2, 4, 8, 16, 32 Transpose Offline, online r, workgroups can get such logic Texture memory for multiplied vector Yes, No bal memory using atomic fetch-andpproach incurs small performance Strategy Registers for the per-thread, 8, 16, 32 Workgroup size 64, 128, 256, 512 in our experiments. To accumulate 1 intermediate sums array rkgroups, way by we all use threads a global together XXXX:16 memory (Reg_size) in a Shared memory for the perthread intermediate parameters sums of the array auto-tuning framework., 8, 16, 32 Y. Zhang et al. rray is initialized to a special value Table 1.Tunable point rtial sums number). across This workgroups array is updated Table I. Tunable (ShM_size) parameters of the auto-tuning framework on GPUs on 3.2.3, for segments spanning Strategy Thread-level tile size 8,16,24,32,4,64,96,128 Workgroup updates the first entry Parameter 2 Name Result cache size (multiple of Possible 1,2,3,4 Values he last last partial workgroup, sum. For which a subsequent contains Matrix format the workgroup size) BCCOO, BCCOO+ f accumulate it does not contain previous a workgroups row stop, it Col_index compress Yes, No _sum[x-1] ake an implicit to be assumption changed from that the Block width 1, 2, 4 e ted distributed by workgroup to workgroups (X-1), and in-order. then Block height 1, 2, 3, 4 Data type for the bit flag array Unsigned char, unsigned with group the sum processes of its last the partial first sum tile; short, unsigned int the a workgroup second tile; contains etc. Current a row stop, GPUs it Vertical slice number 1, 2, 4, 8, 16, 32 -order. updates Therefore, and directly we can directly updates Transpose Offline, online in last the partial kernel. sum. If a This GPU approach dispatches Texture memory for multiplied vector Yes, No r, ization workgroups in[24]. can get such logic Workgroup size 64, 128, 256, 512 bal memory using atomic fetch-andpproach Strategy Registers for the per-thread, 8, 16, 32 amework 1 intermediate sums array incurs small performance (Reg_size) s in 2 our and experiments. 3, we propose To a new accumulate format Shared memory for the perthread intermediate sums array, 8, 16, 32 t rkgroups, BCCOO+ we for use sparse a global matrices, memory and computesegmented rray is initialized to sums/scans a special value for (ShM_size) mal Strategy Thread-level tile size 8,16,24,32,4,64,96,128 oint solution number). for This a sparse array matrix, is updated we amework to select the format, the 2 Result cache size (multiple of 1,2,3,4 Workgroup updates the first entry Table 2.Tunable the workgroup parameters size) of the auto-tuning framework for well as their associated parameters. last partial sum. For a subsequent MIC. de is generated according to the Table II. Tunable parameters of the auto-tuning framework on MIC f m it this does auto-tuning not contain framework.we a row stop, it Table 2.Tunable parameters of the auto-tuning framework for _sum[x-1] to be changed from Parameter Name Possible Values to exploit the texture cache for the MIC. ted by workgroup (X-1), and then Matrix format BCCOO her optimization is that we use Col_index compress Yes, No with ype for the sum the col_index of its last array partial if sum the Parameter Block width Name Possible 1, 2, 4 Values ix a workgroup is less than contains a In row this stop, case, it Matrix Block height format BCCOO 1, 2, 4 rther updates compress and the directly col_index updates array Col_index Data type for compress the bit flag array Yes, Unsigned No char, unsigned ussed last partial in Section sum This The approach parameters is Block width 1, short, 2, 4 unsigned int ization in[24]. Block Workgroup height size 1,2,4,8,16,32 lores are listed in Table 1. Note that 4 Data Thread-level type for tile the size bit flag array Unsigned 32~124 char, unsigned amework to compute the segmented scan, the Bunch size short, 1,2,4 unsigned int s 2 and 3, we propose a new format Workgroup size 1,2,4,8,16,32 BCCOO+ for sparse matrices, ones onand NVIDIAThread-level GTX68 and tile size AMD W8 GPUs. 32~124 On NVIDIA GTX48, however, the Threads bunch size 1,2,4 computesegmented sums/scans optimalfor configurations show 1.5% better performance for the matrix Epidemiology, mal solution for a sparse which matrix, prefers we no texture memory usage, and 11.1% better performance for the matrix Circuit, which prefers online transpose. As we can expect, a finer grain parameter amework to select the format, the selection may As further shown improve in Table the1, performance. there are many In parameters addition, we to find tune, that block width, well as their associated parameters. block height, thread-level which form tile a size, relatively and bunch large size search arespace the parameters for a sparse that top affect the de is generated according performance to the among matrix all on the a parameters. particular hardware platform. In order to m this auto-tuning framework.we accelerate auto-tuning, we perform the following to exploit the texture cache 5. EXPERIMENTAL for the optimizations. METHODOLOGY First, we use GPUs to accelerate the her optimization is that we Ouruse experiments the translation have been from performed the COO format on sixto different the BCCOO/BCCOO+ platforms - Nvidia GTX68, ype for the col_index array Nvidia if the GTX48 format.second, GPU, Tesla we K2, cache GeForce compiled Titan kernelsin X, AMD a hash FirePro table so W8 and Intel ix is less than In MIC this SE1P. case, We that use they a total can reused of 2 sparse for difference matrices matrices. for performance Third, we prune evaluation. Table III rther compress the col_index summarizes array the information of the sparse matrices. These matrices have been widely the search space using the follow heuristics: since the ssed in Section 2.2. The parameters used in previous works [Bell and Garland 29], [Choi et al. 21], [Monakov et al. memory footprint is highly dependent on block dimensions, lores are listed in Table 1. 21], Note that [Su and Keutzer 212], [Liu and Vinter 215], [Williams et al. 29]. All matrices except Dense we are only downloadable need to select at the the block University dimensions of Florida corresponding Sparse Matrix Collection [Davis andto Hu the 211]. 4smallest In our memory experiments, footprints. we also Fourth, use CUSPARSE we further V7. [NVIDIA to compute the segmented scan, the he size of the immediate_sums 214], array, CUSP [Bell reduce andthe Garland search 29], space clspmv by: always [Su and using Keutzer the texture 212], and CSR5 [Liu and Vinter 215] memory for performance the multiplied comparisons. vector, always CUSPARSE using supports offline three formats parameters,reg_size and ShM_size. transpose, limiting the result cache size to 1 and 2 for ACM Transactions strategy on Architecture 2, and and setting Code Optimization, the shared Vol. memory x, No. x, Article size as XXXX, for Publication the date: August 216. per-thread intermediate sums array for strategy 1. With these optimizations, the average auto-tuning time is 12.8 seconds among the 2 matrices in our study, running on a desktop machine with an Intel(R) Core2 Quad CPU 3.GHzand an NVIDIA GTX68 GPU. Compared to the optimal results obtained from an exhaustive search of

17 A Cross-Platform SpMV Framework on Many-Core Architectures XXXX:17 Table III. The sparse matrices used in the experiments Spyplot Name Size Non-zeros (NNZ) NNZ/Row Dense 2K * 2K 4 2 Protein 36K * 36K FEM/Spheres 83K * 83K FEM/Cantilever 62K * 62K Wind Tunnel 218K*218K FEM/Harbor 47K * 47K QCD 49K * 49K FEM/Ship 141K*141K Economics 27K*27K Epidemiology 526K*526K FEM/Accelerator 121K*121K Circuit 171K*171K Webbase 1M * 1M LP 4K * 1.1M Circuit5M 5.56M* 5.56M eu K*863K Ga41As41H72 268K*268K in M*1.38M mip1 66K* 66K Si41Ge41H72 186K*186K HYB, BCSR, and CSR. We manually searched the best performing configuration for each matrix. For the BCSR format in CUSPARSE, we also searched the block size for the best performance. For clspmv, besides the COCKTAIL format which uses different formats for different partitions of a matrix, we also tested all the single formats and chose the best performing one for each matrix. Since the CUDA code is not supported on AMD platforms, we only compared our scheme with clspmv on AMD FirePro W8. On Intel MIC, we compared our scheme with CSR5 [Liu and Vinter 215]. The code of our proposed framework is available at 6. EXPERIMENTAL RESULTS 6.1. Memory footprint size comparison between different formats We evaluate the impact of our proposed BCCOO/BCCOO+ format on memory bandwidth. In BCCOO/BCCOO+ format, all the information, including the bit flag array, the col index array, the data value array, and the auxiliary information described in Section 2.4, is only read once. We assume that it is also the case for all the other formats for comparison. Therefore, we can simply use the total size the arrays to show the memory footprint of each format. The results are shown in Table IV. As our autotuning framework selects the BCCOO+ format only for the matrix LP, we do not separate the BCCOO and the BCCOO+ format. For some sparse matrices, due to the high variance in the number of non-zeros in different row, the ELL format is not applicable (labeled N/A in Table IV). From Table IV, we find that BCCOO/BCCOO+ format significantly reduces the storage size of various sparse matrices. BCCOO/BCCOO+ format reduces the storage size by 4% on average compared with the COO format, 31% on average compared with the best single format among all the 9 formats in clspmv, and 21% on average compared with the COCKTAIL format Performance on NVIDIA and AMD GPUs We first examine the performance contributions from different optimizations in our approach, including memory footprint reduction, efficient segmented sum/scan, adjacent synchronization to remove global synchronization, and fine-grain optimizations, 5. Experimental Methodology We implemented our proposed scheme in OpenCL[19]. Our experiments have been performed on both an Nv GPU and an Nvidia GTX48 GPU. We use a total of 2 sparse matrices, 14 of them are from [23] and 6 of them are from[16]. Table 2 sum information of the sparse matrices, including the size, total number of non-zeros, and number of non-zerospe matrices have been widely used in previous works [1][7][12][16][23]. In our experiments, we also use CUSPARSE V5.[13], CUSP[1], and clspmv [16] for performance comparisons. CUSPARSE supports three formats HYB, BCSR, and CSR. As the HYB format is a hybrid format combining the advantages of the ELL and COO formats, the row length of the ELL part is configurable. We manually sear length in a wide range and use the best perfor each matrix. For the BCSR format in CUSPA searched the block size for the best perfo clspmv, besides the COCKTAIL format,

A Cross-Platform SpMV Framework on Many-Core Architectures

A Cross-Platform SpMV Framework on Many-Core Architectures A Cross-Platform SpMV Framework on Many-Core Architectures YUNQUAN ZHANG and SHIGANG LI, State Key Laboratory of Computer Architecture, Institute of Computing Technologies, Chinese Academy of Sciences

More information

Administrative Issues. L11: Sparse Linear Algebra on GPUs. Triangular Solve (STRSM) A Few Details 2/25/11. Next assignment, triangular solve

Administrative Issues. L11: Sparse Linear Algebra on GPUs. Triangular Solve (STRSM) A Few Details 2/25/11. Next assignment, triangular solve Administrative Issues L11: Sparse Linear Algebra on GPUs Next assignment, triangular solve Due 5PM, Tuesday, March 15 handin cs6963 lab 3 Project proposals Due 5PM, Wednesday, March 7 (hard

More information

Exploiting GPU Caches in Sparse Matrix Vector Multiplication. Yusuke Nagasaka Tokyo Institute of Technology

Exploiting GPU Caches in Sparse Matrix Vector Multiplication. Yusuke Nagasaka Tokyo Institute of Technology Exploiting GPU Caches in Sparse Matrix Vector Multiplication Yusuke Nagasaka Tokyo Institute of Technology Sparse Matrix Generated by FEM, being as the graph data Often require solving sparse linear equation

More information

EFFICIENT SPARSE MATRIX-VECTOR MULTIPLICATION ON GPUS USING THE CSR STORAGE FORMAT

EFFICIENT SPARSE MATRIX-VECTOR MULTIPLICATION ON GPUS USING THE CSR STORAGE FORMAT EFFICIENT SPARSE MATRIX-VECTOR MULTIPLICATION ON GPUS USING THE CSR STORAGE FORMAT JOSEPH L. GREATHOUSE, MAYANK DAGA AMD RESEARCH 11/20/2014 THIS TALK IN ONE SLIDE Demonstrate how to save space and time

More information

Generating and Automatically Tuning OpenCL Code for Sparse Linear Algebra

Generating and Automatically Tuning OpenCL Code for Sparse Linear Algebra Generating and Automatically Tuning OpenCL Code for Sparse Linear Algebra Dominik Grewe Anton Lokhmotov Media Processing Division ARM School of Informatics University of Edinburgh December 13, 2010 Introduction

More information

Automatically Generating and Tuning GPU Code for Sparse Matrix-Vector Multiplication from a High-Level Representation

Automatically Generating and Tuning GPU Code for Sparse Matrix-Vector Multiplication from a High-Level Representation Automatically Generating and Tuning GPU Code for Sparse Matrix-Vector Multiplication from a High-Level Representation Dominik Grewe Institute for Computing Systems Architecture School of Informatics University

More information

Optimization solutions for the segmented sum algorithmic function

Optimization solutions for the segmented sum algorithmic function Optimization solutions for the segmented sum algorithmic function ALEXANDRU PÎRJAN Department of Informatics, Statistics and Mathematics Romanian-American University 1B, Expozitiei Blvd., district 1, code

More information

Scalable GPU Graph Traversal!

Scalable GPU Graph Traversal! Scalable GPU Graph Traversal Duane Merrill, Michael Garland, and Andrew Grimshaw PPoPP '12 Proceedings of the 17th ACM SIGPLAN symposium on Principles and Practice of Parallel Programming Benwen Zhang

More information

ad-heap: an Efficient Heap Data Structure for Asymmetric Multicore Processors

ad-heap: an Efficient Heap Data Structure for Asymmetric Multicore Processors ad-heap: an Efficient Heap Data Structure for Asymmetric Multicore Processors Weifeng Liu and Brian Vinter Niels Bohr Institute University of Copenhagen Denmark {weifeng, vinter}@nbi.dk March 1, 2014 Weifeng

More information

CSE 599 I Accelerated Computing - Programming GPUS. Parallel Pattern: Sparse Matrices

CSE 599 I Accelerated Computing - Programming GPUS. Parallel Pattern: Sparse Matrices CSE 599 I Accelerated Computing - Programming GPUS Parallel Pattern: Sparse Matrices Objective Learn about various sparse matrix representations Consider how input data affects run-time performance of

More information

Code Optimizations for High Performance GPU Computing

Code Optimizations for High Performance GPU Computing Code Optimizations for High Performance GPU Computing Yi Yang and Huiyang Zhou Department of Electrical and Computer Engineering North Carolina State University 1 Question to answer Given a task to accelerate

More information

Lecture 13: March 25

Lecture 13: March 25 CISC 879 Software Support for Multicore Architectures Spring 2007 Lecture 13: March 25 Lecturer: John Cavazos Scribe: Ying Yu 13.1. Bryan Youse-Optimization of Sparse Matrix-Vector Multiplication on Emerging

More information

CUB. collective software primitives. Duane Merrill. NVIDIA Research

CUB. collective software primitives. Duane Merrill. NVIDIA Research CUB collective software primitives Duane Merrill NVIDIA Research What is CUB?. A design model for collective primitives How to make reusable SIMT software constructs. A library of collective primitives

More information

State of Art and Project Proposals Intensive Computation

State of Art and Project Proposals Intensive Computation State of Art and Project Proposals Intensive Computation Annalisa Massini - 2015/2016 Today s lecture Project proposals on the following topics: Sparse Matrix- Vector Multiplication Tridiagonal Solvers

More information

Profiling-Based L1 Data Cache Bypassing to Improve GPU Performance and Energy Efficiency

Profiling-Based L1 Data Cache Bypassing to Improve GPU Performance and Energy Efficiency Profiling-Based L1 Data Cache Bypassing to Improve GPU Performance and Energy Efficiency Yijie Huangfu and Wei Zhang Department of Electrical and Computer Engineering Virginia Commonwealth University {huangfuy2,wzhang4}@vcu.edu

More information

Applications of Berkeley s Dwarfs on Nvidia GPUs

Applications of Berkeley s Dwarfs on Nvidia GPUs Applications of Berkeley s Dwarfs on Nvidia GPUs Seminar: Topics in High-Performance and Scientific Computing Team N2: Yang Zhang, Haiqing Wang 05.02.2015 Overview CUDA The Dwarfs Dynamic Programming Sparse

More information

Sparse Matrix-Vector Multiplication with Wide SIMD Units: Performance Models and a Unified Storage Format

Sparse Matrix-Vector Multiplication with Wide SIMD Units: Performance Models and a Unified Storage Format ERLANGEN REGIONAL COMPUTING CENTER Sparse Matrix-Vector Multiplication with Wide SIMD Units: Performance Models and a Unified Storage Format Moritz Kreutzer, Georg Hager, Gerhard Wellein SIAM PP14 MS53

More information

Fluidic Kernels: Cooperative Execution of OpenCL Programs on Multiple Heterogeneous Devices

Fluidic Kernels: Cooperative Execution of OpenCL Programs on Multiple Heterogeneous Devices Fluidic Kernels: Cooperative Execution of OpenCL Programs on Multiple Heterogeneous Devices Prasanna Pandit Supercomputer Education and Research Centre, Indian Institute of Science, Bangalore, India prasanna@hpc.serc.iisc.ernet.in

More information

A Matrix--Matrix Multiplication methodology for single/multi-core architectures using SIMD

A Matrix--Matrix Multiplication methodology for single/multi-core architectures using SIMD A Matrix--Matrix Multiplication methodology for single/multi-core architectures using SIMD KELEFOURAS, Vasileios , KRITIKAKOU, Angeliki and GOUTIS, Costas Available

More information

Towards a Performance- Portable FFT Library for Heterogeneous Computing

Towards a Performance- Portable FFT Library for Heterogeneous Computing Towards a Performance- Portable FFT Library for Heterogeneous Computing Carlo C. del Mundo*, Wu- chun Feng* *Dept. of ECE, Dept. of CS Virginia Tech Slides Updated: 5/19/2014 Forecast (Problem) AMD Radeon

More information

NVIDIA GTX200: TeraFLOPS Visual Computing. August 26, 2008 John Tynefield

NVIDIA GTX200: TeraFLOPS Visual Computing. August 26, 2008 John Tynefield NVIDIA GTX200: TeraFLOPS Visual Computing August 26, 2008 John Tynefield 2 Outline Execution Model Architecture Demo 3 Execution Model 4 Software Architecture Applications DX10 OpenGL OpenCL CUDA C Host

More information

Data Partitioning on Heterogeneous Multicore and Multi-GPU systems Using Functional Performance Models of Data-Parallel Applictions

Data Partitioning on Heterogeneous Multicore and Multi-GPU systems Using Functional Performance Models of Data-Parallel Applictions Data Partitioning on Heterogeneous Multicore and Multi-GPU systems Using Functional Performance Models of Data-Parallel Applictions Ziming Zhong Vladimir Rychkov Alexey Lastovetsky Heterogeneous Computing

More information

A Unified Optimizing Compiler Framework for Different GPGPU Architectures

A Unified Optimizing Compiler Framework for Different GPGPU Architectures A Unified Optimizing Compiler Framework for Different GPGPU Architectures YI YANG and PING XIANG, North Carolina State University JINGFEI KONG and MIKE MANTOR, Advanced Micro Devices HUIYANG ZHOU, North

More information

A Unified Optimizing Compiler Framework for Different GPGPU Architectures

A Unified Optimizing Compiler Framework for Different GPGPU Architectures A Unified Optimizing Compiler Framework for Different GPGPU Architectures YI YANG, North Carolina State University PING XIANG, North Carolina State University JINGFEI KONG, Advanced Micro Devices MIKE

More information

Warps and Reduction Algorithms

Warps and Reduction Algorithms Warps and Reduction Algorithms 1 more on Thread Execution block partitioning into warps single-instruction, multiple-thread, and divergence 2 Parallel Reduction Algorithms computing the sum or the maximum

More information

Addressing the Memory Wall

Addressing the Memory Wall Lecture 26: Addressing the Memory Wall Parallel Computer Architecture and Programming CMU 15-418/15-618, Spring 2015 Tunes Cage the Elephant Back Against the Wall (Cage the Elephant) This song is for the

More information

Data parallel algorithms, algorithmic building blocks, precision vs. accuracy

Data parallel algorithms, algorithmic building blocks, precision vs. accuracy Data parallel algorithms, algorithmic building blocks, precision vs. accuracy Robert Strzodka Architecture of Computing Systems GPGPU and CUDA Tutorials Dresden, Germany, February 25 2008 2 Overview Parallel

More information

Flexible Batched Sparse Matrix-Vector Product on GPUs

Flexible Batched Sparse Matrix-Vector Product on GPUs ScalA'17: 8th Workshop on Latest Advances in Scalable Algorithms for Large-Scale Systems November 13, 217 Flexible Batched Sparse Matrix-Vector Product on GPUs Hartwig Anzt, Gary Collins, Jack Dongarra,

More information

High Performance Computing on GPUs using NVIDIA CUDA

High Performance Computing on GPUs using NVIDIA CUDA High Performance Computing on GPUs using NVIDIA CUDA Slides include some material from GPGPU tutorial at SIGGRAPH2007: http://www.gpgpu.org/s2007 1 Outline Motivation Stream programming Simplified HW and

More information

General Purpose GPU Programming. Advanced Operating Systems Tutorial 9

General Purpose GPU Programming. Advanced Operating Systems Tutorial 9 General Purpose GPU Programming Advanced Operating Systems Tutorial 9 Tutorial Outline Review of lectured material Key points Discussion OpenCL Future directions 2 Review of Lectured Material Heterogeneous

More information

Parallel Variable-Length Encoding on GPGPUs

Parallel Variable-Length Encoding on GPGPUs Parallel Variable-Length Encoding on GPGPUs Ana Balevic University of Stuttgart ana.balevic@gmail.com Abstract. Variable-Length Encoding (VLE) is a process of reducing input data size by replacing fixed-length

More information

Performance Models for Evaluation and Automatic Tuning of Symmetric Sparse Matrix-Vector Multiply

Performance Models for Evaluation and Automatic Tuning of Symmetric Sparse Matrix-Vector Multiply Performance Models for Evaluation and Automatic Tuning of Symmetric Sparse Matrix-Vector Multiply University of California, Berkeley Berkeley Benchmarking and Optimization Group (BeBOP) http://bebop.cs.berkeley.edu

More information

Locality-Aware Software Throttling for Sparse Matrix Operation on GPUs

Locality-Aware Software Throttling for Sparse Matrix Operation on GPUs Locality-Aware Software Throttling for Sparse Matrix Operation on GPUs Yanhao Chen 1, Ari B. Hayes 1, Chi Zhang 2, Timothy Salmon 1, Eddy Z. Zhang 1 1. Rutgers University 2. University of Pittsburgh Sparse

More information

A PERFORMANCE COMPARISON OF SORT AND SCAN LIBRARIES FOR GPUS

A PERFORMANCE COMPARISON OF SORT AND SCAN LIBRARIES FOR GPUS October 9, 215 9:46 WSPC/INSTRUCTION FILE ssbench Parallel Processing Letters c World Scientific Publishing Company A PERFORMANCE COMPARISON OF SORT AND SCAN LIBRARIES FOR GPUS BRUCE MERRY SKA South Africa,

More information

A Translation Framework for Automatic Translation of Annotated LLVM IR into OpenCL Kernel Function

A Translation Framework for Automatic Translation of Annotated LLVM IR into OpenCL Kernel Function A Translation Framework for Automatic Translation of Annotated LLVM IR into OpenCL Kernel Function Chen-Ting Chang, Yu-Sheng Chen, I-Wei Wu, and Jyh-Jiun Shann Dept. of Computer Science, National Chiao

More information

TUNING CUDA APPLICATIONS FOR MAXWELL

TUNING CUDA APPLICATIONS FOR MAXWELL TUNING CUDA APPLICATIONS FOR MAXWELL DA-07173-001_v7.0 March 2015 Application Note TABLE OF CONTENTS Chapter 1. Maxwell Tuning Guide... 1 1.1. NVIDIA Maxwell Compute Architecture... 1 1.2. CUDA Best Practices...2

More information

Fast BVH Construction on GPUs

Fast BVH Construction on GPUs Fast BVH Construction on GPUs Published in EUROGRAGHICS, (2009) C. Lauterbach, M. Garland, S. Sengupta, D. Luebke, D. Manocha University of North Carolina at Chapel Hill NVIDIA University of California

More information

TUNING CUDA APPLICATIONS FOR MAXWELL

TUNING CUDA APPLICATIONS FOR MAXWELL TUNING CUDA APPLICATIONS FOR MAXWELL DA-07173-001_v6.5 August 2014 Application Note TABLE OF CONTENTS Chapter 1. Maxwell Tuning Guide... 1 1.1. NVIDIA Maxwell Compute Architecture... 1 1.2. CUDA Best Practices...2

More information

Auto-Tuning Strategies for Parallelizing Sparse Matrix-Vector (SpMV) Multiplication on Multi- and Many-Core Processors

Auto-Tuning Strategies for Parallelizing Sparse Matrix-Vector (SpMV) Multiplication on Multi- and Many-Core Processors Auto-Tuning Strategies for Parallelizing Sparse Matrix-Vector (SpMV) Multiplication on Multi- and Many-Core Processors Kaixi Hou, Wu-chun Feng {kaixihou, wfeng}@vt.edu Shuai Che Shuai.Che@amd.com Sparse

More information

Programming Languages Research Programme

Programming Languages Research Programme Programming Languages Research Programme Logic & semantics Planning Language-based security Resource-bound analysis Theorem proving/ CISA verification LFCS Logic Functional "Foundational" PL has been an

More information

Review for Midterm 3/28/11. Administrative. Parts of Exam. Midterm Exam Monday, April 4. Midterm. Design Review. Final projects

Review for Midterm 3/28/11. Administrative. Parts of Exam. Midterm Exam Monday, April 4. Midterm. Design Review. Final projects Administrative Midterm - In class April 4, open notes - Review notes, readings and review lecture (before break) - Will post prior exams Design Review - Intermediate assessment of progress on project,

More information

Lecture 2: CUDA Programming

Lecture 2: CUDA Programming CS 515 Programming Language and Compilers I Lecture 2: CUDA Programming Zheng (Eddy) Zhang Rutgers University Fall 2017, 9/12/2017 Review: Programming in CUDA Let s look at a sequential program in C first:

More information

Portland State University ECE 588/688. Graphics Processors

Portland State University ECE 588/688. Graphics Processors Portland State University ECE 588/688 Graphics Processors Copyright by Alaa Alameldeen 2018 Why Graphics Processors? Graphics programs have different characteristics from general purpose programs Highly

More information

Towards a Uniform Template-based Architecture for Accelerating 2D and 3D CNNs on FPGA

Towards a Uniform Template-based Architecture for Accelerating 2D and 3D CNNs on FPGA Towards a Uniform Template-based Architecture for Accelerating 2D and 3D CNNs on FPGA Junzhong Shen, You Huang, Zelong Wang, Yuran Qiao, Mei Wen, Chunyuan Zhang National University of Defense Technology,

More information

Performance of Multicore LUP Decomposition

Performance of Multicore LUP Decomposition Performance of Multicore LUP Decomposition Nathan Beckmann Silas Boyd-Wickizer May 3, 00 ABSTRACT This paper evaluates the performance of four parallel LUP decomposition implementations. The implementations

More information

Porting the NAS-NPB Conjugate Gradient Benchmark to CUDA. NVIDIA Corporation

Porting the NAS-NPB Conjugate Gradient Benchmark to CUDA. NVIDIA Corporation Porting the NAS-NPB Conjugate Gradient Benchmark to CUDA NVIDIA Corporation Outline! Overview of CG benchmark! Overview of CUDA Libraries! CUSPARSE! CUBLAS! Porting Sequence! Algorithm Analysis! Data/Code

More information

CUDA PROGRAMMING MODEL Chaithanya Gadiyam Swapnil S Jadhav

CUDA PROGRAMMING MODEL Chaithanya Gadiyam Swapnil S Jadhav CUDA PROGRAMMING MODEL Chaithanya Gadiyam Swapnil S Jadhav CMPE655 - Multiple Processor Systems Fall 2015 Rochester Institute of Technology Contents What is GPGPU? What s the need? CUDA-Capable GPU Architecture

More information

Parallel Alternating Direction Implicit Solver for the Two-Dimensional Heat Diffusion Problem on Graphics Processing Units

Parallel Alternating Direction Implicit Solver for the Two-Dimensional Heat Diffusion Problem on Graphics Processing Units Parallel Alternating Direction Implicit Solver for the Two-Dimensional Heat Diffusion Problem on Graphics Processing Units Khor Shu Heng Engineering Science Programme National University of Singapore Abstract

More information

Recent Advances in Heterogeneous Computing using Charm++

Recent Advances in Heterogeneous Computing using Charm++ Recent Advances in Heterogeneous Computing using Charm++ Jaemin Choi, Michael Robson Parallel Programming Laboratory University of Illinois Urbana-Champaign April 12, 2018 1 / 24 Heterogeneous Computing

More information

Efficient Particle-Mesh Spreading on GPUs

Efficient Particle-Mesh Spreading on GPUs Procedia Computer Science Volume 51, 2015, Pages 120 129 ICCS 2015 International Conference On Computational Science Efficient Particle-Mesh Spreading on GPUs Xiangyu Guo 1, Xing Liu 2,PengXu 1, Zhihui

More information

Introduction to CUDA Algoritmi e Calcolo Parallelo. Daniele Loiacono

Introduction to CUDA Algoritmi e Calcolo Parallelo. Daniele Loiacono Introduction to CUDA Algoritmi e Calcolo Parallelo References q This set of slides is mainly based on: " CUDA Technical Training, Dr. Antonino Tumeo, Pacific Northwest National Laboratory " Slide of Applied

More information

CS377P Programming for Performance GPU Programming - II

CS377P Programming for Performance GPU Programming - II CS377P Programming for Performance GPU Programming - II Sreepathi Pai UTCS November 11, 2015 Outline 1 GPU Occupancy 2 Divergence 3 Costs 4 Cooperation to reduce costs 5 Scheduling Regular Work Outline

More information

Master Thesis. Master Program of Computer Science

Master Thesis. Master Program of Computer Science Hochschule Bonn-Rhein-Sieg University of Applied Sciences Fachbereich Informatik Computer Science Department Master Thesis Master Program of Computer Science Requirement Analysis and Realization of Efficient

More information

OpenMP for next generation heterogeneous clusters

OpenMP for next generation heterogeneous clusters OpenMP for next generation heterogeneous clusters Jens Breitbart Research Group Programming Languages / Methodologies, Universität Kassel, jbreitbart@uni-kassel.de Abstract The last years have seen great

More information

A Batched GPU Algorithm for Set Intersection

A Batched GPU Algorithm for Set Intersection A Batched GPU Algorithm for Set Intersection Di Wu, Fan Zhang, Naiyong Ao, Fang Wang, Xiaoguang Liu, Gang Wang Nankai-Baidu Joint Lab, College of Information Technical Science, Nankai University Weijin

More information

Computational Graphics: Lecture 15 SpMSpM and SpMV, or, who cares about complexity when we have a thousand processors?

Computational Graphics: Lecture 15 SpMSpM and SpMV, or, who cares about complexity when we have a thousand processors? Computational Graphics: Lecture 15 SpMSpM and SpMV, or, who cares about complexity when we have a thousand processors? The CVDLab Team Francesco Furiani Tue, April 3, 2014 ROMA TRE UNIVERSITÀ DEGLI STUDI

More information

Evaluation Of The Performance Of GPU Global Memory Coalescing

Evaluation Of The Performance Of GPU Global Memory Coalescing Evaluation Of The Performance Of GPU Global Memory Coalescing Dae-Hwan Kim Department of Computer and Information, Suwon Science College, 288 Seja-ro, Jeongnam-myun, Hwaseong-si, Gyeonggi-do, Rep. of Korea

More information

Improved Integral Histogram Algorithm. for Big Sized Images in CUDA Environment

Improved Integral Histogram Algorithm. for Big Sized Images in CUDA Environment Contemporary Engineering Sciences, Vol. 7, 2014, no. 24, 1415-1423 HIKARI Ltd, www.m-hikari.com http://dx.doi.org/10.12988/ces.2014.49174 Improved Integral Histogram Algorithm for Big Sized Images in CUDA

More information

Finite Element Integration and Assembly on Modern Multi and Many-core Processors

Finite Element Integration and Assembly on Modern Multi and Many-core Processors Finite Element Integration and Assembly on Modern Multi and Many-core Processors Krzysztof Banaś, Jan Bielański, Kazimierz Chłoń AGH University of Science and Technology, Mickiewicza 30, 30-059 Kraków,

More information

Dynamic Sparse Matrix Allocation on GPUs. James King

Dynamic Sparse Matrix Allocation on GPUs. James King Dynamic Sparse Matrix Allocation on GPUs James King Graph Applications Dynamic updates to graphs Adding edges add entries to sparse matrix representation Motivation Graph operations (adding edges) (e.g.

More information

High Performance Parallel Summed-Area Table Kernels for Multi-Core and Many-Core Systems

High Performance Parallel Summed-Area Table Kernels for Multi-Core and Many-Core Systems High Performance Parallel Summed-Area Table Kernels for Multi-Core and Many-Core Systems Angelos Papatriantafyllou 1 and Dimitris Sacharidis 2 1 Faculty of Informatics, Institute of Information Systems,

More information

THE problem of string matching is to find all locations

THE problem of string matching is to find all locations IEEE TRANSACTIONS ON PARALLEL AND DISTRIBUTED SYSTEMS, VOL. XX, NO. XX, XX 2X Parallelizing Exact and Approximate String Matching via Inclusive Scan on a GPU Yasuaki Mitani, Fumihiko Ino, Member, IEEE,

More information

Scalpel: Customizing DNN Pruning to the Underlying Hardware Parallelism

Scalpel: Customizing DNN Pruning to the Underlying Hardware Parallelism Scalpel: Customizing DNN Pruning to the Underlying Hardware Parallelism Jiecao Yu 1, Andrew Lukefahr 1, David Palframan 2, Ganesh Dasika 2, Reetuparna Das 1, Scott Mahlke 1 1 University of Michigan 2 ARM

More information

implementation using GPU architecture is implemented only from the viewpoint of frame level parallel encoding [6]. However, it is obvious that the mot

implementation using GPU architecture is implemented only from the viewpoint of frame level parallel encoding [6]. However, it is obvious that the mot Parallel Implementation Algorithm of Motion Estimation for GPU Applications by Tian Song 1,2*, Masashi Koshino 2, Yuya Matsunohana 2 and Takashi Shimamoto 1,2 Abstract The video coding standard H.264/AVC

More information

CS 179: GPU Computing LECTURE 4: GPU MEMORY SYSTEMS

CS 179: GPU Computing LECTURE 4: GPU MEMORY SYSTEMS CS 179: GPU Computing LECTURE 4: GPU MEMORY SYSTEMS 1 Last time Each block is assigned to and executed on a single streaming multiprocessor (SM). Threads execute in groups of 32 called warps. Threads in

More information

Novel implementations of recursive discrete wavelet transform for real time computation with multicore systems on chip (SOC)

Novel implementations of recursive discrete wavelet transform for real time computation with multicore systems on chip (SOC) Science Journal of Circuits, Systems and Signal Processing 2013; 2(2) : 22-28 Published online April 2, 2013 (http://www.sciencepublishinggroup.com/j/cssp) doi: 10.11648/j.cssp.20130202.11 Novel implementations

More information

Double-Precision Matrix Multiply on CUDA

Double-Precision Matrix Multiply on CUDA Double-Precision Matrix Multiply on CUDA Parallel Computation (CSE 60), Assignment Andrew Conegliano (A5055) Matthias Springer (A995007) GID G--665 February, 0 Assumptions All matrices are square matrices

More information

Solving the heat equation with CUDA

Solving the heat equation with CUDA Solving the heat equation with CUDA Oliver Meister January 09 th 2013 Last Tutorial CSR kernel - scalar One row per thread No coalesced memory access Non-uniform matrices CSR kernel - vectorized One row

More information

Fundamental Optimizations in CUDA Peng Wang, Developer Technology, NVIDIA

Fundamental Optimizations in CUDA Peng Wang, Developer Technology, NVIDIA Fundamental Optimizations in CUDA Peng Wang, Developer Technology, NVIDIA Optimization Overview GPU architecture Kernel optimization Memory optimization Latency optimization Instruction optimization CPU-GPU

More information

CSE 599 I Accelerated Computing - Programming GPUS. Memory performance

CSE 599 I Accelerated Computing - Programming GPUS. Memory performance CSE 599 I Accelerated Computing - Programming GPUS Memory performance GPU Teaching Kit Accelerated Computing Module 6.1 Memory Access Performance DRAM Bandwidth Objective To learn that memory bandwidth

More information

General Purpose GPU Programming. Advanced Operating Systems Tutorial 7

General Purpose GPU Programming. Advanced Operating Systems Tutorial 7 General Purpose GPU Programming Advanced Operating Systems Tutorial 7 Tutorial Outline Review of lectured material Key points Discussion OpenCL Future directions 2 Review of Lectured Material Heterogeneous

More information

Using Butterfly-Patterned Partial Sums to Draw from Discrete Distributions

Using Butterfly-Patterned Partial Sums to Draw from Discrete Distributions Using Butterfly-Patterned Partial Sums to Draw from Discrete Distributions Guy L. Steele Jr. Software Architect Oracle Labs April 6, 2016 The image part with relationship Copyright 2016 Oracle and/or its

More information

Kartik Lakhotia, Rajgopal Kannan, Viktor Prasanna USENIX ATC 18

Kartik Lakhotia, Rajgopal Kannan, Viktor Prasanna USENIX ATC 18 Accelerating PageRank using Partition-Centric Processing Kartik Lakhotia, Rajgopal Kannan, Viktor Prasanna USENIX ATC 18 Outline Introduction Partition-centric Processing Methodology Analytical Evaluation

More information

ACCELERATING MATRIX PROCESSING WITH GPUs. Nicholas Malaya, Shuai Che, Joseph Greathouse, Rene van Oostrum, and Michael Schulte AMD Research

ACCELERATING MATRIX PROCESSING WITH GPUs. Nicholas Malaya, Shuai Che, Joseph Greathouse, Rene van Oostrum, and Michael Schulte AMD Research ACCELERATING MATRIX PROCESSING WITH GPUs Nicholas Malaya, Shuai Che, Joseph Greathouse, Rene van Oostrum, and Michael Schulte AMD Research ACCELERATING MATRIX PROCESSING WITH GPUS MOTIVATION Matrix operations

More information

AN 831: Intel FPGA SDK for OpenCL

AN 831: Intel FPGA SDK for OpenCL AN 831: Intel FPGA SDK for OpenCL Host Pipelined Multithread Subscribe Send Feedback Latest document on the web: PDF HTML Contents Contents 1 Intel FPGA SDK for OpenCL Host Pipelined Multithread...3 1.1

More information

Performance impact of dynamic parallelism on different clustering algorithms

Performance impact of dynamic parallelism on different clustering algorithms Performance impact of dynamic parallelism on different clustering algorithms Jeffrey DiMarco and Michela Taufer Computer and Information Sciences, University of Delaware E-mail: jdimarco@udel.edu, taufer@udel.edu

More information

Summary of CERN Workshop on Future Challenges in Tracking and Trigger Concepts. Abdeslem DJAOUI PPD Rutherford Appleton Laboratory

Summary of CERN Workshop on Future Challenges in Tracking and Trigger Concepts. Abdeslem DJAOUI PPD Rutherford Appleton Laboratory Summary of CERN Workshop on Future Challenges in Tracking and Trigger Concepts Abdeslem DJAOUI PPD Rutherford Appleton Laboratory Background to Workshop Organised by CERN OpenLab and held in IT Auditorium,

More information

LaPerm: Locality Aware Scheduler for Dynamic Parallelism on GPUs

LaPerm: Locality Aware Scheduler for Dynamic Parallelism on GPUs LaPerm: Locality Aware Scheduler for Dynamic Parallelism on GPUs Jin Wang* Norm Rubin Albert Sidelnik Sudhakar Yalamanchili* *Georgia Institute of Technology NVIDIA Research Email: {jin.wang,sudha}@gatech.edu,

More information

Execution Strategy and Runtime Support for Regular and Irregular Applications on Emerging Parallel Architectures

Execution Strategy and Runtime Support for Regular and Irregular Applications on Emerging Parallel Architectures Execution Strategy and Runtime Support for Regular and Irregular Applications on Emerging Parallel Architectures Xin Huo Advisor: Gagan Agrawal Motivation - Architecture Challenges on GPU architecture

More information

On Level Scheduling for Incomplete LU Factorization Preconditioners on Accelerators

On Level Scheduling for Incomplete LU Factorization Preconditioners on Accelerators On Level Scheduling for Incomplete LU Factorization Preconditioners on Accelerators Karl Rupp, Barry Smith rupp@mcs.anl.gov Mathematics and Computer Science Division Argonne National Laboratory FEMTEC

More information

GPU ACCELERATION OF WSMP (WATSON SPARSE MATRIX PACKAGE)

GPU ACCELERATION OF WSMP (WATSON SPARSE MATRIX PACKAGE) GPU ACCELERATION OF WSMP (WATSON SPARSE MATRIX PACKAGE) NATALIA GIMELSHEIN ANSHUL GUPTA STEVE RENNICH SEID KORIC NVIDIA IBM NVIDIA NCSA WATSON SPARSE MATRIX PACKAGE (WSMP) Cholesky, LDL T, LU factorization

More information

Module 5: Performance Issues in Shared Memory and Introduction to Coherence Lecture 9: Performance Issues in Shared Memory. The Lecture Contains:

Module 5: Performance Issues in Shared Memory and Introduction to Coherence Lecture 9: Performance Issues in Shared Memory. The Lecture Contains: The Lecture Contains: Data Access and Communication Data Access Artifactual Comm. Capacity Problem Temporal Locality Spatial Locality 2D to 4D Conversion Transfer Granularity Worse: False Sharing Contention

More information

A GPGPU Compiler for Memory Optimization and Parallelism Management

A GPGPU Compiler for Memory Optimization and Parallelism Management GPGPU Compiler for Memory Optimization and Parallelism Management Yi Yang, Ping Xiang, Jingfei Kong, Huiyang Zhou Department of Electrical and Computer Engineering North Carolina State University School

More information

Sparse Linear Algebra in CUDA

Sparse Linear Algebra in CUDA Sparse Linear Algebra in CUDA HPC - Algorithms and Applications Alexander Pöppl Technical University of Munich Chair of Scientific Computing November 22 nd 2017 Table of Contents Homework - Worksheet 2

More information

Data Structures and Algorithms for Counting Problems on Graphs using GPU

Data Structures and Algorithms for Counting Problems on Graphs using GPU International Journal of Networking and Computing www.ijnc.org ISSN 85-839 (print) ISSN 85-847 (online) Volume 3, Number, pages 64 88, July 3 Data Structures and Algorithms for Counting Problems on Graphs

More information

Case study: OpenMP-parallel sparse matrix-vector multiplication

Case study: OpenMP-parallel sparse matrix-vector multiplication Case study: OpenMP-parallel sparse matrix-vector multiplication A simple (but sometimes not-so-simple) example for bandwidth-bound code and saturation effects in memory Sparse matrix-vector multiply (spmvm)

More information

Introduction to CUDA Algoritmi e Calcolo Parallelo. Daniele Loiacono

Introduction to CUDA Algoritmi e Calcolo Parallelo. Daniele Loiacono Introduction to CUDA Algoritmi e Calcolo Parallelo References This set of slides is mainly based on: CUDA Technical Training, Dr. Antonino Tumeo, Pacific Northwest National Laboratory Slide of Applied

More information

Modern GPUs (Graphics Processing Units)

Modern GPUs (Graphics Processing Units) Modern GPUs (Graphics Processing Units) Powerful data parallel computation platform. High computation density, high memory bandwidth. Relatively low cost. NVIDIA GTX 580 512 cores 1.6 Tera FLOPs 1.5 GB

More information

Performance Optimization Part II: Locality, Communication, and Contention

Performance Optimization Part II: Locality, Communication, and Contention Lecture 7: Performance Optimization Part II: Locality, Communication, and Contention Parallel Computer Architecture and Programming CMU 15-418/15-618, Spring 2015 Tunes Beth Rowley Nobody s Fault but Mine

More information

Deep Learning Accelerators

Deep Learning Accelerators Deep Learning Accelerators Abhishek Srivastava (as29) Samarth Kulshreshtha (samarth5) University of Illinois, Urbana-Champaign Submitted as a requirement for CS 433 graduate student project Outline Introduction

More information

GPU-Based Acceleration for CT Image Reconstruction

GPU-Based Acceleration for CT Image Reconstruction GPU-Based Acceleration for CT Image Reconstruction Xiaodong Yu Advisor: Wu-chun Feng Collaborators: Guohua Cao, Hao Gong Outline Introduction and Motivation Background Knowledge Challenges and Proposed

More information

CUDA Memory Types All material not from online sources/textbook copyright Travis Desell, 2012

CUDA Memory Types All material not from online sources/textbook copyright Travis Desell, 2012 CUDA Memory Types All material not from online sources/textbook copyright Travis Desell, 2012 Overview 1. Memory Access Efficiency 2. CUDA Memory Types 3. Reducing Global Memory Traffic 4. Example: Matrix-Matrix

More information

Institute of Cardiovascular Science, UCL Centre for Cardiovascular Imaging, London, United Kingdom, 2

Institute of Cardiovascular Science, UCL Centre for Cardiovascular Imaging, London, United Kingdom, 2 Grzegorz Tomasz Kowalik 1, Jennifer Anne Steeden 1, Bejal Pandya 1, David Atkinson 2, Andrew Taylor 1, and Vivek Muthurangu 1 1 Institute of Cardiovascular Science, UCL Centre for Cardiovascular Imaging,

More information

Optimizing Sparse Matrix Vector Multiplication Using Cache Blocking Method on Fermi GPU

Optimizing Sparse Matrix Vector Multiplication Using Cache Blocking Method on Fermi GPU 2012 13th ACIS International Conference on Software Engineering, Artificial Intelligence, Networking and Parallel/Distributed Computing Optimizing Sparse Matrix Vector Multiplication Using Cache Blocking

More information

COMP 322: Fundamentals of Parallel Programming. Flynn s Taxonomy for Parallel Computers

COMP 322: Fundamentals of Parallel Programming. Flynn s Taxonomy for Parallel Computers COMP 322: Fundamentals of Parallel Programming Lecture 37: General-Purpose GPU (GPGPU) Computing Max Grossman, Vivek Sarkar Department of Computer Science, Rice University max.grossman@rice.edu, vsarkar@rice.edu

More information

L17: Introduction to Irregular Algorithms and MPI, cont.! November 8, 2011!

L17: Introduction to Irregular Algorithms and MPI, cont.! November 8, 2011! L17: Introduction to Irregular Algorithms and MPI, cont.! November 8, 2011! Administrative Class cancelled, Tuesday, November 15 Guest Lecture, Thursday, November 17, Ganesh Gopalakrishnan CUDA Project

More information

From Shader Code to a Teraflop: How GPU Shader Cores Work. Jonathan Ragan- Kelley (Slides by Kayvon Fatahalian)

From Shader Code to a Teraflop: How GPU Shader Cores Work. Jonathan Ragan- Kelley (Slides by Kayvon Fatahalian) From Shader Code to a Teraflop: How GPU Shader Cores Work Jonathan Ragan- Kelley (Slides by Kayvon Fatahalian) 1 This talk Three major ideas that make GPU processing cores run fast Closer look at real

More information

Accelerated Load Balancing of Unstructured Meshes

Accelerated Load Balancing of Unstructured Meshes Accelerated Load Balancing of Unstructured Meshes Gerrett Diamond, Lucas Davis, and Cameron W. Smith Abstract Unstructured mesh applications running on large, parallel, distributed memory systems require

More information

Efficient Multi-GPU CUDA Linear Solvers for OpenFOAM

Efficient Multi-GPU CUDA Linear Solvers for OpenFOAM Efficient Multi-GPU CUDA Linear Solvers for OpenFOAM Alexander Monakov, amonakov@ispras.ru Institute for System Programming of Russian Academy of Sciences March 20, 2013 1 / 17 Problem Statement In OpenFOAM,

More information

Generating Optimized Sparse Matrix Vector Product over Finite Fields

Generating Optimized Sparse Matrix Vector Product over Finite Fields Generating Optimized Sparse Matrix Vector Product over Finite Fields Pascal Giorgi 1 and Bastien Vialla 1 LIRMM, CNRS, Université Montpellier 2, pascal.giorgi@lirmm.fr, bastien.vialla@lirmm.fr Abstract.

More information