cupy / cupy/cupy

Allow setup code in `%gpu_timeit`

Open
#9,573 0 comments 0 reactions 1 assignee Claimed by @leofang View on GitHub
cat:enhancement prio:high
Dominant language
Python
Stars
12.3k
Forks
1.1k
Avg merge
1d 20h
Merged PRs (30d)
45

Description

> It seems that `args.code` is still active but ignored. Maybe add an error for that? (Mainly, because `%timeit` supports that as setup code I think).
>
> EDIT: For clarity, I mean:
>
> ```
> %%gpu_timeit -n100 a = cp.ones(100)
> a.sum()
> ```
>
> the `a = cp.ones(100)` is just ignored, but if it was used would be an error (and if it was called, should be setup code).
>
> If it is trivial to do as setup code, that would be even cooler of course.

_Originally posted by @seberg in https://github.com/cupy/cupy/pull/9561#discussion_r2661677837_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.