epfl-theos / koopmans

Implementation of Koopmans-compliant functionals in Quantum ESPRESSO
https://koopmans-functionals.org
GNU General Public License v2.0
14 stars 6 forks source link

pw2wannier90 fails if too many tasks #196

Open nscolonna opened 1 year ago

nscolonna commented 1 year ago

In the periodic workflow we combine primitive cell (pwscf pw2wannier90 wannier90) and Super cell (kcp.x) calculations that might require very different parallelization strategies. Asking for the adequate number of tasks for the SC calculations might end up with a failure of pw2wannier because in the PC there are not enough plane-wave to parallelize over. It would be great to have the possibility to setup different parallelization strategies in the two cases. Maybe I'm too naive but shouldn't the definition of two distinct PARA_PREFIX enviromental variables easily fix this issue? E.g. Suppose I ask for 100 tasks (that I know are needed for the SC calculations but makes pw2wannier fail) and I define PARA_PREFIX_PC="srun -n 10" and PARA_PREFIX_SC="srun".

elinscott commented 1 year ago

Good spotting. I don't think we want to add more environmental variables unless it's absolutely necessary.

What about the following solution: koopmans checks the number of plane waves, compares against $PARA_PREFIX (and $SLURM_NTASKS if PARA_PREFIX="srun"), and then temporarily alters$PARA_PREFIX` if required.

Is this sufficiently flexible? Or might a user want to do more than simply decrease the number of tasks when going from PC to SC?

nscolonna commented 1 year ago

Thanks Edward! I think what you suggested is perfect. Reducing the number of tasks is the only option for pw2wannier (it is not parallelized over k-points). For pw.x one can imagine to keep the same number of tasks and parallelize over k-points. But as far as I understood this is what pw.x automatically does (otherwise also pw.x should fail as pw2wannier). In any case we typically deal with small meshes so not a big deal :) Does Koopmans already computes the number of PW or this is something we have to implement in python?

nscolonna commented 8 months ago

Possible alternative solution: exploit other parallelisation schemes e.g. pencil decomposition (-pd .true.) for pw2wannier90.x.