2016-05-18 02:14:59 +08:00
|
|
|
##############################################################################
|
2017-09-07 11:44:16 +08:00
|
|
|
# Copyright (c) 2013-2017, Lawrence Livermore National Security, LLC.
|
2016-05-18 02:14:59 +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
|
|
|
|
#
|
|
|
|
# For details, see https://github.com/llnl/spack
|
2017-06-25 13:22:55 +08:00
|
|
|
# Please also see the NOTICE and LICENSE files for our notice and the LGPL.
|
2016-05-18 02:14:59 +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 *
|
|
|
|
import os
|
|
|
|
import platform
|
|
|
|
|
|
|
|
|
2017-04-22 01:11:29 +08:00
|
|
|
class Hpl(MakefilePackage):
|
2016-05-18 02:14:59 +08:00
|
|
|
"""HPL is a software package that solves a (random) dense linear system
|
|
|
|
in double precision (64 bits) arithmetic on distributed-memory computers.
|
|
|
|
It can thus be regarded as a portable as well as freely available
|
|
|
|
implementation of the High Performance Computing Linpack Benchmark."""
|
|
|
|
|
|
|
|
homepage = "http://www.netlib.org/benchmark/hpl/"
|
|
|
|
url = "http://www.netlib.org/benchmark/hpl/hpl-2.2.tar.gz"
|
|
|
|
|
|
|
|
version('2.2', '0eb19e787c3dc8f4058db22c9e0c5320')
|
|
|
|
|
|
|
|
variant('openmp', default=False, description='Enable OpenMP support')
|
|
|
|
|
|
|
|
depends_on('mpi@1.1:')
|
|
|
|
depends_on('blas')
|
|
|
|
|
2016-05-31 22:32:24 +08:00
|
|
|
parallel = False
|
|
|
|
|
2017-04-22 01:11:29 +08:00
|
|
|
arch = '{0}-{1}'.format(platform.system(), platform.processor())
|
|
|
|
|
|
|
|
build_targets = ['arch={0}'.format(arch)]
|
|
|
|
|
|
|
|
def edit(self, spec, prefix):
|
2016-05-18 02:14:59 +08:00
|
|
|
# List of configuration options
|
|
|
|
# Order is important
|
|
|
|
config = []
|
|
|
|
|
|
|
|
# OpenMP support
|
|
|
|
if '+openmp' in spec:
|
|
|
|
config.append(
|
|
|
|
'OMP_DEFS = {0}'.format(self.compiler.openmp_flag)
|
|
|
|
)
|
|
|
|
|
|
|
|
config.extend([
|
|
|
|
# Shell
|
|
|
|
'SHELL = /bin/sh',
|
|
|
|
'CD = cd',
|
|
|
|
'CP = cp',
|
|
|
|
'LN_S = ln -fs',
|
|
|
|
'MKDIR = mkdir -p',
|
|
|
|
'RM = /bin/rm -f',
|
|
|
|
'TOUCH = touch',
|
|
|
|
# Platform identifier
|
2017-04-22 01:11:29 +08:00
|
|
|
'ARCH = {0}'.format(self.arch),
|
2016-05-18 02:14:59 +08:00
|
|
|
# HPL Directory Structure / HPL library
|
|
|
|
'TOPdir = {0}'.format(os.getcwd()),
|
|
|
|
'INCdir = $(TOPdir)/include',
|
|
|
|
'BINdir = $(TOPdir)/bin/$(ARCH)',
|
|
|
|
'LIBdir = $(TOPdir)/lib/$(ARCH)',
|
|
|
|
'HPLlib = $(LIBdir)/libhpl.a',
|
|
|
|
# Message Passing library (MPI)
|
2017-04-22 01:11:29 +08:00
|
|
|
'MPinc = {0}'.format(spec['mpi'].prefix.include),
|
2016-05-18 02:14:59 +08:00
|
|
|
'MPlib = -L{0}'.format(spec['mpi'].prefix.lib),
|
|
|
|
# Linear Algebra library (BLAS or VSIPL)
|
|
|
|
'LAinc = {0}'.format(spec['blas'].prefix.include),
|
2017-03-03 02:01:29 +08:00
|
|
|
'LAlib = {0}'.format(spec['blas'].libs.joined()),
|
2016-05-18 02:14:59 +08:00
|
|
|
# F77 / C interface
|
|
|
|
'F2CDEFS = -DAdd_ -DF77_INTEGER=int -DStringSunStyle',
|
|
|
|
# HPL includes / libraries / specifics
|
|
|
|
'HPL_INCLUDES = -I$(INCdir) -I$(INCdir)/$(ARCH) ' +
|
2016-05-18 02:22:00 +08:00
|
|
|
'-I$(LAinc) -I$(MPinc)',
|
2016-05-18 02:14:59 +08:00
|
|
|
'HPL_LIBS = $(HPLlib) $(LAlib) $(MPlib)',
|
|
|
|
'HPL_OPTS = -DHPL_DETAILED_TIMING -DHPL_PROGRESS_REPORT',
|
|
|
|
'HPL_DEFS = $(F2CDEFS) $(HPL_OPTS) $(HPL_INCLUDES)',
|
|
|
|
# Compilers / linkers - Optimization flags
|
|
|
|
'CC = {0}'.format(spec['mpi'].mpicc),
|
|
|
|
'CCNOOPT = $(HPL_DEFS)',
|
|
|
|
'CCFLAGS = $(HPL_DEFS) -O3',
|
|
|
|
'LINKER = $(CC)',
|
|
|
|
'LINKFLAGS = $(CCFLAGS) $(OMP_DEFS)',
|
|
|
|
'ARCHIVER = ar',
|
|
|
|
'ARFLAGS = r',
|
|
|
|
'RANLIB = echo'
|
|
|
|
])
|
|
|
|
|
|
|
|
# Write configuration options to include file
|
2017-04-22 01:11:29 +08:00
|
|
|
with open('Make.{0}'.format(self.arch), 'w') as makefile:
|
2016-05-18 02:14:59 +08:00
|
|
|
for var in config:
|
|
|
|
makefile.write('{0}\n'.format(var))
|
|
|
|
|
|
|
|
def install(self, spec, prefix):
|
2016-05-18 02:36:38 +08:00
|
|
|
# Manual installation
|
2017-04-22 01:11:29 +08:00
|
|
|
install_tree(join_path('bin', self.arch), prefix.bin)
|
|
|
|
install_tree(join_path('lib', self.arch), prefix.lib)
|
|
|
|
install_tree(join_path('include', self.arch), prefix.include)
|
2016-05-18 02:36:38 +08:00
|
|
|
install_tree('man', prefix.man)
|