1function test49 2%TEST49 performance test of GrB_mxm (dot product method, A'*B) 3 4% SuiteSparse:GraphBLAS, Timothy A. Davis, (c) 2017-2021, All Rights Reserved. 5% SPDX-License-Identifier: Apache-2.0 6 7[save save_chunk] = nthreads_get ; 8chunk = 4096 ; 9nthreads = feature ('numcores') ; 10nthreads_set (nthreads, chunk) ; 11 12d = struct ('inp0', 'tran', 'axb', 'dot') ; 13 14rng ('default') ; 15k = 1e6 ; 16 17semiring.multiply = 'times' ; 18semiring.add = 'plus' ; 19semiring.class = 'double' ; 20 21A1 = sprand (k, 16, 10e6 / (k*16)) ; 22B1 = sprand (k, 16, 10e6 / (k*16)) ; 23 24for m = 1:4 25 for n = 1:4 26 27 A = A1 (:, 1:m) ; 28 B = B1 (:, 1:n) ; 29 30 W = sparse (m, n) ; 31 32 tic ; 33 C = A'*B ; 34 t1 = toc ; 35 36 tic ; 37 C2 = GB_mex_mxm (W, [], [], semiring, A, B, d) ; 38 % t2 = toc ; 39 t2 = grbresults ; 40 41 e = norm (C - C2.matrix, 1) ; 42 fprintf (... 43 'm %3d n %3d MATLAB: %10.5g GrB: %10.5g speedup %10.2f err: %g\n', ... 44 m, n, t1, t2, t1/t2, e) ; 45 end 46end 47 48nthreads_set (save, save_chunk) ; 49 50fprintf ('\ntest49: all tests passed\n') ; 51 52