JuliaORNL / JACC.jl

CPU/GPU parallel performance portable layer in Julia via functions as arguments
MIT License
19 stars 9 forks source link

Random Numbers #77

Closed PhilipFackler closed 4 months ago

PhilipFackler commented 4 months ago

My code is using the version CUDA.randn!(A::AnyCuArray) (here) from within a kernel. This corresponds to here. Is this something we could add to JACC or should I just try to wrap this myself? (The random number interface is pretty large. And right now I only need this one function.)

williamfgc commented 4 months ago

@PhilipFackler one quick check is to just use rand as-is in your kernel function. It should be overloaded by CUDA.jl and AMDGPU.jl as you point out in your link. Meaning that rand would be understood inside the kernel at compilation time as in here for CUDA.jl and here for AMDGPU.jl. Let me know if this worked as I need it for this app as well. Thanks.

PhilipFackler commented 4 months ago

@williamfgc you're right. I can't use the version I was using, but r = randn() works. Thanks.

williamfgc commented 4 months ago

@PhilipFackler do you think we can close this?