How to run loop without caching?

I need to run a gpu hungry function in a loop. I speculate that rust tends to cache the for loop instead of calling the function step by step for each i. By caching, it will use up all the device's gpu memory and crash the the program.
My question is how to force rust to run the program step by step

for i in 0..100 {
let a = gpu_hungry_function(x, y, z);
...
}

1 Like

I need to run a gpu hungry function in a loop. I speculate that rust tends to cache the for loop instead of calling the function step by step for each i

what do you mean here? I'm honestly not sure what you're talking about.
Plus, if it's a speculation, did you actually test to see if it will crash?

1 Like

Rust wont make your loop parallel for you, if that's what you're asking.

1 Like

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.