Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tech memory #148

Open
wants to merge 18 commits into
base: tech-master
Choose a base branch
from

Conversation

sangallidavide
Copy link
Member

This is an example of the idea of changing the logic of
#include<memory.h>
in order to move it in the header section of the source.

It does not need to be merged. Changes can be easily transferred to other branches thanks to this bask / awk script
https://github.com/sangallidavide/yambo/blob/tech-memory/sbin/move_include_files.sh

Just to link an example of a file after the action of the script (header at the top, implicit none in the source)
https://github.com/sangallidavide/yambo/blob/tech-memory/src/bse/K_blocks.F

Other relevant changes are here:
https://github.com/sangallidavide/yambo/blob/tech-memory/include/headers/common/y_memory.h

MODIFIED *  configure include/version/version.m4

Changes:
- [yambo]: configure re-generated after merge

Patch sent by:  Davide Sangalli <[email protected]>
Version 5.3.0,  Revision 23801,  Hash 9914088

MODIFIED *  configure include/headers/common/y_memory.h include/version/version.m4 a2y/a2y_db1.F c2y/c2y.F c2y/c2y_db1.F p2y/mod_p2y.F p2y/p2y.F p2y/p2y_atmproj.F p2y/p2y_db1.F p2y/p2y_wf.F p2y/qe_pseudo_init.F Ymodules/mod_BS.F Ymodules/mod_BS_solvers.F Ymodules/mod_DICHROISM.F Ymodules/mod_DIPOLES.F Ymodules/mod_D_lattice.F Ymodules/mod_ELPH.F Ymodules/mod_FFT.F Ymodules/mod_MAGNONS.F Ymodules/mod_MPA.F Ymodules/mod_Overlaps.F Ymodules/mod_PHOTOLUM.F Ymodules/mod_POL_FIT.F Ymodules/mod_QP.F Ymodules/mod_QP_CTL.F Ymodules/mod_RT_control.F Ymodules/mod_RT_lifetimes.F Ymodules/mod_RT_occupations.F Ymodules/mod_RT_output.F Ymodules/mod_R_lattice.F Ymodules/mod_SC.F Ymodules/mod_SLK.F Ymodules/mod_X.F Ymodules/mod_collision_el.F Ymodules/mod_electric.F Ymodules/mod_electrons.F Ymodules/mod_frequency.F Ymodules/mod_hamiltonian.F Ymodules/mod_interpolate_tools.F Ymodules/mod_linear_algebra.F Ymodules/mod_matrix.F Ymodules/mod_memory.F Ymodules/mod_mklfft_gpu.F Ymodules/mod_nl_optics.F Ymodules/mod_parallel.F Ymodules/mod_plasma.F Ymodules/mod_pseudo.F Ymodules/mod_real_time.F Ymodules/mod_wave_func.F Ymodules/mod_wrapper.F acfdt/acfdt_tot_energy.F allocations/ELPH_alloc.F allocations/MPA_ALLOC_parallel.F allocations/X_ALLOC_elemental.F allocations/X_ALLOC_global.F allocations/X_ALLOC_parallel.F bse/BSE_utilities.F bse/K_Haydock.F bse/K_IP.F bse/K_IP_sort.F bse/K_Transitions_setup.F bse/K_WF_phases.F bse/K_blocks.F bse/K_correlation_collisions_dir.F bse/K_correlation_collisions_std.F bse/K_correlation_kernel_dir.F bse/K_correlation_kernel_std.F bse/K_diago_driver.F bse/K_diagonal.F bse/K_dipoles.F bse/K_driver.F bse/K_exchange_collisions.F bse/K_exchange_kernel.F bse/K_inversion_Lo.F bse/K_inversion_driver.F bse/K_inversion_engine.F bse/K_inversion_restart.F bse/K_kernel.F bse/K_multiply_by_V_slepc.F bse/K_multiply_by_V_transpose_slepc.F bse/K_screened_interaction.F bse/K_shell_matrix.F bse/K_solvers.F bse/K_stored_in_a_big_matrix.F bse/K_stored_in_a_nest_matrix.F bse/K_stored_in_a_slepc_matrix.F bz_ops/bz_samp_indexes.F bz_ops/k_build_up_BZ_tables.F bz_ops/k_expand.F bz_ops/k_ibz2bz.F bz_ops/k_lattice.F bz_ops/k_map_nearest_by_dir.F bz_ops/k_reduce.F collisions/Build_LSEX_collisions.F collisions/COLLISIONS_HXC.F collisions/COLLISIONS_NEQ_GW_static.F collisions/COLLISIONS_alloc_and_free.F collisions/COLLISIONS_basic_operations.F collisions/COLLISIONS_compress.F collisions/COLLISIONS_eval.F collisions/COLLISIONS_linearize_and_IO.F collisions/COLLISIONS_load.F collisions/COLLISIONS_map_to_QP_table.F collisions/LSEX_potential.F collisions/OSCLL_eval.F collisions/OSCLL_load.F collisions/PLASMA_parallel_setup.F collisions/PLASMA_tables_and_dimensions.F common/FREQUENCIES_coarse_grid.F common/FREQUENCIES_merge.F common/FREQUENCIES_reset.F common/FREQUENCIES_setup.F common/G_rot_grid.F common/OCCUPATIONS_Extend.F common/OCCUPATIONS_Fermi.F common/QP_state_print.F common/eval_G_minus_G.F common/eval_Gradient.F common/eval_Gradient_cpu.F common/eval_Gradient_gpu.F coulomb/col_driver.F coulomb/cutoff_box.F coulomb/cutoff_cylinder.F coulomb/rim.F dipoles/DIPOLE_build_covariants.F dipoles/DIPOLE_kb_init.F dipoles/DIPOLE_kb_sum.F dipoles/DIPOLE_overlaps.F dipoles/DIPOLE_p_matrix_elements.F dipoles/DIPOLE_shifted_grids.F dipoles/DIPOLE_transverse.F dipoles/DIPOLE_x_real_space.F el-ph/ELPH_Hamiltonian.F el-ph/ELPH_Sigma_c.F el-ph/ELPH_Sigma_c_engine.F el-ph/ELPH_databases_grids_map.F el-ph/ELPH_databases_load.F el-ph/En_k_plus_q_interpolate.F el-ph/Eval_Efermi_DbGd.F el-ph/get_ph_E_DbGd.F gpu_test/GPU_test.F gpu_test/saxpy_explicit.F gpu_test_mod/mod_data.F gpu_test_mod/mod_dev_linalg.F gpu_test_mod/mod_dev_memory.F hamiltonian/Bare_Hamiltonian.F hamiltonian/MAG_Hamiltonian.F hamiltonian/MAG_common_build_A.F hamiltonian/Pseudo_Hamiltonian.F hamiltonian/Pseudo_KB_FFT.F hamiltonian/Pseudo_KB_G_to_R_space.F hamiltonian/Pseudo_KB_gauge_factor.F interface/INIT.F interface/INIT_DephMatrix.F interface/INIT_QP.F interface/INIT_check_databases.F interface/INIT_q_points.F interpolate/INTERPOLATION_BZ.F interpolate/INTERPOLATION_BZ_coeff.F interpolate/INTERPOLATION_BZ_setup.F interpolate/INTERPOLATION_coefficients.F interpolate/INTERPOLATION_driver_do.F interpolate/INTERPOLATION_driver_end.F interpolate/INTERPOLATION_fourier.F interpolate/INTERPOLATION_nearest_k.F io/io_ATMPROJ_pwscf.F io/io_BSS_invert.F io/io_BS_Fxc.F io/io_COL_CUT.F io/io_DB1.F io/io_DB1_selective_scan.F io/io_Double_Grid.F io/io_ELPH.F io/io_E_SOC_map.F io/io_GROT.F io/io_HF_and_locXC.F io/io_KB_abinit.F io/io_KB_pwscf.F io/io_KB_real_space.F io/io_MPA.F io/io_NL.F io/io_OSCLL.F io/io_PH.F io/io_QINDX.F io/io_QP_and_GF.F io/io_RIM.F io/io_RIM_W.F io/io_RT_components_OBS.F io/io_RT_components_Reference.F io/io_RT_components_TIME_points.F io/io_SC_components.F io/io_Vnl.F io/io_X.F io/io_gFsq.F io/load_SC_components.F io/variables_ELPH.F io_parallel/io_COLLISIONS.F io_parallel/io_COLLISIONS_header.F io_serial/io_BS.F io_serial/io_COLLISIONS.F linear_algebra/LINEAR_ALGEBRA_driver.F linear_algebra/MATRIX_slepc.F linear_algebra/PARALLEL_HERMITIAN_diagonalization.F linear_algebra/PARALLEL_inversion.F linear_algebra/PARALLEL_lin_system.F linear_algebra/SERIAL_HERMITIAN_diagonalization.F linear_algebra/SERIAL_SVD_inversion.F linear_algebra/SERIAL_diagonalization.F linear_algebra/SERIAL_inversion.F linear_algebra/SERIAL_lin_system.F linear_algebra/SERIAL_lin_system_gpu.F linear_algebra/SLK_test.F matrices/MATRIX_duplicate.F matrices/MATRIX_init.F matrices/MATRIX_transfer.F matrices/MATRIX_transpose.F matrices/SLK_matrix_init.F nloptics/NL_driver.F nloptics/NL_initialize.F nloptics/NL_start_and_restart.F parallel/PARALLEL_FREQS_setup.F parallel/PARALLEL_Haydock_VEC_COMMs.F parallel/PARALLEL_Transitions_grouping.F parallel/PARALLEL_WF_distribute.F parallel/PARALLEL_WF_index.F parallel/PARALLEL_add_Q_to_K_list.F parallel/PARALLEL_collisions.F parallel/PARALLEL_distribute_BZk_using_IBZk.F parallel/PARALLEL_global_Oscillators.F parallel/PARALLEL_global_Real_Time.F parallel/PARALLEL_global_Response_G.F parallel/PARALLEL_global_Response_T.F parallel/PARALLEL_global_Response_T_transitions.F parallel/PARALLEL_global_Self_Energy.F parallel/PARALLEL_global_dimensions.F parallel/PARALLEL_global_indexes.F parallel/PARALLEL_global_reset.F parallel/PARALLEL_index.F parallel/PARALLEL_scheme_initialize.F pol_function/OPTICS_driver.F pol_function/X_AVERAGE_do_it.F pol_function/X_Double_Grid_setup.F pol_function/X_GreenF_analytical.F pol_function/X_GreenF_remap.F pol_function/X_dielectric_matrix.F pol_function/X_eh_setup.F pol_function/X_irredux.F pol_function/X_irredux_residuals.F pol_function/X_redux.F qp/QED_Sigma_c.F qp/QP_driver.F qp/QP_expand.F qp/QP_interpolate_W.F qp/QP_life_transitions.F qp/QP_mpa.F qp/QP_ppa_cohsex.F qp/QP_real_axis.F qp/QP_secant_driver.F qp/XCo_Hartree_Fock.F qp/XCo_driver.F qp/XCo_local.F qp/XCo_report.F qp_control/QP_DBs_add_me.F qp_control/QP_DBs_merge.F qp_control/QP_apply.F qp_control/QP_apply_QP.F qp_control/QP_apply_dump_user_CTLs.F qp_control/QP_apply_interpolate_QP.F qp_control/QP_apply_the_ACTION.F qp_control/QP_load_DB.F qp_control/QP_load_GFs.F real_time_control/RT_alloc.F real_time_control/RT_free.F real_time_control/RT_interpolation_driver.F real_time_control/RT_k_grid.F real_time_drivers/RT_driver.F real_time_initialize/RT_Dephasing_Matrix.F real_time_initialize/RT_ELPH_initialize.F real_time_initialize/RT_initialize.F real_time_initialize/RT_start_and_restart.F real_time_propagation/RT_Integrator_init.F sc/OEP_ApplySigmaCSX.F sc/OEP_ApplySigmaX.F sc/OEP_app_inversion.F sc/OEP_driver.F sc/OEP_exact_inversion.F sc/SC_driver.F sc/SC_start_and_restart.F setup/G_shells_finder.F setup/QP_state_table_setup.F setup/build_spin_sop.F setup/eval_Mtot.F setup/eval_minus_G.F setup/setup.F tddft/TDDFT_ALDA_G_space.F tddft/TDDFT_ALDA_eh_space_G_collisions_L.F tddft/TDDFT_ALDA_eh_space_G_collisions_R.F tddft/TDDFT_BSK_2_FXC.F tddft/TDDFT_BSK_disk_2_FXC.F tddft/TDDFT_do_X_W_typs.F wf_and_fft/PP_compute_becp.F wf_and_fft/PP_rotate_becp.F wf_and_fft/PP_scatterBamp_init.F wf_and_fft/PP_uspp_init.F wf_and_fft/PP_vloc_augment.F wf_and_fft/WF_alloc.F wf_and_fft/WF_derivative.F wf_and_fft/WF_free.F wf_and_fft/WF_load.F wf_and_fft/WF_rotate.F wf_and_fft/WF_shift_kpoint.F wf_and_fft/eval_GradOperator.F wf_and_fft/eval_R_minus_R.F wf_and_fft/fft_3d_cuda.F wf_and_fft/fft_3d_hip.F wf_and_fft/fft_free.F wf_and_fft/fft_setup.F wf_and_fft/scatter_Bamp_using_the_gradient.F wf_and_fft/scatter_Gamp.F wf_and_fft/scatter_Modscr.F xc_functionals/XC_libxc_driver.F xc_functionals/XC_nlcc_setup.F xc_functionals/el_density_and_current.F ypp/YPPmodules/mod_YPP_ELPH.F ypp/YPPmodules/mod_YPP_real_time.F ypp/bits/WANNIER_driver.F ypp/bits/WF_map_perturbative_SOC.F ypp/dipoles/DIPOLE_ypp_driver.F ypp/el-ph/ELPH_atomic_amplitude.F ypp/el-ph/ELPH_databases.F ypp/el-ph/ELPH_double_grid.F ypp/el-ph/ELPH_eliashberg_dos.F ypp/el-ph/ELPH_excitonic_gkkp.F ypp/el-ph/ELPH_general_gFsq.F ypp/el-ph/ELPH_plot_gkkp.F ypp/el-ph/Eliashberg_Dos_Func.F ypp/electrons/electrons_WFs.F ypp/electrons/electrons_angular_momentum.F ypp/electrons/electrons_bands.F ypp/electrons/electrons_dos.F ypp/electrons/electrons_driver.F ypp/electrons/electrons_magnetization.F ypp/electrons/electrons_position.F ypp/excitons/excitons_WFs.F ypp/excitons/excitons_bands.F ypp/excitons/excitons_driver.F ypp/excitons/excitons_interpolate_setup.F ypp/excitons/excitons_ph_ass_dos.F ypp/excitons/excitons_read.F ypp/excitons/excitons_spin.F ypp/interface/INIT_ypp.F ypp/interface/QP_DBs_initialize.F ypp/k-points/k_circuit_driver.F ypp/k-points/k_circuit_made_of_special_points.F ypp/k-points/k_circuit_made_of_user_points.F ypp/k-points/k_find_border_and_merge.F ypp/k-points/k_grids.F ypp/k-points/k_map_fine_to_coarse.F ypp/k-points/k_map_fine_to_coarse_driver.F ypp/k-points/k_map_fine_to_coarse_engine.F ypp/k-points/k_map_fine_to_coarse_init.F ypp/k-points/k_map_fine_to_coarse_reduce.F ypp/k-points/k_random.F ypp/k-points/k_special.F ypp/plotting/PROJECTION_plot.F ypp/plotting/plot_gnuplot.F ypp/plotting/plot_interpolated_values.F ypp/plotting/plot_xcrysden.F ypp/qp/QP_DB_expand.F ypp/qp/QP_DBs_create_and_modify.F ypp/qp/QP_DBs_manipulate.F ypp/real_time/NL_exc_driver.F ypp/real_time/NL_ypp_driver.F ypp/real_time/RT_1D_Fourier_setup.F ypp/real_time/RT_G_two_times_build.F ypp/real_time/RT_G_two_times_interp_and_plot.F ypp/real_time/RT_OBSERVABLES_IO.F ypp/real_time/RT_OBSERVABLES_damp_and_write.F ypp/real_time/RT_Polarization.F ypp/real_time/RT_TRabs_driver.F ypp/real_time/RT_TRabs_output.F ypp/real_time/RT_TRabs_residuals.F ypp/real_time/RT_X_LRR_real_field.F ypp/real_time/RT_X_effective.F ypp/real_time/RT_X_inversion.F ypp/real_time/RT_X_qssin.F ypp/real_time/RT_X_response.F ypp/real_time/RT_coefficients_Fourier.F ypp/real_time/RT_coefficients_Inversion.F ypp/real_time/RT_components_energy_plot.F ypp/real_time/RT_density.F ypp/real_time/RT_dos_time_plot.F ypp/real_time/RT_occ_bands_interpolation.F ypp/real_time/RT_occ_time_plot.F ypp/real_time/RT_occupations_driver.F ypp/real_time/RT_split_Polarization.F ypp/real_time/RT_time_configuration_setup.F ypp/symmetries/fix_ATOMPROJs.F ypp/symmetries/fix_PPs.F ypp/symmetries/fix_QP_DBs.F ypp/symmetries/fix_SC_DBs.F ypp/symmetries/fix_WFs_Gshells.F ypp/symmetries/fix_WFs_and_E.F ypp/symmetries/fix_symmetries.F ypp/symmetries/symmetries_driver.F

NEW *  sbin/move_include_files.sh

Bugs:
-

Additions:
-

Changes:
-

Patch sent by:  Davide Sangalli <[email protected]>
@sangallidavide sangallidavide marked this pull request as draft October 29, 2024 17:50
@andreamarini
Copy link
Member

I do think that the use of macros should be avoided.

In the maintenance/master I fixed a problem in K_blocks where the lines

 integer(IPL) :: HOST_SIZE(1),TMP_SIZE,LOCAL_SIZE(1)

are there to provide y_memory.h with pieces of modules.

In this way something is declared but not used in routine body but in a macro.

This makes the code difficult to read and with hidden dependencies.

@andreamarini andreamarini marked this pull request as ready for review October 29, 2024 20:06
@sangallidavide
Copy link
Member Author

I think we do not want to remove all the macros, e.g. remove YAMBO_ALLOC.

However, I agree there is an asymmetry between this explicit declaration
integer(IPL) :: HOST_SIZE(1),TMP_SIZE,LOCAL_SIZE(1)
and the use of the macro YAMBO_PAR_ALLOC.

I've seen the proposed solution, but it forces back the header to be put inside the fortran code.

A possible solutions, which can merge the two things, is defining:

define YAMBO_PAR_ALLOC_DEFS \
integer(IPL) :: HOST_SIZE(1),TMP_SIZE,LOCAL_SIZE(1)

and similarly

use    y_memory   ONLY: ... ``

Doing so, in the main source, only `YAMBO_PAR_ALLOC` and `YAMBO_PAR_ALLOC_DEF` and `USE_PAR_MEMORY` would appear.

MODIFIED *  configure include/version/version.m4

Changes:
- configure re-generated

Patch sent by:  Davide Sangalli <[email protected]>
Version 5.3.0,  Revision 23799,  Hash d803014

MODIFIED *  config/configure.ac config/mk/global/actions/compile_interfaces.mk config/mk/global/actions/compile_yambo.mk config/mk/global/actions/compile_yambo_libraries.mk config/mk/global/actions/compile_ypp.mk config/mk/global/actions/dependencies.mk config/mk/global/actions/download_external_libraries.mk config/mk/global/actions/help.mk config/mk/global/functions/cleaning.mk config/mk/global/functions/help.mk config/mk/global/functions/mk_exe.mk config/mk/global/libraries.mk config/mk/local/functions.mk config/mk/local/makefile config/report.in config/setup.in configure include/version/version.m4 lib/archive/Makefile.loc lib/archive/git.list.in lib/archive/package.list sbin/compilation/check_updated_locks.sh sbin/compilation/dependencies_project.sh sbin/compilation/object_save_and_restore.sh Ymodules/DOUBLE_project.dep common/DOUBLE_project.dep driver/.objects driver/DOUBLE_project.dep driver/QED_project.dep driver/YPP_RT_project.dep driver/a2y_project.dep linear_algebra/DOUBLE_project.dep qp/SC_project.dep wf_and_fft/DOUBLE_project.dep

NEW *  include/driver/driver.h include/driver/fortran_arguments.h include/driver/kind.h include/driver/wrapper.h driver/C_driver_transfer.F driver/YPP_ELPH_project.dep driver/YPP_NL_project.dep driver/YPP_SC_project.dep driver/c2y_project.dep driver/command_line.c driver/driver.c driver/get_libraries.c driver/get_runlevel.c driver/get_running_project.c driver/get_running_tool.c driver/get_version.c driver/input_file.c driver/launcher.c driver/load_environments.c driver/mod_C_driver.F driver/options_help.c driver/options_maker.c driver/p2y_project.dep driver/title.c driver/tool_init.c driver/usage.c driver/use_me.c driver/winsize.c driver/yambo_project.dep driver/ypp_project.dep gpu_test/DOUBLE_project.dep gpu_test_mod/DOUBLE_project.dep

DELETED *  config/m4/yambo_driver.m4 include/driver/fortran_ydriver.h

Bugs:
-

Additions:
-

Changes:
-

Patch sent by:  Davide Sangalli <[email protected]>
MODIFIED *  configure include/version/version.m4 driver/get_libraries.c

Changes:
- [yambo] Changed flags order

Patch sent by:  Davide Sangalli <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants