-
Notifications
You must be signed in to change notification settings - Fork 154
fix(sim): Euler–Euler bubbles GPU data race on shared bubble-wall scratch #1648
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -17,11 +17,6 @@ module m_bubbles | |
|
|
||
| implicit none | ||
|
|
||
| real(wp) :: chi_vw !< Bubble wall properties (Ando 2010) | ||
| real(wp) :: k_mw !< Bubble wall properties (Ando 2010) | ||
| real(wp) :: rho_mw !< Bubble wall properties (Ando 2010) | ||
| $:GPU_DECLARE(create='[chi_vw, k_mw, rho_mw]') | ||
|
|
||
| contains | ||
|
|
||
| !> Compute the bubble radial acceleration based on the selected bubble model | ||
|
|
@@ -251,7 +246,7 @@ contains | |
| end subroutine s_bwproperty | ||
|
|
||
| !> Compute the vapour flux | ||
| subroutine s_vflux(fR, fV, fpb, fmass_v, iR0, vflux, fmass_g, fbeta_c, fR_m, fgamma_m) | ||
| subroutine s_vflux(fR, fV, fpb, fmass_v, iR0, vflux, fmass_g, fbeta_c, fR_m, fgamma_m, fchi_vw, frho_mw) | ||
|
|
||
| $:GPU_ROUTINE(parallelism='[seq]') | ||
| real(wp), intent(in) :: fR | ||
|
|
@@ -262,6 +257,7 @@ contains | |
| real(wp), intent(out) :: vflux | ||
| real(wp), intent(in), optional :: fmass_g, fbeta_c | ||
| real(wp), intent(out), optional :: fR_m, fgamma_m | ||
| real(wp), intent(in), optional :: fchi_vw, frho_mw !< Per-thread bubble-wall scratch (Euler-Euler path) | ||
| real(wp) :: chi_bar | ||
| real(wp) :: rho_mw_lag | ||
| real(wp) :: grad_chi | ||
|
|
@@ -288,8 +284,8 @@ contains | |
| end if | ||
| else | ||
| chi_bar = fmass_v/(fmass_v + mass_g0(iR0)) | ||
| grad_chi = -Re_trans_c(iR0)*(chi_bar - chi_vw) | ||
| vflux = rho_mw*grad_chi/Pe_c/(1._wp - chi_vw)/fR | ||
| grad_chi = -Re_trans_c(iR0)*(chi_bar - fchi_vw) | ||
| vflux = frho_mw*grad_chi/Pe_c/(1._wp - fchi_vw)/fR | ||
| end if | ||
| else | ||
| ! polytropic | ||
|
|
@@ -299,7 +295,7 @@ contains | |
| end subroutine s_vflux | ||
|
|
||
| !> Compute the time derivative of the internal bubble pressure | ||
| function f_bpres_dot(fvflux, fR, fV, fpb, fmass_v, iR0, fbeta_t, fR_m, fgamma_m) | ||
| function f_bpres_dot(fvflux, fR, fV, fpb, fmass_v, iR0, fbeta_t, fR_m, fgamma_m, fk_mw) | ||
|
|
||
| $:GPU_ROUTINE(parallelism='[seq]') | ||
| real(wp), intent(in) :: fvflux | ||
|
|
@@ -309,6 +305,7 @@ contains | |
| real(wp), intent(in) :: fmass_v | ||
| integer, intent(in) :: iR0 | ||
| real(wp), intent(in), optional :: fbeta_t, fR_m, fgamma_m | ||
| real(wp), intent(in), optional :: fk_mw !< Per-thread bubble-wall conductivity scratch (Euler-Euler path) | ||
| real(wp) :: T_bar | ||
| real(wp) :: grad_T | ||
| real(wp) :: f_bpres_dot | ||
|
|
@@ -324,7 +321,7 @@ contains | |
| end if | ||
| grad_T = -Re_trans_T(iR0)*((fpb/pb0(iR0))*(fR/R0(iR0))**3*(mass_g0(iR0) + mass_v0(iR0))/(mass_g0(iR0) + fmass_v) & | ||
| & - 1._wp) | ||
| f_bpres_dot = 3._wp*gam_m*(-fV*fpb + fvflux*R_v*Tw + pb0(iR0)*k_mw*grad_T/Pe_T(iR0)/fR)/fR | ||
| f_bpres_dot = 3._wp*gam_m*(-fV*fpb + fvflux*R_v*Tw + pb0(iR0)*fk_mw*grad_T/Pe_T(iR0)/fR)/fR | ||
| else | ||
|
Comment on lines
307
to
325
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same reasoning as the |
||
| f_bpres_dot = -3._wp*gam_m*fV/fR*(fpb - pv) | ||
| end if | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The
thermal == 3 .and. .not. bubbles_lagrangebranch that readsfchi_vw/frho_mwis only reachable from the Euler–Euler source loop (m_bubbles_EE), which always computes these vias_bwpropertyinto per-thread scratch and passes them (fchi_vw=chi_vw_l, frho_mw=rho_mw_l). The other callers — the Lagrangian path (m_bubbles_EL) and the adaptive substep — run withbubbles_lagrange = .true., so they take thebubbles_lagrangebranch above and never touch these optionals. So the branch is never entered with the optionals absent.These are
$:GPU_ROUTINE(parallelism='[seq]')device routines, so an@:ASSERT(present(...))guard isn't available on-device, and a locals_bwpropertyfallback would duplicate the bubble-wall computation into the device path for an unreachable case; the coupling is enforced by the caller structure instead. (PR is now rebased onto master post-#1290, which reworked these routines to non-elemental — the fix re-applies cleanly.)