diff --git a/src/core_ppl.F b/src/core_ppl.F index 9a7f2f7885..2684efe310 100644 --- a/src/core_ppl.F +++ b/src/core_ppl.F @@ -43,6 +43,9 @@ MODULE core_ppl timestop USE virial_methods, ONLY: virial_pair_force USE virial_types, ONLY: virial_type + + !$ USE OMP_LIB + #include "./common/cp_common_uses.f90" IMPLICIT NONE @@ -135,8 +138,6 @@ CONTAINS TYPE(neighbor_list_iterator_p_type), & DIMENSION(:), POINTER :: ap_iterator, nl_iterator -!$ INTEGER :: omp_get_thread_num, omp_get_max_threads - failure = .FALSE. IF (calculate_forces) THEN CALL timeset(routineN//"_forces",handle) diff --git a/src/core_ppnl.F b/src/core_ppnl.F index 32243fdfae..e9f22986a7 100644 --- a/src/core_ppnl.F +++ b/src/core_ppnl.F @@ -45,6 +45,9 @@ MODULE core_ppnl timestop USE virial_methods, ONLY: virial_pair_force USE virial_types, ONLY: virial_type + + !$ USE OMP_LIB + #include "./common/cp_common_uses.f90" IMPLICIT NONE @@ -139,8 +142,6 @@ CONTAINS TYPE(sap_int_type), DIMENSION(:), & POINTER :: sap_int -!$ INTEGER :: omp_get_thread_num, omp_get_max_threads - failure = .FALSE. IF (calculate_forces) THEN CALL timeset(routineN//"_forces",handle) diff --git a/src/hfx_derivatives.F b/src/hfx_derivatives.F index 7ece12c523..79e452ece6 100644 --- a/src/hfx_derivatives.F +++ b/src/hfx_derivatives.F @@ -74,6 +74,9 @@ MODULE hfx_derivatives timestop USE util, ONLY: sort USE virial_types, ONLY: virial_type + + !$ USE OMP_LIB + #include "./common/cp_common_uses.f90" IMPLICIT NONE @@ -123,151 +126,124 @@ MODULE hfx_derivatives CHARACTER(LEN=*), PARAMETER :: routineN = 'derivatives_four_center', & routineP = moduleN//':'//routineN - INTEGER :: bin, coord, forces_map(4,2), handle, handle_bin, handle_getP, & - handle_load, handle_main, i, i_atom, i_thread, iatom, ikind, iset, & - j_atom, jatom, jkind, jset, k_atom, katom, kkind, kset, l_atom, latom, & - lkind, lset, max_am, max_set, my_bin_size, n_threads, natom, ncob, & - ncos_max, nseta, nsetb, nspins, sgfb, stat - INTEGER(int_8) :: my_current_counter, & - my_istart, n_processes, ncpu + INTEGER :: atomic_offset_ac, atomic_offset_ad, atomic_offset_bc, & + atomic_offset_bd, bin, bits_max_val, buffer_left, buffer_size, & + buffer_start, cache_size, coord, current_counter, forces_map(4,2), & + handle, handle_bin, handle_getP, handle_load, handle_main, i, i_atom, & + i_list_ij, i_list_kl, i_set_list_ij, i_set_list_ij_start, & + i_set_list_ij_stop, i_set_list_kl, i_set_list_kl_start, & + i_set_list_kl_stop, i_thread, iatom, iatom_block, iatom_end, & + iatom_start, ikind, iset, iw, j, j_atom, jatom, jatom_block, jatom_end, & + jatom_start, jkind, jset, k, k_atom, katom, katom_block, katom_end, & + katom_start + INTEGER :: kind_kind_idx, kkind, kset, l_atom, l_max, latom, latom_block, & + latom_end, latom_start, lkind, lset, max_am, max_pgf, max_set, & + my_bin_id, my_bin_size, my_thread_id, n_threads, natom, nbits, ncob, & + ncos_max, nints, nkind, nneighbors, nseta, nsetb, nsgf_max, nspins, & + sgfb, shm_task_counter, shm_total_bins, sphi_a_u1, sphi_a_u2, & + sphi_a_u3, sphi_b_u1, sphi_b_u2, sphi_b_u3, sphi_c_u1, sphi_c_u2, & + sphi_c_u3, sphi_d_u1, sphi_d_u2, sphi_d_u3, stat, swap_id, unit_id + INTEGER(int_8) :: atom_block, counter, estimate_to_store_int, & + max_val_memory, mem_compression_counter, mem_eris, mem_max_val, & + my_current_counter, my_istart, n_processes, nblocks, ncpu, & + neris_incore, neris_onthefly, neris_tmp, neris_total, nprim_ints, & + shm_neris_incore, shm_neris_onthefly, shm_neris_total, shm_nprim_ints, & + shm_stor_count_max_val, shm_storage_counter_integrals, & + stor_count_max_val, storage_counter_integrals, tmp_block, tmp_i8(6) + INTEGER(int_8), ALLOCATABLE, & + DIMENSION(:) :: tmp_task_list_cost INTEGER, ALLOCATABLE, DIMENSION(:) :: atom_of_kind, kind_of, & - last_sgf_global + last_sgf_global, nimages, & + tmp_index INTEGER, DIMENSION(:), POINTER :: la_max, la_min, lb_max, lb_min, lc_max, & lc_min, ld_max, ld_min, npgfa, npgfb, npgfc, npgfd, nsgfa, nsgfb, & - nsgfc, nsgfd - INTEGER, DIMENSION(:, :), POINTER :: first_sgfb - LOGICAL :: do_periodic, failure, & - screen_pmat_forces + nsgfc, nsgfd, shm_block_offset + INTEGER, DIMENSION(:, :), POINTER :: first_sgfb, nsgfl_a, nsgfl_b, & + nsgfl_c, nsgfl_d, offset_ac_set, offset_ad_set, offset_bc_set, & + offset_bd_set, shm_atomic_block_offset + INTEGER, DIMENSION(:, :), POINTER, SAVE :: shm_is_assoc_atomic_block + INTEGER, DIMENSION(:, :, :, :), POINTER :: shm_set_offset + INTEGER, SAVE :: shm_number_of_p_entries + LOGICAL :: bins_left, buffer_overflow, do_dynamic_load_balancing, do_it, & + do_periodic, do_print_load_balance_info, failure, is_anti_symmetric, & + screen_pmat_forces, treat_forces_in_core, use_disk_storage, & + with_mp2_density + LOGICAL, DIMENSION(:, :), POINTER :: shm_atomic_pair_list REAL(dp) :: bintime_start, bintime_stop, cartesian_estimate, & - cartesian_estimate_virial, eps_schwarz, fac, hf_fraction, & - max_contraction_val, max_val1, max_val2, my_adiabatic_rescale_factor, & - pmax_entry, ra(3), rb(3), rc(3), rd(3), spherical_estimate_virial, & - symm_fac + cartesian_estimate_virial, compression_factor, eps_schwarz, & + eps_storage, fac, hf_fraction, ln_10, log10_eps_schwarz, log10_pmax, & + log_2, max_contraction_val, max_val1, max_val2, max_val2_set, & + my_adiabatic_rescale_factor, pmax_atom, pmax_blocks, pmax_entry, & + pmax_tmp, ra(3), rab2, rb(3), rc(3), rcd2, rd(3), spherical_estimate, & + spherical_estimate_virial, symm_fac, tmp_virial(3,3) + REAL(dp), ALLOCATABLE, DIMENSION(:) :: ede_buffer1, ede_buffer2, & + ede_primitives_tmp, ede_primitives_tmp_virial, ede_work, ede_work2, & + ede_work2_virial, ede_work_forces, ede_work_virial, pac_buf, & + pac_buf_beta, pac_buf_mp2, pad_buf, pad_buf_beta, pad_buf_mp2, pbc_buf, & + pbc_buf_beta, pbc_buf_mp2, pbd_buf, pbd_buf_beta, pbd_buf_mp2 REAL(dp), ALLOCATABLE, DIMENSION(:), & - TARGET :: primitive_forces + TARGET :: primitive_forces, & + primitive_forces_virial REAL(dp), DIMENSION(:), POINTER :: full_density, & full_density_beta, & full_density_mp2, T2 - REAL(dp), DIMENSION(:, :), POINTER :: max_contraction, sphi_b, & - zeta, zetb, zetc, zetd + REAL(dp), DIMENSION(:, :), POINTER :: max_contraction, ptr_p_1, ptr_p_2, & + ptr_p_3, ptr_p_4, shm_pmax_atom, shm_pmax_block, sphi_b, zeta, zetb, & + zetc, zetd + REAL(dp), DIMENSION(:, :, :), POINTER :: sphi_a_ext_set, & + sphi_b_ext_set, & + sphi_c_ext_set, sphi_d_ext_set + REAL(dp), DIMENSION(:, :, :, :), POINTER :: sphi_a_ext, sphi_b_ext, & + sphi_c_ext, sphi_d_ext + REAL(KIND=dp) :: coeffs_kind_max0 + TYPE(admm_type), POINTER :: admm_env TYPE(atomic_kind_type), DIMENSION(:), & POINTER :: atomic_kind_set + TYPE(cell_type), POINTER :: cell + TYPE(cp_dbcsr_p_type), DIMENSION(:), & + POINTER :: rho_ao_mp2 + TYPE(cp_logger_type), POINTER :: logger + TYPE(dft_control_type), POINTER :: dft_control TYPE(hfx_basis_info_type), POINTER :: basis_info TYPE(hfx_basis_type), DIMENSION(:), & POINTER :: basis_parameter - TYPE(hfx_general_type) :: general_parameter - TYPE(hfx_load_balance_type), POINTER :: load_balance_parameter - TYPE(hfx_potential_type) :: potential_parameter - TYPE(hfx_screening_type) :: screening_parameter - TYPE(hfx_type), POINTER :: actual_x_data - TYPE(particle_type), DIMENSION(:), & - POINTER :: particle_set - TYPE(qs_force_type), DIMENSION(:), & - POINTER :: force - -!$ INTEGER :: omp_get_max_threads,omp_get_thread_num - INTEGER, SAVE :: shm_number_of_p_entries - INTEGER, DIMENSION(:,:), POINTER, SAVE :: shm_is_assoc_atomic_block - INTEGER :: nkind, l_max - TYPE(cell_type), POINTER :: cell - INTEGER :: unit_id - TYPE(hfx_screen_coeff_type), & - DIMENSION(:,:,:,:,:,:), POINTER :: screen_coeffs_pgf, radii_pgf - TYPE(hfx_screen_coeff_type), & - DIMENSION(:,:,:,:), POINTER :: screen_coeffs_set - TYPE(hfx_screen_coeff_type), & - DIMENSION(:,:), POINTER :: screen_coeffs_kind, tmp_R_1, tmp_R_2, tmp_screen_pgf1, tmp_screen_pgf2 - REAL(dp) :: ln_10, rab2, rcd2, log10_eps_schwarz,& - log10_pmax, max_val2_set, log_2 - INTEGER :: nsgf_max - REAL(dp), DIMENSION(:), ALLOCATABLE :: pbd_buf, pbc_buf, pad_buf, pac_buf, & - pbd_buf_mp2, pbc_buf_mp2, pad_buf_mp2, pac_buf_mp2, & - pbd_buf_beta, pbc_buf_beta, pad_buf_beta, pac_buf_beta - INTEGER(int_8) :: atom_block, tmp_block, nblocks - INTEGER :: iatom_block, jatom_block, katom_block, latom_block - INTEGER :: i_list_ij,i_list_kl, & - i_set_list_ij, i_set_list_ij_start, i_set_list_ij_stop,& - i_set_list_kl, i_set_list_kl_start, i_set_list_kl_stop - TYPE(pair_list_type) :: list_ij, list_kl - REAL(KIND=dp) :: coeffs_kind_max0 - TYPE(pair_set_list_type), DIMENSION(:), ALLOCATABLE :: set_list_ij, set_list_kl - TYPE(hfx_p_kind), DIMENSION(:), POINTER :: shm_initial_p - REAL(dp) :: pmax_tmp - INTEGER :: kind_kind_idx, swap_id - REAL(dp), DIMENSION(:,:), POINTER :: ptr_p_1, ptr_p_2, ptr_p_3, ptr_p_4, shm_pmax_block - INTEGER, DIMENSION(:), POINTER :: shm_block_offset - INTEGER, DIMENSION(:,:), POINTER :: shm_atomic_block_offset - INTEGER, DIMENSION(:,:,:,:), POINTER :: shm_set_offset - INTEGER :: atomic_offset_bd, atomic_offset_bc, atomic_offset_ad, & - atomic_offset_ac, nneighbors, max_pgf - INTEGER, DIMENSION(:,:), POINTER :: offset_bd_set, offset_bc_set, offset_ad_set, offset_ac_set - TYPE(hfx_pgf_list), DIMENSION(:), & - ALLOCATABLE :: pgf_list_ij, pgf_list_kl - TYPE(hfx_pgf_product_list), DIMENSION(:), & - ALLOCATABLE :: pgf_product_list - REAL(dp), DIMENSION(:,:,:,:), POINTER & - :: sphi_a_ext, sphi_b_ext, sphi_c_ext, sphi_d_ext - REAL(dp), DIMENSION(:,:,:), POINTER & - :: sphi_a_ext_set, sphi_b_ext_set, sphi_c_ext_set, sphi_d_ext_set - INTEGER, DIMENSION(:, :), POINTER :: nsgfl_a, nsgfl_b, & - nsgfl_c, nsgfl_d - REAL(dp), DIMENSION(:), ALLOCATABLE :: ede_work, ede_work2, ede_work_forces, & - ede_buffer1, ede_buffer2, & - ede_primitives_tmp - TYPE(lib_deriv) :: private_deriv - LOGICAL :: do_dynamic_load_balancing, bins_left, do_it - TYPE(hfx_distribution), POINTER :: distribution_forces - INTEGER :: shm_total_bins, shm_task_counter, my_thread_id, my_bin_id - TYPE(hfx_task_list_type), DIMENSION(:), & - POINTER :: shm_task_list, tmp_task_list - INTEGER(int_8), DIMENSION(:), & - ALLOCATABLE :: tmp_task_list_cost - INTEGER, DIMENSION(:), ALLOCATABLE :: tmp_index - INTEGER, DIMENSION(:), ALLOCATABLE :: nimages - INTEGER :: sphi_d_u1,sphi_d_u2,sphi_d_u3 - INTEGER :: sphi_c_u1,sphi_c_u2,sphi_c_u3 - INTEGER :: sphi_b_u1,sphi_b_u2,sphi_b_u3 - INTEGER :: sphi_a_u1,sphi_a_u2,sphi_a_u3 - INTEGER :: iatom_start, iatom_end, jatom_start, jatom_end, katom_start,& - katom_end, latom_start, latom_end TYPE(hfx_cache_type), DIMENSION(:), & POINTER :: integral_caches TYPE(hfx_cache_type), POINTER :: maxval_cache TYPE(hfx_container_type), DIMENSION(:), & POINTER :: integral_containers TYPE(hfx_container_type), POINTER :: maxval_container - INTEGER :: cache_size, bits_max_val, current_counter, nints, & - nbits, buffer_left, buffer_start, buffer_size, iw + TYPE(hfx_distribution), POINTER :: distribution_forces + TYPE(hfx_general_type) :: general_parameter + TYPE(hfx_load_balance_type), POINTER :: load_balance_parameter TYPE(hfx_memory_type), POINTER :: memory_parameter - INTEGER(int_8) :: mem_compression_counter, counter, neris_onthefly, & - estimate_to_store_int, neris_total, nprim_ints, neris_tmp,& - max_val_memory, neris_incore - LOGICAL :: buffer_overflow, use_disk_storage - REAL(dp) :: spherical_estimate, eps_storage - INTEGER(int_8) :: shm_neris_total, shm_neris_onthefly, & - shm_storage_counter_integrals, shm_neris_incore, & - shm_stor_count_max_val,& - tmp_i8(6), mem_eris, mem_max_val, shm_nprim_ints, stor_count_max_val,& - storage_counter_integrals - REAL(dp) :: compression_factor - TYPE(cp_logger_type), POINTER :: logger - LOGICAL :: treat_forces_in_core - REAL(dp), DIMENSION(:,:), POINTER :: shm_pmax_atom - - TYPE(cp_dbcsr_p_type), POINTER, DIMENSION(:) :: rho_ao_mp2 - REAL(dp), DIMENSION(:), ALLOCATABLE :: ede_work_virial, ede_work2_virial,& - ede_primitives_tmp_virial - REAL(dp), ALLOCATABLE, DIMENSION(:), & - TARGET :: primitive_forces_virial + TYPE(hfx_p_kind), DIMENSION(:), POINTER :: shm_initial_p + TYPE(hfx_pgf_list), ALLOCATABLE, & + DIMENSION(:) :: pgf_list_ij, pgf_list_kl + TYPE(hfx_pgf_product_list), & + ALLOCATABLE, DIMENSION(:) :: pgf_product_list + TYPE(hfx_potential_type) :: potential_parameter + TYPE(hfx_screen_coeff_type), & + DIMENSION(:, :), POINTER :: screen_coeffs_kind, tmp_R_1, & + tmp_R_2, tmp_screen_pgf1, & + tmp_screen_pgf2 + TYPE(hfx_screen_coeff_type), & + DIMENSION(:, :, :, :), POINTER :: screen_coeffs_set + TYPE(hfx_screen_coeff_type), & + DIMENSION(:, :, :, :, :, :), POINTER :: radii_pgf, screen_coeffs_pgf + TYPE(hfx_screening_type) :: screening_parameter + TYPE(hfx_task_list_type), DIMENSION(:), & + POINTER :: shm_task_list, tmp_task_list + TYPE(hfx_type), POINTER :: actual_x_data + TYPE(lib_deriv) :: private_deriv + TYPE(pair_list_type) :: list_ij, list_kl + TYPE(pair_set_list_type), ALLOCATABLE, & + DIMENSION(:) :: set_list_ij, set_list_kl + TYPE(particle_type), DIMENSION(:), & + POINTER :: particle_set + TYPE(qs_force_type), DIMENSION(:), & + POINTER :: force TYPE(virial_type), POINTER :: virial - REAL(dp) :: tmp_virial(3,3), pmax_blocks, pmax_atom - INTEGER :: k,j - LOGICAL, DIMENSION(:,:), POINTER :: shm_atomic_pair_list - LOGICAL :: do_print_load_balance_info - LOGICAL :: with_mp2_density, is_anti_symmetric - TYPE(dft_control_type), & - POINTER :: dft_control - TYPE(admm_type), POINTER :: admm_env NULLIFY(dft_control, admm_env) diff --git a/src/hfx_energy_potential.F b/src/hfx_energy_potential.F index 8b88d8d88f..067e4421ac 100644 --- a/src/hfx_energy_potential.F +++ b/src/hfx_energy_potential.F @@ -87,6 +87,9 @@ MODULE hfx_energy_potential USE timings, ONLY: timeset,& timestop USE util, ONLY: sort + + !$ USE OMP_LIB + #include "./common/cp_common_uses.f90" IMPLICIT NONE @@ -146,6 +149,7 @@ MODULE hfx_energy_potential CHARACTER(LEN=*), PARAMETER :: routineN = 'integrate_four_center', & routineP = moduleN//':'//routineN + CHARACTER(LEN=512) :: error_msg INTEGER :: act_atomic_block_offset, act_set_offset, atomic_offset_ac, & atomic_offset_ad, atomic_offset_bc, atomic_offset_bd, bin, & bits_max_val, buffer_left, buffer_size, buffer_start, cache_size, & @@ -153,39 +157,75 @@ MODULE hfx_energy_potential handle_load, handle_main, i, i_list_ij, i_list_kl, i_set_list_ij, & i_set_list_ij_start, i_set_list_ij_stop, i_set_list_kl, & i_set_list_kl_start, i_set_list_kl_stop, i_thread, iatom, iatom_block, & - ikind, iset, iw, j, jatom, jatom_block, jkind, jset, katom, & - katom_block, kind_kind_idx, kkind, kset, l_max, latom, latom_block, & - lkind, lset, ma - INTEGER :: max_am, max_pgf, max_set, mb, my_bin_size, n_threads, natom, & - nbits, ncob, ncos_max, nints, nkind, nneighbors, nseta, nsetb, & - nsgf_max, nspins, pa, sgfb, stat, swap_id, unit_id - INTEGER(int_8) :: estimate_to_store_int, mem_compression_counter, & - mem_compression_counter_disk, mem_eris, mem_eris_disk, mem_max_val, & - my_current_counter, my_istart, n_processes, ncpu, neris_disk, & - neris_incore, neris_onthefly, neris_total, shm_mem_compression_counter, & - stor_count_int_disk, stor_count_max_val, storage_counter_integrals - INTEGER, ALLOCATABLE, DIMENSION(:) :: kind_of, last_sgf_global + iatom_end, iatom_start, ikind, iset, iw, j, jatom, jatom_block, & + jatom_end, jatom_start, jkind, jset, katom, katom_block, katom_end, & + katom_start + INTEGER :: kind_kind_idx, kkind, kset, l_max, latom, latom_block, & + latom_end, latom_start, lkind, lset, ma, max_am, max_pgf, max_set, mb, & + my_bin_id, my_bin_size, my_thread_id, n_threads, natom, nbits, ncob, & + ncos_max, nints, nkind, nneighbors, nseta, nsetb, nsgf_max, nspins, pa, & + sgfb, shm_task_counter, shm_total_bins, sphi_a_u1, sphi_a_u2, & + sphi_a_u3, sphi_b_u1, sphi_b_u2, sphi_b_u3, sphi_c_u1, sphi_c_u2, & + sphi_c_u3, sphi_d_u1, sphi_d_u2, sphi_d_u3, stat, swap_id, unit_id + INTEGER(int_8) :: atom_block, counter, estimate_to_store_int, & + max_val_memory, mb_size_buffers, mb_size_f, mb_size_p, & + mem_compression_counter, mem_compression_counter_disk, mem_eris, & + mem_eris_disk, mem_max_val, memsize_after, memsize_before, & + my_current_counter, my_istart, n_processes, nblocks, ncpu, neris_disk, & + neris_incore, neris_onthefly, neris_tmp, neris_total, nprim_ints, & + shm_mem_compression_counter, shm_neris_disk, shm_neris_incore, & + shm_neris_onthefly, shm_neris_total, shm_nprim_ints, & + shm_stor_count_int_disk, shm_stor_count_max_val, & + shm_storage_counter_integrals, stor_count_int_disk + INTEGER(int_8) :: stor_count_max_val, storage_counter_integrals, & + subtr_size_mb, tmp_block, tmp_i8(8) + INTEGER(int_8), ALLOCATABLE, & + DIMENSION(:) :: tmp_task_list_cost + INTEGER, ALLOCATABLE, DIMENSION(:) :: kind_of, last_sgf_global, & + nimages, tmp_index INTEGER, DIMENSION(:), POINTER :: la_max, la_min, lb_max, lb_min, lc_max, & lc_min, ld_max, ld_min, npgfa, npgfb, npgfc, npgfd, nsgfa, nsgfb, & - nsgfc, nsgfd - INTEGER, DIMENSION(:, :), POINTER :: first_sgfb, nsgfl_a, nsgfl_b, & - nsgfl_c, nsgfl_d - LOGICAL :: buffer_overflow, & - do_p_screening, do_periodic, & - failure, my_do_exx - REAL(dp) :: bintime_start, bintime_stop, cartesian_estimate, & - compression_factor, compression_factor_disk, ene_x_aa, ene_x_bb, & - eps_schwarz, eps_storage, fac, hf_fraction, max_contraction_val, & - max_val1, max_val2, pmax_entry, ra(3), rb(3), rc(3), rd(3), & + nsgfc, nsgfd, shm_block_offset + INTEGER, DIMENSION(:, :), POINTER :: first_sgfb, nsgfl_a, nsgfl_b, & + nsgfl_c, nsgfl_d, offset_ac_set, offset_ad_set, offset_bc_set, & + offset_bd_set, shm_atomic_block_offset + INTEGER, DIMENSION(:, :), POINTER, SAVE :: shm_is_assoc_atomic_block + INTEGER, DIMENSION(:, :, :, :), POINTER :: shm_set_offset + INTEGER, SAVE :: shm_number_of_p_entries + LOGICAL :: bins_left, buffer_overflow, do_disk_storage, & + do_dynamic_load_balancing, do_it, do_p_screening, do_periodic, & + do_print_load_balance_info, failure, is_anti_symmetric, ks_fully_occ, & + my_do_exx, treat_lsd_in_core, use_disk_storage + LOGICAL, DIMENSION(:, :), POINTER :: shm_atomic_pair_list + REAL(dp) :: afac, bintime_start, bintime_stop, cartesian_estimate, & + compression_factor, compression_factor_disk, ene_x_aa, ene_x_aa_diag, & + ene_x_bb, ene_x_bb_diag, eps_schwarz, eps_storage, fac, hf_fraction, & + ln_10, log10_eps_schwarz, log10_pmax, max_contraction_val, max_val1, & + max_val2, max_val2_set, pmax_atom, pmax_blocks, pmax_entry, ra(3), & + rab2, rb(3), rc(3), rcd2, rd(3), screen_kind_ij, screen_kind_kl, & spherical_estimate, symm_fac - REAL(dp), ALLOCATABLE, DIMENSION(:) :: primitive_integrals - REAL(dp), DIMENSION(:, :), POINTER :: max_contraction, sphi_b, & - zeta, zetb, zetc, zetd + REAL(dp), ALLOCATABLE, DIMENSION(:) :: ee_buffer1, ee_buffer2, & + ee_primitives_tmp, ee_work, ee_work2, kac_buf, kad_buf, kbc_buf, & + kbd_buf, pac_buf, pad_buf, pbc_buf, pbd_buf, primitive_integrals + REAL(dp), DIMENSION(:), POINTER :: full_density, & + full_density_beta, full_ks, & + full_ks_beta, p_work + REAL(dp), DIMENSION(:, :), POINTER :: max_contraction, ptr_p_1, ptr_p_2, & + ptr_p_3, ptr_p_4, shm_pmax_atom, shm_pmax_block, sphi_b, zeta, zetb, & + zetc, zetd + REAL(dp), DIMENSION(:, :, :), POINTER :: sphi_a_ext_set, & + sphi_b_ext_set, & + sphi_c_ext_set, sphi_d_ext_set + REAL(dp), DIMENSION(:, :, :, :), POINTER :: sphi_a_ext, sphi_b_ext, & + sphi_c_ext, sphi_d_ext + REAL(KIND=dp) :: coeffs_kind_max0 TYPE(atomic_kind_type), DIMENSION(:), & POINTER :: atomic_kind_set + TYPE(cell_type), POINTER :: cell TYPE(cp_dbcsr_p_type), DIMENSION(:), & POINTER :: matrix_ks_aux_fit_hfx TYPE(cp_logger_type), POINTER :: logger + TYPE(dft_control_type), POINTER :: dft_control TYPE(hfx_basis_info_type), POINTER :: basis_info TYPE(hfx_basis_type), DIMENSION(:), & POINTER :: basis_parameter @@ -199,97 +239,37 @@ MODULE hfx_energy_potential integral_containers_disk TYPE(hfx_container_type), POINTER :: maxval_container, & maxval_container_disk + TYPE(hfx_distribution), POINTER :: distribution_energy TYPE(hfx_general_type) :: general_parameter TYPE(hfx_load_balance_type), POINTER :: load_balance_parameter TYPE(hfx_memory_type), POINTER :: memory_parameter + TYPE(hfx_p_kind), DIMENSION(:), POINTER :: shm_initial_p + TYPE(hfx_pgf_list), ALLOCATABLE, & + DIMENSION(:) :: pgf_list_ij, pgf_list_kl + TYPE(hfx_pgf_product_list), & + ALLOCATABLE, DIMENSION(:) :: pgf_product_list TYPE(hfx_potential_type) :: potential_parameter + TYPE(hfx_screen_coeff_type), & + DIMENSION(:, :), POINTER :: screen_coeffs_kind, tmp_R_1, & + tmp_R_2, tmp_screen_pgf1, & + tmp_screen_pgf2 + TYPE(hfx_screen_coeff_type), & + DIMENSION(:, :, :, :), POINTER :: screen_coeffs_set + TYPE(hfx_screen_coeff_type), & + DIMENSION(:, :, :, :, :, :), POINTER :: radii_pgf, screen_coeffs_pgf TYPE(hfx_screening_type) :: screening_parameter + TYPE(hfx_task_list_type), DIMENSION(:), & + POINTER :: shm_task_list, tmp_task_list TYPE(hfx_type), DIMENSION(:, :), POINTER :: x_data TYPE(hfx_type), POINTER :: actual_x_data, & shm_master_x_data + TYPE(lib_int) :: private_lib + TYPE(pair_list_type) :: list_ij, list_kl + TYPE(pair_set_list_type), ALLOCATABLE, & + DIMENSION(:) :: set_list_ij, set_list_kl TYPE(particle_type), DIMENSION(:), & POINTER :: particle_set -!$ INTEGER :: omp_get_max_threads,omp_get_thread_num - INTEGER, SAVE :: shm_number_of_p_entries - INTEGER, DIMENSION(:,:), POINTER, SAVE :: shm_is_assoc_atomic_block - INTEGER(int_8) :: shm_neris_total, shm_neris_onthefly, & - shm_storage_counter_integrals, shm_neris_incore, & - shm_neris_disk, shm_stor_count_int_disk, shm_stor_count_max_val - LOGICAL :: do_disk_storage, use_disk_storage - INTEGER(int_8) :: counter, neris_tmp, nprim_ints, shm_nprim_ints,& - mb_size_p, mb_size_f, mb_size_buffers - TYPE(cell_type), POINTER :: cell - CHARACTER(LEN=512) :: error_msg - TYPE(hfx_screen_coeff_type), & - DIMENSION(:,:,:,:,:,:), POINTER :: screen_coeffs_pgf, radii_pgf - TYPE(hfx_screen_coeff_type), & - DIMENSION(:,:,:,:), POINTER :: screen_coeffs_set - TYPE(hfx_screen_coeff_type), & - DIMENSION(:,:), POINTER :: screen_coeffs_kind - REAL(dp) :: rab2, rcd2, & - log10_eps_schwarz, & - log10_pmax, & - ln_10 - INTEGER(int_8) :: subtr_size_mb - - TYPE(hfx_screen_coeff_type), & - DIMENSION(:,:), POINTER :: tmp_R_1, tmp_R_2, tmp_screen_pgf1, tmp_screen_pgf2 - - INTEGER(int_8) :: memsize_before,memsize_after,& - max_val_memory, tmp_i8(8) - REAL(dp) :: max_val2_set - TYPE(lib_int) :: private_lib - REAL(dp), DIMENSION(:), POINTER :: full_density, full_density_beta, full_ks,& - full_ks_beta - REAL(dp), DIMENSION(:), ALLOCATABLE :: pbd_buf, pbc_buf, pad_buf, pac_buf,& - kbd_buf, kbc_buf, kad_buf, kac_buf - LOGICAL :: treat_lsd_in_core, ks_fully_occ - INTEGER(int_8) :: atom_block, tmp_block, nblocks - TYPE(pair_list_type) :: list_ij, list_kl - REAL(KIND=dp) :: coeffs_kind_max0 - TYPE(pair_set_list_type), DIMENSION(:), ALLOCATABLE :: set_list_ij, set_list_kl - TYPE(hfx_p_kind), DIMENSION(:), POINTER :: shm_initial_p - REAL(dp), DIMENSION(:,:), POINTER :: ptr_p_1, ptr_p_2, ptr_p_3, ptr_p_4 - INTEGER, DIMENSION(:), POINTER :: shm_block_offset - INTEGER, DIMENSION(:,:), POINTER :: shm_atomic_block_offset - INTEGER, DIMENSION(:,:,:,:), POINTER :: shm_set_offset - INTEGER, DIMENSION(:,:), POINTER :: offset_bd_set, offset_bc_set, offset_ad_set, offset_ac_set - REAL(dp) :: ene_x_aa_diag, ene_x_bb_diag - TYPE(hfx_pgf_list), DIMENSION(:), & - ALLOCATABLE :: pgf_list_ij, pgf_list_kl - TYPE(hfx_pgf_product_list), DIMENSION(:), & - ALLOCATABLE :: pgf_product_list - REAL(dp), DIMENSION(:,:,:,:), POINTER & - :: sphi_a_ext, sphi_b_ext, sphi_c_ext, sphi_d_ext - REAL(dp), DIMENSION(:,:,:), POINTER & - :: sphi_a_ext_set, sphi_b_ext_set, sphi_c_ext_set, sphi_d_ext_set - LOGICAL :: do_dynamic_load_balancing, bins_left, do_it - TYPE(hfx_distribution), POINTER :: distribution_energy - INTEGER :: shm_total_bins, shm_task_counter, my_thread_id, my_bin_id - TYPE(hfx_task_list_type), DIMENSION(:), & - POINTER :: shm_task_list, tmp_task_list - INTEGER(int_8), DIMENSION(:), & - ALLOCATABLE :: tmp_task_list_cost - INTEGER, DIMENSION(:), ALLOCATABLE :: tmp_index - REAL(dp), DIMENSION(:), ALLOCATABLE :: ee_work, ee_work2, & - ee_buffer1, ee_buffer2, & - ee_primitives_tmp - INTEGER, DIMENSION(:), ALLOCATABLE :: nimages - INTEGER :: sphi_d_u1, sphi_d_u2, sphi_d_u3 - INTEGER :: sphi_c_u1, sphi_c_u2, sphi_c_u3 - INTEGER :: sphi_b_u1, sphi_b_u2, sphi_b_u3 - INTEGER :: sphi_a_u1, sphi_a_u2, sphi_a_u3 - INTEGER :: iatom_start, iatom_end, jatom_start, jatom_end, katom_start,& - katom_end, latom_start, latom_end - REAL(dp), DIMENSION(:,:), POINTER :: shm_pmax_atom, shm_pmax_block - REAL(dp) :: pmax_atom, screen_kind_ij, screen_kind_kl, pmax_blocks,afac - REAL(dp), DIMENSION(:), POINTER :: p_work - LOGICAL, DIMENSION(:,:), POINTER :: shm_atomic_pair_list - LOGICAL :: do_print_load_balance_info,is_anti_symmetric - TYPE(dft_control_type), & - POINTER :: dft_control - NULLIFY(dft_control) CALL timeset(routineN,handle) diff --git a/src/hfx_types.F b/src/hfx_types.F index a9dad38919..cfd254621c 100644 --- a/src/hfx_types.F +++ b/src/hfx_types.F @@ -66,6 +66,9 @@ MODULE hfx_types USE t_c_g0, ONLY: free_C0 USE timings, ONLY: timeset,& timestop + + !$ USE OMP_LIB + #include "./common/cp_common_uses.f90" IMPLICIT NONE @@ -489,8 +492,6 @@ MODULE hfx_types TYPE(hfx_type), POINTER :: actual_x_data TYPE(section_vals_type), POINTER :: hf_pbc_section, hf_sub_section -!$ INTEGER :: omp_get_max_threads - CALL timeset(routineN,handle) failure = .FALSE. @@ -1238,9 +1239,6 @@ MODULE hfx_types LOGICAL :: failure TYPE(hfx_type), POINTER :: actual_x_data -!$ INTEGER :: omp_get_max_threads - - failure = .FALSE. !! There might be 2 hf sections n_rep_hf = x_data(1,1)%n_rep_hf diff --git a/src/kg_tnadd_mat.F b/src/kg_tnadd_mat.F index 09674b0ed8..781300e650 100644 --- a/src/kg_tnadd_mat.F +++ b/src/kg_tnadd_mat.F @@ -46,6 +46,9 @@ MODULE kg_tnadd_mat timestop USE virial_methods, ONLY: virial_pair_force USE virial_types, ONLY: virial_type + + !$ USE OMP_LIB + #include "./common/cp_common_uses.f90" IMPLICIT NONE @@ -140,8 +143,6 @@ CONTAINS TYPE(neighbor_list_set_p_type), & DIMENSION(:), POINTER :: sac_kin -!$ INTEGER :: omp_get_thread_num, omp_get_max_threads - NULLIFY(matrix_kg) failure = .FALSE. diff --git a/src/mp2.F b/src/mp2.F index 3ebb3671bd..9e638c1596 100644 --- a/src/mp2.F +++ b/src/mp2.F @@ -87,6 +87,9 @@ MODULE mp2 USE timings, ONLY: timeset,& timestop USE virial_types, ONLY: virial_type + + !$ USE OMP_LIB + #include "./common/cp_common_uses.f90" IMPLICIT NONE @@ -167,8 +170,6 @@ MODULE mp2 TYPE(section_vals_type), POINTER :: hfx_sections, input TYPE(virial_type), POINTER :: virial -!$ INTEGER :: omp_get_max_threads - NULLIFY(virial, dft_control, blacs_env) CALL timeset(routineN,handle) failure=.FALSE. diff --git a/src/mp2_cphf.F b/src/mp2_cphf.F index d2351b5565..8722f2f7f2 100644 --- a/src/mp2_cphf.F +++ b/src/mp2_cphf.F @@ -91,6 +91,9 @@ MODULE mp2_cphf USE timings, ONLY: timeset,& timestop USE virial_types, ONLY: virial_type + + !$ USE OMP_LIB + #include "./common/cp_common_uses.f90" IMPLICIT NONE @@ -191,8 +194,6 @@ MODULE mp2_cphf TYPE(section_vals_type), POINTER :: hfx_sections, input TYPE(virial_type), POINTER :: virial -!$ INTEGER :: omp_get_max_threads - CALL timeset(routineN,handle) failure=.FALSE. @@ -336,7 +337,7 @@ MODULE mp2_cphf IF(.NOT. actual_x_data%memory_parameter%do_all_on_the_fly) THEN ! CALL dealloc_containers(actual_x_data, hfx_do_eval_energy, error) CALL alloc_containers(actual_x_data, my_bin_size, hfx_do_eval_energy, error) - + DO bin=1, my_bin_size maxval_container => actual_x_data%maxval_container(bin) integral_containers => actual_x_data%integral_containers(:,bin) diff --git a/src/pw/fft/fftw3_lib.F b/src/pw/fft/fftw3_lib.F index ad991737f1..c39ab25732 100644 --- a/src/pw/fft/fftw3_lib.F +++ b/src/pw/fft/fftw3_lib.F @@ -78,8 +78,6 @@ SUBROUTINE fftw3_do_init(wisdom_file) !$ LOGICAL :: mkl_is_safe -!$ INTEGER :: omp_get_max_threads - ! If using the Intel compiler then we need to declare ! a C interface to a global variable in MKL that sets ! the number of threads which can concurrently execute diff --git a/src/pw/fft_tools.F b/src/pw/fft_tools.F index 260074dff9..5a07b43dde 100644 --- a/src/pw/fft_tools.F +++ b/src/pw/fft_tools.F @@ -44,6 +44,9 @@ MODULE fft_tools stop_program USE timings, ONLY: timeset,& timestop + + !$ USE OMP_LIB + #include "../common/cp_common_uses.f90" IMPLICIT NONE @@ -2246,8 +2249,6 @@ CONTAINS INTEGER, DIMENSION(:), POINTER :: rcount, rdispl, scount, sdispl INTEGER, DIMENSION(:, :), POINTER :: pgrid -!$ INTEGER :: omp_get_max_threads, omp_get_thread_num - CALL timeset(routineN,handle) sub_group = fft_scratch%cart_sub_comm(1) @@ -2357,8 +2358,6 @@ CONTAINS INTEGER, DIMENSION(:), POINTER :: rcount, rdispl, scount, sdispl INTEGER, DIMENSION(:, :), POINTER :: pgrid -!$ INTEGER :: omp_get_max_threads, omp_get_thread_num - CALL timeset(routineN,handle) sub_group = fft_scratch%cart_sub_comm(1) @@ -2461,8 +2460,6 @@ CONTAINS num_threads, nx, ny, nz, ub INTEGER, DIMENSION(:), POINTER :: rcount, rdispl, scount, sdispl -!$ INTEGER :: omp_get_max_threads, omp_get_thread_num - CALL timeset(routineN,handle) np = fft_scratch%sizes%numtask @@ -2563,8 +2560,6 @@ CONTAINS num_threads, nx, ny, nz, ub INTEGER, DIMENSION(:), POINTER :: rcount, rdispl, scount, sdispl -!$ INTEGER :: omp_get_max_threads, omp_get_thread_num - CALL timeset(routineN,handle) np = fft_scratch%sizes%numtask diff --git a/src/pw/realspace_grid_types.F b/src/pw/realspace_grid_types.F index aec9da8533..6f59fa7686 100644 --- a/src/pw/realspace_grid_types.F +++ b/src/pw/realspace_grid_types.F @@ -37,6 +37,9 @@ MODULE realspace_grid_types USE timings, ONLY: timeset,& timestop USE util, ONLY: get_limit + + !$ USE OMP_LIB + #include "../common/cp_common_uses.f90" IMPLICIT NONE @@ -1099,8 +1102,6 @@ CONTAINS TYPE(cp_1d_r_p_type), ALLOCATABLE, & DIMENSION(:) :: recv_bufs, send_bufs -!$ INTEGER :: omp_get_max_threads, omp_get_thread_num - num_threads = 1 my_id = 0 diff --git a/src/qs_collocate_density.F b/src/qs_collocate_density.F index 0487d6d725..9bc23afc08 100644 --- a/src/qs_collocate_density.F +++ b/src/qs_collocate_density.F @@ -137,6 +137,9 @@ MODULE qs_collocate_density stop_program USE timings, ONLY: timeset,& timestop + + !$ USE OMP_LIB + #include "./common/cp_common_uses.f90" IMPLICIT NONE @@ -1743,8 +1746,6 @@ CONTAINS DIMENSION(:), POINTER :: rs_rho TYPE(task_list_type), POINTER :: task_list, task_list_soft -!$ INTEGER :: omp_get_thread_num, omp_get_max_threads - failure=.FALSE. NULLIFY(qs_kind, cell, dft_control, orb_basis_set, deltap, & qs_kind_set, particle_set, rs_rho, pw_env, rs_descs, & diff --git a/src/qs_integrate_potential_product.F b/src/qs_integrate_potential_product.F index 83d1bdfa27..053ec73ec1 100644 --- a/src/qs_integrate_potential_product.F +++ b/src/qs_integrate_potential_product.F @@ -74,6 +74,9 @@ MODULE qs_integrate_potential_product USE timings, ONLY: timeset,& timestop USE virial_types, ONLY: virial_type + + !$ USE OMP_LIB + #include "./common/cp_common_uses.f90" IMPLICIT NONE @@ -205,9 +208,6 @@ CONTAINS TYPE(task_list_type), POINTER :: task_list, task_list_soft TYPE(virial_type), POINTER :: virial -!$ INTEGER :: omp_get_max_threads, & -!$ omp_get_thread_num - CALL timeset(routineN,handle) failure=.FALSE. diff --git a/tools/conventions/conventions.supp b/tools/conventions/conventions.supp index 6b340623eb..df8d563974 100644 --- a/tools/conventions/conventions.supp +++ b/tools/conventions/conventions.supp @@ -333,12 +333,9 @@ f77_int.h: Copyright banner malformed farming_methods.F: Found CLOSE statement in procedure "farming_parse_input" farming_methods.F: Found OPEN statement in procedure "farming_parse_input" fft_lib.F: Unused parameter 'dp' which has been explicitly imported at (1) -fft_tools.F: Routine OMP_GET_MAX_THREADS called with an implicit interface. -fft_tools.F: Routine OMP_GET_THREAD_NUM called with an implicit interface. fft_tools.F: Unused dummy argument 'group' at (1) fft_tools.F: Unused parameter 'cudahostallocmapped' declared at (1) fft_tools.F: Unused parameter 'cudahostallocportable' declared at (1) -fftw3_lib.F: Routine OMP_GET_MAX_THREADS called with an implicit interface. force_field_kind_types.F: Unused dummy argument 'impr_kind' at (1) force_fields_all.F: Unused dummy argument 'amb_info' at (1) force_fields_all.F: Unused dummy argument 'iw2' at (1) @@ -370,19 +367,12 @@ hartree_local_methods.F: Unused dummy argument 'iatom' at (1) helium_methods.F: Unused dummy argument 'pint_env' at (1) hfx_admm_utils.F: Unused dummy argument 'ks_env' at (1) hfx_communication.F: Unused dummy argument 'natom' at (1) -hfx_derivatives.F: Routine OMP_GET_MAX_THREADS called with an implicit interface. -hfx_derivatives.F: Routine OMP_GET_THREAD_NUM called with an implicit interface. -hfx_energy_potential.F: Routine OMP_GET_MAX_THREADS called with an implicit interface. -hfx_energy_potential.F: Routine OMP_GET_THREAD_NUM called with an implicit interface. hfx_energy_potential.F: Unused dummy argument 'anti_symmetric' at (1) -hfx_types.F: Routine OMP_GET_MAX_THREADS called with an implicit interface. input_cp2k_restarts.F: Unused dummy argument 'motion_section' at (1) k290.F: Found GOTO statement in procedure "mesh" k290.F: Found GOTO statement in procedure "sppt2" k290.F: Unused dummy argument 'iout' at (1) k290.F: Unused dummy argument 'nsp' at (1) -kg_tnadd_mat.F: Routine OMP_GET_MAX_THREADS called with an implicit interface. -kg_tnadd_mat.F: Routine OMP_GET_THREAD_NUM called with an implicit interface. library_tests.F: Routine PILAENV called with an implicit interface. library_tests.F: Unused dummy argument 'blacs_grid_layout' at (1) library_tests.F: Unused dummy argument 'blacs_repeatable' at (1) @@ -478,11 +468,9 @@ mol_force.F: Unused dummy argument 'ism' at (1) mol_force.F: Unused dummy argument 'isn' at (1) mol_force.F: Unused dummy argument 't32' at (1) mol_force.F: Unused dummy argument 'tn' at (1) -mp2.F: Routine OMP_GET_MAX_THREADS called with an implicit interface. mp2.F: Unused dummy argument 'basis_parameter' at (1) mp2.F: Unused dummy argument 'kind_of' at (1) mp2.F: Unused dummy argument 'matrix_ks' at (1) -mp2_cphf.F: Routine OMP_GET_MAX_THREADS called with an implicit interface. mp2_cphf.F: Unused dummy argument 'cell' at (1) mp2_cphf.F: Unused dummy argument 'dft_control' at (1) mp2_cphf.F: Unused dummy argument 'mp2_env' at (1) @@ -605,8 +593,6 @@ qmmm_se_energy.F: Unused dummy argument 'mm_el_pot_radius' at (1) qmmm_se_energy.F: Unused dummy argument 'num_mm_atoms' at (1) qmmm_se_forces.F: Unused dummy argument 'mm_el_pot_radius' at (1) qmmm_se_forces.F: Unused dummy argument 'num_mm_atoms' at (1) -qs_collocate_density.F: Routine OMP_GET_MAX_THREADS called with an implicit interface. -qs_collocate_density.F: Routine OMP_GET_THREAD_NUM called with an implicit interface. qs_collocate_density.F: Unused dummy argument 'lri_env' at (1) qs_collocate_density.F: ‘atomic_kind_set.dim[0].lbound’ is used uninitialized in this function [-Wuninitialized] qs_collocate_density.F: ‘atomic_kind_set.dim[0].ubound’ is used uninitialized in this function [-Wuninitialized] @@ -628,8 +614,6 @@ qs_integrate_potential_low.F: Routine INTEGRATE_CORE_7 called with an implicit i qs_integrate_potential_low.F: Routine INTEGRATE_CORE_8 called with an implicit interface. qs_integrate_potential_low.F: Routine INTEGRATE_CORE_9 called with an implicit interface. qs_integrate_potential_low.F: Routine INTEGRATE_CORE_DEFAULT called with an implicit interface. -qs_integrate_potential_product.F: Routine OMP_GET_MAX_THREADS called with an implicit interface. -qs_integrate_potential_product.F: Routine OMP_GET_THREAD_NUM called with an implicit interface. qs_kpp1_env_methods.F: Unused dummy argument 'kpp1_env' at (1) qs_linres_op.F: Routine INDXL2G called with an implicit interface. qs_loc_methods.F: Unused dummy argument 'loc_section' at (1) @@ -648,8 +632,6 @@ qs_scf_loop_utils.F: Unused dummy argument 'scf_control' at (1) qs_scf_output.F: Unused dummy argument 'last' at (1) qs_vxc_atom.F: Unused dummy argument 'drho_h' at (1) qs_vxc_atom.F: Unused dummy argument 'drho_s' at (1) -realspace_grid_types.F: Routine OMP_GET_MAX_THREADS called with an implicit interface. -realspace_grid_types.F: Routine OMP_GET_THREAD_NUM called with an implicit interface. rpa_communication.F: Unused dummy argument 'number_of_rec' at (1) rpa_ri_gpw.F: Unused dummy argument 'dimen_ia' at (1) rpa_ri_gpw.F: Unused dummy argument 'dimen_ri' at (1)