Skip to content

Commit

Permalink
Complete 3D
Browse files Browse the repository at this point in the history
  • Loading branch information
huiyuxie committed Oct 4, 2024
1 parent afc1415 commit 774b556
Show file tree
Hide file tree
Showing 4 changed files with 117 additions and 127 deletions.
37 changes: 19 additions & 18 deletions src/auxiliary/configurators.jl
Original file line number Diff line number Diff line change
Expand Up @@ -57,29 +57,30 @@ function kernel_configurator_3d(kernel::HostKernel, x::Int, y::Int, z::Int)
end

# Deprecated old kernel configurators below
function configurator_1d(kernel::HostKernel, array::CuArray{<:Any, 1})
config = launch_configuration(kernel.fun)

threads = min(length(array), config.threads)
blocks = cld(length(array), threads)
# function configurator_1d(kernel::HostKernel, array::CuArray{<:Any, 1})
# config = launch_configuration(kernel.fun)

return (threads = threads, blocks = blocks)
end
# threads = min(length(array), config.threads)
# blocks = cld(length(array), threads)

function configurator_2d(kernel::HostKernel, array::CuArray{<:Any, 2})
config = launch_configuration(kernel.fun)
# return (threads = threads, blocks = blocks)
# end

threads = Tuple(fill(Int(floor((min(maximum(size(array)), config.threads))^(1 / 2))), 2))
blocks = map(cld, size(array), threads)
# function configurator_2d(kernel::HostKernel, array::CuArray{<:Any, 2})
# config = launch_configuration(kernel.fun)

return (threads = threads, blocks = blocks)
end
# threads = Tuple(fill(Int(floor((min(maximum(size(array)), config.threads))^(1 / 2))), 2))
# blocks = map(cld, size(array), threads)

function configurator_3d(kernel::HostKernel, array::CuArray{<:Any, 3})
config = launch_configuration(kernel.fun)
# return (threads = threads, blocks = blocks)
# end

threads = Tuple(fill(Int(floor((min(maximum(size(array)), config.threads))^(1 / 3))), 3))
blocks = map(cld, size(array), threads)
# function configurator_3d(kernel::HostKernel, array::CuArray{<:Any, 3})
# config = launch_configuration(kernel.fun)

return (threads = threads, blocks = blocks)
end
# threads = Tuple(fill(Int(floor((min(maximum(size(array)), config.threads))^(1 / 3))), 3))
# blocks = map(cld, size(array), threads)

# return (threads = threads, blocks = blocks)
# end
2 changes: 1 addition & 1 deletion src/solvers/dg_2d.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1536,7 +1536,7 @@ function cuda_prolong2mortars!(u, mesh::TreeMesh{2}, cache_mortars::True, dg::DG
orientations)
prolong_mortars_large2small_kernel(u_upper, u_lower, u, forward_upper, forward_lower,
neighbor_ids, large_sides, orientations;
kernel_configurator_3d(prolong_mortars_small2small_kernel,
kernel_configurator_3d(prolong_mortars_large2small_kernel,
size(u_upper, 2), size(u_upper, 3),
size(u_upper, 4))...)

Expand Down
Loading

0 comments on commit 774b556

Please sign in to comment.