Comments (4)
Okay cool, thought that might be the case.
from parallelstencil.jl.
Ahh yes parallel_indices
is the kind of primitive I was looking for, thanks.
from parallelstencil.jl.
Thanks @ChrisRackauckas for reporting and happy to see you could combine ParallelStencil to OrdinaryDiffEq!
Regarding the BCs, there is indeed no specific API available in ParallelStencil. The current example assumes implicitly that T on the boundaries is kept to its initial value, i.e. 0. Imposing Dirichlet BCs in x-direction and Neumann (no flux) in y-direction, leaving the z-direction to 0, one could write
@parallel diffusion3D_step!(du, u, Ci, lam, dx, dy, dz)
T[1 ,: ,: ] .= 4 # Dirichlet with value = 4
T[end,: ,: ] .= 3 # Dirichlet with value = 3
T[: ,end,: ] .= T[:,end-1,:] # Dirichlet
T[: ,1 ,: ] .= T[:,2,:] # Neumann no flux
or combine them in a more compact way (and eventually put them into kernels - currently needed for to enable @hide_communication
to work with multi-GPUs).
-- EDIT --
When performance is relevant, BCs should be wrapped into a @parallel_indices
call:
@parallel_indices (iy,iz) function bc_x!(A::Data.Array)
A[1 , iy, iz] = 4
A[end, iy, iz] = 3
return
end
@parallel_indices (ix,iz) function bc_y!(A::Data.Array)
A[ix, 1 , iz] = A[ix, 2 , iz]
A[ix, end, iz] = A[ix, end-1, iz]
return
end
and called with the according range:
@parallel diffusion3D_step!(du, u, Ci, lam, dx, dy, dz)
@parallel (1:size(du,2), 1:size(du,3)) bc_x!(du)
@parallel (1:size(du,1), 1:size(du,3)) bc_y!(du)
as in e.g. this 3D example.
from parallelstencil.jl.
My example was 2D while yours 3D - see EDITs, also for the kernel version.
from parallelstencil.jl.
Related Issues (20)
- AMDGPU v0.5.0 compat HOT 1
- Add device_sync
- sync issues on AMDGPU backend
- Make CellArrays mutable HOT 4
- finite volume method HOT 3
- [JuliaCon/proceedings-review] @parallel keyword argument `loopopt` deprecated? HOT 1
- ParallelStencil on 1.10 HOT 6
- [JuliaCon/proceedings-review] DOI of paper by Besard et al. HOT 2
- [JuliaCon/proceedings-review] Community guidelines HOT 1
- [JuliaCon/proceedings-review] Performance metrics HOT 4
- Type unstable Data.Number HOT 2
- GPU memory management issue when running multi-GPU code HOT 10
- Add support for Polyester's `@batch` HOT 20
- Generalize loopopt
- Create and update GPU unit tests
- Thread (CPU) Float32/Float64 performance comparison on miniapp acoustic2D HOT 12
- Example for init_global_grid_usage HOT 3
- How to implement custom finite differencing operators HOT 8
- CUDA Crash with julia 1.9.0 HOT 8
- Non cartesian gather! HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from parallelstencil.jl.