This commit is contained in:
Matteo Giantomassi 2016-01-21 20:40:42 +01:00
commit 38929f1b56
49 changed files with 172922 additions and 181 deletions

View File

@ -3,6 +3,8 @@ This module gathers the most important classes and helper functions used for scr
"""
from __future__ import print_function, division, unicode_literals
import os
from monty.os.path import which
from pymatgen.core.units import *
from pymatgen.io.abinit.eos import EOS
@ -59,6 +61,14 @@ def _straceback():
def abifile_subclass_from_filename(filename):
"""Returns the appropriate class associated to the given filename."""
# Abinit text files.
if filename.endswith(".abi"): return AbinitInputFile
if filename.endswith(".abo"): return AbinitOutputFile
if filename.endswith(".log"): return AbinitLogFile
# CIF files.
if filename.endswith(".cif"): return Structure
ext2ncfile = {
"SIGRES.nc": SigresFile,
"WFK-etsf.nc": WfkFile,
@ -72,14 +82,6 @@ def abifile_subclass_from_filename(filename):
"PSPS.nc": PspsFile,
}
# Abinit text files.
if filename.endswith(".abi"): return AbinitInputFile
if filename.endswith(".abo"): return AbinitOutputFile
if filename.endswith(".log"): return AbinitLogFile
# CIF files.
if filename.endswith(".cif"): return Structure
ext = filename.split("_")[-1]
try:
return ext2ncfile[ext]
@ -99,6 +101,9 @@ def abiopen(filepath):
Args:
filepath: string with the filename.
"""
if os.path.basename(filepath) == "__AbinitFlow__.pickle":
return Flow.pickle_load(filepath)
cls = abifile_subclass_from_filename(filepath)
return cls.from_file(filepath)
@ -145,7 +150,6 @@ def abicheck():
Raises:
RuntimeError if not all the dependencies are fulfilled.
"""
import os
# Executables must be in $PATH. Unfortunately we cannot test the version of the binaries.
# A possible approach would be to execute "exe -v" but supporting argv in Fortran is not trivial.
# Dynamic linking is tested by calling `ldd exe`

View File

@ -701,6 +701,18 @@ class AbinitInput(six.with_metaclass(abc.ABCMeta, AbstractInput, MSONable, Has_S
return inps
def new_with_vars(self, *args, **kwargs):
"""
Return a new input with the given variables.
Example:
new = input.new_with_vars(ecut=20)
"""
# Avoid modifications in self.
new = self.deepcopy()
new.set_vars(*args, **kwargs)
return new
def new_with_decorators(self, decorators):
"""
This function receives a list of :class:`AbinitInputDecorator` objects or just a single object,
@ -1094,7 +1106,10 @@ class AbinitInput(six.with_metaclass(abc.ABCMeta, AbstractInput, MSONable, Has_S
workdir=workdir, manager=manager)
def abiget_autoparal_pconfs(self, max_ncpus, autoparal=1, workdir=None, manager=None):
"""Get all the possible configurations up to max_ncpus"""
"""
Get all the possible configurations up to max_ncpus
Return list of parallel configurations.
"""
inp = self.deepcopy()
inp.set_vars(autoparal=autoparal, max_ncpus=max_ncpus)

View File

@ -0,0 +1,163 @@
# ABINIT -INPUT FILE
# OR 107 ATOMES
# Distribution des processeurs
npkpt 1 npband 13 npfft 10 # 130 processeurs
#npkpt 1 npband 26 npfft 10 # 260 processeurs
#npkpt 1 npband 65 npfft 8 # 520 processeurs
#npkpt 1 npband 65 npfft 16 # 1040 processeurs
# Algorithmes pour les fonctions d'onde
paral_kgb 1
wfoptalg 1
fftalg 402
#fftalg 302 ! To use FFTW instead of ABINIT FFT
# Donnees de la base d'ondes planes
ecut 10.
pawecutdg 20.
# Parametres du cycle auto-coherent
toldfe 1.d-5
nstep 20
# Points K et symetries
nkpt 1
kpt 3*0.
kptopt 0
istwfk *1
nsym 0
chksymbreak 0
# Bandes electroniques
nband 650
occopt 3
tsmear 0.002 hartree
nbdbuf 20
# Cellule de simulation
acell 3*23.01
rprim 1. 0. 0. 0. 1. 0. 0. 0. 1.
natom 107
ntypat 1
typat 107*1
znucl 79.
chkprim 0
# Activation/desactvation des I/O
optforces 2
optstress 1
prtwf 0
prtden 0
prteig 0
timopt 0
#Positions des atomes
xred
0.0000000000E+00 1.6326095981E-01 1.6326095981E-01
1.6326095981E-01 0.0000000000E+00 1.6326095981E-01
1.6326095981E-01 1.6326095981E-01 0.0000000000E+00
0.0000000000E+00 1.6641506689E-01 5.0000000000E-01
1.6641506689E-01 0.0000000000E+00 5.0000000000E-01
1.6596912386E-01 1.6596912386E-01 3.3213568011E-01
0.0000000000E+00 0.0000000000E+00 3.3251308046E-01
0.0000000000E+00 1.6326095981E-01 8.3673904019E-01
1.6326095981E-01 0.0000000000E+00 8.3673904019E-01
1.6596912386E-01 1.6596912386E-01 6.6786431989E-01
0.0000000000E+00 0.0000000000E+00 6.6748691954E-01
0.0000000000E+00 5.0000000000E-01 1.6641506689E-01
1.6596912386E-01 3.3213568011E-01 1.6596912386E-01
1.6641506689E-01 5.0000000000E-01 0.0000000000E+00
0.0000000000E+00 3.3251308046E-01 0.0000000000E+00
0.0000000000E+00 5.0000000000E-01 5.0000000000E-01
1.6649623194E-01 3.3291657817E-01 5.0000000000E-01
1.6649623194E-01 5.0000000000E-01 3.3291657817E-01
0.0000000000E+00 3.3314040855E-01 3.3314040855E-01
0.0000000000E+00 5.0000000000E-01 8.3358493311E-01
1.6596912386E-01 3.3213568011E-01 8.3403087614E-01
1.6649623194E-01 5.0000000000E-01 6.6708342183E-01
0.0000000000E+00 3.3314040855E-01 6.6685959145E-01
0.0000000000E+00 8.3673904019E-01 1.6326095981E-01
1.6596912386E-01 6.6786431989E-01 1.6596912386E-01
1.6326095981E-01 8.3673904019E-01 0.0000000000E+00
0.0000000000E+00 6.6748691954E-01 0.0000000000E+00
0.0000000000E+00 8.3358493311E-01 5.0000000000E-01
1.6649623194E-01 6.6708342183E-01 5.0000000000E-01
1.6596912386E-01 8.3403087614E-01 3.3213568011E-01
0.0000000000E+00 6.6685959145E-01 3.3314040855E-01
0.0000000000E+00 8.3673904019E-01 8.3673904019E-01
1.6596912386E-01 6.6786431989E-01 8.3403087614E-01
1.6596912386E-01 8.3403087614E-01 6.6786431989E-01
0.0000000000E+00 6.6685959145E-01 6.6685959145E-01
3.3213568011E-01 1.6596912386E-01 1.6596912386E-01
5.0000000000E-01 0.0000000000E+00 1.6641506689E-01
5.0000000000E-01 1.6641506689E-01 0.0000000000E+00
3.3251308046E-01 0.0000000000E+00 0.0000000000E+00
3.3291657817E-01 1.6649623194E-01 5.0000000000E-01
5.0000000000E-01 0.0000000000E+00 5.0000000000E-01
5.0000000000E-01 1.6649623194E-01 3.3291657817E-01
3.3314040855E-01 0.0000000000E+00 3.3314040855E-01
3.3213568011E-01 1.6596912386E-01 8.3403087614E-01
5.0000000000E-01 0.0000000000E+00 8.3358493311E-01
5.0000000000E-01 1.6649623194E-01 6.6708342183E-01
3.3314040855E-01 0.0000000000E+00 6.6685959145E-01
3.3291657817E-01 5.0000000000E-01 1.6649623194E-01
5.0000000000E-01 3.3291657817E-01 1.6649623194E-01
5.0000000000E-01 5.0000000000E-01 0.0000000000E+00
3.3314040855E-01 3.3314040855E-01 0.0000000000E+00
3.3316116420E-01 5.0000000000E-01 5.0000000000E-01
5.0000000000E-01 3.3316116420E-01 5.0000000000E-01
5.0000000000E-01 5.0000000000E-01 3.3316116420E-01
3.3302887829E-01 3.3302887829E-01 3.3302887829E-01
3.3291657817E-01 5.0000000000E-01 8.3350376806E-01
5.0000000000E-01 3.3291657817E-01 8.3350376806E-01
5.0000000000E-01 5.0000000000E-01 6.6683883580E-01
3.3302887829E-01 3.3302887829E-01 6.6697112171E-01
3.3213568011E-01 8.3403087614E-01 1.6596912386E-01
5.0000000000E-01 6.6708342183E-01 1.6649623194E-01
5.0000000000E-01 8.3358493311E-01 0.0000000000E+00
3.3314040855E-01 6.6685959145E-01 0.0000000000E+00
3.3291657817E-01 8.3350376806E-01 5.0000000000E-01
5.0000000000E-01 6.6683883580E-01 5.0000000000E-01
5.0000000000E-01 8.3350376806E-01 3.3291657817E-01
3.3302887829E-01 6.6697112171E-01 3.3302887829E-01
3.3213568011E-01 8.3403087614E-01 8.3403087614E-01
5.0000000000E-01 6.6708342183E-01 8.3350376806E-01
5.0000000000E-01 8.3350376806E-01 6.6708342183E-01
3.3302887829E-01 6.6697112171E-01 6.6697112171E-01
6.6786431989E-01 1.6596912386E-01 1.6596912386E-01
8.3673904019E-01 0.0000000000E+00 1.6326095981E-01
8.3673904019E-01 1.6326095981E-01 0.0000000000E+00
6.6748691954E-01 0.0000000000E+00 0.0000000000E+00
6.6708342183E-01 1.6649623194E-01 5.0000000000E-01
8.3358493311E-01 0.0000000000E+00 5.0000000000E-01
8.3403087614E-01 1.6596912386E-01 3.3213568011E-01
6.6685959145E-01 0.0000000000E+00 3.3314040855E-01
6.6786431989E-01 1.6596912386E-01 8.3403087614E-01
8.3673904019E-01 0.0000000000E+00 8.3673904019E-01
8.3403087614E-01 1.6596912386E-01 6.6786431989E-01
6.6685959145E-01 0.0000000000E+00 6.6685959145E-01
6.6708342183E-01 5.0000000000E-01 1.6649623194E-01
8.3403087614E-01 3.3213568011E-01 1.6596912386E-01
8.3358493311E-01 5.0000000000E-01 0.0000000000E+00
6.6685959145E-01 3.3314040855E-01 0.0000000000E+00
6.6683883580E-01 5.0000000000E-01 5.0000000000E-01
8.3350376806E-01 3.3291657817E-01 5.0000000000E-01
8.3350376806E-01 5.0000000000E-01 3.3291657817E-01
6.6697112171E-01 3.3302887829E-01 3.3302887829E-01
6.6708342183E-01 5.0000000000E-01 8.3350376806E-01
8.3403087614E-01 3.3213568011E-01 8.3403087614E-01
8.3350376806E-01 5.0000000000E-01 6.6708342183E-01
6.6697112171E-01 3.3302887829E-01 6.6697112171E-01
6.6786431989E-01 8.3403087614E-01 1.6596912386E-01
8.3403087614E-01 6.6786431989E-01 1.6596912386E-01
8.3673904019E-01 8.3673904019E-01 0.0000000000E+00
6.6685959145E-01 6.6685959145E-01 0.0000000000E+00
6.6708342183E-01 8.3350376806E-01 5.0000000000E-01
8.3350376806E-01 6.6708342183E-01 5.0000000000E-01
8.3403087614E-01 8.3403087614E-01 3.3213568011E-01
6.6697112171E-01 6.6697112171E-01 3.3302887829E-01
6.6786431989E-01 8.3403087614E-01 8.3403087614E-01
8.3403087614E-01 6.6786431989E-01 8.3403087614E-01
8.3403087614E-01 8.3403087614E-01 6.6786431989E-01
6.6697112171E-01 6.6697112171E-01 6.6697112171E-01

219
abipy/benchmarks/AU107/flowgen.py Executable file
View File

@ -0,0 +1,219 @@
#!/usr/bin/env python
from __future__ import division, print_function, unicode_literals, absolute_import
import sys
import operator
import numpy as np
import abipy.abilab as abilab
import abipy.data as abidata
from abipy.benchmarks import bench_main, BenchmarkFlow
def make_input():
"""
GS calculations with paralkgb==1
Gold with 107 atoms.
"""
pseudos = abidata.pseudos("au.paw")
# Atomic Positions.
xred = np.fromstring("""
0.0000000000E+00 1.6326095981E-01 1.6326095981E-01
1.6326095981E-01 0.0000000000E+00 1.6326095981E-01
1.6326095981E-01 1.6326095981E-01 0.0000000000E+00
0.0000000000E+00 1.6641506689E-01 5.0000000000E-01
1.6641506689E-01 0.0000000000E+00 5.0000000000E-01
1.6596912386E-01 1.6596912386E-01 3.3213568011E-01
0.0000000000E+00 0.0000000000E+00 3.3251308046E-01
0.0000000000E+00 1.6326095981E-01 8.3673904019E-01
1.6326095981E-01 0.0000000000E+00 8.3673904019E-01
1.6596912386E-01 1.6596912386E-01 6.6786431989E-01
0.0000000000E+00 0.0000000000E+00 6.6748691954E-01
0.0000000000E+00 5.0000000000E-01 1.6641506689E-01
1.6596912386E-01 3.3213568011E-01 1.6596912386E-01
1.6641506689E-01 5.0000000000E-01 0.0000000000E+00
0.0000000000E+00 3.3251308046E-01 0.0000000000E+00
0.0000000000E+00 5.0000000000E-01 5.0000000000E-01
1.6649623194E-01 3.3291657817E-01 5.0000000000E-01
1.6649623194E-01 5.0000000000E-01 3.3291657817E-01
0.0000000000E+00 3.3314040855E-01 3.3314040855E-01
0.0000000000E+00 5.0000000000E-01 8.3358493311E-01
1.6596912386E-01 3.3213568011E-01 8.3403087614E-01
1.6649623194E-01 5.0000000000E-01 6.6708342183E-01
0.0000000000E+00 3.3314040855E-01 6.6685959145E-01
0.0000000000E+00 8.3673904019E-01 1.6326095981E-01
1.6596912386E-01 6.6786431989E-01 1.6596912386E-01
1.6326095981E-01 8.3673904019E-01 0.0000000000E+00
0.0000000000E+00 6.6748691954E-01 0.0000000000E+00
0.0000000000E+00 8.3358493311E-01 5.0000000000E-01
1.6649623194E-01 6.6708342183E-01 5.0000000000E-01
1.6596912386E-01 8.3403087614E-01 3.3213568011E-01
0.0000000000E+00 6.6685959145E-01 3.3314040855E-01
0.0000000000E+00 8.3673904019E-01 8.3673904019E-01
1.6596912386E-01 6.6786431989E-01 8.3403087614E-01
1.6596912386E-01 8.3403087614E-01 6.6786431989E-01
0.0000000000E+00 6.6685959145E-01 6.6685959145E-01
3.3213568011E-01 1.6596912386E-01 1.6596912386E-01
5.0000000000E-01 0.0000000000E+00 1.6641506689E-01
5.0000000000E-01 1.6641506689E-01 0.0000000000E+00
3.3251308046E-01 0.0000000000E+00 0.0000000000E+00
3.3291657817E-01 1.6649623194E-01 5.0000000000E-01
5.0000000000E-01 0.0000000000E+00 5.0000000000E-01
5.0000000000E-01 1.6649623194E-01 3.3291657817E-01
3.3314040855E-01 0.0000000000E+00 3.3314040855E-01
3.3213568011E-01 1.6596912386E-01 8.3403087614E-01
5.0000000000E-01 0.0000000000E+00 8.3358493311E-01
5.0000000000E-01 1.6649623194E-01 6.6708342183E-01
3.3314040855E-01 0.0000000000E+00 6.6685959145E-01
3.3291657817E-01 5.0000000000E-01 1.6649623194E-01
5.0000000000E-01 3.3291657817E-01 1.6649623194E-01
5.0000000000E-01 5.0000000000E-01 0.0000000000E+00
3.3314040855E-01 3.3314040855E-01 0.0000000000E+00
3.3316116420E-01 5.0000000000E-01 5.0000000000E-01
5.0000000000E-01 3.3316116420E-01 5.0000000000E-01
5.0000000000E-01 5.0000000000E-01 3.3316116420E-01
3.3302887829E-01 3.3302887829E-01 3.3302887829E-01
3.3291657817E-01 5.0000000000E-01 8.3350376806E-01
5.0000000000E-01 3.3291657817E-01 8.3350376806E-01
5.0000000000E-01 5.0000000000E-01 6.6683883580E-01
3.3302887829E-01 3.3302887829E-01 6.6697112171E-01
3.3213568011E-01 8.3403087614E-01 1.6596912386E-01
5.0000000000E-01 6.6708342183E-01 1.6649623194E-01
5.0000000000E-01 8.3358493311E-01 0.0000000000E+00
3.3314040855E-01 6.6685959145E-01 0.0000000000E+00
3.3291657817E-01 8.3350376806E-01 5.0000000000E-01
5.0000000000E-01 6.6683883580E-01 5.0000000000E-01
5.0000000000E-01 8.3350376806E-01 3.3291657817E-01
3.3302887829E-01 6.6697112171E-01 3.3302887829E-01
3.3213568011E-01 8.3403087614E-01 8.3403087614E-01
5.0000000000E-01 6.6708342183E-01 8.3350376806E-01
5.0000000000E-01 8.3350376806E-01 6.6708342183E-01
3.3302887829E-01 6.6697112171E-01 6.6697112171E-01
6.6786431989E-01 1.6596912386E-01 1.6596912386E-01
8.3673904019E-01 0.0000000000E+00 1.6326095981E-01
8.3673904019E-01 1.6326095981E-01 0.0000000000E+00
6.6748691954E-01 0.0000000000E+00 0.0000000000E+00
6.6708342183E-01 1.6649623194E-01 5.0000000000E-01
8.3358493311E-01 0.0000000000E+00 5.0000000000E-01
8.3403087614E-01 1.6596912386E-01 3.3213568011E-01
6.6685959145E-01 0.0000000000E+00 3.3314040855E-01
6.6786431989E-01 1.6596912386E-01 8.3403087614E-01
8.3673904019E-01 0.0000000000E+00 8.3673904019E-01
8.3403087614E-01 1.6596912386E-01 6.6786431989E-01
6.6685959145E-01 0.0000000000E+00 6.6685959145E-01
6.6708342183E-01 5.0000000000E-01 1.6649623194E-01
8.3403087614E-01 3.3213568011E-01 1.6596912386E-01
8.3358493311E-01 5.0000000000E-01 0.0000000000E+00
6.6685959145E-01 3.3314040855E-01 0.0000000000E+00
6.6683883580E-01 5.0000000000E-01 5.0000000000E-01
8.3350376806E-01 3.3291657817E-01 5.0000000000E-01
8.3350376806E-01 5.0000000000E-01 3.3291657817E-01
6.6697112171E-01 3.3302887829E-01 3.3302887829E-01
6.6708342183E-01 5.0000000000E-01 8.3350376806E-01
8.3403087614E-01 3.3213568011E-01 8.3403087614E-01
8.3350376806E-01 5.0000000000E-01 6.6708342183E-01
6.6697112171E-01 3.3302887829E-01 6.6697112171E-01
6.6786431989E-01 8.3403087614E-01 1.6596912386E-01
8.3403087614E-01 6.6786431989E-01 1.6596912386E-01
8.3673904019E-01 8.3673904019E-01 0.0000000000E+00
6.6685959145E-01 6.6685959145E-01 0.0000000000E+00
6.6708342183E-01 8.3350376806E-01 5.0000000000E-01
8.3350376806E-01 6.6708342183E-01 5.0000000000E-01
8.3403087614E-01 8.3403087614E-01 3.3213568011E-01
6.6697112171E-01 6.6697112171E-01 3.3302887829E-01
6.6786431989E-01 8.3403087614E-01 8.3403087614E-01
8.3403087614E-01 6.6786431989E-01 8.3403087614E-01
8.3403087614E-01 8.3403087614E-01 6.6786431989E-01
6.6697112171E-01 6.6697112171E-01 6.6697112171E-01
""", sep=" ").reshape((-1,3))
# Crystal structure.
structure = abilab.Structure.from_abivars(
acell=3*[23.01],
rprim=np.eye(3),
typat=107*[1],
znucl=79.,
xred=xred,
)
inp = abilab.AbinitInput(structure, pseudos)
inp.set_vars(
# Basis set.
ecut=10.,
pawecutdg=20.,
# SCF algorithm
paral_kgb=1,
wfoptalg=1,
fftalg=402,
#fftalg=302, # To use FFTW instead of ABINIT FFT
# SCF cycle
toldfe=1.e-5,
nstep=20,
# K-points and symmetries.
nkpt=1,
kpt=3*[0.],
kptopt=0,
istwfk="*1",
nsym=0,
chksymbreak=0,
chkprim=0,
# Bands and occupation scheme
nband=650,
occopt=3,
tsmear=0.002,
nbdbuf=20,
# Activation/desactvation des I/O
optforces=2,
optstress=1,
prtwf=0,
prtden=0,
prteig=0,
timopt=-1,
)
return inp
def build_flow(options):
flow = BenchmarkFlow(workdir="bench_au108")
work = abilab.Work()
template = make_input()
# Processor distribution.
pconfs = [
dict(npkpt=1, npband=13, npfft=10), # 130
dict(npkpt=1, npband=26, npfft=10), # 260
dict(npkpt=1, npband=65, npfft=8 ), # 520
dict(npkpt=1, npband=65, npfft=16), # 1040
]
for d in pconfs:
mpi_procs = reduce(operator.mul, d.values(), 1)
manager = options.manager.deepcopy()
manager.policy.autoparal = 0
manager.set_mpi_procs(mpi_procs)
print("MPI_PROCS:", mpi_procs, "done with:", d)
inp = template.new_with_vars(d)
#inp.abivalidate()
work.register(inp, manager=manager)
flow.register_work(work)
return flow.allocate()
@bench_main
def main(options):
flow = build_flow(options)
flow.build_and_pickle_dump()
return flow
if __name__ == "__main__":
sys.exit(main())

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

370
abipy/benchmarks/TI256/flowgen.py Executable file
View File

@ -0,0 +1,370 @@
#!/usr/bin/env python
from __future__ import division, print_function, unicode_literals, absolute_import
import sys
import operator
import numpy as np
import abipy.abilab as abilab
import abipy.data as abidata
from abipy.benchmarks import bench_main, BenchmarkFlow
def make_input():
"""
GS calculations with paralkgb==1
Titanium with 256 atoms.
"""
pseudos = abidata.pseudos("ti.paw")
# Atomic Positions.
xred = np.fromstring("""
0.00000000000000 0.00000000000000 0.00000000000000
0.06250000000000 0.12500000000000 0.12500000000000
0.00000000000000 0.00000000000000 0.25000000000000
0.06250000000000 0.12500000000000 0.37500000000000
0.00000000000000 0.00000000000000 0.50000000000000
0.06250000000000 0.12500000000000 0.62500000000000
0.00000000000000 0.00000000000000 0.75000000000000
0.06250000000000 0.12500000000000 0.87500000000000
0.00000000000000 0.25000000000000 0.00000000000000
0.06250000000000 0.37500000000000 0.12500000000000
0.00000000000000 0.25000000000000 0.25000000000000
0.06250000000000 0.37500000000000 0.37500000000000
0.00000000000000 0.25000000000000 0.50000000000000
0.06250000000000 0.37500000000000 0.62500000000000
0.00000000000000 0.25000000000000 0.75000000000000
0.06250000000000 0.37500000000000 0.87500000000000
0.00000000000000 0.50000000000000 0.00000000000000
0.06250000000000 0.62500000000000 0.12500000000000
0.00000000000000 0.50000000000000 0.25000000000000
0.06250000000000 0.62500000000000 0.37500000000000
0.00000000000000 0.50000000000000 0.50000000000000
0.06250000000000 0.62500000000000 0.62500000000000
0.00000000000000 0.50000000000000 0.75000000000000
0.06250000000000 0.62500000000000 0.87500000000000
0.00000000000000 0.75000000000000 0.00000000000000
0.06250000000000 0.87500000000000 0.12500000000000
0.00000000000000 0.75000000000000 0.25000000000000
0.06250000000000 0.87500000000000 0.37500000000000
0.00000000000000 0.75000000000000 0.50000000000000
0.06250000000000 0.87500000000000 0.62500000000000
0.00000000000000 0.75000000000000 0.75000000000000
0.06250000000000 0.87500000000000 0.87500000000000
0.12500000000000 0.00000000000000 0.00000000000000
0.18750000000000 0.12500000000000 0.12500000000000
0.12500000000000 0.00000000000000 0.25000000000000
0.18750000000000 0.12500000000000 0.37500000000000
0.12500000000000 0.00000000000000 0.50000000000000
0.18750000000000 0.12500000000000 0.62500000000000
0.12500000000000 0.00000000000000 0.75000000000000
0.18750000000000 0.12500000000000 0.87500000000000
0.12500000000000 0.25000000000000 0.00000000000000
0.18750000000000 0.37500000000000 0.12500000000000
0.12500000000000 0.25000000000000 0.25000000000000
0.18750000000000 0.37500000000000 0.37500000000000
0.12500000000000 0.25000000000000 0.50000000000000
0.18750000000000 0.37500000000000 0.62500000000000
0.12500000000000 0.25000000000000 0.75000000000000
0.18750000000000 0.37500000000000 0.87500000000000
0.12500000000000 0.50000000000000 0.00000000000000
0.18750000000000 0.62500000000000 0.12500000000000
0.12500000000000 0.50000000000000 0.25000000000000
0.18750000000000 0.62500000000000 0.37500000000000
0.12500000000000 0.50000000000000 0.50000000000000
0.18750000000000 0.62500000000000 0.62500000000000
0.12500000000000 0.50000000000000 0.75000000000000
0.18750000000000 0.62500000000000 0.87500000000000
0.12500000000000 0.75000000000000 0.00000000000000
0.18750000000000 0.87500000000000 0.12500000000000
0.12500000000000 0.75000000000000 0.25000000000000
0.18750000000000 0.87500000000000 0.37500000000000
0.12500000000000 0.75000000000000 0.50000000000000
0.18750000000000 0.87500000000000 0.62500000000000
0.12500000000000 0.75000000000000 0.75000000000000
0.18750000000000 0.87500000000000 0.87500000000000
0.25000000000000 0.00000000000000 0.00000000000000
0.31250000000000 0.12500000000000 0.12500000000000
0.25000000000000 0.00000000000000 0.25000000000000
0.31250000000000 0.12500000000000 0.37500000000000
0.25000000000000 0.00000000000000 0.50000000000000
0.31250000000000 0.12500000000000 0.62500000000000
0.25000000000000 0.00000000000000 0.75000000000000
0.31250000000000 0.12500000000000 0.87500000000000
0.25000000000000 0.25000000000000 0.00000000000000
0.31250000000000 0.37500000000000 0.12500000000000
0.25000000000000 0.25000000000000 0.25000000000000
0.31250000000000 0.37500000000000 0.37500000000000
0.25000000000000 0.25000000000000 0.50000000000000
0.31250000000000 0.37500000000000 0.62500000000000
0.25000000000000 0.25000000000000 0.75000000000000
0.31250000000000 0.37500000000000 0.87500000000000
0.25000000000000 0.50000000000000 0.00000000000000
0.31250000000000 0.62500000000000 0.12500000000000
0.25000000000000 0.50000000000000 0.25000000000000
0.31250000000000 0.62500000000000 0.37500000000000
0.25000000000000 0.50000000000000 0.50000000000000
0.31250000000000 0.62500000000000 0.62500000000000
0.25000000000000 0.50000000000000 0.75000000000000
0.31250000000000 0.62500000000000 0.87500000000000
0.25000000000000 0.75000000000000 0.00000000000000
0.31250000000000 0.87500000000000 0.12500000000000
0.25000000000000 0.75000000000000 0.25000000000000
0.31250000000000 0.87500000000000 0.37500000000000
0.25000000000000 0.75000000000000 0.50000000000000
0.31250000000000 0.87500000000000 0.62500000000000
0.25000000000000 0.75000000000000 0.75000000000000
0.31250000000000 0.87500000000000 0.87500000000000
0.37500000000000 0.00000000000000 0.00000000000000
0.43750000000000 0.12500000000000 0.12500000000000
0.37500000000000 0.00000000000000 0.25000000000000
0.43750000000000 0.12500000000000 0.37500000000000
0.37500000000000 0.00000000000000 0.50000000000000
0.43750000000000 0.12500000000000 0.62500000000000
0.37500000000000 0.00000000000000 0.75000000000000
0.43750000000000 0.12500000000000 0.87500000000000
0.37500000000000 0.25000000000000 0.00000000000000
0.43750000000000 0.37500000000000 0.12500000000000
0.37500000000000 0.25000000000000 0.25000000000000
0.43750000000000 0.37500000000000 0.37500000000000
0.37500000000000 0.25000000000000 0.50000000000000
0.43750000000000 0.37500000000000 0.62500000000000
0.37500000000000 0.25000000000000 0.75000000000000
0.43750000000000 0.37500000000000 0.87500000000000
0.37500000000000 0.50000000000000 0.00000000000000
0.43750000000000 0.62500000000000 0.12500000000000
0.37500000000000 0.50000000000000 0.25000000000000
0.43750000000000 0.62500000000000 0.37500000000000
0.37500000000000 0.50000000000000 0.50000000000000
0.43750000000000 0.62500000000000 0.62500000000000
0.37500000000000 0.50000000000000 0.75000000000000
0.43750000000000 0.62500000000000 0.87500000000000
0.37500000000000 0.75000000000000 0.00000000000000
0.43750000000000 0.87500000000000 0.12500000000000
0.37500000000000 0.75000000000000 0.25000000000000
0.43750000000000 0.87500000000000 0.37500000000000
0.37500000000000 0.75000000000000 0.50000000000000
0.43750000000000 0.87500000000000 0.62500000000000
0.37500000000000 0.75000000000000 0.75000000000000
0.43750000000000 0.87500000000000 0.87500000000000
0.50066333333333 0.43795366666666 0.20604666666667
0.58978833333333 0.17685666666666 0.24527666666667
0.59038833333333 0.04865666666666 0.46713866666667
0.57337833333333 0.36896766666666 0.44071566666667
0.49437333333333 0.29799666666666 0.62702666666667
0.58165333333333 0.34787366666666 0.95079666666667
0.54251333333333 0.10940666666666 0.84782666666667
0.67878919833333 0.40517666666666 0.06963666666667
0.59048833333333 0.45379666666666 0.10264666666667
0.60238833333333 0.47341066666666 0.31733066666667
0.50515833333333 0.27181666666666 0.25024666666667
0.60375833333333 0.54262666666666 0.50900866666667
0.59347833333333 0.44882266666666 0.67936666666667
0.67186083333333 0.62119666666666 0.73076666666667
0.63907933333333 0.58259666666666 0.93075666666667
0.67825691833333 0.39313466666666 0.28615666666667
0.55216833333333 0.64702666666666 0.29008666666667
0.65788433333333 0.66224666666666 0.34085666666667
0.54558333333333 0.70723666666666 0.50473966666667
0.59868333333333 0.84143666666666 0.65086666666667
0.56312333333333 0.65245666666666 0.66560666666667
0.59459833333333 0.74256666666666 0.86209666666667
0.54859333333333 0.64326666666666 0.02438666666667
0.61449833333333 0.84178666666666 0.03484666666667
0.50916333333333 0.81220666666666 0.08581666666667
0.96250333333333 0.00988666666666 0.16680666666667
0.61246833333333 0.84705666666666 0.43006566666667
0.58969333333333 0.24281666666666 0.62900666666667
0.52407833333333 0.87938666666666 0.92985666666667
0.63529633333333 0.04594666666666 0.68961666666667
0.55587333333333 0.04528666666666 0.08935666666667
0.66776783333333 0.01468666666666 0.17755666666667
0.70887233333333 0.20161666666666 0.21002666666667
0.92334333333333 0.16592666666666 0.29334666666667
0.67033283333333 0.01914666666666 0.36823266666667
0.65631933333333 0.21883666666666 0.36941666666667
0.62474833333333 0.22426666666666 0.80279666666667
0.66286883333333 0.41444856666666 0.82225666666667
0.62886383333333 0.18910666666666 0.05475666666667
0.71154233333333 0.27103666666666 0.73880666666667
0.73958333333333 0.15453666666666 0.01370666666667
0.75625833333333 0.64794666666666 0.24326666666667
0.76121333333333 0.28914666666666 0.37663266666667
0.72632283333333 0.51671666666666 0.43261966666667
0.67498088333333 0.39143366666666 0.52916666666667
0.76689333333333 0.74595666666666 0.77130666666667
0.74752333333333 0.55142666666666 0.86622666666667
0.74464333333333 0.55552666666666 0.08736666666667
0.64824733333333 0.59911666666666 0.13674666666667
0.83169333333333 0.97781666666666 0.30673666666667
0.66809783333333 0.72582666666666 0.55477666666667
0.76887333333333 0.70689666666666 0.49468866666667
0.74088833333333 0.56763666666666 0.64551666666667
0.79800333333333 0.77201666666666 0.97858666666667
0.69187333333333 0.74064666666666 0.93339666666667
0.71363633333333 0.95878666666666 0.99392666666667
0.65551333333333 0.83387666666666 0.24756666666667
0.75738333333333 0.99888666666666 0.18068666666667
0.74925833333333 0.84733666666666 0.35821766666667
0.68541433333333 0.90449666666666 0.52917666666667
0.68926733333333 0.85888666666666 0.73183666666667
0.75026333333333 0.06949666666666 0.64433666666667
0.60628833333333 0.97677666666666 0.86873666666667
0.69994983333333 0.07068666666666 0.84985666666667
0.87101333333333 0.05882666666666 0.16847666666667
0.84889333333333 0.41975886666666 0.18471666666667
0.93339833333333 0.98165666666666 0.38450366666667
0.67249083333333 0.17969666666666 0.57686666666667
0.85423833333333 0.10957666666666 0.47681066666667
0.82493333333333 0.49135366666666 0.55000666666667
0.78462333333333 0.29096666666666 0.57421666666667
0.76800333333333 0.36121566666666 0.92644666666667
0.81058333333333 0.16971666666666 0.22684666666667
0.90856333333333 0.57026666666666 0.23815666666667
0.76182833333333 0.37614666666666 0.18845666666667
0.88871833333333 0.53080666666666 0.42358146666667
0.85562833333333 0.32263166666666 0.36426866666667
0.83515833333333 0.59152666666666 0.77291666666667
0.78718833333333 0.38821366666666 0.74611666666667
0.83699333333333 0.68114666666666 0.18497666666667
0.82814333333333 0.73293666666666 0.36987966666667
0.85414333333333 0.87401666666666 0.48911766666667
0.81410333333333 0.50145866666666 0.34903766666667
0.85689833333333 0.67681666666666 0.58823666666667
0.86804333333333 0.78560666666666 0.84977666666667
0.93271333333333 0.57988666666666 0.81896666666667
0.71184083333333 0.77304666666666 0.11347666666667
0.90540833333333 0.74061666666666 0.03022666666667
0.81621333333333 0.85319666666666 0.13512666666667
0.52441333333333 0.08306666666666 0.34711166666667
0.75732333333333 0.03364666666666 0.44157466666667
0.94750833333333 0.01092666666666 0.60645666666667
0.77594833333333 0.83782666666666 0.62102666666667
0.86107833333333 0.04928666666666 0.67310666666667
0.79300333333333 0.97135666666666 0.79084666666667
0.82238833333333 0.01293666666666 0.97004666666667
0.83750833333333 0.23664666666666 0.02062666666667
0.95388333333333 0.34178766666666 0.44811166666667
0.88708833333333 0.27382666666666 0.58093666666667
0.53206333333333 0.20845666666666 0.48642566666667
0.94568833333333 0.16754666666666 0.74426666666667
0.49329333333333 0.31900866666666 0.82460666666667
0.79113333333333 0.15633666666666 0.84792666666667
0.51232833333333 0.25059666666666 0.04522666666667
0.91374333333333 0.47641466666666 0.07637666666667
0.48904333333333 0.52828666666666 0.38552966666667
0.85357333333333 0.27436666666666 0.76343666666667
0.51098333333333 0.49550966666666 0.56943666666667
0.90882833333333 0.41875446666666 0.67028666666667
0.55464333333333 0.52472666666666 0.82758666666667
0.88878333333333 0.39984166666666 0.89648666666667
0.49674833333333 0.46952266666666 0.97251666666667
0.50698333333333 0.81906666666666 0.32010066666667
0.56672333333333 0.96197666666666 0.24366666666667
0.93230333333333 0.73529666666666 0.43107266666667
0.50525833333333 0.82783666666666 0.66778666666667
0.94398833333333 0.65432666666666 0.66346666666667
0.48605333333333 0.74336666666666 0.85736666666667
0.83221333333333 0.55263666666666 0.00047666666667
0.47925833333333 0.63845666666666 0.16634666666667
0.91936333333333 0.84625666666666 0.22666666666667
0.91682333333333 0.28260666666666 0.13265666666667
0.51926833333333 0.92371666666666 0.50915766666667
0.53698833333333 0.07929666666666 0.66035666666667
0.89665333333333 0.84174666666666 0.67481666666667
0.93254833333333 0.97751666666666 0.81711666666667
0.91770833333333 0.93970666666666 0.99482666666667
0.92680333333333 0.14577666666666 0.95922666666667
""", sep=" ").reshape((-1,3))
# Crystal structure.
structure = abilab.Structure.from_abivars(
acell=[50.4, 25.2, 25.2],
rprim=np.eye(3),
typat=256*[1],
znucl=22,
xred=xred,
)
inp = abilab.AbinitInput(structure, pseudos)
inp.set_vars(
# SCF algorithm
paral_kgb=1,
wfoptalg=1,
fftalg=402,
#fftalg-302, # To use FFTW instead of ABINIT FFT
# Basis set
ecut=5,
pawecutdg=10,
# SCF cycle
tolvrs=1.e-3,
nstep=20,
# K-Points and symmetries
nkpt=2,
kpt=[3*[0.5], [0, 0, 0.5]],
kptopt=0,
istwfk="*1",
nsym=0,
chksymbreak=0,
chkprim=0,
pawovlp=-1,
# bands and occupation scheme.
nband=2048,
occopt=3,
tsmear="1800. K",
# IO
optforces=2,
optstress=1,
prtwf=0,
prtden=0,
prteig=0,
timopt=-1,
)
return inp
def build_flow(options):
flow = BenchmarkFlow(workdir="bench_ti256")
work = abilab.Work()
template = make_input()
# Processor distribution.
pconfs = [
dict(npkpt=2, npband=8 , npfft=8 ), # 128
dict(npkpt=2, npband=8 , npfft=16), # 256
dict(npkpt=2, npband=16, npfft=16), # 512
dict(npkpt=2, npband=16, npfft=32), # 1024
dict(npkpt=2, npband=32, npfft=32), # 2048
]
for d in pconfs:
mpi_procs = reduce(operator.mul, d.values(), 1)
d["np_slk"] = 32
manager = options.manager.deepcopy()
manager.policy.autoparal = 0
manager.set_mpi_procs(mpi_procs)
print("MPI_PROCS:", mpi_procs, "done with:", d)
inp = template.new_with_vars(d)
#inp.abivalidate()
work.register(inp, manager=manager)
flow.register_work(work)
return flow.allocate()
@bench_main
def main(options):
flow = build_flow(options)
flow.build_and_pickle_dump()
return flow
if __name__ == "__main__":
sys.exit(main())

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,315 @@
# ABINIT -INPUT FILE
# TITANE 256 ATOMES
# Distribution des processeurs
#npkpt 2 npband 8 npfft 8 # 128 processeurs
#npkpt 2 npband 8 npfft 16 # 256 processeurs
#npkpt 2 npband 16 npfft 16 # 512 processeurs
npkpt 2 npband 16 npfft 32 # 1024 processeurs
#npkpt 2 npband 32 npfft 32 # 2048 processeurs
np_slk 32
# Algorithme de diagonalisation
paral_kgb 1
wfoptalg 1
fftalg 402
#fftalg 302 ! To use FFTW instead of ABINIT FFT
# Donnees de la base d'ondes planes
ecut 5.
pawecutdg 10.
# Parametres du cycle auto-coherent
tolvrs 1.d-3
nstep 20
# Points K et symetries
nkpt 2
kpt 3*0.5 2*0. 0.5
kptopt 0
istwfk *1
nsym 0
chksymbreak 0
# Bandes electroniques
nband 2048
occopt 3
tsmear 1800. K
# Cellule de simulation
acell 50.4 25.2 25.2
rprim 1. 0. 0. 0. 1. 0. 0. 0. 1.
natom 256
ntypat 1
typat 256*1
znucl 22.
chkprim 0
pawovlp -1
# Activation/desactvation des I/O
optforces 2
optstress 1
prtwf 0
prtden 0
prteig 0
timopt 0
#Positions des atomes
xred
0.00000000000000 0.00000000000000 0.00000000000000
0.06250000000000 0.12500000000000 0.12500000000000
0.00000000000000 0.00000000000000 0.25000000000000
0.06250000000000 0.12500000000000 0.37500000000000
0.00000000000000 0.00000000000000 0.50000000000000
0.06250000000000 0.12500000000000 0.62500000000000
0.00000000000000 0.00000000000000 0.75000000000000
0.06250000000000 0.12500000000000 0.87500000000000
0.00000000000000 0.25000000000000 0.00000000000000
0.06250000000000 0.37500000000000 0.12500000000000
0.00000000000000 0.25000000000000 0.25000000000000
0.06250000000000 0.37500000000000 0.37500000000000
0.00000000000000 0.25000000000000 0.50000000000000
0.06250000000000 0.37500000000000 0.62500000000000
0.00000000000000 0.25000000000000 0.75000000000000
0.06250000000000 0.37500000000000 0.87500000000000
0.00000000000000 0.50000000000000 0.00000000000000
0.06250000000000 0.62500000000000 0.12500000000000
0.00000000000000 0.50000000000000 0.25000000000000
0.06250000000000 0.62500000000000 0.37500000000000
0.00000000000000 0.50000000000000 0.50000000000000
0.06250000000000 0.62500000000000 0.62500000000000
0.00000000000000 0.50000000000000 0.75000000000000
0.06250000000000 0.62500000000000 0.87500000000000
0.00000000000000 0.75000000000000 0.00000000000000
0.06250000000000 0.87500000000000 0.12500000000000
0.00000000000000 0.75000000000000 0.25000000000000
0.06250000000000 0.87500000000000 0.37500000000000
0.00000000000000 0.75000000000000 0.50000000000000
0.06250000000000 0.87500000000000 0.62500000000000
0.00000000000000 0.75000000000000 0.75000000000000
0.06250000000000 0.87500000000000 0.87500000000000
0.12500000000000 0.00000000000000 0.00000000000000
0.18750000000000 0.12500000000000 0.12500000000000
0.12500000000000 0.00000000000000 0.25000000000000
0.18750000000000 0.12500000000000 0.37500000000000
0.12500000000000 0.00000000000000 0.50000000000000
0.18750000000000 0.12500000000000 0.62500000000000
0.12500000000000 0.00000000000000 0.75000000000000
0.18750000000000 0.12500000000000 0.87500000000000
0.12500000000000 0.25000000000000 0.00000000000000
0.18750000000000 0.37500000000000 0.12500000000000
0.12500000000000 0.25000000000000 0.25000000000000
0.18750000000000 0.37500000000000 0.37500000000000
0.12500000000000 0.25000000000000 0.50000000000000
0.18750000000000 0.37500000000000 0.62500000000000
0.12500000000000 0.25000000000000 0.75000000000000
0.18750000000000 0.37500000000000 0.87500000000000
0.12500000000000 0.50000000000000 0.00000000000000
0.18750000000000 0.62500000000000 0.12500000000000
0.12500000000000 0.50000000000000 0.25000000000000
0.18750000000000 0.62500000000000 0.37500000000000
0.12500000000000 0.50000000000000 0.50000000000000
0.18750000000000 0.62500000000000 0.62500000000000
0.12500000000000 0.50000000000000 0.75000000000000
0.18750000000000 0.62500000000000 0.87500000000000
0.12500000000000 0.75000000000000 0.00000000000000
0.18750000000000 0.87500000000000 0.12500000000000
0.12500000000000 0.75000000000000 0.25000000000000
0.18750000000000 0.87500000000000 0.37500000000000
0.12500000000000 0.75000000000000 0.50000000000000
0.18750000000000 0.87500000000000 0.62500000000000
0.12500000000000 0.75000000000000 0.75000000000000
0.18750000000000 0.87500000000000 0.87500000000000
0.25000000000000 0.00000000000000 0.00000000000000
0.31250000000000 0.12500000000000 0.12500000000000
0.25000000000000 0.00000000000000 0.25000000000000
0.31250000000000 0.12500000000000 0.37500000000000
0.25000000000000 0.00000000000000 0.50000000000000
0.31250000000000 0.12500000000000 0.62500000000000
0.25000000000000 0.00000000000000 0.75000000000000
0.31250000000000 0.12500000000000 0.87500000000000
0.25000000000000 0.25000000000000 0.00000000000000
0.31250000000000 0.37500000000000 0.12500000000000
0.25000000000000 0.25000000000000 0.25000000000000
0.31250000000000 0.37500000000000 0.37500000000000
0.25000000000000 0.25000000000000 0.50000000000000
0.31250000000000 0.37500000000000 0.62500000000000
0.25000000000000 0.25000000000000 0.75000000000000
0.31250000000000 0.37500000000000 0.87500000000000
0.25000000000000 0.50000000000000 0.00000000000000
0.31250000000000 0.62500000000000 0.12500000000000
0.25000000000000 0.50000000000000 0.25000000000000
0.31250000000000 0.62500000000000 0.37500000000000
0.25000000000000 0.50000000000000 0.50000000000000
0.31250000000000 0.62500000000000 0.62500000000000
0.25000000000000 0.50000000000000 0.75000000000000
0.31250000000000 0.62500000000000 0.87500000000000
0.25000000000000 0.75000000000000 0.00000000000000
0.31250000000000 0.87500000000000 0.12500000000000
0.25000000000000 0.75000000000000 0.25000000000000
0.31250000000000 0.87500000000000 0.37500000000000
0.25000000000000 0.75000000000000 0.50000000000000
0.31250000000000 0.87500000000000 0.62500000000000
0.25000000000000 0.75000000000000 0.75000000000000
0.31250000000000 0.87500000000000 0.87500000000000
0.37500000000000 0.00000000000000 0.00000000000000
0.43750000000000 0.12500000000000 0.12500000000000
0.37500000000000 0.00000000000000 0.25000000000000
0.43750000000000 0.12500000000000 0.37500000000000
0.37500000000000 0.00000000000000 0.50000000000000
0.43750000000000 0.12500000000000 0.62500000000000
0.37500000000000 0.00000000000000 0.75000000000000
0.43750000000000 0.12500000000000 0.87500000000000
0.37500000000000 0.25000000000000 0.00000000000000
0.43750000000000 0.37500000000000 0.12500000000000
0.37500000000000 0.25000000000000 0.25000000000000
0.43750000000000 0.37500000000000 0.37500000000000
0.37500000000000 0.25000000000000 0.50000000000000
0.43750000000000 0.37500000000000 0.62500000000000
0.37500000000000 0.25000000000000 0.75000000000000
0.43750000000000 0.37500000000000 0.87500000000000
0.37500000000000 0.50000000000000 0.00000000000000
0.43750000000000 0.62500000000000 0.12500000000000
0.37500000000000 0.50000000000000 0.25000000000000
0.43750000000000 0.62500000000000 0.37500000000000
0.37500000000000 0.50000000000000 0.50000000000000
0.43750000000000 0.62500000000000 0.62500000000000
0.37500000000000 0.50000000000000 0.75000000000000
0.43750000000000 0.62500000000000 0.87500000000000
0.37500000000000 0.75000000000000 0.00000000000000
0.43750000000000 0.87500000000000 0.12500000000000
0.37500000000000 0.75000000000000 0.25000000000000
0.43750000000000 0.87500000000000 0.37500000000000
0.37500000000000 0.75000000000000 0.50000000000000
0.43750000000000 0.87500000000000 0.62500000000000
0.37500000000000 0.75000000000000 0.75000000000000
0.43750000000000 0.87500000000000 0.87500000000000
0.50066333333333 0.43795366666666 0.20604666666667
0.58978833333333 0.17685666666666 0.24527666666667
0.59038833333333 0.04865666666666 0.46713866666667
0.57337833333333 0.36896766666666 0.44071566666667
0.49437333333333 0.29799666666666 0.62702666666667
0.58165333333333 0.34787366666666 0.95079666666667
0.54251333333333 0.10940666666666 0.84782666666667
0.67878919833333 0.40517666666666 0.06963666666667
0.59048833333333 0.45379666666666 0.10264666666667
0.60238833333333 0.47341066666666 0.31733066666667
0.50515833333333 0.27181666666666 0.25024666666667
0.60375833333333 0.54262666666666 0.50900866666667
0.59347833333333 0.44882266666666 0.67936666666667
0.67186083333333 0.62119666666666 0.73076666666667
0.63907933333333 0.58259666666666 0.93075666666667
0.67825691833333 0.39313466666666 0.28615666666667
0.55216833333333 0.64702666666666 0.29008666666667
0.65788433333333 0.66224666666666 0.34085666666667
0.54558333333333 0.70723666666666 0.50473966666667
0.59868333333333 0.84143666666666 0.65086666666667
0.56312333333333 0.65245666666666 0.66560666666667
0.59459833333333 0.74256666666666 0.86209666666667
0.54859333333333 0.64326666666666 0.02438666666667
0.61449833333333 0.84178666666666 0.03484666666667
0.50916333333333 0.81220666666666 0.08581666666667
0.96250333333333 0.00988666666666 0.16680666666667
0.61246833333333 0.84705666666666 0.43006566666667
0.58969333333333 0.24281666666666 0.62900666666667
0.52407833333333 0.87938666666666 0.92985666666667
0.63529633333333 0.04594666666666 0.68961666666667
0.55587333333333 0.04528666666666 0.08935666666667
0.66776783333333 0.01468666666666 0.17755666666667
0.70887233333333 0.20161666666666 0.21002666666667
0.92334333333333 0.16592666666666 0.29334666666667
0.67033283333333 0.01914666666666 0.36823266666667
0.65631933333333 0.21883666666666 0.36941666666667
0.62474833333333 0.22426666666666 0.80279666666667
0.66286883333333 0.41444856666666 0.82225666666667
0.62886383333333 0.18910666666666 0.05475666666667
0.71154233333333 0.27103666666666 0.73880666666667
0.73958333333333 0.15453666666666 0.01370666666667
0.75625833333333 0.64794666666666 0.24326666666667
0.76121333333333 0.28914666666666 0.37663266666667
0.72632283333333 0.51671666666666 0.43261966666667
0.67498088333333 0.39143366666666 0.52916666666667
0.76689333333333 0.74595666666666 0.77130666666667
0.74752333333333 0.55142666666666 0.86622666666667
0.74464333333333 0.55552666666666 0.08736666666667
0.64824733333333 0.59911666666666 0.13674666666667
0.83169333333333 0.97781666666666 0.30673666666667
0.66809783333333 0.72582666666666 0.55477666666667
0.76887333333333 0.70689666666666 0.49468866666667
0.74088833333333 0.56763666666666 0.64551666666667
0.79800333333333 0.77201666666666 0.97858666666667
0.69187333333333 0.74064666666666 0.93339666666667
0.71363633333333 0.95878666666666 0.99392666666667
0.65551333333333 0.83387666666666 0.24756666666667
0.75738333333333 0.99888666666666 0.18068666666667
0.74925833333333 0.84733666666666 0.35821766666667
0.68541433333333 0.90449666666666 0.52917666666667
0.68926733333333 0.85888666666666 0.73183666666667
0.75026333333333 0.06949666666666 0.64433666666667
0.60628833333333 0.97677666666666 0.86873666666667
0.69994983333333 0.07068666666666 0.84985666666667
0.87101333333333 0.05882666666666 0.16847666666667
0.84889333333333 0.41975886666666 0.18471666666667
0.93339833333333 0.98165666666666 0.38450366666667
0.67249083333333 0.17969666666666 0.57686666666667
0.85423833333333 0.10957666666666 0.47681066666667
0.82493333333333 0.49135366666666 0.55000666666667
0.78462333333333 0.29096666666666 0.57421666666667
0.76800333333333 0.36121566666666 0.92644666666667
0.81058333333333 0.16971666666666 0.22684666666667
0.90856333333333 0.57026666666666 0.23815666666667
0.76182833333333 0.37614666666666 0.18845666666667
0.88871833333333 0.53080666666666 0.42358146666667
0.85562833333333 0.32263166666666 0.36426866666667
0.83515833333333 0.59152666666666 0.77291666666667
0.78718833333333 0.38821366666666 0.74611666666667
0.83699333333333 0.68114666666666 0.18497666666667
0.82814333333333 0.73293666666666 0.36987966666667
0.85414333333333 0.87401666666666 0.48911766666667
0.81410333333333 0.50145866666666 0.34903766666667
0.85689833333333 0.67681666666666 0.58823666666667
0.86804333333333 0.78560666666666 0.84977666666667
0.93271333333333 0.57988666666666 0.81896666666667
0.71184083333333 0.77304666666666 0.11347666666667
0.90540833333333 0.74061666666666 0.03022666666667
0.81621333333333 0.85319666666666 0.13512666666667
0.52441333333333 0.08306666666666 0.34711166666667
0.75732333333333 0.03364666666666 0.44157466666667
0.94750833333333 0.01092666666666 0.60645666666667
0.77594833333333 0.83782666666666 0.62102666666667
0.86107833333333 0.04928666666666 0.67310666666667
0.79300333333333 0.97135666666666 0.79084666666667
0.82238833333333 0.01293666666666 0.97004666666667
0.83750833333333 0.23664666666666 0.02062666666667
0.95388333333333 0.34178766666666 0.44811166666667
0.88708833333333 0.27382666666666 0.58093666666667
0.53206333333333 0.20845666666666 0.48642566666667
0.94568833333333 0.16754666666666 0.74426666666667
0.49329333333333 0.31900866666666 0.82460666666667
0.79113333333333 0.15633666666666 0.84792666666667
0.51232833333333 0.25059666666666 0.04522666666667
0.91374333333333 0.47641466666666 0.07637666666667
0.48904333333333 0.52828666666666 0.38552966666667
0.85357333333333 0.27436666666666 0.76343666666667
0.51098333333333 0.49550966666666 0.56943666666667
0.90882833333333 0.41875446666666 0.67028666666667
0.55464333333333 0.52472666666666 0.82758666666667
0.88878333333333 0.39984166666666 0.89648666666667
0.49674833333333 0.46952266666666 0.97251666666667
0.50698333333333 0.81906666666666 0.32010066666667
0.56672333333333 0.96197666666666 0.24366666666667
0.93230333333333 0.73529666666666 0.43107266666667
0.50525833333333 0.82783666666666 0.66778666666667
0.94398833333333 0.65432666666666 0.66346666666667
0.48605333333333 0.74336666666666 0.85736666666667
0.83221333333333 0.55263666666666 0.00047666666667
0.47925833333333 0.63845666666666 0.16634666666667
0.91936333333333 0.84625666666666 0.22666666666667
0.91682333333333 0.28260666666666 0.13265666666667
0.51926833333333 0.92371666666666 0.50915766666667
0.53698833333333 0.07929666666666 0.66035666666667
0.89665333333333 0.84174666666666 0.67481666666667
0.93254833333333 0.97751666666666 0.81711666666667
0.91770833333333 0.93970666666666 0.99482666666667
0.92680333333333 0.14577666666666 0.95922666666667

225
abipy/benchmarks/UO96/flowgen.py Executable file
View File

@ -0,0 +1,225 @@
#!/usr/bin/env python
from __future__ import division, print_function, unicode_literals, absolute_import
import sys
import operator
import numpy as np
import abipy.abilab as abilab
import abipy.data as abidata
from abipy.benchmarks import bench_main, BenchmarkFlow
def make_input():
"""
GS calculations with paralkgb==1
UO2 with 96 atoms.
"""
pseudos = abidata.pseudos("u.paw", "o.paw")
# Atomic Positions.
xred = np.fromstring("""
0.00000000000000 0.00000000000000 0.00000000000000
0.25000000000000 0.25000000000000 0.00000000000000
0.25000000000000 0.00000000000000 0.25000000000000
0.00000000000000 0.25000000000000 0.25000000000000
0.00000000000000 0.00000000000000 0.50000000000000
0.25000000000000 0.25000000000000 0.50000000000000
0.25000000000000 0.00000000000000 0.75000000000000
0.00000000000000 0.25000000000000 0.75000000000000
0.00000000000000 0.50000000000000 0.00000000000000
0.25000000000000 0.75000000000000 0.00000000000000
0.25000000000000 0.50000000000000 0.25000000000000
0.00000000000000 0.75000000000000 0.25000000000000
0.00000000000000 0.50000000000000 0.50000000000000
0.25000000000000 0.75000000000000 0.50000000000000
0.25000000000000 0.50000000000000 0.75000000000000
0.00000000000000 0.75000000000000 0.75000000000000
0.50000000000000 0.00000000000000 0.00000000000000
0.75000000000000 0.25000000000000 0.00000000000000
0.75000000000000 0.00000000000000 0.25000000000000
0.50000000000000 0.25000000000000 0.25000000000000
0.50000000000000 0.00000000000000 0.50000000000000
0.75000000000000 0.25000000000000 0.50000000000000
0.75000000000000 0.00000000000000 0.75000000000000
0.50000000000000 0.25000000000000 0.75000000000000
0.50000000000000 0.50000000000000 0.00000000000000
0.75000000000000 0.75000000000000 0.00000000000000
0.75000000000000 0.50000000000000 0.25000000000000
0.50000000000000 0.75000000000000 0.25000000000000
0.50000000000000 0.50000000000000 0.50000000000000
0.75000000000000 0.75000000000000 0.50000000000000
0.75000000000000 0.50000000000000 0.75000000000000
0.50000000000000 0.75000000000000 0.75000000000000
0.12500000000000 0.12500000000000 0.12500000000000
0.12500000000000 0.37500000000000 0.12500000000000
0.37500000000000 0.12500000000000 0.12500000000000
0.37500000000000 0.37500000000000 0.12500000000000
0.12500000000000 0.12500000000000 0.37500000000000
0.12500000000000 0.37500000000000 0.37500000000000
0.37500000000000 0.12500000000000 0.37500000000000
0.37500000000000 0.37500000000000 0.37500000000000
0.12500000000000 0.12500000000000 0.62500000000000
0.12500000000000 0.37500000000000 0.62500000000000
0.37500000000000 0.12500000000000 0.62500000000000
0.37500000000000 0.37500000000000 0.62500000000000
0.12500000000000 0.12500000000000 0.87500000000000
0.12500000000000 0.37500000000000 0.87500000000000
0.37500000000000 0.12500000000000 0.87500000000000
0.37500000000000 0.37500000000000 0.87500000000000
0.12500000000000 0.62500000000000 0.12500000000000
0.12500000000000 0.87500000000000 0.12500000000000
0.37500000000000 0.62500000000000 0.12500000000000
0.37500000000000 0.87500000000000 0.12500000000000
0.12500000000000 0.62500000000000 0.37500000000000
0.12500000000000 0.87500000000000 0.37500000000000
0.37500000000000 0.62500000000000 0.37500000000000
0.37500000000000 0.87500000000000 0.37500000000000
0.12500000000000 0.62500000000000 0.62500000000000
0.12500000000000 0.87500000000000 0.62500000000000
0.37500000000000 0.62500000000000 0.62500000000000
0.37500000000000 0.87500000000000 0.62500000000000
0.12500000000000 0.62500000000000 0.87500000000000
0.12500000000000 0.87500000000000 0.87500000000000
0.37500000000000 0.62500000000000 0.87500000000000
0.37500000000000 0.87500000000000 0.87500000000000
0.62500000000000 0.12500000000000 0.12500000000000
0.62500000000000 0.37500000000000 0.12500000000000
0.87500000000000 0.12500000000000 0.12500000000000
0.87500000000000 0.37500000000000 0.12500000000000
0.62500000000000 0.12500000000000 0.37500000000000
0.62500000000000 0.37500000000000 0.37500000000000
0.87500000000000 0.12500000000000 0.37500000000000
0.87500000000000 0.37500000000000 0.37500000000000
0.62500000000000 0.12500000000000 0.62500000000000
0.62500000000000 0.37500000000000 0.62500000000000
0.87500000000000 0.12500000000000 0.62500000000000
0.87500000000000 0.37500000000000 0.62500000000000
0.62500000000000 0.12500000000000 0.87500000000000
0.62500000000000 0.37500000000000 0.87500000000000
0.87500000000000 0.12500000000000 0.87500000000000
0.87500000000000 0.37500000000000 0.87500000000000
0.62500000000000 0.62500000000000 0.12500000000000
0.62500000000000 0.87500000000000 0.12500000000000
0.87500000000000 0.62500000000000 0.12500000000000
0.87500000000000 0.87500000000000 0.12500000000000
0.62500000000000 0.62500000000000 0.37500000000000
0.62500000000000 0.87500000000000 0.37500000000000
0.87500000000000 0.62500000000000 0.37500000000000
0.87500000000000 0.87500000000000 0.37500000000000
0.62500000000000 0.62500000000000 0.62500000000000
0.62500000000000 0.87500000000000 0.62500000000000
0.87500000000000 0.62500000000000 0.62500000000000
0.87500000000000 0.87500000000000 0.62500000000000
0.62500000000000 0.62500000000000 0.87500000000000
0.62500000000000 0.87500000000000 0.87500000000000
0.87500000000000 0.62500000000000 0.87500000000000
0.87500000000000 0.87500000000000 0.87500000000000
""", sep=" ").reshape((-1,3))
# Crystal structure.
structure = abilab.Structure.from_abivars(
acell=3 * [11. / abilab.bohr_to_ang],
rprim=np.eye(3),
typat=32*[1] + 64*[2],
znucl=[92, 8],
xred=xred,
)
#acell 3*11. angstrom
#natom 96
#ntypat 2
inp = abilab.AbinitInput(structure, pseudos)
inp.set_vars(
# SCF algorithm
paral_kgb=1,
wfoptalg=1,
nline=6,
fftalg=402,
#fftalg=302, ! To use FFTW instead of ABINIT FFT
# Basis set
ecut=6,
pawecutdg=10,
# SCF parameters
toldfe=1.e-5,
nstep=28,
#diemac 500.
# K-Points and symmetries.
nkpt=1,
kpt=[0.5, 0.5, 0.5],
kptopt=0,
istwfk="*1",
nsym=0,
maxnsym=2048,
chksymbreak=0,
chkprim=0,
# Bands and occupation scheme
nsppol=2,
nband=448,
nbdbuf=20,
occopt=3,
tsmear=0.0005,
# IO
optforces=2,
optstress=1,
prtwf=0,
prtden=0,
prteig=0,
timopt=-1,
# Initial magnetization.
spinat="""
2*0 1 2*0 1 2*0 1 2*0 1 2*0 1 2*0 1 2*0 1 2*0 1
2*0 1 2*0 1 2*0 1 2*0 1 2*0 1 2*0 1 2*0 1 2*0 1
2*0 1 2*0 1 2*0 1 2*0 1 2*0 1 2*0 1 2*0 1 2*0 1
2*0 1 2*0 1 2*0 1 2*0 1 2*0 1 2*0 1 2*0 1 2*0 1
192*0""",
)
return inp
def build_flow(options):
flow = BenchmarkFlow(workdir="bench_ti256")
work = abilab.Work()
template = make_input()
# Processor distribution.
pconfs = [
dict(npkpt=2, npband=8 , npfft=8 ), # 128 processeurs
dict(npkpt=2, npband=16, npfft=8 ), # 256 processeurs
dict(npkpt=2, npband=16, npfft=16), # 512 processeurs
dict(npkpt=2, npband=16, npfft=32), # 1024 processeurs
]
for d in pconfs:
mpi_procs = reduce(operator.mul, d.values(), 1)
d["np_slk"] = 64
manager = options.manager.deepcopy()
manager.policy.autoparal = 0
manager.set_mpi_procs(mpi_procs)
print("MPI_PROCS:", mpi_procs, "done with:", d)
inp = template.new_with_vars(d)
#inp.abivalidate()
work.register(inp, manager=manager)
flow.register_work(work)
return flow.allocate()
@bench_main
def main(options):
flow = build_flow(options)
flow.build_and_pickle_dump()
return flow
if __name__ == "__main__":
sys.exit(main())

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,166 @@
# ABINIT -INPUT FILE
# UO2 96 ATOMES
# Distribution des processeurs
#npkpt 2 npband 8 npfft 8 # 128 processeurs
#npkpt 2 npband 16 npfft 8 # 256 processeurs
#npkpt 2 npband 16 npfft 16 # 512 processeurs
npkpt 2 npband 16 npfft 32 # 1024 processeurs
np_slk 64
# Algorithmes pour les fonctions d'onde
paral_kgb 1
wfoptalg 1
nline 6
fftalg 402
#fftalg 302 ! To use FFTW instead of ABINIT FFT
# Donnees de la base d'ondes planes
ecut 6.
pawecutdg 10.
# Parametres du cycle auto-coherent
toldfe 1.d-5
nstep 28
#diemac 500.
# Points K et symetries
nkpt 1
kpt 0.5 0.5 0.5
kptopt 0
istwfk *1
nsym 0
maxnsym 2048
chksymbreak 0
# Bandes electroniques
nsppol 2
nband 448
nbdbuf 20
occopt 3
tsmear 0.0005 hartree
# Cellule de simulation
acell 3*11. angstrom
rprim 1. 0. 0. 0. 1. 0. 0. 0. 1.
natom 96
ntypat 2
typat 32*1 64*2
znucl 92. 8.
chkprim 0
# Activation/desactvation des I/O
optforces 2
optstress 1
prtwf 0
prtden 0
prteig 0
timopt 0
#Positions des atomes
xred
0.00000000000000 0.00000000000000 0.00000000000000
0.25000000000000 0.25000000000000 0.00000000000000
0.25000000000000 0.00000000000000 0.25000000000000
0.00000000000000 0.25000000000000 0.25000000000000
0.00000000000000 0.00000000000000 0.50000000000000
0.25000000000000 0.25000000000000 0.50000000000000
0.25000000000000 0.00000000000000 0.75000000000000
0.00000000000000 0.25000000000000 0.75000000000000
0.00000000000000 0.50000000000000 0.00000000000000
0.25000000000000 0.75000000000000 0.00000000000000
0.25000000000000 0.50000000000000 0.25000000000000
0.00000000000000 0.75000000000000 0.25000000000000
0.00000000000000 0.50000000000000 0.50000000000000
0.25000000000000 0.75000000000000 0.50000000000000
0.25000000000000 0.50000000000000 0.75000000000000
0.00000000000000 0.75000000000000 0.75000000000000
0.50000000000000 0.00000000000000 0.00000000000000
0.75000000000000 0.25000000000000 0.00000000000000
0.75000000000000 0.00000000000000 0.25000000000000
0.50000000000000 0.25000000000000 0.25000000000000
0.50000000000000 0.00000000000000 0.50000000000000
0.75000000000000 0.25000000000000 0.50000000000000
0.75000000000000 0.00000000000000 0.75000000000000
0.50000000000000 0.25000000000000 0.75000000000000
0.50000000000000 0.50000000000000 0.00000000000000
0.75000000000000 0.75000000000000 0.00000000000000
0.75000000000000 0.50000000000000 0.25000000000000
0.50000000000000 0.75000000000000 0.25000000000000
0.50000000000000 0.50000000000000 0.50000000000000
0.75000000000000 0.75000000000000 0.50000000000000
0.75000000000000 0.50000000000000 0.75000000000000
0.50000000000000 0.75000000000000 0.75000000000000
0.12500000000000 0.12500000000000 0.12500000000000
0.12500000000000 0.37500000000000 0.12500000000000
0.37500000000000 0.12500000000000 0.12500000000000
0.37500000000000 0.37500000000000 0.12500000000000
0.12500000000000 0.12500000000000 0.37500000000000
0.12500000000000 0.37500000000000 0.37500000000000
0.37500000000000 0.12500000000000 0.37500000000000
0.37500000000000 0.37500000000000 0.37500000000000
0.12500000000000 0.12500000000000 0.62500000000000
0.12500000000000 0.37500000000000 0.62500000000000
0.37500000000000 0.12500000000000 0.62500000000000
0.37500000000000 0.37500000000000 0.62500000000000
0.12500000000000 0.12500000000000 0.87500000000000
0.12500000000000 0.37500000000000 0.87500000000000
0.37500000000000 0.12500000000000 0.87500000000000
0.37500000000000 0.37500000000000 0.87500000000000
0.12500000000000 0.62500000000000 0.12500000000000
0.12500000000000 0.87500000000000 0.12500000000000
0.37500000000000 0.62500000000000 0.12500000000000
0.37500000000000 0.87500000000000 0.12500000000000
0.12500000000000 0.62500000000000 0.37500000000000
0.12500000000000 0.87500000000000 0.37500000000000
0.37500000000000 0.62500000000000 0.37500000000000
0.37500000000000 0.87500000000000 0.37500000000000
0.12500000000000 0.62500000000000 0.62500000000000
0.12500000000000 0.87500000000000 0.62500000000000
0.37500000000000 0.62500000000000 0.62500000000000
0.37500000000000 0.87500000000000 0.62500000000000
0.12500000000000 0.62500000000000 0.87500000000000
0.12500000000000 0.87500000000000 0.87500000000000
0.37500000000000 0.62500000000000 0.87500000000000
0.37500000000000 0.87500000000000 0.87500000000000
0.62500000000000 0.12500000000000 0.12500000000000
0.62500000000000 0.37500000000000 0.12500000000000
0.87500000000000 0.12500000000000 0.12500000000000
0.87500000000000 0.37500000000000 0.12500000000000
0.62500000000000 0.12500000000000 0.37500000000000
0.62500000000000 0.37500000000000 0.37500000000000
0.87500000000000 0.12500000000000 0.37500000000000
0.87500000000000 0.37500000000000 0.37500000000000
0.62500000000000 0.12500000000000 0.62500000000000
0.62500000000000 0.37500000000000 0.62500000000000
0.87500000000000 0.12500000000000 0.62500000000000
0.87500000000000 0.37500000000000 0.62500000000000
0.62500000000000 0.12500000000000 0.87500000000000
0.62500000000000 0.37500000000000 0.87500000000000
0.87500000000000 0.12500000000000 0.87500000000000
0.87500000000000 0.37500000000000 0.87500000000000
0.62500000000000 0.62500000000000 0.12500000000000
0.62500000000000 0.87500000000000 0.12500000000000
0.87500000000000 0.62500000000000 0.12500000000000
0.87500000000000 0.87500000000000 0.12500000000000
0.62500000000000 0.62500000000000 0.37500000000000
0.62500000000000 0.87500000000000 0.37500000000000
0.87500000000000 0.62500000000000 0.37500000000000
0.87500000000000 0.87500000000000 0.37500000000000
0.62500000000000 0.62500000000000 0.62500000000000
0.62500000000000 0.87500000000000 0.62500000000000
0.87500000000000 0.62500000000000 0.62500000000000
0.87500000000000 0.87500000000000 0.62500000000000
0.62500000000000 0.62500000000000 0.87500000000000
0.62500000000000 0.87500000000000 0.87500000000000
0.87500000000000 0.62500000000000 0.87500000000000
0.87500000000000 0.87500000000000 0.87500000000000
# Aimantations initiales
spinat
2*0 1 2*0 1 2*0 1 2*0 1 2*0 1 2*0 1 2*0 1 2*0 1
2*0 1 2*0 1 2*0 1 2*0 1 2*0 1 2*0 1 2*0 1 2*0 1
2*0 1 2*0 1 2*0 1 2*0 1 2*0 1 2*0 1 2*0 1 2*0 1
2*0 1 2*0 1 2*0 1 2*0 1 2*0 1 2*0 1 2*0 1 2*0 1
192*0

View File

@ -0,0 +1,130 @@
from __future__ import division, print_function
from pymatgen.io.abinit.flows import Flow
def bench_main(main):
"""
This decorator is used to decorate main functions producing `AbinitFlows`.
It adds the initialization of the logger and an argument parser that allows one to select
the loglevel, the workdir of the flow as well as the YAML file with the parameters of the `TaskManager`.
The main function shall have the signature:
main(options)
where options in the container with the command line options generated by `ArgumentParser`.
Args:
main:
main function.
"""
from functools import wraps
@wraps(main)
def wrapper(*args, **kwargs):
import argparse
parser = argparse.ArgumentParser()
parser.add_argument('--loglevel', default="ERROR", type=str,
help="set the loglevel. Possible values: CRITICAL, ERROR (default), WARNING, INFO, DEBUG")
parser.add_argument("-w", '--workdir', default="", type=str, help="Working directory of the flow.")
parser.add_argument("-m", '--manager', default=None,
help="YAML file with the parameters of the task manager. "
"Default None i.e. the manager is read from standard locations: "
"working directory first then ~/.abinit/abipy/manager.yml.")
parser.add_argument("--mpi-range", default=None, help="Range of MPI processors to be tested."
"'--mpi-range='(1,4,2)' performs benchmarks for mpi_procs in [1, 3]")
parser.add_argument("--omp-range", default=None, help="Range of OMP threads to be tested."
"'--omp-range='(1,4,2)' performs benchmarks for omp_threads in [1, 3]")
parser.add_argument('--paw', default=False, action="store_true", help="Run PAW calculation if present")
#parser.add_argument('--paral_kgb', default=1, type=int, help="paral_kgb input variable")
parser.add_argument("--scheduler", "-s", default=False, action="store_true", help="Run with the scheduler")
options = parser.parse_args()
# loglevel is bound to the string value obtained from the command line argument.
# Convert to upper case to allow the user to specify --loglevel=DEBUG or --loglevel=debug
import logging
numeric_level = getattr(logging, options.loglevel.upper(), None)
if not isinstance(numeric_level, int):
raise ValueError('Invalid log level: %s' % options.loglevel)
logging.basicConfig(level=numeric_level)
# parse arguments
if options.mpi_range is not None:
import ast
t = ast.literal_eval(options.mpi_range)
assert len(t) == 3
options.mpi_range = range(t[0], t[1], t[2])
#print(options.mpi_range)
if options.omp_range is not None:
import ast
t = ast.literal_eval(options.omp_range)
assert len(t) == 3
options.omp_range = range(t[0], t[1], t[2])
#print(options.omp_range)
# Istantiate the manager.
from abipy.abilab import TaskManager
options.manager = TaskManager.as_manager(options.manager)
flow = main(options)
if options.scheduler:
flow.make_scheduler().start()
return 0
return wrapper
class BenchmarkFlow(Flow):
def exclude_from_benchmark(self, node):
"""Exclude a task or the tasks in a Work from the benchmark analysis."""
if not hasattr(self, "_exclude_nodeids"): self._exclude_nodeids = set()
if node.is_work:
for task in node:
self._exclude_nodeids.add(task.node_id)
else:
assert node.is_task
self._exclude_nodeids.add(node.node_id)
@property
def exclude_nodeids(self):
if not hasattr(self, "_exclude_nodeids"): self._exclude_nodeids = set()
return self._exclude_nodeids
def get_parser(self):
"""
Parse the timing sections in the output files.
Return AbinitTimerParser parser object for further analysis.
"""
nids = []
for task in self.iflat_tasks():
if task.node_id in self.exclude_nodeids: continue
if task.status != task.S_OK: continue
#print("analysing task:", task)
nids.append(task.node_id)
parser = self.parse_timing(nids=nids)
if parser is None:
print("parse_timing returned None!")
else:
if len(parser) != len(nids):
print("Not all timing sections have been parsed!")
return parser
#def make_tarball(self):
# self.make_tarfile(self, name=None, max_filesize=None, exclude_exts=None, exclude_dirs=None, verbose=0, **kwargs):

View File

@ -1,18 +1,19 @@
#!/usr/bin/env python
from __future__ import division, print_function, unicode_literals, absolute_import
import sys
import abipy.abilab as abilab
import abipy.data as abidata
from abipy.data.benchmarks import bench_main
from abipy.benchmarks import bench_main, BenchmarkFlow
def make_input(paral_kgb=1, paw=False):
"""Build a template input file for GS calculations with paral_kgb"""
def make_input(paw=False):
"""Build a template input file for GS calculations with k-point parallelism """
pseudos = abidata.pseudos("14si.pspnc") if not paw else abidata.pseudos("Si.GGA_PBE-JTH-paw.xml")
inp = abilab.AbiInput(pseudos=pseudos)
structure = abidata.structure_from_ucell("Si")
inp.set_structure(abidata.structure_from_ucell("Si"))
inp = abilab.AbinitInput(structure, pseudos)
inp.set_kmesh(ngkpt=[2,2,2], shiftk=[0,0,0])
# Global variables
@ -22,12 +23,9 @@ def make_input(paral_kgb=1, paw=False):
pawecutdg=ecut*4,
nsppol=1,
nband=20,
paral_kgb=paral_kgb,
npkpt=1,
npband=1,
npfft=1,
#
istwfk="*1",
paral_kgb=0,
#istwfk="*1",
#fftalg=312,
timopt=-1,
chksymbreak=0,
prtwf=0,
@ -40,20 +38,19 @@ def make_input(paral_kgb=1, paw=False):
def build_flow(options):
inp = make_input(paral_kgb=options.paral_kgb, paw=options.paw)
inp = make_input(paw=options.paw)
nkpt = len(inp.abiget_ibz().points)
flow = abilab.AbinitFlow(workdir="bench_gs")
work = abilab.Workflow()
# Instantiate the TaskManager.
manager = abilab.TaskManager.from_user_config() if not options.manager else \
abilab.TaskManager.from_file(options.manager)
manager.set_autoparal(0)
flow = BenchmarkFlow(workdir="bench_gs_kpara")
work = abilab.Work()
for mpi_procs in options.mpi_range:
mpi_range = range(1, nkpt*inp.nsppol + 1) if options.mpi_range is None else options.mpi_range
print("Using mpi_range:", mpi_range)
for mpi_procs in mpi_range:
manager = options.manager.deepcopy()
manager.policy.autoparal = 0
manager.set_mpi_procs(mpi_procs)
for qad in manager.qads:
qad.min_cores = 1
qad.max_cores = mpi_procs
work.register(inp, manager=manager)
flow.register_work(work)
@ -68,5 +65,4 @@ def main(options):
if __name__ == "__main__":
import sys
sys.exit(main())

81
abipy/benchmarks/gs_paralkgb.py Executable file
View File

@ -0,0 +1,81 @@
#!/usr/bin/env python
from __future__ import division, print_function, unicode_literals, absolute_import
import sys
import abipy.abilab as abilab
import abipy.data as abidata
from abipy.benchmarks import bench_main, BenchmarkFlow
def make_input(paw=False):
"""
Build and return an input file for GS calculations with paral_kgb=1
"""
pseudos = abidata.pseudos("14si.pspnc") if not paw else abidata.pseudos("Si.GGA_PBE-JTH-paw.xml")
structure = abidata.structure_from_ucell("Si")
inp = abilab.AbinitInput(structure, pseudos)
inp.set_kmesh(ngkpt=[1,1,1], shiftk=[0,0,0])
# Global variables
ecut = 20
inp.set_vars(
ecut=ecut,
pawecutdg=ecut*4,
nsppol=1,
nband=20,
paral_kgb=1,
#npkpt=1,
#npband=1,
#npfft=1,
#fftalg=112,
#
#istwfk="*1",
timopt=-1,
chksymbreak=0,
prtwf=0,
prtden=0,
tolvrs=1e-8,
nstep=10,
)
return inp
def build_flow(options):
template = make_input()
# Get the list of possible parallel configurations from abinit autoparal.
max_ncpus = 10
pconfs = template.abiget_autoparal_pconfs(max_ncpus, autoparal=1)
print(pconfs)
flow = BenchmarkFlow(workdir="bench_paralkgb")
work = abilab.Work()
for conf in pconfs:
if conf.efficiency < 0.7: continue
inp = template.deepcopy()
inp.set_vars(conf.vars)
manager = options.manager.deepcopy()
manager.policy.autoparal = 0
#manager.set_autoparal(0)
manager.set_mpi_procs(conf.mpi_ncpus)
work.register(inp, manager=manager)
flow.register_work(work)
return flow.allocate()
@bench_main
def main(options):
flow = build_flow(options)
flow.build_and_pickle_dump()
return flow
if __name__ == "__main__":
sys.exit(main())

71
abipy/benchmarks/gs_pureomp.py Executable file
View File

@ -0,0 +1,71 @@
#!/usr/bin/env python
from __future__ import division, print_function, unicode_literals, absolute_import
import sys
import abipy.abilab as abilab
import abipy.data as abidata
from abipy.benchmarks import bench_main, BenchmarkFlow
def make_input(paw=False):
"""Build a template input file for GS calculations with k-point parallelism """
pseudos = abidata.pseudos("14si.pspnc") if not paw else abidata.pseudos("Si.GGA_PBE-JTH-paw.xml")
structure = abidata.structure_from_ucell("Si")
inp = abilab.AbinitInput(structure, pseudos)
inp.set_kmesh(ngkpt=[1,1,1], shiftk=[0,0,0])
# Global variables
ecut = 10
inp.set_vars(
ecut=ecut,
pawecutdg=ecut*4,
nsppol=1,
nband=20,
paral_kgb=0,
#istwfk="*1",
#fftalg=312,
timopt=-1,
chksymbreak=0,
prtwf=0,
prtden=0,
tolvrs=1e-10,
nstep=50,
)
return inp
def build_flow(options):
inp = make_input(paw=options.paw)
nkpt = len(inp.abiget_ibz().points)
flow = BenchmarkFlow(workdir="bench_gs_pureomp")
work = abilab.Work()
omp_range = options.omp_range
print("Using omp-range:", omp_range)
if omp_range is None:
raise RuntimeError("--omp-range must be specified for this benchmark")
for omp_threads in omp_range:
manager = options.manager.deepcopy()
manager.policy.autoparal = 0
manager.set_mpi_procs(1)
manager.set_omp_threads(omp_threads)
work.register(inp, manager=manager)
flow.register_work(work)
return flow.allocate()
@bench_main
def main(options):
flow = build_flow(options)
flow.build_and_pickle_dump()
return flow
if __name__ == "__main__":
sys.exit(main())

View File

@ -1,65 +1,65 @@
#!/usr/bin/env python
from __future__ import division, print_function, unicode_literals, absolute_import
import sys
import abipy.abilab as abilab
import abipy.data as abidata
from abipy.data.benchmarks import bench_main
from abipy.benchmarks import bench_main
def make_template(paral_kgb=1, paw=False):
"""Build a template input file for GS calculations with paral_kgb"""
def make_input(paw=False):
"""
Build and return an input file for GS calculations with paral_kgb=1
"""
pseudos = abidata.pseudos("14si.pspnc") if not paw else abidata.pseudos("Si.GGA_PBE-JTH-paw.xml")
inp = abilab.AbiInput(pseudos=pseudos, ndtset=1)
inp.set_structure(abidata.structure_from_ucell("Si"))
structure = abidata.structure_from_ucell("Si")
# GS run with paral_kgb
inp = abilab.AbinitInput(structure, pseudos)
inp.set_kmesh(ngkpt=[1,1,1], shiftk=[0,0,0])
# Global variables
ecut = 20
global_vars = dict(
inp.set_vars(
ecut=ecut,
pawecutdg=ecut*4,
nsppol=1,
nband=20,
paral_kgb=paral_kgb,
npkpt=1,
npband=1,
paral_kgb=1,
#npkpt=1,
#npband=1,
npfft=1,
fftalg=112,
#
istwfk="*1",
#istwfk="*1",
timopt=-1,
chksymbreak=0,
prtwf=0,
prtden=0,
tolvrs=1e-8,
nstep=10,
)
inp.set_variables(**global_vars)
)
return inp
def build_flow(options):
template = make_template()
template = make_input()
flow = abilab.AbinitFlow(workdir="bench_mpifft")
# Instantiate the TaskManager.
manager = abilab.TaskManager.from_user_config() if not options.manager else \
abilab.TaskManager.from_file(options.manager)
flow = abilab.Flow(workdir="bench_mpifft")
mpi_list = [2]
fftalg_list = [312, 402, 401]
ecut_list = list(range(400, 410, 10))
for fftalg in fftalg_list:
work = abilab.Workflow()
work = abilab.Work()
for npfft in mpi_list:
manager = options.manager.deepcopy()
manager.policy.autoparal = 0
#manager.set_autoparal(0)
manager.set_mpi_procs(npfft)
for inp in abilab.input_gen(template, fftalg=fftalg, npfft=npfft, ecut=ecut_list):
manager.set_autoparal(0)
#manager.set_mpi_procs(mpi_procs)
work.register(inp, manager=manager)
flow.register_work(work)
@ -74,5 +74,5 @@ def main(options):
if __name__ == "__main__":
import sys
sys.exit(main())

View File

@ -1,13 +1,14 @@
#!/usr/bin/env python
from __future__ import division, print_function, unicode_literals, absolute_import
import sys
import abipy.abilab as abilab
import abipy.data as abidata
from abipy.data.benchmarks import bench_main
from abipy.benchmarks import bench_main, BenchmarkFlow
def make_inputs(paral_kgb=1, paw=False):
def make_inputs(paw=False):
# Crystalline silicon
# Calculation of the GW correction to the direct band gap in Gamma
# Dataset 1: ground state calculation
@ -17,20 +18,19 @@ def make_inputs(paral_kgb=1, paw=False):
structure = abilab.Structure.from_file(abidata.cif_file("si.cif"))
pseudos = abidata.pseudos("14si.pspnc") if not paw else abidata.pseudos("Si.GGA_PBE-JTH-paw.xml")
multi = abilab.MultiDataset(structure, pseudos=pseudos, ndtset=4)
ecut = 6
global_vars = dict(
multi.set_vars(
ecut=ecut,
pawecutdg=ecut*4,
gwpara=2,
timopt=-1,
istwfk="*1",
paral_kgb=0,
)
inp = abilab.AbiInput(pseudos=pseudos, ndtset=4)
inp.set_structure(structure)
inp.set_vars(**global_vars)
gs, nscf, scr, sigma = inp.split_datasets()
gs, nscf, scr, sigma = multi.split_datasets()
# This grid is the most economical, but does not contain the Gamma point.
gs_kmesh = dict(
@ -96,23 +96,26 @@ def scr_benchmark(options):
"""
Build an `AbinitWorkflow` used for benchmarking ABINIT.
"""
gs_inp, nscf_inp, scr_inp, sigma_inp = make_inputs(paw=options.paw, paral_kgb=options.paral_kgb)
flow = abilab.AbinitFlow(workdir="bench_scr")
# Instantiate the TaskManager.
manager = abilab.TaskManager.from_user_config() if not options.manager else \
abilab.TaskManager.from_file(options.manager)
gs_inp, nscf_inp, scr_inp, sigma_inp = make_inputs(paw=options.paw)
flow = BenchmarkFlow(workdir="bench_scr")
bands = abilab.BandStructureWorkflow(gs_inp, nscf_inp)
bands = abilab.BandStructureWork(gs_inp, nscf_inp)
flow.register_work(bands)
flow.exclude_from_benchmark(bands)
scr_work = abilab.Workflow()
manager.set_autoparal(0)
scr_work = abilab.Work()
print("Using mpi_range:", options.mpi_range)
# Get the list of possible parallel configurations from abinit autoparal.
#max_ncpus = 10
#pconfs = scr_inp.abiget_autoparal_pconfs(max_ncpus, autoparal=1)
#print(pconfs)
for mpi_procs in options.mpi_range:
manager = options.manager.deepcopy()
manager.policy.autoparal = 0
manager.set_mpi_procs(mpi_procs)
for qad in manager.qads:
qad.min_cores = 1
qad.max_cores = mpi_procs
#manager.set_autoparal(0)
scr_work.register(scr_inp, manager=manager, deps={bands.nscf_task: "WFK"})
flow.register_work(scr_work)
@ -127,5 +130,4 @@ def main(options):
if __name__ == "__main__":
import sys
sys.exit(main())

140
abipy/benchmarks/sigma.py Executable file
View File

@ -0,0 +1,140 @@
#!/usr/bin/env python
from __future__ import division, print_function, unicode_literals, absolute_import
import sys
import abipy.abilab as abilab
import abipy.data as abidata
from abipy.benchmarks import bench_main, BenchmarkFlow
def make_inputs(paw=False):
# Crystalline silicon
# Calculation of the GW correction to the direct band gap in Gamma
# Dataset 1: ground state calculation
# Dataset 2: NSCF calculation
# Dataset 3: calculation of the screening
# Dataset 4: calculation of the Self-Energy matrix elements (GW corrections)
structure = abilab.Structure.from_file(abidata.cif_file("si.cif"))
pseudos = abidata.pseudos("14si.pspnc") if not paw else abidata.pseudos("Si.GGA_PBE-JTH-paw.xml")
multi = abilab.MultiDataset(structure, pseudos=pseudos, ndtset=4)
ecut = 6
multi.set_vars(
ecut=ecut,
pawecutdg=ecut*4,
gwpara=2,
timopt=-1,
istwfk="*1",
paral_kgb=0,
)
gs, nscf, scr, sigma = multi.split_datasets()
# This grid is the most economical, but does not contain the Gamma point.
gs_kmesh = dict(
ngkpt=[2, 2, 2],
shiftk=[0.5, 0.5, 0.5,
0.5, 0.0, 0.0,
0.0, 0.5, 0.0,
0.0, 0.0, 0.5]
)
# This grid contains the Gamma point, which is the point at which
# we will compute the (direct) band gap.
gw_kmesh = dict(
ngkpt=[2, 2, 2],
shiftk=[0.0, 0.0, 0.0,
0.0, 0.5, 0.5,
0.5, 0.0, 0.5,
0.5, 0.5, 0.0]
)
# Dataset 1 (GS run)
gs.set_kmesh(**gs_kmesh)
gs.set_vars(tolvrs=1e-6,
nband=4,
)
# Dataset 2 (NSCF run)
# Here we select the second dataset directly with the syntax inp[2]
nscf.set_kmesh(**gw_kmesh)
nscf.set_vars(iscf=-2,
tolwfr=1e-12,
nband=35,
nbdbuf=5,
)
# Dataset3: Calculation of the screening.
scr.set_kmesh(**gw_kmesh)
scr.set_vars(
optdriver=3,
nband=25,
ecutwfn=ecut,
symchi=1,
inclvkb=0,
ecuteps=4.0,
)
# Dataset4: Calculation of the Self-Energy matrix elements (GW corrections)
sigma.set_kmesh(**gw_kmesh)
sigma.set_vars(
optdriver=4,
nband=35,
ecutwfn=ecut,
ecuteps=4.0,
ecutsigx=6.0,
symsigma=1,
gw_qprange=1,
)
return gs, nscf, scr, sigma
def sigma_benchmark(options):
"""
Build an `AbinitWorkflow` used for benchmarking ABINIT.
"""
gs_inp, nscf_inp, scr_inp, sigma_inp = make_inputs(paw=options.paw)
flow = BenchmarkFlow(workdir="bench_sigma")
bands = abilab.BandStructureWork(gs_inp, nscf_inp)
flow.register_work(bands)
flow.exclude_from_benchmark(bands)
scr_work = abilab.Work()
scr_work.register_scr_task(scr_inp, deps={bands.nscf_task: "WFK"})
flow.register_work(scr_work)
flow.exclude_from_benchmark(scr_work)
print("Using mpi_range:", options.mpi_range)
if options.mpi_range is None:
raise RuntimeError("This benchmark requires --mpi-range")
# Get the list of possible parallel configurations from abinit autoparal.
#max_ncpus = 10
#pconfs = scr_inp.abiget_autoparal_pconfs(max_ncpus, autoparal=1)
#print(pconfs)
sigma_work = abilab.Work()
for mpi_procs in options.mpi_range:
manager = options.manager.deepcopy()
manager.policy.autoparal = 0
manager.set_mpi_procs(mpi_procs)
#manager.set_autoparal(0)
sigma_work.register_sigma_task(sigma_inp, manager=manager,
deps={bands.nscf_task: "WFK", scr_work[0]: "SCR"})
flow.register_work(sigma_work)
return flow.allocate()
@bench_main
def main(options):
flow = sigma_benchmark(options)
flow.build_and_pickle_dump()
return flow
if __name__ == "__main__":
sys.exit(main())

View File

@ -51,7 +51,7 @@ class Structure(pymatgen.Structure):
raise TypeError("Don't know how to convert %s into a structure" % type(obj))
@classmethod
def from_file(cls, filepath, primitive=True, sort=False):
def from_file(cls, filepath, primitive=False, sort=False):
"""
Reads a structure from a file. For example, anything ending in
a "cif" is assumed to be a Crystallographic Information Format file.

View File

@ -1,67 +0,0 @@
from __future__ import division, print_function
def bench_main(main):
"""
This decorator is used to decorate main functions producing `AbinitFlows`.
It adds the initialization of the logger and an argument parser that allows one to select
the loglevel, the workdir of the flow as well as the YAML file with the parameters of the `TaskManager`.
The main function shall have the signature:
main(options)
where options in the container with the command line options generated by `ArgumentParser`.
Args:
main:
main function.
"""
from functools import wraps
@wraps(main)
def wrapper(*args, **kwargs):
import argparse
parser = argparse.ArgumentParser()
parser.add_argument('--loglevel', default="ERROR", type=str,
help="set the loglevel. Possible values: CRITICAL, ERROR (default), WARNING, INFO, DEBUG")
parser.add_argument("-w", '--workdir', default="", type=str, help="Working directory of the flow.")
parser.add_argument("-m", '--manager', default="", type=str,
help="YAML file with the parameters of the task manager")
parser.add_argument("--mpi-range", type=str, default="(1,3,1)", help="Range of MPI processors to test."
"'--mpi-range='(1,4,2)' performs benchmarks for mpi_procs in [1, 3]")
parser.add_argument('--paw', default=False, action="store_true", help="Run PAW calculation if present")
parser.add_argument('--paral_kgb', default=1, type=int, help="paral_kgb input variable")
parser.add_argument("--scheduler", "-s", default=False, action="store_true", help="Run with the scheduler")
options = parser.parse_args()
# loglevel is bound to the string value obtained from the command line argument.
# Convert to upper case to allow the user to specify --loglevel=DEBUG or --loglevel=debug
import logging
numeric_level = getattr(logging, options.loglevel.upper(), None)
if not isinstance(numeric_level, int):
raise ValueError('Invalid log level: %s' % options.loglevel)
logging.basicConfig(level=numeric_level)
# parse arguments
if options.mpi_range is not None:
import ast
t = ast.literal_eval(options.mpi_range)
assert len(t) == 3
options.mpi_range = range(t[0], t[1], t[2])
#print(lst(options.mpi_range))
flow = main(options)
if options.scheduler:
flow.make_scheduler().start()
return 0
return wrapper

View File

@ -1,38 +0,0 @@
qtype: shell
mpi_runner: mpirun
qparams:
queue: main
model: westmere
walltime: 0:30:00
group_list: naps
place: excl
pvmem: 1000
vmem: 1000
select: 1
mpi_runner: mpirun
shell_env:
PATH: /home/acad/ucl/mgiantom/bzr_repos/7.7.3-public/build_impi/src/98_main:$PATH
modules:
- load compiler/intel/composerxe/2013_sp1.1.106
- load intelmpi
- load python/2.7
# pre_run is a string in verbatim mode (note |)
pre_run: |
echo "------------------ Work dir --------------------"
echo $PBS_O_WORKDIR
cd ${PBS_O_WORKDIR}
echo "------------------ Job Info --------------------"
echo "jobid : $PBS_JOBID"
echo "jobname : $PBS_JOBNAME"
echo "job type : $PBS_ENVIRONMENT"
echo "submit dir : $PBS_O_WORKDIR"
echo "exec dir : $PBS_JOBDIR"
echo "queue : $PBS_O_QUEUE"
echo "user : $PBS_O_LOGNAME"
echo "threads : $OMP_NUM_THREADS"
# if $PBS_NODEFILE is not set the cat will hang at this point
# echo "------------------ $PBS_NODEFILE ---------------"
# cat $PBS_NODEFILE
echo "------------------ Checking limits -------------"
ulimit
echo "------------- Loading environment --------------"

7599
abipy/data/pseudos/au.paw Normal file

File diff suppressed because it is too large Load Diff

10207
abipy/data/pseudos/o.paw Normal file

File diff suppressed because it is too large Load Diff

10850
abipy/data/pseudos/ti.paw Normal file

File diff suppressed because it is too large Load Diff

14523
abipy/data/pseudos/u.paw Normal file

File diff suppressed because it is too large Load Diff

148
abipy/scripts/abitime.py Executable file
View File

@ -0,0 +1,148 @@
#!/usr/bin/env python
"""Script to analyze/plot the timing data of single or multiple runs."""
from __future__ import print_function, division, unicode_literals
import sys
import os
import argparse
from monty.termcolor import cprint
from pymatgen.io.abinit.abitimer import AbinitTimerParser
#from abipy import abilab
import logging
logger = logging.getLogger(__name__)
def main():
def str_examples():
return """\
Usage example:\n
abitime.py.py scan filename(s) =>
abitime.py.py walk . --ext=abo =>
"""
def show_examples_and_exit(err_msg=None, error_code=1):
"""Display the usage of the script."""
sys.stderr.write(str_examples())
if err_msg:
sys.stderr.write("Fatal Error\n" + err_msg + "\n")
sys.exit(error_code)
# Parent parse for common options.
copts_parser = argparse.ArgumentParser(add_help=False)
copts_parser.add_argument('--loglevel', default="ERROR", type=str,
help="set the loglevel. Possible values: CRITICAL, ERROR (default), WARNING, INFO, DEBUG")
copts_parser.add_argument('-i', '--ipython', default=False, action='store_true',
help='Open interactive ipython terminal to interact with the parser.')
copts_parser.add_argument('-p', '--plot', default=False, action='store_true',
help='Plot data with matplotlib.')
#copts_parser.add_argument('-v', '--verbose', default=0, action='count', # -vv --> verbose=2
# help='verbose, can be supplied multiple times to increase verbosity')
# Build the main parser.
parser = argparse.ArgumentParser(epilog=str_examples(), formatter_class=argparse.RawDescriptionHelpFormatter)
# Create the parsers for the sub-commands
subparsers = parser.add_subparsers(dest='command', help='sub-command help', description="Valid subcommands")
# Subparser for scan command.
p_scan = subparsers.add_parser('scan', parents=[copts_parser], help=".")
p_scan.add_argument('paths', nargs="+", help="File(s) to be analyzed")
# Subparser for scan command.
p_walk = subparsers.add_parser('walk', parents=[copts_parser], help=".")
p_walk.add_argument('top', nargs="?", default=".", help="Top level directory. Defaults to working dir.")
p_walk.add_argument("-e", '--ext', type=str, default="abo", help="File extension. Default: abo")
# Parse the command line.
try:
options = parser.parse_args()
except Exception:
show_examples_and_exit(error_code=1)
# loglevel is bound to the string value obtained from the command line argument.
# Convert to upper case to allow the user to specify --loglevel=DEBUG or --loglevel=debug
import logging
numeric_level = getattr(logging, options.loglevel.upper(), None)
if not isinstance(numeric_level, int):
raise ValueError('Invalid log level: %s' % options.loglevel)
logging.basicConfig(level=numeric_level)
#import seaborn as sns
#sns.set(style='ticks', palette='Set2')
#sns.set(style="dark", palette="Set2")
#And to remove "chartjunk", do:
#sns.despine()
#plt.tight_layout()
#sns.despine(offset=30, trim=True)
if options.command == "scan":
parser = AbinitTimerParser()
okfiles = parser.parse(options.paths)
if okfiles != options.paths:
badfiles = [f for f in options.paths if f not in okfiles]
cprint("Cannot parse timing data from the following files:", color="magenta")
for bad in badfiles: print(bad)
elif options.command == "walk":
print("Walking directory tree from top:", options.top, "Looking for file extension:", options.ext)
paths = []
for root, dirs, files in os.walk(options.top):
for f in files:
if f.endswith(options.ext):
paths.append(os.path.join(root, f))
if not paths:
cprint("Empty file list!", color="magenta")
return 1
print("Found %d files\n" % len(paths))
parser = AbinitTimerParser()
okfiles = parser.parse(paths)
if okfiles != paths:
badfiles = [f for f in paths if f not in okfiles]
cprint("Cannot parse timing data from the following files:", color="magenta")
for bad in badfiles: print(bad)
else:
raise RuntimeError("Don't know what to do with command: %s!" % options.command)
if parser is None:
cprint("Cannot analyze timing data. parser is None", color="magenta")
return 1
if options.ipython:
cprint("Invoking ipython shell. Use parser to access the object inside ipython", color="blue")
import IPython
IPython.start_ipython(argv=[], user_ns={"parser": parser})
if options.plot:
parser.plot_all()
#parser.plot_efficiency()
#parser.plot_pie()
#parser.plot_stacked_hist()
print(parser.summarize())
#table = parser.make_table()
#print(table)
return
for timer in parser.timers():
print(timer.get_dataframe())
#print(timer)
#print(timer.totable())
return 0
if __name__ == "__main__":
sys.exit(main())