plumed : adding dependents

* cp2k : added plumed
* gromacs : patched pme load balancing
* gromacs : added plumed
This commit is contained in:
Massimiliano Culpo 2016-08-04 09:42:02 +02:00 committed by alalazo
parent 2b94d7cf8e
commit 15d9fb1879
3 changed files with 71 additions and 18 deletions

View file

@ -40,6 +40,7 @@ class Cp2k(Package):
version('3.0', 'c05bc47335f68597a310b1ed75601d35') version('3.0', 'c05bc47335f68597a310b1ed75601d35')
variant('mpi', default=True, description='Enable MPI support') variant('mpi', default=True, description='Enable MPI support')
variant('plumed', default=False, description='Enable PLUMED support')
depends_on('python') # Build dependency depends_on('python') # Build dependency
@ -49,6 +50,8 @@ class Cp2k(Package):
depends_on('mpi', when='+mpi') depends_on('mpi', when='+mpi')
depends_on('scalapack', when='+mpi') depends_on('scalapack', when='+mpi')
depends_on('plumed+shared+mpi', when='+plumed+mpi')
depends_on('plumed+shared~mpi', when='+plumed~mpi')
# TODO : add dependency on libint # TODO : add dependency on libint
# TODO : add dependency on libsmm, libxsmm # TODO : add dependency on libsmm, libxsmm
@ -56,7 +59,6 @@ class Cp2k(Package):
# TODO : add dependency on CUDA # TODO : add dependency on CUDA
# TODO : add dependency on PEXSI # TODO : add dependency on PEXSI
# TODO : add dependency on QUIP # TODO : add dependency on QUIP
# TODO : add dependency on plumed
# TODO : add dependency on libwannier90 # TODO : add dependency on libwannier90
parallel = False parallel = False
@ -70,22 +72,6 @@ def install(self, spec, prefix):
# Write the custom makefile # Write the custom makefile
with open(makefile, 'w') as mkf: with open(makefile, 'w') as mkf:
mkf.write('CC = {0.compiler.cc}\n'.format(self))
if '%intel' in self.spec:
# CPP is a commented command in Intel arch of CP2K
# This is the hack through which cp2k developers avoid doing :
#
# ${CPP} <file>.F > <file>.f90
#
# and use `-fpp` instead
mkf.write('CPP = # {0.compiler.cc} -P\n'.format(self))
mkf.write('AR = xiar -r\n')
else:
mkf.write('CPP = {0.compiler.cc} -E\n'.format(self))
mkf.write('AR = ar -r\n')
fc = self.compiler.fc if '~mpi' in spec else self.spec['mpi'].mpifc
mkf.write('FC = {0}\n'.format(fc))
mkf.write('LD = {0}\n'.format(fc))
# Optimization flags # Optimization flags
optflags = { optflags = {
'gcc': ['-O2', 'gcc': ['-O2',
@ -110,6 +96,37 @@ def install(self, spec, prefix):
]) ])
ldflags = ['-L' + spec['fftw'].prefix.lib] ldflags = ['-L' + spec['fftw'].prefix.lib]
libs = [] libs = []
if '+plumed' in self.spec:
# Include Plumed.inc in the Makefile
mkf.write('include {0}\n'.format(
join_path(self.spec['plumed'].prefix.lib,
'plumed',
'src',
'lib',
'Plumed.inc')
))
# Add required macro
cppflags.extend(['-D__PLUMED2'])
libs.extend([
join_path(self.spec['plumed'].prefix.lib, 'libplumed.so')
])
mkf.write('CC = {0.compiler.cc}\n'.format(self))
if '%intel' in self.spec:
# CPP is a commented command in Intel arch of CP2K
# This is the hack through which cp2k developers avoid doing :
#
# ${CPP} <file>.F > <file>.f90
#
# and use `-fpp` instead
mkf.write('CPP = # {0.compiler.cc} -P\n'.format(self))
mkf.write('AR = xiar -r\n')
else:
mkf.write('CPP = {0.compiler.cc} -E\n'.format(self))
mkf.write('AR = ar -r\n')
fc = self.compiler.fc if '~mpi' in spec else self.spec['mpi'].mpifc
mkf.write('FC = {0}\n'.format(fc))
mkf.write('LD = {0}\n'.format(fc))
# Intel # Intel
if '%intel' in self.spec: if '%intel' in self.spec:
cppflags.extend([ cppflags.extend([

View file

@ -22,6 +22,8 @@
# License along with this program; if not, write to the Free Software # License along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
############################################################################## ##############################################################################
import subprocess
from spack import * from spack import *
@ -46,14 +48,20 @@ class Gromacs(Package):
variant('shared', default=True, description='Enables the build of shared libraries') variant('shared', default=True, description='Enables the build of shared libraries')
variant('debug', default=False, description='Enables debug mode') variant('debug', default=False, description='Enables debug mode')
variant('double', default=False, description='Produces a double precision version of the executables') variant('double', default=False, description='Produces a double precision version of the executables')
variant('plumed', default=False, description='Enable PLUMED support')
depends_on('mpi', when='+mpi') depends_on('mpi', when='+mpi')
depends_on('plumed+mpi', when='+plumed+mpi')
depends_on('plumed~mpi', when='+plumed~mpi')
depends_on('fftw') depends_on('fftw')
depends_on('cmake', type='build') depends_on('cmake', type='build')
# TODO : add GPU support # TODO : add GPU support
def patch(self):
if '+plumed' in self.spec:
self.spec['plumed'].package.apply_patch(self)
def install(self, spec, prefix): def install(self, spec, prefix):
options = [] options = []

View file

@ -22,6 +22,7 @@
# License along with this program; if not, write to the Free Software # License along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
############################################################################## ##############################################################################
import subprocess
from spack import * from spack import *
@ -55,6 +56,33 @@ class Plumed(Package):
depends_on('mpi', when='+mpi') depends_on('mpi', when='+mpi')
depends_on('gsl', when='+gsl') depends_on('gsl', when='+gsl')
# Dictionary mapping PLUMED versions to the patches it provides
# interactively
patches = {
'2.2.3': {
'amber-14': '1',
'gromacs-4.5.7': '2',
'gromacs-4.6.7': '3',
'gromacs-5.0.7': '4',
'gromacs-5.1.2': '5',
'lammps-6Apr13': '6',
'namd-2.8': '7',
'namd-2.9': '8',
'espresso-5.0.2': '9'
}
}
def apply_patch(self, other):
plumed = subprocess.Popen(
[join_path(self.spec.prefix.bin, 'plumed'), 'patch', '-p'],
stdin=subprocess.PIPE
)
opts = Plumed.patches[str(self.version)]
search = '{0.name}-{0.version}'.format(other)
choice = opts[search] + '\n'
plumed.stdin.write(choice)
plumed.wait()
def setup_dependent_package(self, module, ext_spec): def setup_dependent_package(self, module, ext_spec):
# Make plumed visible from dependent packages # Make plumed visible from dependent packages
module.plumed = Executable(join_path(self.spec.prefix.bin, 'plumed')) module.plumed = Executable(join_path(self.spec.prefix.bin, 'plumed'))