2017-04-28 05:52:05 +08:00
|
|
|
##############################################################################
|
2018-03-25 03:13:52 +08:00
|
|
|
# Copyright (c) 2013-2018, Lawrence Livermore National Security, LLC.
|
2017-04-28 05:52:05 +08:00
|
|
|
# Produced at the Lawrence Livermore National Laboratory.
|
|
|
|
#
|
|
|
|
# This file is part of Spack.
|
|
|
|
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
|
|
|
|
# LLNL-CODE-647188
|
|
|
|
#
|
2017-11-05 08:08:04 +08:00
|
|
|
# For details, see https://github.com/spack/spack
|
2017-06-25 13:22:55 +08:00
|
|
|
# Please also see the NOTICE and LICENSE files for our notice and the LGPL.
|
2017-04-28 05:52:05 +08:00
|
|
|
#
|
|
|
|
# This program is free software; you can redistribute it and/or modify
|
|
|
|
# it under the terms of the GNU Lesser General Public License (as
|
|
|
|
# published by the Free Software Foundation) version 2.1, February 1999.
|
|
|
|
#
|
|
|
|
# This program 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 terms and
|
|
|
|
# conditions of the GNU Lesser General Public License for more details.
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU Lesser General Public
|
|
|
|
# License along with this program; if not, write to the Free Software
|
|
|
|
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
|
|
##############################################################################
|
|
|
|
from spack import *
|
|
|
|
|
|
|
|
|
2018-03-07 14:45:48 +08:00
|
|
|
class Relion(CMakePackage, CudaPackage):
|
2017-04-28 05:52:05 +08:00
|
|
|
"""RELION (for REgularised LIkelihood OptimisatioN, pronounce rely-on) is a
|
|
|
|
stand-alone computer program that employs an empirical Bayesian approach to
|
|
|
|
refinement of (multiple) 3D reconstructions or 2D class averages in
|
|
|
|
electron cryo-microscopy (cryo-EM)."""
|
|
|
|
|
|
|
|
homepage = "http://http://www2.mrc-lmb.cam.ac.uk/relion"
|
2018-07-25 09:52:35 +08:00
|
|
|
git = "https://github.com/3dem/relion.git"
|
2017-04-28 05:52:05 +08:00
|
|
|
|
2018-08-16 23:51:58 +08:00
|
|
|
version('3.0_beta',
|
|
|
|
git='https://bitbucket.org/scheres/relion-3.0_beta.git')
|
|
|
|
version('2.1', preferred='true', tag='2.1')
|
2018-07-25 09:52:35 +08:00
|
|
|
version('2.0.3', tag='2.0.3')
|
2018-08-16 23:51:58 +08:00
|
|
|
# relion has no develop branch though pulling from master
|
|
|
|
# should be considered the same as develop
|
|
|
|
version('develop', branch='master')
|
2017-04-28 05:52:05 +08:00
|
|
|
|
|
|
|
variant('gui', default=True, description="build the gui")
|
2017-11-14 04:29:43 +08:00
|
|
|
variant('cuda', default=True, description="enable compute on gpu")
|
|
|
|
variant('double', default=True, description="double precision (cpu) code")
|
2018-08-16 23:51:58 +08:00
|
|
|
variant('double-gpu', default=False, description="double precision gpu")
|
|
|
|
# if built with purpose=cluster then relion will link to gpfs libraries
|
|
|
|
# if that's not desirable then use purpose=desktop
|
|
|
|
variant('purpose', default='cluster', values=('cluster', 'desktop'),
|
|
|
|
description="build relion for use in cluster or desktop")
|
2017-07-26 07:34:43 +08:00
|
|
|
variant('build_type', default='RelWithDebInfo',
|
|
|
|
description='The build type to build',
|
|
|
|
values=('Debug', 'Release', 'RelWithDebInfo',
|
|
|
|
'Profiling', 'Benchmarking'))
|
2017-04-28 05:52:05 +08:00
|
|
|
|
|
|
|
depends_on('mpi')
|
2018-08-16 23:51:58 +08:00
|
|
|
# relion will not build with newer versions of cmake
|
|
|
|
# per https://github.com/3dem/relion/issues/380
|
|
|
|
depends_on('cmake@3:3.9.4', type='build')
|
2017-04-28 05:52:05 +08:00
|
|
|
depends_on('fftw+float+double')
|
|
|
|
depends_on('fltk', when='+gui')
|
2018-08-16 23:51:58 +08:00
|
|
|
depends_on('libtiff')
|
|
|
|
|
|
|
|
# relion 3 supports cuda 9
|
|
|
|
# relion < 3 does not
|
|
|
|
depends_on('cuda', when='+cuda')
|
|
|
|
depends_on('cuda@9:', when='@3: +cuda')
|
|
|
|
depends_on('cuda@8.0:8.99', when='@:2 +cuda')
|
2017-04-28 05:52:05 +08:00
|
|
|
|
|
|
|
def cmake_args(self):
|
2018-08-16 23:51:58 +08:00
|
|
|
|
|
|
|
carch = self.spec.variants['cuda_arch'].value[0]
|
|
|
|
|
2017-04-28 05:52:05 +08:00
|
|
|
args = [
|
|
|
|
'-DCMAKE_C_FLAGS=-g',
|
|
|
|
'-DCMAKE_CXX_FLAGS=-g',
|
|
|
|
'-DGUI=%s' % ('+gui' in self.spec),
|
|
|
|
'-DDoublePrec_CPU=%s' % ('+double' in self.spec),
|
|
|
|
'-DDoublePrec_GPU=%s' % ('+double-gpu' in self.spec),
|
|
|
|
]
|
2017-12-14 02:30:38 +08:00
|
|
|
|
2018-03-07 14:45:48 +08:00
|
|
|
if '+cuda' in self.spec:
|
2018-08-16 23:51:58 +08:00
|
|
|
# relion+cuda requires selecting cuda_arch
|
|
|
|
if not carch:
|
|
|
|
raise ValueError("select cuda_arch when building with +cuda")
|
|
|
|
else:
|
|
|
|
args += ['-DCUDA=ON', '-DCudaTexture=ON',
|
|
|
|
'-DCUDA_ARCH=%s' % (carch)]
|
|
|
|
|
|
|
|
# these new values were added in relion 3
|
|
|
|
# do not seem to cause problems with < 3
|
|
|
|
else:
|
|
|
|
args += ['-DMKLFFT=ON', '-DFORCE_OWN_TBB=ON', '-DALTCPU=ON']
|
|
|
|
|
2017-04-28 05:52:05 +08:00
|
|
|
return args
|