Mercurial > repos > public > sbplib_julia
comparison Notes.md @ 1734:2311f33b6bd3 cleanup
Delete submodule DiffOps
author | Jonatan Werpers <jonatan@werpers.com> |
---|---|
date | Tue, 10 Sep 2024 20:42:41 +0200 |
parents | 52c2e6dff228 |
children | fe058a0ebd97 |
comparison
equal
deleted
inserted
replaced
1733:ec5589090faa | 1734:2311f33b6bd3 |
---|---|
390 We should make sure that `@inbounds` and `Base.@propagate_inbounds` are | 390 We should make sure that `@inbounds` and `Base.@propagate_inbounds` are |
391 applied correctly throughout the stack. When testing the performance of | 391 applied correctly throughout the stack. When testing the performance of |
392 stencil application on the bugfix/sbp_operators/stencil_return_type branch | 392 stencil application on the bugfix/sbp_operators/stencil_return_type branch |
393 there seemed to be some strange results where such errors could be the | 393 there seemed to be some strange results where such errors could be the |
394 culprit. | 394 culprit. |
395 | |
396 | |
397 ## Tiled loops and regions in apply | |
398 There should be easy ways to use functionalty splitting the application of a lazy array into regions and using tiled iteration. This could make the application more efficient by reducing branching and improving cache usage in the tight loop. On commit f215ac2a5c66 and before there were some early tests regarding this in a DiffOp submodule. | |
399 | |
400 The main ideas were: | |
401 ```julia | |
402 function apply_region!(D::DiffOpCartesian{2}, u::AbstractArray{T,2}, v::AbstractArray{T,2}) where T | |
403 apply_region!(D, u, v, Lower, Lower) | |
404 apply_region!(D, u, v, Lower, Interior) | |
405 apply_region!(D, u, v, Lower, Upper) | |
406 apply_region!(D, u, v, Interior, Lower) | |
407 apply_region!(D, u, v, Interior, Interior) | |
408 apply_region!(D, u, v, Interior, Upper) | |
409 apply_region!(D, u, v, Upper, Lower) | |
410 apply_region!(D, u, v, Upper, Interior) | |
411 apply_region!(D, u, v, Upper, Upper) | |
412 return nothing | |
413 end | |
414 ``` | |
415 | |
416 ```julia | |
417 using TiledIteration | |
418 function apply_region_tiled!(D::DiffOpCartesian{2}, u::AbstractArray{T,2}, v::AbstractArray{T,2}, r1::Type{<:Region}, r2::Type{<:Region}) where T | |
419 ri = regionindices(D.grid.size, closuresize(D.op), (r1,r2)) | |
420 # TODO: Pass Tilesize to function | |
421 for tileaxs ∈ TileIterator(axes(ri), padded_tilesize(T, (5,5), 2)) | |
422 for j ∈ tileaxs[2], i ∈ tileaxs[1] | |
423 I = ri[i,j] | |
424 u[I] = apply(D, v, (Index{r1}(I[1]), Index{r2}(I[2]))) | |
425 end | |
426 end | |
427 return nothing | |
428 end | |
429 ``` |