Skip to content
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

Remove Allocate Global #722

Merged
merged 4 commits into from
Nov 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 0 additions & 14 deletions src/common/include/macros.fpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,20 +22,6 @@
!$acc exit data delete(${', '.join(args)}$)
#:enddef DEALLOCATE

#:def ALLOCATE_GLOBAL(*args)
@:LOG({'@:ALLOCATE_GLOBAL(${re.sub(' +', ' ', ', '.join(args))}$)'})

allocate (${', '.join(args)}$)

#:enddef ALLOCATE_GLOBAL

#:def DEALLOCATE_GLOBAL(*args)
@:LOG({'@:DEALLOCATE_GLOBAL(${re.sub(' +', ' ', ', '.join(args))}$)'})

deallocate (${', '.join(args)}$)

#:enddef DEALLOCATE_GLOBAL

#:def ACC_SETUP_VFs(*args)
#ifdef _CRAYFTN
block
Expand Down
6 changes: 3 additions & 3 deletions src/common/m_helper.fpp
Original file line number Diff line number Diff line change
Expand Up @@ -121,9 +121,9 @@
rhol0 = rhoref
pl0 = pref
#ifdef MFC_SIMULATION
@:ALLOCATE_GLOBAL(pb0(nb), mass_n0(nb), mass_v0(nb), Pe_T(nb))
@:ALLOCATE_GLOBAL(k_n(nb), k_v(nb), omegaN(nb))
@:ALLOCATE_GLOBAL(Re_trans_T(nb), Re_trans_c(nb), Im_trans_T(nb), Im_trans_c(nb))
@:ALLOCATE(pb0(nb), mass_n0(nb), mass_v0(nb), Pe_T(nb))
@:ALLOCATE(k_n(nb), k_v(nb), omegaN(nb))
@:ALLOCATE(Re_trans_T(nb), Re_trans_c(nb), Im_trans_T(nb), Im_trans_c(nb))

Check warning on line 126 in src/common/m_helper.fpp

View check run for this annotation

Codecov / codecov/patch

src/common/m_helper.fpp#L124-L126

Added lines #L124 - L126 were not covered by tests
#else
@:ALLOCATE(pb0(nb), mass_n0(nb), mass_v0(nb), Pe_T(nb))
@:ALLOCATE(k_n(nb), k_v(nb), omegaN(nb))
Expand Down
24 changes: 12 additions & 12 deletions src/common/m_variables_conversion.fpp
Original file line number Diff line number Diff line change
Expand Up @@ -621,14 +621,14 @@
!$acc enter data copyin(is1b, is1e, is2b, is2e, is3b, is3e)

#ifdef MFC_SIMULATION
@:ALLOCATE_GLOBAL(gammas (1:num_fluids))
@:ALLOCATE_GLOBAL(gs_min (1:num_fluids))
@:ALLOCATE_GLOBAL(pi_infs(1:num_fluids))
@:ALLOCATE_GLOBAL(ps_inf(1:num_fluids))
@:ALLOCATE_GLOBAL(cvs (1:num_fluids))
@:ALLOCATE_GLOBAL(qvs (1:num_fluids))
@:ALLOCATE_GLOBAL(qvps (1:num_fluids))
@:ALLOCATE_GLOBAL(Gs (1:num_fluids))
@:ALLOCATE(gammas (1:num_fluids))
@:ALLOCATE(gs_min (1:num_fluids))
@:ALLOCATE(pi_infs(1:num_fluids))
@:ALLOCATE(ps_inf(1:num_fluids))
@:ALLOCATE(cvs (1:num_fluids))
@:ALLOCATE(qvs (1:num_fluids))
@:ALLOCATE(qvps (1:num_fluids))
@:ALLOCATE(Gs (1:num_fluids))
#else
@:ALLOCATE(gammas (1:num_fluids))
@:ALLOCATE(gs_min (1:num_fluids))
Expand All @@ -655,7 +655,7 @@
#ifdef MFC_SIMULATION

if (viscous) then
@:ALLOCATE_GLOBAL(Res(1:2, 1:maxval(Re_size)))
@:ALLOCATE(Res(1:2, 1:maxval(Re_size)))

Check warning on line 658 in src/common/m_variables_conversion.fpp

View check run for this annotation

Codecov / codecov/patch

src/common/m_variables_conversion.fpp#L658

Added line #L658 was not covered by tests
do i = 1, 2
do j = 1, Re_size(i)
Res(i, j) = fluid_pp(Re_idx(i, j))%Re(i)
Expand All @@ -668,7 +668,7 @@

if (bubbles) then
#ifdef MFC_SIMULATION
@:ALLOCATE_GLOBAL(bubrs(1:nb))
@:ALLOCATE(bubrs(1:nb))

Check warning on line 671 in src/common/m_variables_conversion.fpp

View check run for this annotation

Codecov / codecov/patch

src/common/m_variables_conversion.fpp#L671

Added line #L671 was not covered by tests
#else
@:ALLOCATE(bubrs(1:nb))
#endif
Expand Down Expand Up @@ -1361,9 +1361,9 @@
#endif

#ifdef MFC_SIMULATION
@:DEALLOCATE_GLOBAL(gammas, gs_min, pi_infs, ps_inf, cvs, qvs, qvps, Gs)
@:DEALLOCATE(gammas, gs_min, pi_infs, ps_inf, cvs, qvs, qvps, Gs)
if (bubbles) then
@:DEALLOCATE_GLOBAL(bubrs)
@:DEALLOCATE(bubrs)

Check warning on line 1366 in src/common/m_variables_conversion.fpp

View check run for this annotation

Codecov / codecov/patch

src/common/m_variables_conversion.fpp#L1366

Added line #L1366 was not covered by tests
end if
#else
@:DEALLOCATE(gammas, gs_min, pi_infs, ps_inf, cvs, qvs, qvps, Gs)
Expand Down
12 changes: 6 additions & 6 deletions src/simulation/m_acoustic_src.fpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
subroutine s_initialize_acoustic_src
integer :: i, j !< generic loop variables

@:ALLOCATE_GLOBAL(loc_acoustic(1:3, 1:num_source), mag(1:num_source), dipole(1:num_source), support(1:num_source), length(1:num_source), height(1:num_source), wavelength(1:num_source), frequency(1:num_source), gauss_sigma_dist(1:num_source), gauss_sigma_time(1:num_source), foc_length(1:num_source), aperture(1:num_source), npulse(1:num_source), pulse(1:num_source), dir(1:num_source), delay(1:num_source), element_polygon_ratio(1:num_source), rotate_angle(1:num_source), element_spacing_angle(1:num_source), num_elements(1:num_source), element_on(1:num_source))
@:ALLOCATE(loc_acoustic(1:3, 1:num_source), mag(1:num_source), dipole(1:num_source), support(1:num_source), length(1:num_source), height(1:num_source), wavelength(1:num_source), frequency(1:num_source), gauss_sigma_dist(1:num_source), gauss_sigma_time(1:num_source), foc_length(1:num_source), aperture(1:num_source), npulse(1:num_source), pulse(1:num_source), dir(1:num_source), delay(1:num_source), element_polygon_ratio(1:num_source), rotate_angle(1:num_source), element_spacing_angle(1:num_source), num_elements(1:num_source), element_on(1:num_source))

Check warning on line 66 in src/simulation/m_acoustic_src.fpp

View check run for this annotation

Codecov / codecov/patch

src/simulation/m_acoustic_src.fpp#L66

Added line #L66 was not covered by tests
do i = 1, num_source
do j = 1, 3
loc_acoustic(j, i) = acoustic(i)%loc(j)
Expand Down Expand Up @@ -103,9 +103,9 @@
end do
!$acc update device(loc_acoustic, mag, dipole, support, length, height, wavelength, frequency, gauss_sigma_dist, gauss_sigma_time, foc_length, aperture, npulse, pulse, dir, delay, element_polygon_ratio, rotate_angle, element_spacing_angle, num_elements, element_on)

@:ALLOCATE_GLOBAL(mass_src(0:m, 0:n, 0:p))
@:ALLOCATE_GLOBAL(mom_src(1:num_dims, 0:m, 0:n, 0:p))
@:ALLOCATE_GLOBAL(E_src(0:m, 0:n, 0:p))
@:ALLOCATE(mass_src(0:m, 0:n, 0:p))
@:ALLOCATE(mom_src(1:num_dims, 0:m, 0:n, 0:p))
@:ALLOCATE(E_src(0:m, 0:n, 0:p))

Check warning on line 108 in src/simulation/m_acoustic_src.fpp

View check run for this annotation

Codecov / codecov/patch

src/simulation/m_acoustic_src.fpp#L106-L108

Added lines #L106 - L108 were not covered by tests

end subroutine s_initialize_acoustic_src

Expand Down Expand Up @@ -370,8 +370,8 @@
dim = 3
end if

@:ALLOCATE_GLOBAL(source_spatials_num_points(1:num_source))
@:ALLOCATE_GLOBAL(source_spatials(1:num_source))
@:ALLOCATE(source_spatials_num_points(1:num_source))
@:ALLOCATE(source_spatials(1:num_source))

Check warning on line 374 in src/simulation/m_acoustic_src.fpp

View check run for this annotation

Codecov / codecov/patch

src/simulation/m_acoustic_src.fpp#L373-L374

Added lines #L373 - L374 were not covered by tests

do ai = 1, num_source
! First pass: Count the number of points for each source
Expand Down
8 changes: 4 additions & 4 deletions src/simulation/m_body_forces.fpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,18 +37,18 @@
if (n > 0) then
! Simulation is 3D
if (p > 0) then
@:ALLOCATE_GLOBAL (rhoM(-buff_size:buff_size + m, &
@:ALLOCATE (rhoM(-buff_size:buff_size + m, &

Check warning on line 40 in src/simulation/m_body_forces.fpp

View check run for this annotation

Codecov / codecov/patch

src/simulation/m_body_forces.fpp#L40

Added line #L40 was not covered by tests
-buff_size:buff_size + n, &
-buff_size:buff_size + p))
! Simulation is 2D
else
@:ALLOCATE_GLOBAL (rhoM(-buff_size:buff_size + m, &
@:ALLOCATE (rhoM(-buff_size:buff_size + m, &

Check warning on line 45 in src/simulation/m_body_forces.fpp

View check run for this annotation

Codecov / codecov/patch

src/simulation/m_body_forces.fpp#L45

Added line #L45 was not covered by tests
-buff_size:buff_size + n, &
0:0))
end if
! Simulation is 1D
else
@:ALLOCATE_GLOBAL (rhoM(-buff_size:buff_size + m, &
@:ALLOCATE (rhoM(-buff_size:buff_size + m, &

Check warning on line 51 in src/simulation/m_body_forces.fpp

View check run for this annotation

Codecov / codecov/patch

src/simulation/m_body_forces.fpp#L51

Added line #L51 was not covered by tests
0:0, &
0:0))
end if
Expand Down Expand Up @@ -173,7 +173,7 @@

subroutine s_finalize_body_forces_module

@:DEALLOCATE_GLOBAL(rhoM)
@:DEALLOCATE(rhoM)

Check warning on line 176 in src/simulation/m_body_forces.fpp

View check run for this annotation

Codecov / codecov/patch

src/simulation/m_body_forces.fpp#L176

Added line #L176 was not covered by tests

end subroutine s_finalize_body_forces_module

Expand Down
18 changes: 9 additions & 9 deletions src/simulation/m_bubbles.fpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,11 @@

integer :: l

@:ALLOCATE_GLOBAL(rs(1:nb))
@:ALLOCATE_GLOBAL(vs(1:nb))
@:ALLOCATE(rs(1:nb))
@:ALLOCATE(vs(1:nb))

Check warning on line 46 in src/simulation/m_bubbles.fpp

View check run for this annotation

Codecov / codecov/patch

src/simulation/m_bubbles.fpp#L45-L46

Added lines #L45 - L46 were not covered by tests
if (.not. polytropic) then
@:ALLOCATE_GLOBAL(ps(1:nb))
@:ALLOCATE_GLOBAL(ms(1:nb))
@:ALLOCATE(ps(1:nb))
@:ALLOCATE(ms(1:nb))

Check warning on line 49 in src/simulation/m_bubbles.fpp

View check run for this annotation

Codecov / codecov/patch

src/simulation/m_bubbles.fpp#L48-L49

Added lines #L48 - L49 were not covered by tests
end if

do l = 1, nb
Expand All @@ -66,11 +66,11 @@
@:ALLOCATE(divu%sf(idwbuff(1)%beg:idwbuff(1)%end, idwbuff(2)%beg:idwbuff(2)%end, idwbuff(3)%beg:idwbuff(3)%end))
@:ACC_SETUP_SFs(divu)

@:ALLOCATE_GLOBAL(bub_adv_src(0:m, 0:n, 0:p))
@:ALLOCATE_GLOBAL(bub_r_src(0:m, 0:n, 0:p, 1:nb))
@:ALLOCATE_GLOBAL(bub_v_src(0:m, 0:n, 0:p, 1:nb))
@:ALLOCATE_GLOBAL(bub_p_src(0:m, 0:n, 0:p, 1:nb))
@:ALLOCATE_GLOBAL(bub_m_src(0:m, 0:n, 0:p, 1:nb))
@:ALLOCATE(bub_adv_src(0:m, 0:n, 0:p))
@:ALLOCATE(bub_r_src(0:m, 0:n, 0:p, 1:nb))
@:ALLOCATE(bub_v_src(0:m, 0:n, 0:p, 1:nb))
@:ALLOCATE(bub_p_src(0:m, 0:n, 0:p, 1:nb))
@:ALLOCATE(bub_m_src(0:m, 0:n, 0:p, 1:nb))

Check warning on line 73 in src/simulation/m_bubbles.fpp

View check run for this annotation

Codecov / codecov/patch

src/simulation/m_bubbles.fpp#L69-L73

Added lines #L69 - L73 were not covered by tests

end subroutine s_initialize_bubbles_module

Expand Down
Loading
Loading