Skip to content
Discussion options

You must be logged in to vote
amrex::ParallelFor(gbx,
    [=] AMREX_GPU_DEVICE(int i, int j, int k)
{
    for (int k = 0; k < 9; k++) {
        stateout(i, j, k) = statein(i, j, k);
    }
});

There is variable shadowing in your code. It can be very confusing. So I think you should fix that. It also appears to me that you are assuming the code is always 2d. Even in that case, I would still access the data with (i,j,k,n), not (i,j,n).

That being said, I suggest you do something like

amrex::ParallelFor(gbx, 9, [=] AMREX_GPU_DEVICE (int i, int j, int k, int n)
{
    if (bx.contains(i,j,k)) {
        // work on interior
        stateout(i, j, k,n) = statein(i, j, k,n);
    } else {
        // work on ghost cells
        R…

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@Afraid31
Comment options

@drummerdoc
Comment options

Answer selected by Afraid31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants