1function testall (threads,longtests) 2%TESTALL run all GraphBLAS tests 3% 4% Usage: 5% testall ; % runs just the shorter tests (about 30 minutes) 6% 7% testall(threads) ; % run with specific list of threads and chunk sizes 8% testall([ ],1) ; % run all longer tests, with default # of threads 9% 10% threads is a cell array. Each entry is 2-by-1, with the first value being 11% the # of threads to use and the 2nd being the chunk size. The default is 12% {[4 1]} if empty or not present. 13 14% SuiteSparse:GraphBLAS, Timothy A. Davis, (c) 2017-2021, All Rights Reserved. 15% SPDX-License-Identifier: Apache-2.0 16 17GrB.init 18 19testall_time = tic ; 20 21if (nargin < 2) 22 % run the shorter tests by default 23 longtests = 0 ; 24end 25 26if (nargin < 1) 27 threads = [ ] ; 28end 29if (isempty (threads)) 30 threads {1} = [4 1] ; 31end 32t = threads ; 33 34% single thread 35s {1} = [1 1] ; 36 37extra {1} = [4 1] ; 38extra {2} = [1 1] ; 39 40% clear the statement coverage counts 41clear global GraphBLAS_grbcov 42 43% use built-in complex data types by default 44GB_builtin_complex_set (1) ; 45 46% many of the tests use SuiteSparse/MATLAB_Tools/spok, a copy of which is 47% included here in GraphBLAS/Test/spok. 48addpath ('../Test/spok') ; 49addpath ('../Demo/MATLAB') ; 50 51try 52 spok (sparse (1)) ; 53catch 54 cd spok ; spok_install ; cd .. 55end 56 57logstat ; % start the log.txt 58 59%------------------------------------------------------------------------------- 60% quick tests for statement coverage 61%------------------------------------------------------------------------------- 62 63% Timings below are for test coverage (Tcov), with malloc debuging enabled, on 64% hypersparse.cse.tamu.edu (20 core Xeon). Times will differ if this test is 65% run with malloc debugging off. 66 67%---------------------------------------- 68% tests with high rates (over 100/sec) 69%---------------------------------------- 70 71% disable the Werk stack for these tests: 72hack = GB_mex_hack ; 73hack (2) = 1 ; 74GB_mex_hack (hack) ; 75 76logstat ('test192',t) ; % test C<C,struct>=scalar 77logstat ('test191',t) ; % test split 78logstat ('test188',t) ; % test concat 79logstat ('test187',t) ; % test dup/assign for all sparsity formats 80logstat ('test186',t) ; % test saxpy for all sparsity formats 81logstat ('test186',s) ; % test saxpy for all sparsity formats 82logstat ('test185',s) ; % test dot4, saxpy for all sparsity formats 83logstat ('test184',t) ; % test special cases for mxm, transpose, and build 84logstat ('test181',s) ; % test transpose with explicit zeros in the mask 85logstat ('test180',s) ; % test assign and subassign (single threaded) 86logstat ('test180',t) ; % test assign and subassign (multi threaded) 87logstat ('test150',t) ; % mxm with zombies and typecasting (dot3 and saxpy) 88logstat ('test14',t) ; % GrB_reduce 89logstat ('test154',t) ; % apply with binop and scalar binding 90logstat ('test151b',t); % test bshift operator 91 92% re-enable the Werk stack for most tests: 93hack (2) = 0 ; 94GB_mex_hack (hack) ; 95 96logstat ('test195',t) ; % test all variants of saxpy3 97logstat ('test194',t) ; % test GxB_Vector_diag 98logstat ('test193',t) ; % test GxB_Matrix_diag 99logstat ('test190',t) ; % test dense matrix for C<!M>=A*B 100logstat ('test189',t) ; % test large assign 101 102logstat ('test183',s) ; % test eWiseMult with hypersparse mask 103logstat ('test182',s) ; % test for internal wait 104logstat ('test179',t) ; % test bitmap select 105 106logstat ('test165',t) ; % test C=A*B' where A is diagonal and B becomes bitmap 107logstat ('test01',t) ; logstat ('test01',s) ; % error handling 108logstat ('test07b',t) ; % quick test GB_mex_assign 109logstat ('test83',t) ; % GrB_assign with C_replace and empty J 110 111logstat ('test176',t) ; % test GrB_assign, method 09, 11 112logstat ('test174',t) ; % test GrB_assign C<A>=A 113logstat ('test170',t) ; % test C<B>=A+B (alias M==B) 114logstat ('test169',t) ; % test C<!M>=A+B with C sparse, M hyper, A and B sparse 115logstat ('test166',t) ; % test GxB_select with a dense matrix 116logstat ('test164',t) ; % test dot5 method 117logstat ('test152',t) ; % test binops with C=A+B, all matrices dense 118logstat ('test155',t) ; % test GrB_*_setElement and GrB_*_removeElement 119logstat ('test156',t) ; % test GrB_assign C=A with typecasting 120logstat ('test136',s) ; % subassignment special cases 121logstat ('test02',t) ; % matrix copy and dup tests 122logstat ('test109',t) ; % terminal monoid with user-defined type 123logstat ('test109',s); % terminal monoid with user-defined type 124logstat ('test110',t) ; % binary search of M(:,j) in accum/mask 125logstat ('test04',t) ; % simple mask and transpose test 126 127%---------------------------------------- 128% tests with good rates (30 to 100/sec) 129%---------------------------------------- 130 131logstat ('test142',t) ; % test GrB_assign with accum 132logstat ('test162',t) ; % test C<M>=A*B with very sparse M 133logstat ('test161',t) ; % test A*B*E 134logstat ('test159',t) ; % test A*B 135logstat ('test137',s) ; % GrB_eWiseMult with FIRST and SECOND operators 136logstat ('test139',s) ; % merge sort, special cases 137logstat ('test09',t) ; % duplicate I,J test of GB_mex_subassign 138logstat ('test132',t) ; % setElement 139logstat ('test167',t) ; % test C<M>=A*B with very sparse M, different types 140logstat ('test177',t) ; % test C<!M>=A*B, C and B bitmap, M and A sparse 141logstat ('test94',t) ; logstat ('test94',s) ; % pagerank 142logstat ('test141',t) ; % eWiseAdd with dense matrices 143logstat ('test144',t) ; % cumsum 144logstat ('test145',t) ; % dot4 for C += A'*B 145 146%---------------------------------------- 147% tests with decent rates (30 to 40/sec) 148%---------------------------------------- 149 150logstat ('test92',t) ; % GB_subref (symbolic case) 151logstat ('test108',t) ; % boolean monoids 152logstat ('test172',t) ; % test eWiseMult with M bitmap/full 153logstat ('test26',t) ; % quick test of GxB_select 154logstat ('test148',t) ; % ewise with alias 155logstat ('testc2(1)',t) ; % complex tests (quick case) 156logstat ('test163',t) ; % test C<!M>=A'*B where C and M are sparse 157 158%---------------------------------------- 159% tests with decent rates (20 to 30/sec) 160%---------------------------------------- 161 162logstat ('test146',t) ; % expand scalar 163logstat ('test173',t) ; % test GrB_assign C<A>=A 164logstat ('test157',t) ; % test sparsity formats 165logstat ('test29',t) ; % reduce with zombies 166logstat ('test74',t) ; % test GrB_mxm on all semirings 167 168%---------------------------------------- 169% tests with decent rates (10 to 20/sec) 170%---------------------------------------- 171 172logstat ('test03',t) ; logstat ('test03',s) ; % random matrix tests 173logstat ('test128',t) ; % eWiseMult, eWiseAdd, special cases 174logstat ('test125',t) ; % test GrB_mxm: row and column scaling 175logstat ('test131',t) ; % GrB_Matrix_clear 176logstat ('test82',t) ; % GrB_extract with index range (hypersparse) 177 178%---------------------------------------- 179% tests with low coverage/sec rates (1/sec to 10/sec) 180%---------------------------------------- 181 182logstat ('test158',t) ; % test colscale and rowscale 183logstat ('test84',t) ; % GrB_assign (row and column with C in CSR/CSC format) 184logstat ('test130',t) ; % GrB_apply, hypersparse cases 185logstat ('test19b',t) ; % GrB_assign, many pending operators 186logstat ('test19b',s); % GrB_assign, many pending operators 187logstat ('test101',t) ; % import and export 188logstat ('test133',t) ; % test mask operations (GB_masker) 189logstat ('test72',t) ; % several special cases 190logstat ('test80',t) ; % test GrB_mxm on all semirings (different matrix) 191logstat ('test151',t) ; % test bitwise operators 192logstat ('test124',t) ; % GrB_extract, case 6 193logstat ('test23',t) ; % quick test of GB_*_build 194 195logstat ('test175',t) ; % test142 updated 196logstat ('test160',t) ; % test A*B, parallel 197logstat ('test160',s) ; % test A*B, single threaded 198logstat ('test134',t) ; % quick test of GxB_select 199logstat ('test00',s); % GB_mex_mis (single threaded) 200logstat ('test54',t) ; % assign and extract with begin:inc:end 201logstat ('test104',t) ; % export/import 202logstat ('test11',t) ; % exhaustive test of GrB_extractTuples 203logstat ('test28',t) ; % mxm with aliased inputs, C<C> = accum(C,C*C) 204 205%---------------------------------------- 206% tests with very low coverage/sec rates (< 1/sec) 207%---------------------------------------- 208 209logstat ('test129',t) ; % test GxB_select (tril and nonzero, hypersparse) 210logstat ('test138',s) ; % test assign, with coarse-only tasks in IxJ slice 211logstat ('test127',t) ; % test eWiseAdd, eWiseMult (all types and operators) 212logstat ('test76',s) ; % GxB_resize (single threaded) 213logstat ('test107',t) ; % monoids with terminal values 214logstat ('test69',t) ; % assign and subassign with alias 215logstat ('test135',t) ; % reduce to scalar 216logstat ('test17',t) ; % quick test of GrB_*_extractElement 217logstat ('test143',t) ; % mxm, special cases 218logstat ('test27',t) ; % quick test of GxB_select (LoHi_band) 219logstat ('test53',t) ; % quick test of GB_mex_Matrix_extract 220logstat ('test77',t) ; % quick tests of GrB_kronecker 221logstat ('test19',t) ; % GxB_subassign, many pending operators 222 223%---------------------------------------- 224% longer tests (200 seconds to 600 seconds) 225%---------------------------------------- 226 227% Turn off malloc debugging 228malloc_debugging = stat ; 229if (malloc_debugging) 230 debug_off 231 fprintf ('[malloc debugging turned off]\n') ; 232 f = fopen ('log.txt', 'a') ; 233 fprintf (f, '[malloc debugging turned off]\n') ; 234 fclose (f) ; 235end 236 237logstat ('test10',t) ; % GrB_apply 238logstat ('test75b',t) ; % test GrB_mxm A'*B (quicker than test75) 239logstat ('test16',t) ; % user-defined complex operators 240logstat ('test81',t) ; % GrB_Matrix_extract with stride, range, backwards 241logstat ('test21b',t) ; % quick test of GB_mex_assign 242logstat ('test18',t) ; % quick tests of GrB_eWiseAdd and eWiseMult 243 244%------------------------------------------------------------------------------- 245% The following tests are not required for statement coverage. Some need 246% other packages in SuiteSparse (CSparse, SSMULT, ssget). By default, these 247% tests are not run. To install them, see test_other.m. Timing is with malloc 248% debugging turned off. 249 250if (longtests) 251 252% ------------------------ % ---- % ------------------------------ 253% test script % time % description 254% ------------------------ % ---- % ------------------------------ 255 256logstat ('test00',t) ; % 8 % GB_mex_mis (multiple threads) 257logstat ('test05',t) ; % % quick setElement test, with typecasting 258logstat ('test06',t) ; % 532 % test GrB_mxm on all semirings 259logstat ('test06(936)',t); % % performance test GrB_mxm on all semirings 260logstat ('test07',t) ; % 0 % quick test GB_mex_subassign 261logstat ('test07',s) ; % 0 % quick test GB_mex_subassign 262logstat ('test08',t) ; % 35 % quick test GB_mex_subassign 263logstat ('test08b',t) ; % % quick test GB_mex_assign 264logstat ('test09b',t) ; % % duplicate I,J test of GB_mex_assign 265 266logstat ('test12',t) ; % % Wathen finite-element matrices (short test) 267logstat ('test12(0)',t) ; % % Wathen finite-element matrices (full test) 268logstat ('test13',t) ; % % simple tests of GB_mex_transpose 269logstat ('test15',t) ; % simple test of GB_mex_AxB 270logstat ('test18(1)',t) ; % % lengthy tests of GrB_eWiseAdd and eWiseMult 271 272logstat ('test20',t) ; % quick test of GB_mex_mxm on a few semirings 273logstat ('test20(1)',t) ; % % test of GB_mex_mxm on all built-in semirings 274logstat ('test21',s) ; % 41 % quick test of GB_mex_subassign 275logstat ('test21(1)',t) ; % % exhaustive test of GB_mex_subassign 276logstat ('test22',t) ; % % quick test of GB_mex_transpose 277logstat ('test23(1)',t) ; % % exhaustive test of GB_*_build 278logstat ('test24',t) ; % 42 % test of GrB_Matrix_reduce 279logstat ('test24(1)',t) ; % % exhaustive test of GrB_Matrix_reduce 280logstat ('test25',t) ; % % long test of GxB_select 281logstat ('test26(1)',t) ; % % performance test of GxB_select (use ssget) 282 283logstat ('test30') ; % 11 % GB_mex_subassign, scalar expansion 284logstat ('test30b') ; % 9 % performance GB_mex_assign, scalar expansion 285logstat ('test31',t) ; % % simple tests of GB_mex_transpose 286logstat ('test32',t) ; % % quick GB_mex_mxm test 287logstat ('test33',t) ; % % create a semiring 288logstat ('test34',t) ; % % quick GB_mex_Matrix_eWiseAdd test 289logstat ('test35') ; % % performance test for GrB_extractTuples 290logstat ('test36') ; % % performance test for GB_mex_Matrix_subref 291logstat ('test38',t) ; % % GB_mex_transpose with matrix collection 292logstat ('test39') ; % % GrB_transpose, GB_*_add and eWiseAdd 293logstat ('test39(0)') ; % 55 % GrB_transpose, GB_*_add and eWiseAdd 294 295logstat ('test40',t) ; % % GrB_Matrix_extractElement, and Vector 296logstat ('test41',t) ; % % test of GB_mex_AxB 297logstat ('test42') ; % % performance tests for GB_mex_Matrix_build 298logstat ('test43',t) ; % % performance tests for GB_mex_Matrix_subref 299logstat ('test44',t) ; % 5 % test qsort 300logstat ('test45(0)',t) ; % 334 % test GB_mex_setElement and build 301logstat ('test46') ; % % performance test GB_mex_subassign 302logstat ('test46b') ; % % performance test GB_mex_assign 303logstat ('test47',t) ; % % performance test of GrB_vxm 304logstat ('test48') ; % % performance test of GrB_mxm 305logstat ('test49') ; % % performance test of GrB_mxm (dot, A'*B) 306 307logstat ('test50',t) ; % % test GB_mex_AxB on larger matrix 308logstat ('test51') ; % % performance test GB_mex_subassign 309logstat ('test51b') ; % % performance test GB_mex_assign, multiple ops 310logstat ('test52',t) ; % % performance of A*B with tall mtx, AdotB, AxB 311logstat ('test53',t) ; % % exhaustive test of GB_mex_Matrix_extract 312logstat ('test55',t) ; % % GxB_subassign, dupl, MATLAB vs GraphBLAS 313logstat ('test55b',t) ; % % GrB_assign, duplicates, MATLAB vs GraphBLAS 314logstat ('test56',t) ; % % test GrB_*_build 315logstat ('test57',t) ; % % test operator on large uint32 values 316logstat ('test58(0)') ; % % longer GB_mex_Matrix_eWiseAdd performance 317logstat ('test58') ; % % test GrB_eWiseAdd 318logstat ('test59',t) ; % % test GrB_mxm 319 320logstat ('test60',t) ; % % test min and max operators with NaNs 321logstat ('test61') ; % % performance test of GrB_eWiseMult 322logstat ('test62',t) ; % % exhaustive test of GrB_apply 323logstat ('test63',t) ; % % GB_mex_op and operator tests 324logstat ('test64',t) ; % % GB_mex_subassign, scalar expansion 325logstat ('test64b',t) ; % % GrB_*_assign, scalar expansion 326logstat ('test65',t) ; % % test type casting 327logstat ('test66',t) ; % % quick test for GrB_Matrix_reduce 328logstat ('test67',t) ; % % quick test for GrB_apply 329logstat ('test68',t) ; 330 331logstat ('test70',t) ; % % performance of triangle counting methods 332logstat ('test71',t) ; % % performance of triangle counting methods 333logstat ('test73',t) ; % % performance of C = A*B, with mask 334logstat ('test75',t) ; % % test GrB_mxm A'*B on all semirings 335logstat ('test78',t) ; % 1 % quick test of hypersparse subref 336logstat ('test79',t) ; % % run all in SuiteSparse Collection w/ test06 337 338logstat ('test85',t) ; % 0 % GrB_transpose (1-by-n with typecasting) 339logstat ('test86',t) ; % % performance test of of GrB_Matrix_extract 340logstat ('test87',t) ; % % performance test of GrB_mxm 341logstat ('test88',t) ; % hypersparse matrices with hash-based method 342logstat ('test89',t) ; % % performance test of complex A*B 343 344logstat ('test90',t) ; % 1 % test user-defined semirings 345logstat ('test91',t) ; % % test subref performance on dense vectors 346logstat ('test93',t) ; % 3 % pagerank 347logstat ('test93b',t) ; % % dpagerank and ipagerank 348logstat ('test95',t) ; % % performance test for GrB_transpose 349logstat ('test96',t) ; % 16 % A*B using dot product 350logstat ('test97',t) ; % 0 % GB_mex_assign, scalar expansion and zombies 351logstat ('test98',t) ; % % GB_mex_mxm, typecast on the fly 352logstat ('test99',t) ; % 20 % GB_mex_transpose w/ explicit 0s in the Mask 353 354logstat ('test100',t) ; % 5 % GB_mex_isequal 355logstat ('test102',t); % 1 % GB_AxB_saxpy3_flopcount 356logstat ('test103',t) ; % % GrB_transpose aliases 357logstat ('test105',t) ; % 2 % eWiseAdd for hypersparse 358logstat ('test106',t) ; % 4 % GxB_subassign with alias 359 360logstat ('test111',t) ; % % performance test for eWiseAdd 361logstat ('test112',t) ; % % test row/col scale 362logstat ('test113',t) ; % % performance tests for GrB_kron 363logstat ('test114',t) ; % % performance of reduce-to-scalar 364logstat ('test115',t) ; % 10 % GrB_assign with duplicate indices 365logstat ('test116',t) ; % % performance tests for GrB_assign 366logstat ('test117',t) ; % % performance tests for GrB_assign 367logstat ('test118',t) ; % % performance tests for GrB_assign 368logstat ('test119',t) ; % % performance tests for GrB_assign 369 370logstat ('test120',t) ; % % performance tests for GrB_assign 371logstat ('test121',t) ; % % performance tests for GrB_assign 372logstat ('test122',t) ; % % performance tests for GrB_assign 373logstat ('test123',t) ; % % test MIS on large matrix 374logstat ('test126',t) ; % 7 % test GrB_reduce to vector on a very sparse matrix 375 376logstat ('test147',t) ; % C<M>=A*B with very sparse M 377logstat ('test149',t) ; % test fine hash tasks for C<!M>=A*B 378 379logstat ('test168',t) ; % test C=A+B with C and B full, A bitmap 380logstat ('test171',t) ; % 1 % test conversion and GB_memset 381 382% tested via test16: 383logstat ('testc1',t) ; % % test complex operators 384logstat ('testc2',t) ; % % test complex A*B, A'*B, A*B', A'*B', A+B 385logstat ('testc3',t) ; % % test complex GrB_extract 386logstat ('testc4',t) ; % % test complex extractElement and setElement 387logstat ('testc5',t) ; % % test complex subref 388logstat ('testc6',t) ; % % test complex apply 389logstat ('testc7',t) ; % % test complex assign 390logstat ('testc8',t) ; % % test complex eWiseAdd and eWiseMult 391logstat ('testc9',t) ; % % test complex extractTuples 392logstat ('testca',t) ; % % test complex mxm, mxv, and vxm 393logstat ('testcb',t) ; % % test complex reduce 394logstat ('testcc',t) ; % % test complex transpose 395 396end 397 398if (malloc_debugging) 399 debug_on 400 fprintf ('[malloc debugging turned back on]\n') ; 401 f = fopen ('log.txt', 'a') ; 402 fprintf (f, '[malloc debugging turned back on]\n') ; 403 fclose (f) ; 404end 405 406t = toc (testall_time) ; 407fprintf ('\ntestall: all tests passed, total time %0.4g minutes\n', t / 60) ; 408 409