Last active
May 3, 2018 14:35
-
-
Save jrevels/20f5e1d7ac64c0b51099960ded3e4687 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using Test, SparseArrays, LinearAlgebra, Random | |
N, M, p = 10, 12, 0.3; | |
Q, X, Y, Z = sprand(N, M, p), sprand(Float32, N, M, p), sprand(N, M, p), sprand(N, M, p); | |
f(x, y, z) = x + y + z + 1; | |
broadcast!(+, Q, X, Y, Z); # warmup for @allocated | |
broadcast!(*, Q, X, Y, Z); # warmup for @allocated | |
broadcast!(f, Q, X, Y, Z); # warmup for @allocated | |
@test (@allocated broadcast!(+, Q, X, Y, Z)) == 0 | |
@test (@allocated broadcast!(*, Q, X, Y, Z)) == 0 | |
@test (@allocated broadcast!(f, Q, X, Y, Z)) == 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment