|
132 | 132 | test_noallocs_structured_decompression(1000; structure, partition, decompression) |
133 | 133 | end |
134 | 134 | end |
| 135 | + |
| 136 | +@testset "Single precision" begin |
| 137 | + n, p = 10_000, 0.001 |
| 138 | + A64 = sparse(Symmetric(sprand(rng, Float32, 100, 100, 0.1))) |
| 139 | + A32 = convert(SparseMatrixCSC{Float32,Int32}, A64) |
| 140 | + @testset "$structure - $partition - $decompression" for ( |
| 141 | + structure, partition, decompression |
| 142 | + ) in [ |
| 143 | + (:nonsymmetric, :column, :direct), |
| 144 | + (:nonsymmetric, :row, :direct), |
| 145 | + (:symmetric, :column, :direct), |
| 146 | + (:symmetric, :column, :substitution), |
| 147 | + (:nonsymmetric, :bidirectional, :direct), |
| 148 | + (:nonsymmetric, :bidirectional, :substitution), |
| 149 | + ] |
| 150 | + @testset for order in |
| 151 | + (NaturalOrder(), RandomOrder(), LargestFirst(), DynamicLargestFirst()) |
| 152 | + problem = ColoringProblem(; structure, partition) |
| 153 | + algo = GreedyColoringAlgorithm(order; decompression) |
| 154 | + b64 = @b fast_coloring(A64, problem, algo) |
| 155 | + b32 = @b fast_coloring(A32, problem, algo) |
| 156 | + # check that we allocate no more than 50% + epsilon with Int32 |
| 157 | + if decompression == :direct |
| 158 | + @test b32.bytes < 0.6 * b64.bytes |
| 159 | + else |
| 160 | + @test_broken b32.bytes < 0.6 * b64.bytes |
| 161 | + end |
| 162 | + end |
| 163 | + end |
| 164 | +end; |
0 commit comments