Skip to content

Commit 4b1f0b8

Browse files
authored
Merge pull request #2616 from rust-lang/gpu-example-update
Add the gpu version of the kernel which was missing in the docs
2 parents 0a70018 + ae6a72b commit 4b1f0b8

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/offload/usage.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,13 @@ fn main() {
5656
unsafe extern "C" {
5757
pub fn kernel_1(array_b: *mut [f64; 256]);
5858
}
59+
60+
#[cfg(not(target_os = "linux"))]
61+
#[unsafe(no_mangle)]
62+
#[inline(never)]
63+
pub extern "gpu-kernel" fn kernel_1(x: *mut [f64; 256]) {
64+
unsafe { (*x)[0] = 21.0 };
65+
}
5966
```
6067

6168
## Compile instructions

0 commit comments

Comments
 (0)