Skip to content

Using Chairmarks for CUDA benchmarks #174

@prabhuramachandran

Description

@prabhuramachandran

Thanks for a very handy and quick benchmarking tool!

This is probably more an issue with my lack of understanding than a bug but when benchmarking CUDA kernels, I often use @benchmark CUDA.@sync some_function($a1, $a2) but this will not quite work the same way with Chairmarks, it would be good to clarify the best approach to do this using Chairmarks as the naive translation will not do the right thing. Here is a small example.

import KernelAbstractions as KA
using CUDA

KA.@kernel function f(y, x, a, b)
    i = KA.@index(Global, Linear)
    y[i] = a[i]*x[i] + b[i]
end
n = 100000
x = CUDA.rand(n)
a = CUDA.rand(n);
b = CUDA.rand(n);
y = CUDA.fill(0.0, n)

func = f(KA.get_backend(x), 64)
@benchmark CUDA.@sync $func($y, $x, $a, $b, ndrange=size(y))

So how do I get chairmarks to call CUDA.@sync after every invocation of func? From the documentation, this is not what it would do if I just changed @benchmark to @be. I could create another function to do this but it would very nice if I could use chairmarks as a close-to-drop-in replacement for BenchmarkTools.

Thank you.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions