Skip to content

Trouble while using a GPU safe random function #3693

Answered by WeiqunZhang
attarnasir asked this question in Q&A
Discussion options

You must be logged in to vote

Try

        amrex::ParallelForRNG(vbx,
        [=] AMREX_GPU_DEVICE(int i, int j, int k, RandomEngine const& rd)
        {   
            Real noise = 0.02;
            phiNew(i,j,k) = 0.4 + noise*(0.5 - amrex::Random(rd));
        });

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@attarnasir
Comment options

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