3 ms·
> If your `foreach` loop's body uses any of those features then it will not be launched as a kernel even though `foreach` signals order-independence. Is this s
by misnome 3y ago
> If your `foreach` loop's body uses any of those features then it will not be launched as a kernel even though `foreach` signals order-independence.
Is this signalled/warned about so that you don’t accidentally use one of these features and kill your performance? Or a way to indicate that you specifically intend it to be run on GPU?
- danilafe 3y agoIt's not signaled / warned about by default. However, if you want to make sure your `foreach` loop runs on the GPU, you can use the `@assertOnGpu` attribute. For instance, the following program would not compile: @assertOnGpu foreach i in 1..10 { /* Do something that can't be done on a GPU. */ } The compiler will print a message explaining why the loop was not eligible for GPU execution.
- e-kayrakli 3y agoI'll also add to @danilafe's reply that we have a GpuDiagnostics module which would count kernel launches or report them as they occur in a section of code. Something like that can be used to debug parts of your code where you do or don't expect kernel launches to occur. See https://chapel-lang.org/docs/main/modules/standard/GpuDiagnostics.html https://chapel-lang.org/docs/main/modules/standard/GpuDiagno...