@@ -60,7 +60,9 @@ module m_start_up
6060 & s_initialize_mpi_domain, s_finalize_modules, s_perform_time_step, s_save_data, s_save_performance_metrics
6161
6262 type(scalar_field), allocatable, dimension (:) :: q_cons_temp
63- real (wp) :: dt_init
63+ real (wp), allocatable, dimension (:) :: probe_dc
64+ $:GPU_DECLARE(create= ' [probe_dc]' )
65+ real (wp) :: dt_init
6466
6567contains
6668
@@ -1032,6 +1034,22 @@ contains
10321034 end subroutine s_initialize_mpi_domain
10331035
10341036 !> Transfer initial conservative variable and model parameter data to the GPU device
1037+ subroutine s_probe_num_fluids_dummy (arr , pres , out )
1038+
1039+ $:GPU_ROUTINE(parallelism= ' [seq]' )
1040+
1041+ #:if not MFC_CASE_OPTIMIZATION and USING_AMD
1042+ real (wp), dimension (3 ), intent (in ) :: arr
1043+ #:else
1044+ real (wp), dimension (num_fluids), intent (in ) :: arr
1045+ #:endif
1046+ real (wp), intent (in ) :: pres
1047+ real (wp), intent (out ) :: out
1048+
1049+ call s_phase_bulk_modulus(pres, 0.5_wp , arr(1 ), 1 , out )
1050+
1051+ end subroutine s_probe_num_fluids_dummy
1052+
10351053 subroutine s_initialize_gpu_vars
10361054
10371055 integer :: i, n, kk
@@ -1042,6 +1060,12 @@ contains
10421060 integer , dimension (6 ) :: nbad, nfirst
10431061 real (wp) :: rho, gamma, pi_inf, dpi, dgamma, tmp
10441062
1063+ #:if not MFC_CASE_OPTIMIZATION and USING_AMD
1064+ real (wp), dimension (3 ) :: arrp
1065+ #:else
1066+ real (wp), dimension (num_fluids) :: arrp
1067+ #:endif
1068+
10451069 if (.not. down_sample) then
10461070 do i = 1 , sys_size
10471071 $:GPU_UPDATE(device= ' [q_cons_ts(1)%vf(i)%sf]' )
@@ -1107,38 +1131,40 @@ contains
11071131 $:GPU_UPDATE(device= ' [igr, nb, igr_order]' )
11081132 #:endif
11091133
1110- ! CI probe: every EOS helper over many lanes with per- lane inputs, device against host.
1111- @:ALLOCATE(pin(1 :np), pout(1 :np, 1 :6 ))
1134+ ! CI probe: which argument kinds break a device- routine call on this backend. Per lane n, six calls of the same
1135+ ! helper; only the kind of one argument differs. Host recomputes each; mismatch counts are printed per kernel.
1136+ @:ALLOCATE(pin(1 :np), pout(1 :np, 1 :6 ), probe_dc(1 :np))
11121137 do n = 1 , np
11131138 pin(n) = 1._wp + 1.e-3_wp * n
1139+ probe_dc(n) = 0._wp
11141140 end do
1115- $:GPU_UPDATE(device= ' [pin]' )
1116- $:GPU_PARALLEL_LOOP(private= ' [n, rho, gamma, pi_inf, dpi, dgamma, tmp ]' )
1141+ $:GPU_UPDATE(device= ' [pin, probe_dc ]' )
1142+ $:GPU_PARALLEL_LOOP(private= ' [n, tmp, arrp ]' )
11171143 do n = 1 , np
1118- pout(n, 1 ) = f_bulk_modulus(pin(n), gammas(1 ), pi_infs(1 ))
1119- call s_phase_coefficients(0.5_wp * pin(n), 0.5_wp , 1 , rho, gamma, pi_inf, dpi, dgamma)
1120- pout(n, 2 ) = gamma* pin(n) + pi_inf + rho
1121- call s_phase_bulk_modulus(pin(n), 0.5_wp , 0.5_wp * pin(n), 1 , pout(n, 3 ))
1122- call s_phase_bulk_modulus(pin(n), 0.5_wp , 0.5_wp * pin(n), 1 , tmp)
1144+ call s_phase_bulk_modulus(pin(n), 0.5_wp , 0.5_wp * pin(n), 1 , probe_dc(n))
1145+ call s_phase_bulk_modulus(pin(n), q_cons_ts(1 )%vf(1 )%sf(0 , 0 , 0 ), 0.5_wp * pin(n), 1 , tmp)
1146+ pout(n, 2 ) = tmp
1147+ call s_phase_bulk_modulus(gammas(1 ), 0.5_wp , 0.5_wp * pin(n), 1 , tmp)
1148+ pout(n, 3 ) = tmp
1149+ arrp(1 ) = 0.5_wp * pin(n)
1150+ call s_probe_num_fluids_dummy(arrp, pin(n), tmp)
11231151 pout(n, 4 ) = tmp
1124- call s_phase_internal_energy (pin(n), 0.5_wp , 0.5_wp * pin(n), 1 , tmp)
1152+ call s_phase_bulk_modulus (pin(n), 0.5_wp , 0.5_wp * pin(n), 1 , tmp)
11251153 pout(n, 5 ) = tmp
1126- call s_eos_coefficients(pin(n), 1 , gamma, pi_inf, dpi, dgamma)
1127- pout(n, 6 ) = gamma* pin(n) + pi_inf + dpi + dgamma
1154+ call s_phase_bulk_modulus(pin(n), 0.5_wp , 0.5_wp * pin(n), 1 , pout(n, 6 ))
11281155 end do
11291156 $:END_GPU_PARALLEL_LOOP()
1130- $:GPU_UPDATE(host= ' [pout]' )
1157+ $:GPU_UPDATE(host= ' [pout, probe_dc ]' )
11311158 nbad = 0
11321159 nfirst = 0
11331160 do n = 1 , np
1134- href(1 ) = f_bulk_modulus(pin(n), gammas(1 ), pi_infs(1 ))
1135- call s_phase_coefficients(0.5_wp * pin(n), 0.5_wp , 1 , rho, gamma, pi_inf, dpi, dgamma)
1136- href(2 ) = gamma* pin(n) + pi_inf + rho
1137- call s_phase_bulk_modulus(pin(n), 0.5_wp , 0.5_wp * pin(n), 1 , href(3 ))
1138- href(4 ) = href(3 )
1139- call s_phase_internal_energy(pin(n), 0.5_wp , 0.5_wp * pin(n), 1 , href(5 ))
1140- call s_eos_coefficients(pin(n), 1 , gamma, pi_inf, dpi, dgamma)
1141- href(6 ) = gamma* pin(n) + pi_inf + dpi + dgamma
1161+ call s_phase_bulk_modulus(pin(n), 0.5_wp , 0.5_wp * pin(n), 1 , href(1 ))
1162+ pout(n, 1 ) = probe_dc(n)
1163+ call s_phase_bulk_modulus(pin(n), q_cons_ts(1 )%vf(1 )%sf(0 , 0 , 0 ), 0.5_wp * pin(n), 1 , href(2 ))
1164+ call s_phase_bulk_modulus(gammas(1 ), 0.5_wp , 0.5_wp * pin(n), 1 , href(3 ))
1165+ href(4 ) = href(1 )
1166+ href(5 ) = href(1 )
1167+ href(6 ) = href(1 )
11421168 do kk = 1 , 6
11431169 if (.not. abs (pout(n, kk) - href(kk)) <= 1.e-12_wp * abs (href(kk))) then
11441170 nbad(kk) = nbad(kk) + 1
@@ -1147,13 +1173,13 @@ contains
11471173 end do
11481174 end do
11491175 if (proc_rank == 0 ) then
1150- print ' (A, 6I8)' , ' eos probe mismatches per kernel (of 100000): ' , nbad
1176+ print ' (A, 6I8)' , ' eos probe kinds: declare-out attached-in declare-in nfdummy-in scalars enterdata-out ' , nbad
11511177 do kk = 1 , 6
1152- if (nfirst(kk) > 0 ) print ' (A, I2, A, I7, 2ES24.15)' , ' eos probe kernel ' , kk, ' first bad lane ' , nfirst(kk), &
1178+ if (nfirst(kk) > 0 ) print ' (A, I2, A, I7, 2ES24.15)' , ' eos probe kind ' , kk, ' first bad lane ' , nfirst(kk), &
11531179 & pout(nfirst(kk), kk), href(kk)
11541180 end do
11551181 end if
1156- @:DEALLOCATE(pin, pout)
1182+ @:DEALLOCATE(pin, pout, probe_dc )
11571183
11581184 end subroutine s_initialize_gpu_vars
11591185
0 commit comments