From 483ce111fd7a122893bb73538fe5b3672aa7b083 Mon Sep 17 00:00:00 2001 From: Billy Cao Date: Wed, 21 Oct 2026 20:52:11 +0800 Subject: [PATCH] Parallelize the cell loops inside each IB patch's gang --- src/simulation/m_ib_patches.fpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/simulation/m_ib_patches.fpp b/src/simulation/m_ib_patches.fpp index 35628a63ff..39cc036d25 100644 --- a/src/simulation/m_ib_patches.fpp +++ b/src/simulation/m_ib_patches.fpp @@ -217,7 +217,7 @@ contains do yp = yp_lower, yp_upper do zp = zp_lower, zp_upper $:GPU_PARALLEL_LOOP(private='[i, il, ir, j, jl, jr, k, kl, kr, xyz_local, length, radius, patch_id, & - & airfoil_id, model_id, encoded_patch_id, center, eta]', copyin='[xp, yp, zp]') + & airfoil_id, model_id, encoded_patch_id, center, eta]', copyin='[xp, yp, zp]', parallelism='[gang]') do patch_id = 1, num_ibs center(1) = patch_ib(patch_id)%x_centroid + real(xp, wp)*(glb_bounds(1)%end - glb_bounds(1)%beg) center(2) = patch_ib(patch_id)%y_centroid + real(yp, wp)*(glb_bounds(2)%end - glb_bounds(2)%beg) @@ -229,6 +229,8 @@ contains ! find the indices to the left and right of the IB in i, j, k call s_get_bounding_indices(patch_ib(patch_id), center, il, ir, jl, jr, kl, kr) + $:GPU_LOOP(collapse=3, parallelism='[vector]', private='[xyz_local, length, radius, airfoil_id, & + & model_id, eta]') do k = kl, kr do j = jl, jr do i = il, ir @@ -301,7 +303,7 @@ contains do xp = xp_lower, xp_upper do yp = yp_lower, yp_upper $:GPU_PARALLEL_LOOP(private='[i, il, ir, j, jl, jr, xyz_local, length, radius, patch_id, airfoil_id, & - & model_id, encoded_patch_id, center, eta]', copyin='[xp, yp]') + & model_id, encoded_patch_id, center, eta]', copyin='[xp, yp]', parallelism='[gang]') do patch_id = 1, num_ibs center(1) = patch_ib(patch_id)%x_centroid + real(xp, wp)*(glb_bounds(1)%end - glb_bounds(1)%beg) center(2) = patch_ib(patch_id)%y_centroid + real(yp, wp)*(glb_bounds(2)%end - glb_bounds(2)%beg) @@ -313,6 +315,8 @@ contains ! find the indices to the left and right of the IB in i, j, k call s_get_bounding_indices(patch_ib(patch_id), center, il, ir, jl, jr, kl, kr) + $:GPU_LOOP(collapse=2, parallelism='[vector]', & + & private='[xyz_local, length, radius, airfoil_id, model_id, eta]') do j = jl, jr do i = il, ir ! get coordinate frame centered on IB