In a single kernel function, can we enable two commands with different condition ranges? For example, in a two-dimensional problem, the first condition executed is if (i>0 && i<imax); j=1. The second condition is if (j>0 && j<jmax); i=1. Would executing in this way lead to errors?
Its certainly legal to do that, just as it would be in C++.
I don’t know if this is spanning multiple threads, but if it results in multiple threads potentially writing to the same location A[i][j], then you might have to sort out simultaneous access in order to get the result you expect.