From 6c667c42d5fa369e1815a2cdd30276e21d7ee6bb Mon Sep 17 00:00:00 2001 From: Valentin Seitz Date: Tue, 3 Feb 2026 16:54:36 +0100 Subject: [PATCH 1/8] Add OpenMP Cmake Stuff --- COMPILATION/CMakeLists.txt | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/COMPILATION/CMakeLists.txt b/COMPILATION/CMakeLists.txt index 7b89f49440..3da7069894 100644 --- a/COMPILATION/CMakeLists.txt +++ b/COMPILATION/CMakeLists.txt @@ -26,6 +26,7 @@ option(STELLA_ENABLE_FFT "Enable FFTs" ON) option(STELLA_ENABLE_NETCDF "Enable NetCDF" ON) option(STELLA_ENABLE_DOUBLE "Promotes precisions of real and complex to double" ON) option(STELLA_ENABLE_PETSC "Enable PETSc" OFF) +option(STELLA_ENABLE_OMP "Enable OpenMP" OFF) # Options for utils internal library option(STELLA_ENABLE_LOCAL_SPFUNC "Enable local special functions" OFF) @@ -294,6 +295,12 @@ if (STELLA_ENABLE_PETSC) target_link_libraries(libstella PUBLIC PETSc::PETSc) endif() +if (STELLA_ENABLE_OMP) + find_package(OpenMP REQUIRED Fortran) + target_link_libraries(libstella PUBLIC OpenMP::OpenMP_Fortran) + target_compile_definitions(libstella PUBLIC WITH_OPENMP) +endif() + # Link the program add_subdirectory(../EXTERNALS/git_version ${CMAKE_CURRENT_BINARY_DIR}/EXTERNALS/git_version) target_link_libraries(libstella PUBLIC fortran_git::fortran_git) From c39a49c3ec06c8b580a5e3b1d3842857373d5db9 Mon Sep 17 00:00:00 2001 From: Valentin Seitz Date: Tue, 3 Feb 2026 16:54:43 +0100 Subject: [PATCH 2/8] add first 3 files --- STELLA_CODE/arrays/arrays_gyro_averages.f90 | 8 +++++ .../calculations/calculations_transforms.f90 | 29 ++++++++++++++++++- .../initialise_redistribute.f90 | 17 +++++++++-- 3 files changed, 51 insertions(+), 3 deletions(-) diff --git a/STELLA_CODE/arrays/arrays_gyro_averages.f90 b/STELLA_CODE/arrays/arrays_gyro_averages.f90 index d780d98fa9..d2a05fb4e7 100644 --- a/STELLA_CODE/arrays/arrays_gyro_averages.f90 +++ b/STELLA_CODE/arrays/arrays_gyro_averages.f90 @@ -155,6 +155,12 @@ subroutine init_bessel_versus_mu_aj0v_aj1v ! Calculate the Bessel functions J_0(x) and J_1(x) on the (nmu) grid ! Note that j1 returns J_1(x)/x, not J_1(x) if (debug) write (*, *) 'arrays_gyro_averages:init_bessel::calculate_aj0v_aj1v' + !$omp parallel default(none) & + !$omp firstprivate(kxkyz_lo, ia) & + !$omp private(ikxkyz, iky, ikx, iz, is, imu, arg) & + !$omp shared(spec, vperp2, kperp2, nmu, bmag, aj0v, aj1v) + + !$omp do do ikxkyz = kxkyz_lo%llim_proc, kxkyz_lo%ulim_proc iky = iky_idx(kxkyz_lo, ikxkyz) ikx = ikx_idx(kxkyz_lo, ikxkyz) @@ -171,6 +177,8 @@ subroutine init_bessel_versus_mu_aj0v_aj1v end do end do + !$omp end do + !$omp end parallel end subroutine init_bessel_versus_mu_aj0v_aj1v diff --git a/STELLA_CODE/calculations/calculations_transforms.f90 b/STELLA_CODE/calculations/calculations_transforms.f90 index b64f83f845..8a27ed23ac 100644 --- a/STELLA_CODE/calculations/calculations_transforms.f90 +++ b/STELLA_CODE/calculations/calculations_transforms.f90 @@ -115,9 +115,11 @@ module calculations_transforms ! Arrays for transforming from alpha-space to k-alpha space real, dimension(:), allocatable :: fft_alpha_alpha ! dimension: nalpha/2+1 complex, dimension(:), allocatable :: fft_alpha_kalpha ! dimension: nalpha - + ! Only initialise the FFTW plans once logical :: transforms_initialized = .false. + + !$omp threadprivate(fft_y_in,fft_y_out,fft_x_k,fft_x_x,fft_xs_k,fft_xs_x,fft_ys_k,fft_ys_y,fftnp_x_k,fftnp_x_x,fftnp_y_k,fftnp_y_y,fft_alpha_alpha,fft_alpha_kalpha) contains @@ -396,6 +398,10 @@ subroutine transform_ky2y_5d(gky_unpad, gy) iky_max = vmu_lo%naky ipad_up = iky_max + vmu_lo%ny - (2 * vmu_lo%naky - 1) + + if (.not. allocated(fft_y_in)) allocate (fft_y_in(vmu_lo%ny)) + if (.not. allocated(fft_y_out)) allocate (fft_y_out(vmu_lo%ny)) + ! Iterate over vmu, tubes, z and positive kx since we Fourier transform along ny do ivmu = vmu_lo%llim_proc, vmu_lo%ulim_proc do it = 1, vmu_lo%ntubes @@ -446,6 +452,10 @@ subroutine transform_ky2y_2d(gky_unpad, gy) iky_max = vmu_lo%naky ipad_up = iky_max + vmu_lo%ny - (2 * vmu_lo%naky - 1) + + if (.not. allocated(fft_y_in)) allocate (fft_y_in(vmu_lo%ny)) + if (.not. allocated(fft_y_out)) allocate (fft_y_out(vmu_lo%ny)) + ! Iterate over positive kx since we Fourier transform along ny do ikx = 1, vmu_lo%nakx / 2 + 1 ! Pad the middle of the array with zeros: zero padding in the wavenumber @@ -535,6 +545,11 @@ subroutine transform_y2ky_2d(gy, gky) ! Get the indices of the last positive ky and negative ky iky_max = vmu_lo%naky ipad_up = iky_max + vmu_lo%ny - (2 * vmu_lo%naky - 1) + + + if (.not. allocated(fft_y_in)) allocate (fft_y_in(vmu_lo%ny)) + if (.not. allocated(fft_y_out)) allocate (fft_y_out(vmu_lo%ny)) + ! Iterate over positive kx since we Fourier transform along ny do ikx = 1, vmu_lo%nakx / 2 + 1 @@ -571,6 +586,10 @@ subroutine transform_kx2x(gkx, gx) integer :: iy + + if (.not. allocated(fft_x_k)) allocate (fft_x_k(vmu_lo%nx / 2 + 1)) + if (.not. allocated(fft_x_x)) allocate (fft_x_x(vmu_lo%nx)) + ! Iterate over ny since we Fourier transform along nx do iy = 1, vmu_lo%ny ! Pad the remainder of the array with zeros (since the real array is longer @@ -605,6 +624,10 @@ subroutine transform_x2kx(gx, gkx) integer :: iy + + if (.not. allocated(fft_x_k)) allocate (fft_x_k(vmu_lo%nx / 2 + 1)) + if (.not. allocated(fft_x_x)) allocate (fft_x_x(vmu_lo%nx)) + ! Iterate over ny since we Fourier transform gx(ny,nx) along nx do iy = 1, vmu_lo%ny ! Fill in the array with gx(ny,nx) @@ -641,6 +664,10 @@ subroutine transform_kx2x_xfirst(gkx, gx) ikx_max = vmu_lo%nakx / 2 + 1 ipad_up = ikx_max + vmu_lo%nx - vmu_lo%nakx + + if (.not. allocated(fft_xs_k)) allocate (fft_xs_k(vmu_lo%nx)) + if (.not. allocated(fft_xs_x)) allocate (fft_xs_x(vmu_lo%nx)) + ! Iterate over naky since we Fourier transform gkx(nakx,nakx) along nx do iky = 1, vmu_lo%naky ! Pad the middle of the array with zeros: zero padding in the wavenumber diff --git a/STELLA_CODE/parallelisation/initialise_redistribute.f90 b/STELLA_CODE/parallelisation/initialise_redistribute.f90 index dad007ea1f..bf227044d4 100644 --- a/STELLA_CODE/parallelisation/initialise_redistribute.f90 +++ b/STELLA_CODE/parallelisation/initialise_redistribute.f90 @@ -112,15 +112,28 @@ subroutine init_kxkyz_to_vmu_redistribute ! Count number of elements to be redistributed to/from each processor nn_to = 0; nn_from = 0 + !$omp parallel default(none) & + !$omp firstprivate(kxkyz_lo, vmu_lo) & + !$omp private(iky, ikx, iz, it, ivmu, imu, iv) & + !$omp shared(nn_from,nn_to, nmu, nvpa) + !$omp do do ikxkyz = kxkyz_lo%llim_world, kxkyz_lo%ulim_world do imu = 1, nmu do iv = 1, nvpa call kxkyzidx2vmuidx(iv, imu, ikxkyz, kxkyz_lo, vmu_lo, iky, ikx, iz, it, ivmu) - if (idx_local(kxkyz_lo, ikxkyz)) nn_from(proc_id(vmu_lo, ivmu)) = nn_from(proc_id(vmu_lo, ivmu)) + 1 - if (idx_local(vmu_lo, ivmu)) nn_to(proc_id(kxkyz_lo, ikxkyz)) = nn_to(proc_id(kxkyz_lo, ikxkyz)) + 1 + if (idx_local(kxkyz_lo, ikxkyz)) then + !$omp critical + nn_from(proc_id(vmu_lo, ivmu)) = nn_from(proc_id(vmu_lo, ivmu)) + 1 + !$omp end critical + endif + if (idx_local(vmu_lo, ivmu)) then + !$omp critical + nn_to(proc_id(kxkyz_lo, ikxkyz)) = nn_to(proc_id(kxkyz_lo, ikxkyz)) + 1 + !$omp end critical end do end do end do + !$omp end parallel ! Debug message if (debug) then From efb65acd49bf91e7deb41809eb8f364a5d4d1222 Mon Sep 17 00:00:00 2001 From: Valentin Seitz Date: Wed, 4 Feb 2026 16:48:59 +0100 Subject: [PATCH 3/8] Add rest of changes --- COMPILATION/CMakeLists.txt | 2 +- .../gk_ExB_nonlinearity.f90 | 20 +++++++++----- .../gyrokinetic_equation/gk_ffs_solve.f90 | 5 +++- .../gk_implicit_terms.f90 | 19 ++++++++++++++ .../gk_magnetic_drift.f90 | 24 +++++++++++++++++ .../initialise_redistribute.f90 | 3 ++- .../parallelisation_layouts.f90 | 15 ++++++++--- STELLA_CODE/utils/mp.fpp | 26 ++++++++++++++++--- 8 files changed, 99 insertions(+), 15 deletions(-) diff --git a/COMPILATION/CMakeLists.txt b/COMPILATION/CMakeLists.txt index 3da7069894..fce2f15fdb 100644 --- a/COMPILATION/CMakeLists.txt +++ b/COMPILATION/CMakeLists.txt @@ -298,7 +298,7 @@ endif() if (STELLA_ENABLE_OMP) find_package(OpenMP REQUIRED Fortran) target_link_libraries(libstella PUBLIC OpenMP::OpenMP_Fortran) - target_compile_definitions(libstella PUBLIC WITH_OPENMP) + target_compile_definitions(libstella PUBLIC USE_OPENMP) endif() # Link the program diff --git a/STELLA_CODE/gyrokinetic_equation/gk_ExB_nonlinearity.f90 b/STELLA_CODE/gyrokinetic_equation/gk_ExB_nonlinearity.f90 index 935d1a655e..53541f3312 100644 --- a/STELLA_CODE/gyrokinetic_equation/gk_ExB_nonlinearity.f90 +++ b/STELLA_CODE/gyrokinetic_equation/gk_ExB_nonlinearity.f90 @@ -91,7 +91,7 @@ subroutine advance_ExB_nonlinearity(g, gout, restart_time_step, istep) complex, dimension(:, :), allocatable :: g0kxy, g0xky, prefac real, dimension(:, :), allocatable :: g0xy, g1xy, bracket complex, dimension(:, :), allocatable :: tmp - integer :: ivmu, iz, it, imu, is + integer :: ivmu, iz, it real :: zero, cfl_dt logical :: yfirst @@ -143,12 +143,14 @@ subroutine advance_ExB_nonlinearity(g, gout, restart_time_step, istep) if (include_apar .or. include_bpar) call g_to_h(g, phi, bpar, fphi) ! Iterate over velocity space + !$omp parallel default(none) & + !$omp firstprivate(vmu_lo, shift_state, exb_nonlin_fac, cfl_dt_ExB, naky,nakx, ny ,rho_clamped, exb_nonlin_fac_p, ikx_max, code_dt, tmp) & + !$omp private(g0k, g0xy, g0a, g1xy, bracket, g0xky, g0k_swap, g0kxy, apar_kykx, bpar_kykx) & + !$omp shared(g, gout, include_apar,phi_gyro, include_bpar, gfac, apar, phi, bpar, aky, ntubes, full_flux_surface, suppress_zonal_interaction,radial_variation, prp_shear_enabled, hammett_flow_shear, g_exb, g_exbfac, prefac, yfirst, akx, fphi, phi_corr_GA, phi_corr_qn, zero, nzgrid) + !$omp do collapse(3) do ivmu = vmu_lo%llim_proc, vmu_lo%ulim_proc - imu = imu_idx(vmu_lo, ivmu) - is = is_idx(vmu_lo, ivmu) do it = 1, ntubes do iz = -nzgrid, nzgrid - ! Get the fields (to avoid indexing arrays which aren't allocated) if (include_apar) apar_kykx = apar(:, :, iz, it) if (include_bpar) bpar_kykx = bpar(:, :, iz, it) @@ -270,6 +272,8 @@ subroutine advance_ExB_nonlinearity(g, gout, restart_time_step, istep) end do end do end do + !$omp end do + !$omp end parallel ! Convert back from h to g = (only needed for EM sims) if (include_apar .or. include_bpar) call g_to_h(g, phi, bpar, -fphi) @@ -340,7 +344,11 @@ subroutine forward_transform(gk, gx) real, dimension(:, :), intent(out) :: gx !---------------------------------------------------------------------- - + !$omp critical (forward_transform) + ! There is some shared state namely the g0k_swap, g0xky and g0kxy arrays. + ! The approach is as always: make if work first, before trying to do premature optimzizations. + ! Even though the crtical might impede performance, we should measure first, before getting rid of it + ! Fourier transform g(kx,ky) to g(kx,y) and then to g(x,y) if (yfirst) then ! We have i*ky*g(kx,ky) for ky >= 0 and all kx. @@ -365,7 +373,7 @@ subroutine forward_transform(gk, gx) g0xky = g0xky * prefac call transform_ky2y_xfirst(g0xky, gx) end if - + !$omp end critical (forward_transform) end subroutine forward_transform end subroutine advance_ExB_nonlinearity diff --git a/STELLA_CODE/gyrokinetic_equation/gk_ffs_solve.f90 b/STELLA_CODE/gyrokinetic_equation/gk_ffs_solve.f90 index b4e136139a..cddff25052 100644 --- a/STELLA_CODE/gyrokinetic_equation/gk_ffs_solve.f90 +++ b/STELLA_CODE/gyrokinetic_equation/gk_ffs_solve.f90 @@ -313,7 +313,9 @@ subroutine get_dgdy(gin, dgdy) integer :: it, iz, ikx !------------------------------------------------------------------------- - + !$omp parallel default(none) & + !$omp shared(gin,dgdy,aky,nzgrid,nakx,ntubes) + !$omp do collapse(3) do it = 1, ntubes do iz = -nzgrid, nzgrid do ikx = 1, nakx @@ -321,6 +323,7 @@ subroutine get_dgdy(gin, dgdy) end do end do end do + !$omp end parallel end subroutine get_dgdy diff --git a/STELLA_CODE/gyrokinetic_equation/gk_implicit_terms.f90 b/STELLA_CODE/gyrokinetic_equation/gk_implicit_terms.f90 index 876bf78869..204e384aaf 100644 --- a/STELLA_CODE/gyrokinetic_equation/gk_implicit_terms.f90 +++ b/STELLA_CODE/gyrokinetic_equation/gk_implicit_terms.f90 @@ -323,6 +323,10 @@ subroutine update_pdf(mod) ! Start the timer for the pdf update if (proc0) call time_message(.false., time_implicit_advance(:, 2), ' (bidiagonal solve)') + !$omp parallel default(none) & + !$omp private(ivmu, iky, it, ie, nz_ext, pdf1, pdf2, phiext, bparext, aparext, aparext_new, aparext_old, phiffsext, ulim) & + !$omp shared(vmu_lo, neigen, ntubes, naky, nsegments, nzed_segment, g1, phi_source, apar_source, apar, apar_old, bpar_source, phi_source_ffs, include_apar, include_bpar, mod, g) + !$omp do collapse(3) do ivmu = vmu_lo%llim_proc, vmu_lo%ulim_proc ! Solve for the pdf, given the sources for phi and the pdf on the RHS of the GK equation ! we do this on set of connected zed segments at a time @@ -383,13 +387,17 @@ subroutine update_pdf(mod) call sweep_g_zext(iky, ie, it, ivmu, pdf2) ! Map the pdf 'pdf2' from the extended zed domain ! to the standard zed domain; the mapped pdf is called 'g' + !$omp critical (write_back) call map_from_extended_zgrid(it, ie, iky, pdf2, g(iky, :, :, :, ivmu)) + !$omp end critical (write_back) deallocate (pdf1, pdf2, phiext, aparext, aparext_new, aparext_old, bparext) if (present(mod)) deallocate(phiffsext) end do end do end do end do + !$omp end do + !$omp end parallel ! Stop the timer for the pdf update if (proc0) call time_message(.false., time_implicit_advance(:, 2), ' (bidiagonal solve)') @@ -1494,6 +1502,10 @@ subroutine invert_parstream_response(phi, apar, bpar) if (debug) write (*, *) 'implicit_solve::invert_parstream_response' ! Put the fields onto the extended zed grid and use LU back substitution + !$omp parallel default(none) & + !$omp private(iky, ie, it, ulim, ikx, offset_apar, offset_bpar, nresponse_per_field, nresponse, nzp, fld_ext, phi_ext, apar_ext, bpar_ext, fld) & + !$omp shared(phi,ntubes, periodic, naky, nsegments, nzed_segment, response_matrix, nzgrid, nfields, include_apar, include_bpar, ikxmod, apar, bpar, phase_shift, neigen) + !$omp do do iky = 1, naky ! Avoid double counting of periodic endpoints for zonal (and any other periodic) modes if (periodic(iky)) then @@ -1572,16 +1584,22 @@ subroutine invert_parstream_response(phi, apar, bpar) ! Get phi_ext contribution from fld_ext and map back to normal (z, kx) grid phi_ext = fld_ext(:nresponse_per_field) + !$omp critical (write_phi) call map_from_extended_zgrid(it, ie, iky, phi_ext, phi(iky, :, :, :)) + !$omp end critical (write_phi) ! If advancing apar, get apar_ext from fld_ext and map back to (z, kx) grid if (include_apar) then apar_ext = fld_ext(offset_apar + 1:nresponse_per_field + offset_apar) + !$omp critical (write_apar) call map_from_extended_zgrid(it, ie, iky, apar_ext, apar(iky, :, :, :)) + !$omp end critical (write_apar) end if if (include_bpar) then bpar_ext = fld_ext(offset_bpar + 1:nresponse_per_field + offset_bpar) + !$omp critical (write_bpar) call map_from_extended_zgrid(it, ie, iky, bpar_ext, bpar(iky, :, :, :)) + !$omp end critical (write_bpar) end if deallocate (fld_ext) @@ -1592,6 +1610,7 @@ subroutine invert_parstream_response(phi, apar, bpar) end do end if end do + !$omp end parallel end subroutine invert_parstream_response diff --git a/STELLA_CODE/gyrokinetic_equation/gk_magnetic_drift.f90 b/STELLA_CODE/gyrokinetic_equation/gk_magnetic_drift.f90 index c813623ead..7584060d2b 100644 --- a/STELLA_CODE/gyrokinetic_equation/gk_magnetic_drift.f90 +++ b/STELLA_CODE/gyrokinetic_equation/gk_magnetic_drift.f90 @@ -444,12 +444,18 @@ subroutine advance_wdrifty_explicit(g, phi, bpar, gout) allocate (g0y(ny, ikx_max, -nzgrid:nzgrid, ntubes, vmu_lo%llim_proc:vmu_lo%ulim_alloc)) allocate (g0k_swap(naky_all, ikx_max)) ! transform dg/dy from k-space to y-space + !$omp parallel default(none) & + !$omp firstprivate(it) & + !$omp private(g0k_swap) & + !$omp shared(g0k,g0y, vmu_lo,nzgrid) + !$omp do collapse(2) do ivmu = vmu_lo%llim_proc, vmu_lo%ulim_proc do iz = -nzgrid, nzgrid call swap_kxky(g0k(:, :, iz, it, ivmu), g0k_swap) call transform_ky2y(g0k_swap, g0y(:, :, iz, it, ivmu)) end do end do + !$omp end parallel ! add vM . grad y dg/dy term to equation call add_explicit_term_ffs(g0y, wdrifty_g, gout) @@ -459,12 +465,18 @@ subroutine advance_wdrifty_explicit(g, phi, bpar, gout) call get_dgdy(phi_gyro, g0k) ! transform d/dy from k-space to y-space + !$omp parallel default(none) & + !$omp firstprivate(it) & + !$omp private(g0k_swap) & + !$omp shared(g0k,g0y, vmu_lo,nzgrid) + !$omp do collapse(2) do ivmu = vmu_lo%llim_proc, vmu_lo%ulim_proc do iz = -nzgrid, nzgrid call swap_kxky(g0k(:, :, iz, it, ivmu), g0k_swap) call transform_ky2y(g0k_swap, g0y(:, :, iz, it, ivmu)) end do end do + !$omp end parallel ! add vM . grad y d/dy term to equation call add_explicit_term_ffs(g0y, wdrifty_phi, gout) @@ -567,12 +579,18 @@ subroutine advance_wdriftx_explicit(g, phi, bpar, gout) allocate (g0y(ny, ikx_max, -nzgrid:nzgrid, ntubes, vmu_lo%llim_proc:vmu_lo%ulim_alloc)) allocate (g0k_swap(naky_all, ikx_max)) ! transform dg/dx from k-space to y-space + !$omp parallel default(none) & + !$omp firstprivate(it) & + !$omp private(g0k_swap) & + !$omp shared(g0k,g0y, vmu_lo,nzgrid) + !$omp do collapse(2) do ivmu = vmu_lo%llim_proc, vmu_lo%ulim_proc do iz = -nzgrid, nzgrid call swap_kxky(g0k(:, :, iz, it, ivmu), g0k_swap) call transform_ky2y(g0k_swap, g0y(:, :, iz, it, ivmu)) end do end do + !$omp end parallel ! add vM . grad x dg/dx term to equation call add_explicit_term_ffs(g0y, wdriftx_g, gout) @@ -581,12 +599,18 @@ subroutine advance_wdriftx_explicit(g, phi, bpar, gout) call get_dgdx(phi_gyro, g0k) ! transform d/dx from k-space to y-space + !$omp parallel default(none) & + !$omp firstprivate(it) & + !$omp private(g0k_swap) & + !$omp shared(g0k,g0y, vmu_lo,nzgrid) + !$omp do collapse(2) do ivmu = vmu_lo%llim_proc, vmu_lo%ulim_proc do iz = -nzgrid, nzgrid call swap_kxky(g0k(:, :, iz, it, ivmu), g0k_swap) call transform_ky2y(g0k_swap, g0y(:, :, iz, it, ivmu)) end do end do + !$omp end parallel ! add vM . grad x d/dx term to equation call add_explicit_term_ffs(g0y, wdriftx_phi, gout) deallocate (g0y, g0k_swap) diff --git a/STELLA_CODE/parallelisation/initialise_redistribute.f90 b/STELLA_CODE/parallelisation/initialise_redistribute.f90 index bf227044d4..c23e8181b2 100644 --- a/STELLA_CODE/parallelisation/initialise_redistribute.f90 +++ b/STELLA_CODE/parallelisation/initialise_redistribute.f90 @@ -125,11 +125,12 @@ subroutine init_kxkyz_to_vmu_redistribute !$omp critical nn_from(proc_id(vmu_lo, ivmu)) = nn_from(proc_id(vmu_lo, ivmu)) + 1 !$omp end critical - endif + end if if (idx_local(vmu_lo, ivmu)) then !$omp critical nn_to(proc_id(kxkyz_lo, ikxkyz)) = nn_to(proc_id(kxkyz_lo, ikxkyz)) + 1 !$omp end critical + end if end do end do end do diff --git a/STELLA_CODE/parallelisation/parallelisation_layouts.f90 b/STELLA_CODE/parallelisation/parallelisation_layouts.f90 index 96809dbf21..006cb50c22 100644 --- a/STELLA_CODE/parallelisation/parallelisation_layouts.f90 +++ b/STELLA_CODE/parallelisation/parallelisation_layouts.f90 @@ -421,7 +421,7 @@ end subroutine sanity_checks !========================================================================= subroutine print_info_to_command_prompt - use mp, only: nproc + use mp, only: nproc, nthreads use iso_fortran_env, only: int64 use debug_flags, only: print_extra_info_to_terminal @@ -436,10 +436,19 @@ subroutine print_info_to_command_prompt write (*, '(A)') '############################################################' write (*, '(A)') ' PARALLELISATION ' write (*, '(A)') '############################################################' + + ! Processors if (nproc == 1) then - write (*, *) ''; write (*, '(A,I0,A)') ' Running on ', nproc, ' processor.' + write (*, '(A,I0,A)', advance='no') ' Running on ', nproc, ' processor' + else + write (*, '(A,I0,A)', advance='no') ' Running on ', nproc, ' processors' + end if + + ! Threads + if (nthreads == 1) then + write (*, '(A,I0,A)') ' with ', nthreads, ' thread.' else - write (*, *) ''; write (*, '(A,I0,A)') ' Running on ', nproc, ' processors.' + write (*, '(A,I0,A)') ' with ', nthreads, ' threads.' end if end if diff --git a/STELLA_CODE/utils/mp.fpp b/STELLA_CODE/utils/mp.fpp index 0199b090c5..6d71b00a03 100644 --- a/STELLA_CODE/utils/mp.fpp +++ b/STELLA_CODE/utils/mp.fpp @@ -46,7 +46,7 @@ module mp public :: max_reduce, max_allreduce public :: min_reduce, min_allreduce public :: comm_split, comm_free - public :: nproc, iproc, proc0, job, min_proc + public :: nproc, nthreads, iproc, proc0, job, min_proc public :: nshared_proc public :: send, ssend, receive public :: numnodes, inode @@ -84,7 +84,7 @@ module mp !comm_cross - communicator that links procs of same rank across comm_group !comm_scross - communicator that links procs of same rank across comm_sgroup - integer, pointer :: nproc + integer, pointer :: nproc, nthreads integer, target :: ntot_proc, nshared_proc, ngroup_proc, ndomain_proc integer, target :: nsgroup_proc, nscross_proc @@ -324,15 +324,24 @@ contains ! Local variables !integer :: info_numa integer :: ierror + integer :: provided_mpi_thread_level logical :: init !------------------------------------------------------------------------- ! Ensure MPI is initialized !------------------------------------------------------------------------- - ! Check whether MPI has already been initialized, if not, initialise MPI call mpi_initialized(init, ierror) + +#ifdef USE_OPENMP + if (.not. init) call mpi_init_thread(MPI_THREAD_FUNNELED, provided_mpi_thread_level, ierror) + if(provided_mpi_thread_level < MPI_THREAD_FUNNELED) then + call mp_abort('ERROR: MPI Implementation does not support MPI_THREAD_FUNNELED. Compile without OpenMP or switch MPI implementation') + end if +#else if (.not. init) call mpi_init(ierror) +#endif + ! Duplicate MPI_COMM_WORLD to avoid accidental modification elsewhere call mpi_comm_dup(mpi_comm_world, mpi_comm_world_private, ierror) @@ -469,6 +478,17 @@ contains write (error_unit(), *) 'ERROR: precision mismatch in mpi' end if +#ifdef USE_OPENMP + + !------------------------------------------------------------------------- + ! Query how many threads the OpenMP provides + !------------------------------------------------------------------------- + + !$omp parallel default(none) shared(nthreads) + nthreads = omp_get_num_threads() + !$omp +#endif + end subroutine init_mp !############################################################################### From 9cc0b877eeda3c43c1c863f5feaf4a8fb2779918 Mon Sep 17 00:00:00 2001 From: Valentin Seitz Date: Wed, 4 Feb 2026 17:44:30 +0100 Subject: [PATCH 4/8] Update Make system to handle OpenMP --- COMPILATION/Makefile.compilerflags | 4 ++++ COMPILATION/Makefiles/Compilers/Makefile.gcc-intel | 5 ----- COMPILATION/Makefiles/Compilers/Makefile.gnu-gfortran | 8 +------- COMPILATION/Makefiles/Makefile.g95 | 5 ----- COMPILATION/Makefiles/Makefile.gnu-g95 | 6 ------ COMPILATION/Makefiles/Makefile.gnu-gcc | 4 ---- 6 files changed, 5 insertions(+), 27 deletions(-) diff --git a/COMPILATION/Makefile.compilerflags b/COMPILATION/Makefile.compilerflags index d904d04f2b..77d4cb8e31 100644 --- a/COMPILATION/Makefile.compilerflags +++ b/COMPILATION/Makefile.compilerflags @@ -23,6 +23,7 @@ USE_LOCAL_SPFUNC ?= # Use local special functions (bin) USE_NAGLIB ?= # Use nag libraray (spfunc,undefined) USE_SFINCS ?= # Link to sfincs library at compilation USE_LAPACK ?= on # Use LAPACK, needed for test particle collisions +USE_OPENMP ?= on # Use OpenMP to parallelize the Code HAS_ISO_C_BINDING ?= on # Does the compiler support the iso_c_binding features of Fortran? (needed for local parallel LU decomposition) SPLIT_BY_NUMA ?= @@ -185,6 +186,9 @@ ifdef USE_LAPACK endif CPPFLAGS += -DLAPACK endif +ifdef USE_OPENMP + F90FLAGS += -fopenmp -DUSE_OPENMP +endif ifdef USE_HDF5 FC = $(H5FC_par) CC = $(H5CC_par) diff --git a/COMPILATION/Makefiles/Compilers/Makefile.gcc-intel b/COMPILATION/Makefiles/Compilers/Makefile.gcc-intel index 847bc44a87..0fb83aa170 100644 --- a/COMPILATION/Makefiles/Compilers/Makefile.gcc-intel +++ b/COMPILATION/Makefiles/Compilers/Makefile.gcc-intel @@ -37,8 +37,3 @@ else CFLAGS += -pg endif endif - -ifdef USE_OPENMP - F90FLAGS += -openmp - CFLAGS += -fopenmp -endif diff --git a/COMPILATION/Makefiles/Compilers/Makefile.gnu-gfortran b/COMPILATION/Makefiles/Compilers/Makefile.gnu-gfortran index af2f59dbd5..6228c45642 100644 --- a/COMPILATION/Makefiles/Compilers/Makefile.gnu-gfortran +++ b/COMPILATION/Makefiles/Compilers/Makefile.gnu-gfortran @@ -56,10 +56,4 @@ else F90FLAGS += -pg CFLAGS += -pg endif -endif - -ifdef USE_OPENMP - F90FLAGS += -fopenmp - CFLAGS += -fopenmp -endif - +endif \ No newline at end of file diff --git a/COMPILATION/Makefiles/Makefile.g95 b/COMPILATION/Makefiles/Makefile.g95 index 947c5d6e4a..988ff0a863 100644 --- a/COMPILATION/Makefiles/Makefile.g95 +++ b/COMPILATION/Makefiles/Makefile.g95 @@ -31,8 +31,3 @@ else endif endif -ifdef USE_OPENMP - F90FLAGS += -fopenmp - CFLAGS += -fopenmp -endif - diff --git a/COMPILATION/Makefiles/Makefile.gnu-g95 b/COMPILATION/Makefiles/Makefile.gnu-g95 index 947c5d6e4a..707a2000e9 100644 --- a/COMPILATION/Makefiles/Makefile.gnu-g95 +++ b/COMPILATION/Makefiles/Makefile.gnu-g95 @@ -30,9 +30,3 @@ else CFLAGS += -pg endif endif - -ifdef USE_OPENMP - F90FLAGS += -fopenmp - CFLAGS += -fopenmp -endif - diff --git a/COMPILATION/Makefiles/Makefile.gnu-gcc b/COMPILATION/Makefiles/Makefile.gnu-gcc index 4f94827189..f68eb55351 100644 --- a/COMPILATION/Makefiles/Makefile.gnu-gcc +++ b/COMPILATION/Makefiles/Makefile.gnu-gcc @@ -17,7 +17,3 @@ else endif endif -ifdef USE_OPENMP - CFLAGS += -fopenmp -endif - From 3fe24e7be4de1e29d6eb4b02eb9b10962cd1b455 Mon Sep 17 00:00:00 2001 From: Valentin Seitz Date: Wed, 4 Feb 2026 17:47:54 +0100 Subject: [PATCH 5/8] Make the workflows go brrrm --- COMPILATION/Makefiles/Compilers/Makefile.gcc-intel | 2 +- COMPILATION/Makefiles/Makefile.g95 | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/COMPILATION/Makefiles/Compilers/Makefile.gcc-intel b/COMPILATION/Makefiles/Compilers/Makefile.gcc-intel index 0fb83aa170..fb658c76ab 100644 --- a/COMPILATION/Makefiles/Compilers/Makefile.gcc-intel +++ b/COMPILATION/Makefiles/Compilers/Makefile.gcc-intel @@ -36,4 +36,4 @@ else F90FLAGS += -pg CFLAGS += -pg endif -endif +endif \ No newline at end of file diff --git a/COMPILATION/Makefiles/Makefile.g95 b/COMPILATION/Makefiles/Makefile.g95 index 988ff0a863..3e1d97f45c 100644 --- a/COMPILATION/Makefiles/Makefile.g95 +++ b/COMPILATION/Makefiles/Makefile.g95 @@ -29,5 +29,4 @@ else F90FLAGS += -pg CFLAGS += -pg endif -endif - +endif \ No newline at end of file From dea6e03af3ecb97723c01ec7975a632955630471 Mon Sep 17 00:00:00 2001 From: Valentin Seitz Date: Mon, 16 Feb 2026 16:00:35 +0100 Subject: [PATCH 6/8] Make printing of booleans standard compliant. --- .../namelist_diagnostics.f90 | 22 +++---- .../namelist_dissipation.f90 | 58 +++++++++---------- .../namelist_flow_shear.f90 | 4 +- .../namelist_geometry.f90 | 30 +++++----- ...elist_initialise_distribution_function.f90 | 20 +++---- .../namelist_kxky_grid.f90 | 10 ++-- .../namelist_neoclassical_input.f90 | 2 +- .../namelist_numerical_parameters.f90 | 30 +++++----- .../namelist_parallelisation.f90 | 6 +- .../namelist_physics_parameters.f90 | 28 ++++----- .../namelist_radial_variation.f90 | 24 ++++---- .../namelist_species.f90 | 4 +- .../namelist_velocity_grids.f90 | 4 +- .../namelist_z_grid.f90 | 2 +- 14 files changed, 122 insertions(+), 122 deletions(-) diff --git a/STELLA_CODE/read_namelists_from_input_file/namelist_diagnostics.f90 b/STELLA_CODE/read_namelists_from_input_file/namelist_diagnostics.f90 index 9ede87a07c..1554067d70 100644 --- a/STELLA_CODE/read_namelists_from_input_file/namelist_diagnostics.f90 +++ b/STELLA_CODE/read_namelists_from_input_file/namelist_diagnostics.f90 @@ -215,17 +215,17 @@ subroutine write_parameters_to_input_file write (unit, '(A, I0)') ' nsave = ', nsave write (unit, '(A, I0)') ' nwrite = ', nwrite write (unit, '(A, I0)') ' nc_mult = ', nc_mult - write (unit, '(A, L0)') ' save_for_restart = ', save_for_restart - write (unit, '(A, L0)') ' write_all = ', write_all - write (unit, '(A, L0)') ' write_all_time_traces = ', write_all_time_traces - write (unit, '(A, L0)') ' write_all_spectra_kxkyz = ', write_all_spectra_kxkyz - write (unit, '(A, L0)') ' write_all_spectra_kxky = ', write_all_spectra_kxky - write (unit, '(A, L0)') ' write_all_velocity_space = ', write_all_velocity_space - write (unit, '(A, L0)') ' write_all_potential = ', write_all_potential - write (unit, '(A, L0)') ' write_all_omega = ', write_all_omega - write (unit, '(A, L0)') ' write_all_distribution = ', write_all_distribution - write (unit, '(A, L0)') ' write_all_fluxes = ', write_all_fluxes - write (unit, '(A, L0)') ' write_all_moments = ', write_all_moments + write (unit, '(A, L1)') ' save_for_restart = ', save_for_restart + write (unit, '(A, L1)') ' write_all = ', write_all + write (unit, '(A, L1)') ' write_all_time_traces = ', write_all_time_traces + write (unit, '(A, L1)') ' write_all_spectra_kxkyz = ', write_all_spectra_kxkyz + write (unit, '(A, L1)') ' write_all_spectra_kxky = ', write_all_spectra_kxky + write (unit, '(A, L1)') ' write_all_velocity_space = ', write_all_velocity_space + write (unit, '(A, L1)') ' write_all_potential = ', write_all_potential + write (unit, '(A, L1)') ' write_all_omega = ', write_all_omega + write (unit, '(A, L1)') ' write_all_distribution = ', write_all_distribution + write (unit, '(A, L1)') ' write_all_fluxes = ', write_all_fluxes + write (unit, '(A, L1)') ' write_all_moments = ', write_all_moments write (unit, '(A)') '/' write (unit, '(A)') '' diff --git a/STELLA_CODE/read_namelists_from_input_file/namelist_dissipation.f90 b/STELLA_CODE/read_namelists_from_input_file/namelist_dissipation.f90 index 81b9fb7f7e..0fd066bfbc 100644 --- a/STELLA_CODE/read_namelists_from_input_file/namelist_dissipation.f90 +++ b/STELLA_CODE/read_namelists_from_input_file/namelist_dissipation.f90 @@ -169,11 +169,11 @@ subroutine write_parameters_to_input_file !------------------------------------------------------------------------- write (unit, '(A)') '&dissipation_and_collisions_options' - write (unit, '(A, L0)') ' hyper_dissipation = ', hyper_dissipation - write (unit, '(A, L0)') ' include_collisions = ', include_collisions + write (unit, '(A, L1)') ' hyper_dissipation = ', hyper_dissipation + write (unit, '(A, L1)') ' include_collisions = ', include_collisions write (unit, '(A, A, A)') ' collision_model = "', trim(collision_model),'"' - write (unit, '(A, L0)') ' collisions_implicit = ', collisions_implicit - write (unit, '(A, L0)') ' ecoll_zeff = ', ecoll_zeff + write (unit, '(A, L1)') ' collisions_implicit = ', collisions_implicit + write (unit, '(A, L1)') ' ecoll_zeff = ', ecoll_zeff write (unit, '(A, ES0.4)') ' zeff = ', zeff write (unit, '(A, ES0.4)') ' vnew_ref = ', vnew_ref write (unit, '(A)') '/' @@ -240,10 +240,10 @@ subroutine write_parameters_to_input_file !------------------------------------------------------------------------- write (unit, '(A)') '&collisions_dougherty' - write (unit, '(A, L0)') ' momentum_conservation = ', momentum_conservation - write (unit, '(A, L0)') ' energy_conservation = ', energy_conservation - write (unit, '(A, L0)') ' vpa_operator = ', vpa_operator - write (unit, '(A, L0)') ' mu_operator = ', mu_operator + write (unit, '(A, L1)') ' momentum_conservation = ', momentum_conservation + write (unit, '(A, L1)') ' energy_conservation = ', energy_conservation + write (unit, '(A, L1)') ' vpa_operator = ', vpa_operator + write (unit, '(A, L1)') ' mu_operator = ', mu_operator write (unit, '(A)') '/' write (unit, '(A)') '' @@ -359,23 +359,23 @@ subroutine write_parameters_to_input_file !------------------------------------------------------------------------- write (unit, '(A)') '&collisions_fokker_planck' - write (unit, '(A, L0)') ' fieldpart = ', fieldpart - write (unit, '(A, L0)') ' testpart = ', testpart - write (unit, '(A, L0)') ' interspec = ', interspec - write (unit, '(A, L0)') ' intraspec = ', intraspec - write (unit, '(A, L0)') ' eimassr_approx = ', eimassr_approx - write (unit, '(A, L0)') ' advfield_coll = ', advfield_coll - write (unit, '(A, L0)') ' spitzer_problem = ', spitzer_problem - write (unit, '(A, L0)') ' density_conservation = ', density_conservation - write (unit, '(A, L0)') ' density_conservation_field = ', density_conservation_field - write (unit, '(A, L0)') ' density_conservation_tp = ', density_conservation_tp - write (unit, '(A, L0)') ' exact_conservation_tp = ', exact_conservation_tp - write (unit, '(A, L0)') ' exact_conservation = ', exact_conservation - write (unit, '(A, L0)') ' vpa_operator = ', vpa_operator - write (unit, '(A, L0)') ' mu_operator = ', mu_operator - write (unit, '(A, L0)') ' no_j1l1 = ', no_j1l1 - write (unit, '(A, L0)') ' no_j1l2 = ', no_j1l2 - write (unit, '(A, L0)') ' no_j0l2 = ', no_j0l2 + write (unit, '(A, L1)') ' fieldpart = ', fieldpart + write (unit, '(A, L1)') ' testpart = ', testpart + write (unit, '(A, L1)') ' interspec = ', interspec + write (unit, '(A, L1)') ' intraspec = ', intraspec + write (unit, '(A, L1)') ' eimassr_approx = ', eimassr_approx + write (unit, '(A, L1)') ' advfield_coll = ', advfield_coll + write (unit, '(A, L1)') ' spitzer_problem = ', spitzer_problem + write (unit, '(A, L1)') ' density_conservation = ', density_conservation + write (unit, '(A, L1)') ' density_conservation_field = ', density_conservation_field + write (unit, '(A, L1)') ' density_conservation_tp = ', density_conservation_tp + write (unit, '(A, L1)') ' exact_conservation_tp = ', exact_conservation_tp + write (unit, '(A, L1)') ' exact_conservation = ', exact_conservation + write (unit, '(A, L1)') ' vpa_operator = ', vpa_operator + write (unit, '(A, L1)') ' mu_operator = ', mu_operator + write (unit, '(A, L1)') ' no_j1l1 = ', no_j1l1 + write (unit, '(A, L1)') ' no_j1l2 = ', no_j1l2 + write (unit, '(A, L1)') ' no_j0l2 = ', no_j0l2 write (unit, '(A, I0)') ' jmax = ', jmax write (unit, '(A, I0)') ' lmax = ', lmax write (unit, '(A, I0)') ' nvel_local = ', nvel_local @@ -477,10 +477,10 @@ subroutine write_parameters_to_input_file !------------------------------------------------------------------------- write (unit, '(A)') '&hyper_dissipation' - write (unit, '(A, L0)') ' use_physical_ksqr = ', use_physical_ksqr - write (unit, '(A, L0)') ' scale_to_outboard = ', scale_to_outboard - write (unit, '(A, L0)') ' hyp_vpa = ', hyp_vpa - write (unit, '(A, L0)') ' hyp_zed = ', hyp_zed + write (unit, '(A, L1)') ' use_physical_ksqr = ', use_physical_ksqr + write (unit, '(A, L1)') ' scale_to_outboard = ', scale_to_outboard + write (unit, '(A, L1)') ' hyp_vpa = ', hyp_vpa + write (unit, '(A, L1)') ' hyp_zed = ', hyp_zed write (unit, '(A, ES0.4)') ' D_hyper = ', D_hyper write (unit, '(A, ES0.4)') ' D_zed = ', D_zed write (unit, '(A, ES0.4)') ' D_vpa = ', D_vpa diff --git a/STELLA_CODE/read_namelists_from_input_file/namelist_flow_shear.f90 b/STELLA_CODE/read_namelists_from_input_file/namelist_flow_shear.f90 index 8500bdd315..18c96c8118 100644 --- a/STELLA_CODE/read_namelists_from_input_file/namelist_flow_shear.f90 +++ b/STELLA_CODE/read_namelists_from_input_file/namelist_flow_shear.f90 @@ -95,8 +95,8 @@ subroutine write_parameters_to_input_file !------------------------------------------------------------------------- write (unit, '(A)') '&flow_shear' - write (unit, '(A, L0)') ' prp_shear_enabled = ', prp_shear_enabled - write (unit, '(A, L0)') ' hammett_flow_shear = ', hammett_flow_shear + write (unit, '(A, L1)') ' prp_shear_enabled = ', prp_shear_enabled + write (unit, '(A, L1)') ' hammett_flow_shear = ', hammett_flow_shear write (unit, '(A, ES0.4)') ' g_exb = ', g_exb write (unit, '(A, ES0.4)') ' g_exbfac = ', g_exbfac write (unit, '(A, ES0.4)') ' omprimfac = ', omprimfac diff --git a/STELLA_CODE/read_namelists_from_input_file/namelist_geometry.f90 b/STELLA_CODE/read_namelists_from_input_file/namelist_geometry.f90 index cc0c872f86..7d24380580 100644 --- a/STELLA_CODE/read_namelists_from_input_file/namelist_geometry.f90 +++ b/STELLA_CODE/read_namelists_from_input_file/namelist_geometry.f90 @@ -227,7 +227,7 @@ subroutine write_parameters_to_input_file write (unit, '(A)') '&geometry_options' write (unit, '(A, A, A)') ' geometry_option = "', trim(geometry_option),'"' - write (unit, '(A, L0)') ' q_as_x = ', q_as_x + write (unit, '(A, L1)') ' q_as_x = ', q_as_x write (unit, '(A)') '/' write (unit, '(A)') '' @@ -331,16 +331,16 @@ subroutine write_parameters_to_input_file write (unit, '(A)') '&geometry_from_txt' write (unit, '(A, A, A)') ' geometry_file = "', trim(geometry_file),'"' - write (unit, '(A, L0)') ' overwrite_bmag = ', overwrite_bmag - write (unit, '(A, L0)') ' overwrite_b_dot_gradzeta = ', overwrite_b_dot_gradzeta - write (unit, '(A, L0)') ' overwrite_grady_dot_grady = ', overwrite_grady_dot_grady - write (unit, '(A, L0)') ' overwrite_gradx_dot_grady = ', overwrite_gradx_dot_grady - write (unit, '(A, L0)') ' overwrite_gradx_dot_gradx = ', overwrite_gradx_dot_gradx - write (unit, '(A, L0)') ' overwrite_gds23 = ', overwrite_gds23 - write (unit, '(A, L0)') ' overwrite_gds24 = ', overwrite_gds24 - write (unit, '(A, L0)') ' overwrite_B_times_kappa_dot_grady = ', overwrite_B_times_kappa_dot_grady - write (unit, '(A, L0)') ' overwrite_B_times_gradB_dot_grady = ', overwrite_B_times_gradB_dot_grady - write (unit, '(A, L0)') ' overwrite_B_times_gradB_dot_gradx = ', overwrite_B_times_gradB_dot_gradx + write (unit, '(A, L1)') ' overwrite_bmag = ', overwrite_bmag + write (unit, '(A, L1)') ' overwrite_b_dot_gradzeta = ', overwrite_b_dot_gradzeta + write (unit, '(A, L1)') ' overwrite_grady_dot_grady = ', overwrite_grady_dot_grady + write (unit, '(A, L1)') ' overwrite_gradx_dot_grady = ', overwrite_gradx_dot_grady + write (unit, '(A, L1)') ' overwrite_gradx_dot_gradx = ', overwrite_gradx_dot_gradx + write (unit, '(A, L1)') ' overwrite_gds23 = ', overwrite_gds23 + write (unit, '(A, L1)') ' overwrite_gds24 = ', overwrite_gds24 + write (unit, '(A, L1)') ' overwrite_B_times_kappa_dot_grady = ', overwrite_B_times_kappa_dot_grady + write (unit, '(A, L1)') ' overwrite_B_times_gradB_dot_grady = ', overwrite_B_times_gradB_dot_grady + write (unit, '(A, L1)') ' overwrite_B_times_gradB_dot_gradx = ', overwrite_B_times_gradB_dot_gradx write (unit, '(A)') '/' write (unit, '(A)') '' @@ -447,8 +447,8 @@ subroutine write_parameters_to_input_file write (unit, '(A, ES0.4)') ' d2qdr2 = ', d2qdr2 write (unit, '(A, ES0.4)') ' d2psidr2 = ', d2psidr2 write (unit, '(A, I0)') ' nzed_local = ', nzed_local - write (unit, '(A, L0)') ' read_profile_variation = ', read_profile_variation - write (unit, '(A, L0)') ' write_profile_variation = ', write_profile_variation + write (unit, '(A, L1)') ' read_profile_variation = ', read_profile_variation + write (unit, '(A, L1)') ' write_profile_variation = ', write_profile_variation write (unit, '(A)') '/' write (unit, '(A)') '' @@ -588,8 +588,8 @@ subroutine write_parameters_to_input_file write (unit, '(A, I0)') ' z_grid_refinement_factor = ', z_grid_refinement_factor write (unit, '(A, I0)') ' surface_option = ', surface_option write (unit, '(A, I0)') ' n_tolerated_test_arrays_inconsistencies = ', n_tolerated_test_arrays_inconsistencies - write (unit, '(A, L0)') ' verbose = ', verbose - write (unit, '(A, L0)') ' rectangular_cross_section = ', rectangular_cross_section + write (unit, '(A, L1)') ' verbose = ', verbose + write (unit, '(A, L1)') ' rectangular_cross_section = ', rectangular_cross_section write (unit, '(A, A, A)') ' radial_coordinate = "', trim(radial_coordinate),'"' write (unit, '(A)') '/' write (unit, '(A)') '' diff --git a/STELLA_CODE/read_namelists_from_input_file/namelist_initialise_distribution_function.f90 b/STELLA_CODE/read_namelists_from_input_file/namelist_initialise_distribution_function.f90 index a50a59606c..a94701a8e3 100644 --- a/STELLA_CODE/read_namelists_from_input_file/namelist_initialise_distribution_function.f90 +++ b/STELLA_CODE/read_namelists_from_input_file/namelist_initialise_distribution_function.f90 @@ -192,7 +192,7 @@ subroutine write_parameters_to_input_file write (unit, '(A)') '&initialise_distribution' write (unit, '(A, A, A)') ' initialise_distribution_option = "', trim(initialise_distribution_option),'"' write (unit, '(A, ES0.4)') ' phiinit = ', phiinit - write (unit, '(A, L0)') ' scale_to_phiinit = ', scale_to_phiinit + write (unit, '(A, L1)') ' scale_to_phiinit = ', scale_to_phiinit write (unit, '(A)') '/' write (unit, '(A)') '' @@ -268,10 +268,10 @@ subroutine write_parameters_to_input_file write (unit, '(A, ES0.4)') ' width0 = ', width0 write (unit, '(A, ES0.4)') ' den0 = ', den0 write (unit, '(A, ES0.4)') ' upar0 = ', upar0 - write (unit, '(A, L0)') ' oddparity = ', oddparity - write (unit, '(A, L0)') ' left = ', left - write (unit, '(A, L0)') ' chop_side = ', chop_side - write (unit, '(A, L0)') ' set_theta0_to_zero = ', set_theta0_to_zero + write (unit, '(A, L1)') ' oddparity = ', oddparity + write (unit, '(A, L1)') ' left = ', left + write (unit, '(A, L1)') ' chop_side = ', chop_side + write (unit, '(A, L1)') ' set_theta0_to_zero = ', set_theta0_to_zero write (unit, '(A)') '/' write (unit, '(A)') '' @@ -342,8 +342,8 @@ subroutine write_parameters_to_input_file write (unit, '(A)') '&initialise_distribution_noise' write (unit, '(A, ES0.4)') ' zf_init = ', zf_init write (unit, '(A, I0)') ' rng_seed = ', rng_seed - write (unit, '(A, L0)') ' left = ', left - write (unit, '(A, L0)') ' chop_side = ', chop_side + write (unit, '(A, L1)') ' left = ', left + write (unit, '(A, L1)') ' chop_side = ', chop_side write (unit, '(A)') '/' write (unit, '(A)') '' @@ -442,8 +442,8 @@ subroutine write_parameters_to_input_file write (unit, '(A, ES0.4)') ' upar2 = ', upar2 write (unit, '(A, ES0.4)') ' tpar2 = ', tpar2 write (unit, '(A, ES0.4)') ' tperp2 = ', tperp2 - write (unit, '(A, L0)') ' left = ', left - write (unit, '(A, L0)') ' chop_side = ', chop_side + write (unit, '(A, L1)') ' left = ', left + write (unit, '(A, L1)') ' chop_side = ', chop_side write (unit, '(A)') '/' write (unit, '(A)') '' @@ -586,7 +586,7 @@ subroutine write_parameters_to_input_file write (unit, '(A, A, A)') ' restart_dir = "', trim(restart_dir),'"' write (unit, '(A, ES0.4)') ' tstart = ', tstart write (unit, '(A, ES0.4)') ' scale = ', scale - write (unit, '(A, L0)') ' save_many = ', save_many + write (unit, '(A, L1)') ' save_many = ', save_many write (unit, '(A)') '/' write (unit, '(A)') '' diff --git a/STELLA_CODE/read_namelists_from_input_file/namelist_kxky_grid.f90 b/STELLA_CODE/read_namelists_from_input_file/namelist_kxky_grid.f90 index 0fc842a15e..c32fc4f648 100644 --- a/STELLA_CODE/read_namelists_from_input_file/namelist_kxky_grid.f90 +++ b/STELLA_CODE/read_namelists_from_input_file/namelist_kxky_grid.f90 @@ -301,10 +301,10 @@ subroutine write_parameters_to_input_file write (unit, '(A, I0)') ' jtwist = ', jtwist write (unit, '(A, ES0.4)') ' jtwistfac = ', jtwistfac write (unit, '(A, ES0.4)') ' phase_shift_angle = ', phase_shift_angle - write (unit, '(A, L0)') ' centered_in_rho = ', centered_in_rho - write (unit, '(A, L0)') ' periodic_variation = ', periodic_variation - write (unit, '(A, L0)') ' randomize_phase_shift = ', randomize_phase_shift - write (unit, '(A, L0)') ' periodic_variation = ', periodic_variation + write (unit, '(A, L1)') ' centered_in_rho = ', centered_in_rho + write (unit, '(A, L1)') ' periodic_variation = ', periodic_variation + write (unit, '(A, L1)') ' randomize_phase_shift = ', randomize_phase_shift + write (unit, '(A, L1)') ' periodic_variation = ', periodic_variation write (unit, '(A)') '/' write (unit, '(A)') '' @@ -313,7 +313,7 @@ subroutine write_parameters_to_input_file write (unit, '(A, I0)') ' naky = ', naky write (unit, '(A, I0)') ' ikx_max = ', ikx_max write (unit, '(A, I0)') ' naky_all = ', naky_all - write (unit, '(A, L0)') ' reality = ', reality + write (unit, '(A, L1)') ' reality = ', reality write (unit, '(A, I0)') ' nalpha = ', nalpha write (unit, '(A)') '/' write (unit, '(A)') '' diff --git a/STELLA_CODE/read_namelists_from_input_file/namelist_neoclassical_input.f90 b/STELLA_CODE/read_namelists_from_input_file/namelist_neoclassical_input.f90 index 91615db552..32f2f21900 100644 --- a/STELLA_CODE/read_namelists_from_input_file/namelist_neoclassical_input.f90 +++ b/STELLA_CODE/read_namelists_from_input_file/namelist_neoclassical_input.f90 @@ -140,7 +140,7 @@ subroutine write_parameters_to_input_file write (unit, '(A)') '&neoclassical_input' write (unit, '(A, A, A)') ' neo_option = "', trim(neo_option),'"' - write (unit, '(A, L0)') ' include_neoclassical_terms = ', include_neoclassical_terms + write (unit, '(A, L1)') ' include_neoclassical_terms = ', include_neoclassical_terms write (unit, '(A, I0)') ' nradii = ', nradii write (unit, '(A, ES0.4)') ' drho = ', drho write (unit, '(A)') '/' diff --git a/STELLA_CODE/read_namelists_from_input_file/namelist_numerical_parameters.f90 b/STELLA_CODE/read_namelists_from_input_file/namelist_numerical_parameters.f90 index 145d5cb588..47061e338a 100644 --- a/STELLA_CODE/read_namelists_from_input_file/namelist_numerical_parameters.f90 +++ b/STELLA_CODE/read_namelists_from_input_file/namelist_numerical_parameters.f90 @@ -159,7 +159,7 @@ subroutine write_parameters_to_input_file write (unit, '(A)') '&time_trace_options' write (unit, '(A, I0)') ' nstep = ', nstep write (unit, '(A, F0.4)') ' tend = ', tend - write (unit, '(A, L0)') ' autostop = ', autostop + write (unit, '(A, L1)') ' autostop = ', autostop write (unit, '(A, ES0.4)') ' avail_cpu_time = ', avail_cpu_time write (unit, '(A)') '/' write (unit, '(A)') '' @@ -371,20 +371,20 @@ subroutine write_parameters_to_input_file write (unit, '(A)') '&numerical_algorithms' write (unit, '(A, A, A)') ' explicit_algorithm = "', trim(explicit_algorithm), '"' - write (unit, '(A, L0)') ' flip_flop = ', flip_flop - write (unit, '(A, L0)') ' stream_implicit = ', stream_implicit - write (unit, '(A, L0)') ' stream_iterative_implicit = ', stream_iterative_implicit - write (unit, '(A, L0)') ' stream_matrix_inversion = ', stream_matrix_inversion - write (unit, '(A, L0)') ' driftkinetic_implicit = ', driftkinetic_implicit - write (unit, '(A, L0)') ' mirror_implicit = ', mirror_implicit - write (unit, '(A, L0)') ' mirror_semi_lagrange = ', mirror_semi_lagrange - write (unit, '(A, L0)') ' mirror_linear_interp = ', mirror_linear_interp - write (unit, '(A, L0)') ' drifts_implicit = ', drifts_implicit - write (unit, '(A, L0)') ' fully_implicit = ', fully_implicit - write (unit, '(A, L0)') ' fully_explicit = ', fully_explicit - write (unit, '(A, L0)') ' maxwellian_inside_zed_derivative = ', maxwellian_inside_zed_derivative - write (unit, '(A, L0)') ' use_deltaphi_for_response_matrix = ', use_deltaphi_for_response_matrix - write (unit, '(A, L0)') ' split_parallel_dynamics = ', split_parallel_dynamics + write (unit, '(A, L1)') ' flip_flop = ', flip_flop + write (unit, '(A, L1)') ' stream_implicit = ', stream_implicit + write (unit, '(A, L1)') ' stream_iterative_implicit = ', stream_iterative_implicit + write (unit, '(A, L1)') ' stream_matrix_inversion = ', stream_matrix_inversion + write (unit, '(A, L1)') ' driftkinetic_implicit = ', driftkinetic_implicit + write (unit, '(A, L1)') ' mirror_implicit = ', mirror_implicit + write (unit, '(A, L1)') ' mirror_semi_lagrange = ', mirror_semi_lagrange + write (unit, '(A, L1)') ' mirror_linear_interp = ', mirror_linear_interp + write (unit, '(A, L1)') ' drifts_implicit = ', drifts_implicit + write (unit, '(A, L1)') ' fully_implicit = ', fully_implicit + write (unit, '(A, L1)') ' fully_explicit = ', fully_explicit + write (unit, '(A, L1)') ' maxwellian_inside_zed_derivative = ', maxwellian_inside_zed_derivative + write (unit, '(A, L1)') ' use_deltaphi_for_response_matrix = ', use_deltaphi_for_response_matrix + write (unit, '(A, L1)') ' split_parallel_dynamics = ', split_parallel_dynamics write (unit, '(A)') '/' write (unit, '(A)') '' diff --git a/STELLA_CODE/read_namelists_from_input_file/namelist_parallelisation.f90 b/STELLA_CODE/read_namelists_from_input_file/namelist_parallelisation.f90 index 8461fb84b9..f5b77a824b 100644 --- a/STELLA_CODE/read_namelists_from_input_file/namelist_parallelisation.f90 +++ b/STELLA_CODE/read_namelists_from_input_file/namelist_parallelisation.f90 @@ -163,9 +163,9 @@ subroutine write_parameters_to_input_file write (unit, '(A, A, A)') ' xyzs_layout = "', trim(xyzs_layout), '"' write (unit, '(A, A, A)') ' vms_layout = "', trim(vms_layout), '"' write (unit, '(A, A, A)') ' kymus_layout = "', trim(kymus_layout), '"' - write (unit, '(A, L0)') ' fields_kxkyz = ', fields_kxkyz - write (unit, '(A, L0)') ' mat_gen = ', mat_gen - write (unit, '(A, L0)') ' mat_read = ', mat_read + write (unit, '(A, L1)') ' fields_kxkyz = ', fields_kxkyz + write (unit, '(A, L1)') ' mat_gen = ', mat_gen + write (unit, '(A, L1)') ' mat_read = ', mat_read write (unit, '(A)') '/' write (unit, '(A)') '' diff --git a/STELLA_CODE/read_namelists_from_input_file/namelist_physics_parameters.f90 b/STELLA_CODE/read_namelists_from_input_file/namelist_physics_parameters.f90 index 6dbe84f7f2..8c0247f4c7 100644 --- a/STELLA_CODE/read_namelists_from_input_file/namelist_physics_parameters.f90 +++ b/STELLA_CODE/read_namelists_from_input_file/namelist_physics_parameters.f90 @@ -194,17 +194,17 @@ subroutine write_parameters_to_input_file write (unit, '(A)') '&gyrokinetic_terms' write (unit, '(A, A, A)') ' simulation_domain = "', trim(simulation_domain), '"' - write (unit, '(A, L0)') ' include_parallel_streaming = ', include_parallel_streaming - write (unit, '(A, L0)') ' include_mirror = ', include_mirror - write (unit, '(A, L0)') ' include_xdrift = ', include_xdrift - write (unit, '(A, L0)') ' include_ydrift = ', include_ydrift - write (unit, '(A, L0)') ' include_drive = ', include_drive - write (unit, '(A, L0)') ' include_nonlinear = ', include_nonlinear - write (unit, '(A, L0)') ' include_parallel_nonlinearity = ', include_parallel_nonlinearity - write (unit, '(A, L0)') ' include_electromagnetic = ', include_electromagnetic - write (unit, '(A, L0)') ' include_flow_shear = ', include_flow_shear - write (unit, '(A, L0)') ' include_full_flux_annulus = ', include_full_flux_annulus - write (unit, '(A, L0)') ' include_radial_variation = ', include_radial_variation + write (unit, '(A, L1)') ' include_parallel_streaming = ', include_parallel_streaming + write (unit, '(A, L1)') ' include_mirror = ', include_mirror + write (unit, '(A, L1)') ' include_xdrift = ', include_xdrift + write (unit, '(A, L1)') ' include_ydrift = ', include_ydrift + write (unit, '(A, L1)') ' include_drive = ', include_drive + write (unit, '(A, L1)') ' include_nonlinear = ', include_nonlinear + write (unit, '(A, L1)') ' include_parallel_nonlinearity = ', include_parallel_nonlinearity + write (unit, '(A, L1)') ' include_electromagnetic = ', include_electromagnetic + write (unit, '(A, L1)') ' include_flow_shear = ', include_flow_shear + write (unit, '(A, L1)') ' include_full_flux_annulus = ', include_full_flux_annulus + write (unit, '(A, L1)') ' include_radial_variation = ', include_radial_variation write (unit, '(A)') '/' write (unit, '(A)') '' @@ -300,7 +300,7 @@ subroutine write_parameters_to_input_file !------------------------------------------------------------------------- write (unit, '(A)') '&scale_gyrokinetic_terms' - write (unit, '(A, L0)') ' suppress_zonal_interaction = ', suppress_zonal_interaction + write (unit, '(A, L1)') ' suppress_zonal_interaction = ', suppress_zonal_interaction write (unit, '(A, F0.2)') ' xdriftknob = ', xdriftknob write (unit, '(A, F0.2)') ' ydriftknob = ', ydriftknob write (unit, '(A, F0.2)') ' wstarknob = ', wstarknob @@ -390,8 +390,8 @@ subroutine write_parameters_to_input_file !------------------------------------------------------------------------- write (unit, '(A)') '&electromagnetic' - write (unit, '(A, L0)') ' include_apar = ', include_apar - write (unit, '(A, L0)') ' include_bpar = ', include_bpar + write (unit, '(A, L1)') ' include_apar = ', include_apar + write (unit, '(A, L1)') ' include_bpar = ', include_bpar write (unit, '(A, ES0.4)') ' beta = ', beta write (unit, '(A)') '/' write (unit, '(A)') '' diff --git a/STELLA_CODE/read_namelists_from_input_file/namelist_radial_variation.f90 b/STELLA_CODE/read_namelists_from_input_file/namelist_radial_variation.f90 index 3baaeac6a7..f382daf81f 100644 --- a/STELLA_CODE/read_namelists_from_input_file/namelist_radial_variation.f90 +++ b/STELLA_CODE/read_namelists_from_input_file/namelist_radial_variation.f90 @@ -249,19 +249,19 @@ subroutine write_parameters_to_input_file_multibox write (unit, '(A, A, A)') ' lr_debug_option = "', lr_debug_option, '"' write (unit, '(A, A, A)') ' krook_option = "', krook_option, '"' write (unit, '(A, A, A)') ' zf_option = "', zf_option, '"' - write (unit, '(A, L0)') ' ky_solve_real = ', ky_solve_real + write (unit, '(A, L1)') ' ky_solve_real = ', ky_solve_real write (unit, '(A, I0)') ' ky_solve_radial = ', ky_solve_radial - write (unit, '(A, L0)') ' include_pressure_variation = ', include_pressure_variation - write (unit, '(A, L0)') ' include_geometric_variation = ', include_geometric_variation - write (unit, '(A, L0)') ' smooth_zf = ', smooth_zf - write (unit, '(A, L0)') ' rk_step = ', rk_step + write (unit, '(A, L1)') ' include_pressure_variation = ', include_pressure_variation + write (unit, '(A, L1)') ' include_geometric_variation = ', include_geometric_variation + write (unit, '(A, L1)') ' smooth_zf = ', smooth_zf + write (unit, '(A, L1)') ' rk_step = ', rk_step write (unit, '(A, ES0.4)') ' nu_krook_mb = ', nu_krook_mb write (unit, '(A, I0)') ' mb_debug_step = ', mb_debug_step write (unit, '(A, ES0.4)') ' krook_exponent = ', krook_exponent write (unit, '(A, ES0.4)') ' krook_efold = ', krook_efold write (unit, '(A, ES0.4)') ' phi_bound = ', phi_bound write (unit, '(A, ES0.4)') ' phi_pow = ', phi_pow - write (unit, '(A, L0)') ' use_dirichlet_bc = ', use_dirichlet_bc + write (unit, '(A, L1)') ' use_dirichlet_bc = ', use_dirichlet_bc write (unit, '(A, I0)') ' boundary_size = ', boundary_size write (unit, '(A, I0)') ' krook_size = ', krook_size write (unit, '(A)') '/' @@ -398,13 +398,13 @@ subroutine write_parameters_to_input_file_sources write (unit, '(A, ES0.4)') ' nu_krook = ', nu_krook write (unit, '(A, ES0.4)') ' tcorr_source = ', tcorr_source write (unit, '(A, I0)') ' ikxmax_source = ', ikxmax_source - write (unit, '(A, L0)') ' krook_odd = ', krook_odd - write (unit, '(A, L0)') ' exclude_boundary_regions = ', exclude_boundary_regions + write (unit, '(A, L1)') ' krook_odd = ', krook_odd + write (unit, '(A, L1)') ' exclude_boundary_regions = ', exclude_boundary_regions write (unit, '(A, ES0.4)') ' tcorr_source_qn = ', tcorr_source_qn - write (unit, '(A, L0)') ' exclude_boundary_regions_qn = ', exclude_boundary_regions_qn - write (unit, '(A, L0)') ' from_zero = ', from_zero - write (unit, '(A, L0)') ' conserve_momentum = ', conserve_momentum - write (unit, '(A, L0)') ' conserve_density = ', conserve_density + write (unit, '(A, L1)') ' exclude_boundary_regions_qn = ', exclude_boundary_regions_qn + write (unit, '(A, L1)') ' from_zero = ', from_zero + write (unit, '(A, L1)') ' conserve_momentum = ', conserve_momentum + write (unit, '(A, L1)') ' conserve_density = ', conserve_density write (unit, '(A)') '/' write (unit, '(A)') '' diff --git a/STELLA_CODE/read_namelists_from_input_file/namelist_species.f90 b/STELLA_CODE/read_namelists_from_input_file/namelist_species.f90 index 80fdd4dee9..a6da3ff8bf 100644 --- a/STELLA_CODE/read_namelists_from_input_file/namelist_species.f90 +++ b/STELLA_CODE/read_namelists_from_input_file/namelist_species.f90 @@ -234,8 +234,8 @@ subroutine write_parameters_to_input_file write (unit, '(A)') '&species_options' write (unit, '(A, I0)') ' nspec = ', nspec write (unit, '(A, A, A)') ' species_option = "', trim(species_option), '"' - write (unit, '(A, L0)') ' read_profile_variation = ', read_profile_variation - write (unit, '(A, L0)') ' write_profile_variation = ', write_profile_variation + write (unit, '(A, L1)') ' read_profile_variation = ', read_profile_variation + write (unit, '(A, L1)') ' write_profile_variation = ', write_profile_variation write (unit, '(A)') '/' write (unit, '(A)') '' diff --git a/STELLA_CODE/read_namelists_from_input_file/namelist_velocity_grids.f90 b/STELLA_CODE/read_namelists_from_input_file/namelist_velocity_grids.f90 index a396e791f4..5b1a319b9b 100644 --- a/STELLA_CODE/read_namelists_from_input_file/namelist_velocity_grids.f90 +++ b/STELLA_CODE/read_namelists_from_input_file/namelist_velocity_grids.f90 @@ -107,8 +107,8 @@ subroutine write_parameters_to_input_file write (unit, '(A, I0)') ' nmu = ', nmu write (unit, '(A, F0.2)') ' vpa_max = ', vpa_max write (unit, '(A, F0.2)') ' vperp_max = ', vperp_max - write (unit, '(A, L0)') ' equally_spaced_mu_grid = ', equally_spaced_mu_grid - write (unit, '(A, L0)') ' conservative_wgts_vpa = ', conservative_wgts_vpa + write (unit, '(A, L1)') ' equally_spaced_mu_grid = ', equally_spaced_mu_grid + write (unit, '(A, L1)') ' conservative_wgts_vpa = ', conservative_wgts_vpa write (unit, '(A)') '/' write (unit, '(A)') '' diff --git a/STELLA_CODE/read_namelists_from_input_file/namelist_z_grid.f90 b/STELLA_CODE/read_namelists_from_input_file/namelist_z_grid.f90 index 13043b96ad..7d6d0baf7f 100644 --- a/STELLA_CODE/read_namelists_from_input_file/namelist_z_grid.f90 +++ b/STELLA_CODE/read_namelists_from_input_file/namelist_z_grid.f90 @@ -167,7 +167,7 @@ subroutine write_parameters_to_input_file write (unit, '(A, I0)') ' nzed = ', nzed write (unit, '(A, I0)') ' nperiod = ', nperiod write (unit, '(A, I0)') ' ntubes = ', ntubes - write (unit, '(A, L0)') ' zed_equal_arc = ', zed_equal_arc + write (unit, '(A, L1)') ' zed_equal_arc = ', zed_equal_arc write (unit, '(A)') '/' write (unit, '(A)') '' From 8217fbfe9e5b0963e65c33e5247813883f778b0f Mon Sep 17 00:00:00 2001 From: Valentin Seitz Date: Mon, 16 Feb 2026 16:41:10 +0100 Subject: [PATCH 7/8] make namelist-group-object not variable length --- .../read_namelists_from_input_file/namelist_species.f90 | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/STELLA_CODE/read_namelists_from_input_file/namelist_species.f90 b/STELLA_CODE/read_namelists_from_input_file/namelist_species.f90 index a6da3ff8bf..12cdc2faca 100644 --- a/STELLA_CODE/read_namelists_from_input_file/namelist_species.f90 +++ b/STELLA_CODE/read_namelists_from_input_file/namelist_species.f90 @@ -620,7 +620,8 @@ subroutine read_namelist_euterpe_parameters(nradii, data_file) ! Variables that are read from the input file integer, intent(out) :: nradii - character(*), intent(out) :: data_file + ! Local fixed-length string for the namelist + character(len=256), intent(out) :: data_file !------------------------------------------------------------------------- From d8f1dadbd2a0d7f8fb4da43615f2ef7839f9f3e4 Mon Sep 17 00:00:00 2001 From: Valentin Seitz Date: Mon, 16 Feb 2026 16:42:34 +0100 Subject: [PATCH 8/8] enforce f08 standard for good measure --- COMPILATION/CMakeLists.txt | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/COMPILATION/CMakeLists.txt b/COMPILATION/CMakeLists.txt index fce2f15fdb..88d6e76f19 100644 --- a/COMPILATION/CMakeLists.txt +++ b/COMPILATION/CMakeLists.txt @@ -419,6 +419,13 @@ else() set(STELLA_PFUNIT_LOCATION "Not used") endif() +# Enforce the standard +if (CMAKE_Fortran_COMPILER_ID STREQUAL "Intel" OR CMAKE_Fortran_COMPILER_ID STREQUAL "IntelLLVM") + set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -std08") +else() + set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -std=f08") +endif() + ############################################################ # Configure summary