Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[cuda] Fix ti.random(dtype=ti.f64) #2042

Merged
merged 2 commits into from
Nov 11, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 10 additions & 13 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,19 @@ Related issue = #

<!--
Thanks for your PR!
If it's your first time contributing to Taichi, please make sure you have read our Contributor Guideline:
https://taichi.readthedocs.io/en/latest/contributor_guide.html
If it is your first time contributing to Taichi, please read our Contributor Guideline:
https://taichi.graphics/contribution/

- Please always prepend your PR title with tags such as [CUDA], [Lang], [Doc], [Example], e.g.:
[Lang] Add ti.Complex as Taichi class
- Use a lowercased tag for PRs that are invisible to end-users, i.e., won't be highlighted in changelog:
[cuda] [test] Fix out-of-memory error while running test
- More details: http://taichi.readthedocs.io/en/latest/contributor_guide.html#prtags
- Please always prepend your PR title with tags such as [CUDA], [Lang], [Doc], [Example]. E.g.:
[Lang] Add ti.sin
- Use upper-case tags (e.g., [Metal]) for PRs that change public APIs. Otherwise, please use lower-case tags (e.g., [metal]).
- More details: https://taichi.graphics/contribution/contributor_guide.html#pr-title-format-and-tags

- Please fill the following blank with the issue number this PR related to (if any):
Related issue = #2345
- If your PR will fix the issue **completely**, use the `close` or `fixes` keyword:
- Please fill in the issue number that this PR relates to.
- If your PR fixes the issue **completely**, use the `close` or `fixes` prefix so that GitHub automatically closes the issue when the PR is merged. For example,
Related issue = close #2345
- So that when the PR gets merged, GitHub will **automatically** close the issue #2345 for you.
- If the PR doesn't belong to any existing issue, and it's a trivial change, feel free to leave it blank :)
-->
- If the PR does not belong to any existing issue, free to leave it blank.
-->

[[Click here for the format server]](http://kun.csail.mit.edu:31415/)

Expand Down
2 changes: 1 addition & 1 deletion taichi/runtime/llvm/runtime.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1466,7 +1466,7 @@ f32 cuda_rand_f32(Context *context) {
return cuda_rand_u32(context) * (1.0f / 4294967296.0f);
}

f32 cuda_rand_f64(Context *context) {
f64 cuda_rand_f64(Context *context) {
return cuda_rand_f32(context);
}

Expand Down
9 changes: 9 additions & 0 deletions tests/python/test_random.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,3 +105,12 @@ def gen(i: ti.i32):
count += 1 if x[i] == x[i - 1] else 0

assert count <= n * 0.15


@ti.test(arch=[ti.cpu, ti.cuda])
def test_random_f64():
@ti.kernel
def foo() -> ti.f64:
return ti.random(dtype=ti.f64)

foo()