Comments (2)
Solved. This will work:
futures::executor::block_on(assert_device_pool_initialized());
let c = compile::<GlslKernel, GlslKernelCompile, Vec<u32>, GlobalCache>(
GlslKernel::new()
.param_mut::<[f32], _>(&format!("float[6][12] md"))
.with_kernel_code(
"
for (int j = 0; j < 12; j++) {
md[gl_GlobalInvocationID.x][j] = float(gl_GlobalInvocationID.x);
}
"
)
)?.finish()?;
let mut md: DeviceBox<[f32]> = vec![0.; 6 * 12].as_device_boxed_mut()?;
unsafe { spawn(6).launch(call!(c.clone(), &mut md))?; }
let result = futures::executor::block_on(md.get())?;
for row in result.chunks(12) {
println!("{:?}", row);
}
Prints:
[0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
[1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0]
[2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0]
[3.0, 3.0, 3.0, 3.0, 3.0, 3.0, 3.0, 3.0, 3.0, 3.0, 3.0, 3.0]
[4.0, 4.0, 4.0, 4.0, 4.0, 4.0, 4.0, 4.0, 4.0, 4.0, 4.0, 4.0]
[5.0, 5.0, 5.0, 5.0, 5.0, 5.0, 5.0, 5.0, 5.0, 5.0, 5.0, 5.0]
from emu.
Awesome! Glad you got this to work! I'm not actively developing emu but I'm happy to review and merge PRs.
PS. - I'd be curious to hear what you're using emu for.
from emu.
Related Issues (20)
- README instructions have various issues HOT 4
- Benchmarks HOT 3
- Benchmarks + against WebGPU
- Compiling error HOT 8
- Add badges to readme.md HOT 2
- Work group sizes greater than 32 don't work on Intel integrated GPU
- Important internal optimizations, potential bug
- Implementing more traits for `DeviceBox`
- Questions regarding the project HOT 1
- Logo is an ostrich not an emu HOT 1
- Unable to run on Ubuntu 20.04 due to python command HOT 1
- Rustdoc documentation search bar does not work
- Example code given in readme doesn't seem to work HOT 6
- coreaudio-sys AudioUnit compile error on Windows & Linux HOT 2
- em compilation fails, traits not implemented, and some missing imports? HOT 2
- Khronos ML summit
- `.finish()` stage of the shader compilation segfaults on NVIDIA Vulkan driver HOT 1
- Example panics at runtime (`COPY_DST` flag) HOT 4
- Current Project Status Update? HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from emu.