Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 13 additions & 12 deletions easybuild/easyblocks/c/cmakepythonpackage.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
from easybuild.easyblocks.p.pythonpackage import PythonPackage

class CMakePythonPackage(CMake, PythonPackage):
"""Build a Python module with cmake.
"""Build a Python package and module with cmake.

Some packages use cmake to first build and install c Python modules
and then put the Python package in lib/pythonX.Y/site-packages
Expand All @@ -34,21 +34,22 @@ class CMakePythonPackage(CMake, PythonPackage):
def __init__(self, *args, **kwargs):
PythonPackage.__init__(self, *args, **kwargs)

def configure(self):
def configure(self, *args, **kwargs):
"""Main onfiguration is with cmake"""

PythonPackage.configure(self)

CMake.configure(self)
PythonPackage.configure(self, *args, **kwargs)

def make(self):
"""Build with make"""
CMake.make(self)
CMake.configure(self, *args, **kwargs)

def make_install(self):
"""Install with make install"""
CMake.make_install(self)
def make(self, *args, **kwargs):
"""Build with cmake"""
return CMake.make(self, *args, **kwargs)

def make_install(self):
"""Install with cmake install"""
return CMake.make_install(self)

def make_module_extra(self):
"""Extra Python package module parameters"""
PythonPackage.make_module_extra(self)
#we return a string here.
return PythonPackage.make_module_extra(self)
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def configure(self):
self.updatecfg('configopts', ' -DMPI_CXX_COMPILER="$MPICXX"')

# Boost config parameters
self.updatecfg('configopts', " -DBoost_DIR=%s" % depsdict['Boost'])
#self.updatecfg('configopts', " -DBoost_DIR=%s" % depsdict['Boost'])
self.updatecfg('configopts', " -DBOOST_INCLUDEDIR=%s/include" % depsdict['Boost'])
self.updatecfg('configopts', " -DBoost_DEBUG=ON -DBOOST_ROOT=%s" % depsdict['Boost'])

Expand All @@ -56,8 +56,7 @@ def configure(self):
self.updatecfg('configopts', "-DARMADILLO_DIR:PATH=%s " % depsdict['Armadillo'])

# specify MPI library
# FIXME
self.updatecfg('configopts', ' -DMPI_COMPILER="%s"' % self.getenv('MPICC'))
self.updatecfg('configopts', ' -DMPI_COMPILER="%s"' % os.getenv('MPICC'))

if not os.getenv('MPI_LIB_SHARED') or not os.getenv('MPI_INC'):
self.updatecfg('configopts', ' -DMPI_LIBRARY="%s"' % os.getenv('MPI_LIB_SHARED'))
Expand All @@ -67,9 +66,9 @@ def configure(self):

# specify Python paths
python_short_ver = ".".join(os.getenv('SOFTVERSIONPYTHON').split(".")[0:2])
self.updatecfg('configopts', " -DPYTHON_INCLUDE_PATH=%s/include/python%s" % (depsdict['Python'],
self.updatecfg('configopts', " -DPYTHON_INCLUDE_PATH=%s/include/python%s" % (depsdict['Python'],
python_short_ver))
self.updatecfg('configopts', " -DPYTHON_LIBRARIES=%s/lib/libpython%s.so" % (depsdict['Python'],
self.updatecfg('configopts', " -DPYTHON_LIBRARY=%s/lib/libpython%s.so" % (depsdict['Python'],
python_short_ver))

# SuiteSparse config params
Expand All @@ -84,8 +83,9 @@ def configure(self):
self.updatecfg('configopts', umfpack_params)

# ParMETIS and SCOTCH

self.updatecfg('configopts', ' -DSCOTCH_DIR="%s" -DSCOTCH_DEBUG:BOOL=ON' % depsdict['SCOTCH'])
self.updatecfg('configopts', ' -DPARMETIS_DIR="%s"' % depsdict['ParMETIS'])
self.updatecfg('configopts', ' -DSCOTCH_DIR="%s"' % depsdict['SCOTCH'])

# BLACS and LAPACK
self.updatecfg('configopts', ' -DBLAS_LIBRARIES:PATH="$LIBBLAS"')
Expand All @@ -95,14 +95,14 @@ def configure(self):
openmp = get_openmp_flag(self.log)
self.updatecfg('configopts', ' -DOpenMP_CXX_FLAGS="%s"' % openmp)
self.updatecfg('configopts', ' -DOpenMP_C_FLAGS="%s"' % openmp)

CMakePythonPackage.configure(self)

def make_module_extra(self):
"""Set extra environment variables for Dolfin."""

txt = CMakePythonPackage.make_module_extra(self)

# Dolfin needs to find Boost and the UFC pkgconfig file
txt += "setenv\tBOOST_DIR\t%s\n" % get_software_root('Boost')
txt += "prepend-path\tPKG_CONFIG_PATH\t%s/lib/pkgconfig\n" % get_software_root('UFC')
Expand All @@ -111,20 +111,20 @@ def make_module_extra(self):
envvars = ['I_MPI_CXX', 'I_MPI_CC']
for envvar in envvars:
envar_val = os.getenv(envvar)
if not envar_val:
if not envar_val and self.tk.name in ['ictce', 'iqacml']:
self.log.error("%s not defined in environment, needed by DOLFIN" % envvar)
else:
txt += "setenv\t%s\t%s\n" % (envvar, envar_val)

return txt

def sanitycheck(self):
"""Custom sanity check for Dolfin."""

if not self.getcfg('sanityCheckPaths'):

self.setcfg('sanityCheckPaths', {'files': ['bin/dolfin-%s' % x for x in ['version','convert',
'order','plot']]
self.setcfg('sanityCheckPaths', {'files': ['bin/dolfin-%s' % x for x in ['version', 'convert',
'order', 'plot']]
+ ['include/dolfin.h'],
'dirs':['%s/dolfin' % self.pylibdir]
})
Expand Down
70 changes: 70 additions & 0 deletions easybuild/easyblocks/m/metis.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
##
# Copyright 2009-2012 Stijn Deweirdt, Dries Verdegem, Kenneth Hoste, Pieter De Baets, Jens Timmerman
#
# This file is part of EasyBuild,
# originally created by the HPC team of the University of Ghent (http://ugent.be/hpc).
#
# http://github.com/hpcugent/easybuild
#
# EasyBuild is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation v2.
#
# EasyBuild is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with EasyBuild. If not, see <http://www.gnu.org/licenses/>.
##

import os
import shutil

from easybuild.framework.application import Application
from easybuild.tools.filetools import mkdir

class METIS(Application):


def configure(self, *args, **kwargs):
"""No configuration is done for METIS"""
pass

def make_install(self):
""" Manually copy the required files to the right place.

And create symlins where expected by other applications
(in Lib instead of lib)"""
libdir = os.path.join(self.installdir, 'lib')
mkdir(libdir)

includedir = os.path.join(self.installdir, 'include')
mkdir(includedir)

try:
src = os.path.join(self.getcfg('startfrom'), 'libmetis.a')
dst = os.path.join(libdir, 'libmetis.a')
shutil.copy2(src, dst)
except OSError, err:
self.log.error("Copying file libmetis.a to lib dir failed: %s" % err)

try:
for f in ['defs.h', 'macros.h', 'metis.h', 'proto.h', 'rename.h', 'struct.h']:
src = os.path.join(self.getcfg('startfrom'), 'Lib', f)
dst = os.path.join(includedir, f)
shutil.copy2(src, dst)
os.chmod(dst, 0755)
except OSError, err:
self.log.error("Copying file metis.h to include dir failed: %s" % err)

# Other applications depending on ParMETIS (SuiteSparse for one) look for both ParMETIS libraries
# and headerfiles in the Lib directory (capital L). The following symlinks are hence created.
try:
Libdir = os.path.join(self.installdir, 'Lib')
os.symlink(libdir, Libdir)
for f in ['defs.h', 'macros.h', 'metis.h', 'proto.h', 'rename.h', 'struct.h']:
os.symlink(os.path.join(includedir, file), os.path.join(libdir, f))
except OSError, err:
self.log.error("Something went wrong during symlink creation: %s" % err)
134 changes: 134 additions & 0 deletions easybuild/easyblocks/p/parmetis.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
##
# Copyright 2009-2012 Stijn Deweirdt, Dries Verdegem, Kenneth Hoste, Pieter De Baets, Jens Timmerman
#
# This file is part of EasyBuild,
# originally created by the HPC team of the University of Ghent (http://ugent.be/hpc).
#
# http://github.com/hpcugent/easybuild
#
# EasyBuild is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation v2.
#
# EasyBuild is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with EasyBuild. If not, see <http://www.gnu.org/licenses/>.
##
"""
ParMETIS easyblock
"""

import os
import shutil

from distutils.version import LooseVersion
from easybuild.easyblocks.m.metis import METIS
from easybuild.tools.filetools import run_cmd, mkdir

class ParMETIS(METIS):
"""
Easyblock for the ParMETIS package
Parmetis
"""

def configure(self):
"""
For versions of ParMETIS < 4 configure METIS separately
New versions of ParMETIS include METIS

Run 'cmake' in the build dir to get rid of a 'user friendly'
help message that is displayed without this step.
"""
if self.version() < LooseVersion("4"):
return METIS.configure(self)
#tested with 4.0.2, now actually requires cmake to be run first
#for bot parmetis and metis
for buildir in [ 'build' ] :
cmd = 'cd %s && cmake .. %s -DCMAKE_INSTALL_PREFIX="%s" && cd %s' % \
(buildir, self.getcfg('configopts'), self.installdir, self.getcfg('startfrom'))
run_cmd(cmd, log_all=True, simple=True)



def make(self, verbose=False):
"""
make ParMETIS and Metis

Calling make
for version > 4 cmake is run in the build dir.
"""
paracmd = ''
if self.getcfg('parallel'):
paracmd = "-j %s" % self.getcfg('parallel')

cmd = "%s make %s %s" % (self.getcfg('premakeopts'), paracmd, self.getcfg('makeopts'))
if self.version() >= LooseVersion("4"):
#this is done in the build dir.
cmd = "cd build && %s && cd %s " % (cmd, self.getcfg('startfrom'))
run_cmd(cmd, log_all=True, simple=True, log_output=verbose)

def make_install(self):
"""
Manually copy files over to the right places
(libmetis.a, libparmetis.a, metis.h, parmetis.h)
Also create symlinks where expected by other packages (Lib directory)
"""
includedir = os.path.join(self.installdir, 'include')
libdir = os.path.join(self.installdir, 'lib')

if self.version() >= LooseVersion("4"):
#includedir etc changed in v4, use a normal makeinstall
cmd = "cd build && make install %s && cd %s" % (self.getcfg('installopts'),
self.getcfg('startfrom'))
run_cmd(cmd, log_all=True, simple=True)

try:
src = os.path.join(self.getcfg('startfrom'), 'build/libmetis/libmetis.a')
dst = os.path.join(libdir, 'libmetis.a')
shutil.copy2(src, dst)
except OSError, err:
self.log.error("Copying files to installation dir failed: %s" % err)
try:
src = os.path.join(self.getcfg('startfrom'), 'build/metis/include/metis.h')
dst = os.path.join(includedir, 'metis.h')
shutil.copy2(src, dst)
except OSError, err:
self.log.error("Copying files to installation dir failed: %s" % err)

else:

mkdir(libdir)
mkdir(includedir)

try:
for fil in ['libmetis.a', 'libparmetis.a']:
src = os.path.join(self.getcfg('startfrom'), fil)
dst = os.path.join(libdir, fil)
shutil.copy2(src, dst)
except OSError, err:
self.log.error("Copying files to installation dir failed: %s" % err)

try:
src = os.path.join(self.getcfg('startfrom'), 'parmetis.h')
dst = os.path.join(includedir, 'parmetis.h')
shutil.copy2(src, dst)
# Some applications (SuiteSparse) can only use METIS (not ParMETIS), but header files are the same
dst = os.path.join(includedir, 'metis.h')
shutil.copy2(src, dst)
except OSError, err:
self.log.error("Copying files to installation dir failed: %s" % err)

# Other applications depending on ParMETIS (SuiteSparse for one) look for both ParMETIS libraries
# and headerfiles in the Lib directory (capital L). The following symlink are hence created.
try:
llibdir = os.path.join(self.installdir, 'Lib')
os.symlink(libdir, llibdir)
os.symlink(os.path.join(includedir, 'metis.h'), os.path.join(libdir, 'metis.h'))
os.symlink(os.path.join(includedir, 'parmetis.h'),
os.path.join(libdir, 'parmetis.h'))
except OSError, err:
self.log.error("Something went wrong during symlink creation: %s" % err)
6 changes: 3 additions & 3 deletions easybuild/easyblocks/p/pythonpackage.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,14 @@ def make(self):

cmd = "python setup.py build"

run_cmd(cmd, logall=True, simple=True)
run_cmd(cmd, log_all=True, simple=True)

def make_install(self):
"""Install Python package to a custom path using setup.py"""

cmd = "python setup.py install --prefix=%s %s" % (self.installdir, self.getcfg('installopts'))

run_cmd(cmd, logall=True, simple=True)
run_cmd(cmd, log_all=True, simple=True)

def make_module_extra(self):
"""Add install path to PYTHONPATH"""
Expand All @@ -75,4 +75,4 @@ def make_module_extra(self):

txt += "prepend-path\tPYTHONPATH\t%s\n" % installdir

return txt
return txt
Loading