Skip to content

Instantly share code, notes, and snippets.

@boegel
Created November 26, 2013 13:54
Show Gist options
  • Save boegel/7658603 to your computer and use it in GitHub Desktop.
Save boegel/7658603 to your computer and use it in GitHub Desktop.
legacy Charm++ easyblock
import glob, os, shutil, re
from easybuild.apps.Application import Application
from easybuild.buildsoft.fileTools import runrun, convertName
class Charm(ConfigureMake):
"""
Charm++
"""
def configure(self):
return 'ok'
def make(self):
paracmd = ''
if self.getCfg('parallel'):
paracmd = "-j%s" % self.getCfg('parallel')
cmd = "./build %s %s" % (self.getCfg('makeopts'), paracmd)
runrun(cmd, logall=True, simple=True)
def makeInstall(self):
"""
Tricky one
"""
src = self.getCfg('startfrom')
try:
shutil.copytree(src, self.installdir, symlinks=False)
except:
self.log.exception("Copying %s to installation dir %s failed" % (src, self.installdir))
def makeModuleExtra(self):
"""Overwritten from Application to add extra txt
- guess the charmarch
"""
txt = Application.makeModuleExtra(self)
base = self.getCfg('makeopts').split(' ')
cand = os.listdir(self.installdir)
## name starts with arch opt and contains at least one of the compilers
## expected structure: charm++ <arch> <c-compiler>
reg = re.compile(r"^%s.*?%s" % (base[1], base[2]))
tmp = []
for c in cand:
## only directories
if os.path.isdir(os.path.join(self.installdir, c)):
if reg.search(c):
tmp.append(c)
## should only have one now
if not (len(tmp) == 1):
self.log.error("Can't determine CHARMARCH from candidate files %s from dir %s with regexp %s" % (cand, self.installdir, "^%s.*?%s" % (base[0], base[1])))
txt += "prepend-path\t\t%sARCH\t%s\n" % (convertName(self.name(), upper=True), tmp[0])
return txt
@boegel
Copy link
Author

boegel commented Nov 26, 2013

old easyconfig file for Charm++:

# Built with 1.0-r83b219d21cae0b40718920bf8d42c1407b2249fa on 2012-02-21_16-24-41
mod="Lib.Charm"

name='Charm++'
version='6.2.1'

homepage='http://charm.cs.uiuc.edu/'
description="Charm++ is a parallel extension to C++"

toolkit={'name':'ictce','version':'4.0.6'}

"""
## all for generating the docs
## poppler-utils provides pdftops (yes, with 'to') 
osdependencies=['tetex-latex','poppler-utils','latex2html','ImageMagick']
makeopts="all mpi-linux-x86_64 mpiicc mpiifort "
## with ulimit, limit the number of build threads by hand. 
parallel='2'
"""

sources=['charm-%s_src.tar.gz'%(version)]

patches=[['cc-mpiicc.h','src/arch/common'],['cc-mpiicc.sh','src/arch/common'],['conv-mach-mpiifort.h','src/arch/common'],['conv-mach-mpiifort.sh','src/arch/common']]


makeopts="charm++ mpi-linux-x86_64 mpiicc mpiifort "

## extra performance
## -O == -O2 for icc
makeopts+="--no-shared -O -DCMK_OPTIMIZE=1"

dontcreateinstalldir='True'

moduleclass='lib'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment