<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=Windows-1252">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<div class="elementToProof" style="line-height: 100%; margin-top: 1em; margin-bottom: 0in; font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Dear QE developers, <br>
</div>
<div class="elementToProof" style="line-height: 100%; margin-top: 1em; margin-bottom: 0in; font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
I had a conceptual question of how I should correctly modify a subroutine in order to avoid parallelization and memory’s absurdities. Specifically, my idea is to slightly modify one of the subroutines in the “calbec” (becmod.f90) interface that is computing
 <\Beta|\psi> products, and I am using QE v.6.4 because I’m working on a specific code repository using this version. By calling such or similar line:<br>
</div>
<div style="line-height: 100%; margin-top: 1em; margin-bottom: 0in; font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
CALL ZGEMV( 'C', npw, nkb, (1.0_DP,0.0_DP), beta, npwx, psi, 1, &</div>
<div class="elementToProof" style="line-height: 100%; margin-top: 1em; margin-bottom: 0in; font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
(0.0_DP, 0.0_DP), betapsi, 1 )<br>
</div>
<div class="elementToProof" style="line-height: 100%; margin-top: 1em; margin-bottom: 0in; font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
and subsequently summing through bands:<br>
</div>
<div class="elementToProof" style="line-height: 100%; margin-top: 1em; margin-bottom: 0in; font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
CALL mp_sum( betapsi( :, 1:m ), intra_bgrp_comm )<br>
</div>
<div class="elementToProof" style="line-height: 100%; margin-top: 1em; margin-bottom: 0in; font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
“calbec_k” computes the betapsi product as a 2D matrix with dimension (number of projectors, number of bands). My goal is to compute the same product but accessing the elements at each G vectors, i.e. without summing over the G vectors themselves. To this end,
 my (very basic, probably terrible) idea was to define another subroutine with an extra variable like this (without breaking the requirement of having unambiguous interface procedures in “calbec”):<br>
</div>
<div style="line-height: 100%; margin-top: 1em; margin-bottom: 0in; font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
calbec_k_modified ( npw, beta, psi, betapsi, betapsi_g, nbnd )</div>
<div class="elementToProof" style="line-height: 100%; margin-top: 1em; margin-bottom: 0in; font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
COMPLEX (DP), INTENT (out) :: betapsi_g(:,:,:) <br>
</div>
<div class="elementToProof" style="line-height: 100%; margin-top: 1em; margin-bottom: 0in; font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
and explicitly computing betapsi_g with nested do loops: <br>
</div>
<div style="line-height: 100%; margin-top: 1em; margin-bottom: 0in; font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
DO k = 1, npw</div>
<div style="line-height: 100%; margin-top: 1em; margin-bottom: 0in; font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
DO i = 1, nkb</div>
<div style="line-height: 100%; margin-top: 1em; margin-bottom: 0in; font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
DO j = 1, m</div>
<div style="line-height: 100%; margin-top: 1em; margin-bottom: 0in; font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
betapsi_g(k, i, j) = CONJG(beta(k, i)) * psi(k, j)</div>
<div style="line-height: 100%; margin-top: 1em; margin-bottom: 0in; font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
ENDDO</div>
<div style="line-height: 100%; margin-top: 1em; margin-bottom: 0in; font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
ENDDO</div>
<div class="elementToProof" style="line-height: 100%; margin-top: 1em; margin-bottom: 0in; font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
ENDDO<br>
</div>
<div class="elementToProof" style="line-height: 100%; margin-top: 1em; margin-bottom: 0in; font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
I am very unsure of whether this is a feasible approach and how I should handle the MPI parallelization in this case (I have little experience in QE development). I read the parallelization section of the developer’s manual, but I’m still quite confused. Any
 suggestions, critics or explanations will be very appreciated. </div>
<div class="elementToProof" style="line-height: 100%; margin-top: 1em; margin-bottom: 0in; font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Best regards,</div>
<div class="elementToProof" style="line-height: 100%; margin-top: 1em; margin-bottom: 0in; font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Luca Marin</div>
<div class="elementToProof" style="line-height: 100%; margin-top: 1em; margin-bottom: 0in; font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
ETH Zurich, PhD student </div>
<div class="elementToProof" style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
</body>
</html>