2023-01-19 06:30:17 +08:00
|
|
|
# Copyright 2013-2023 Lawrence Livermore National Security, LLC and other
|
2018-10-08 04:52:23 +08:00
|
|
|
# Spack Project Developers. See the top-level COPYRIGHT file for details.
|
2017-07-28 03:24:28 +08:00
|
|
|
#
|
2018-10-08 04:52:23 +08:00
|
|
|
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
|
|
|
|
|
2017-07-28 03:24:28 +08:00
|
|
|
|
|
|
|
import platform
|
|
|
|
|
2022-05-29 00:55:44 +08:00
|
|
|
from spack.package import *
|
2021-07-09 06:12:30 +08:00
|
|
|
|
2017-07-28 03:24:28 +08:00
|
|
|
|
|
|
|
class Lcals(MakefilePackage):
|
|
|
|
"""LCALS ("Livermore Compiler Analysis Loop Suite") is a collection of loop
|
2022-07-31 06:19:18 +08:00
|
|
|
kernels based, in part, on historical "Livermore Loops" benchmarks
|
|
|
|
(See the 1986 technical report: "The Livermore Fortran Kernels:
|
|
|
|
A Computer Test of the Numerical Performance Range",
|
|
|
|
by Frank H. McMahon, UCRL-53745.). The suite contains facilities to
|
|
|
|
generate timing statistics and reports."""
|
2017-07-28 03:24:28 +08:00
|
|
|
|
2019-07-15 22:32:51 +08:00
|
|
|
homepage = "https://computing.llnl.gov/projects/co-design/lcals"
|
2022-07-31 06:19:18 +08:00
|
|
|
url = "https://computing.llnl.gov/projects/co-design/download/lcals-v1.0.2.tgz"
|
2017-07-28 03:24:28 +08:00
|
|
|
|
2022-07-31 06:19:18 +08:00
|
|
|
tags = ["proxy-app"]
|
2017-07-28 03:24:28 +08:00
|
|
|
|
2022-07-31 06:19:18 +08:00
|
|
|
version("1.0.2", sha256="a146590f7c1e9a9311ccf74dc0bef1fb19d77429db35a33c6725529fb1b0327e")
|
2017-07-28 03:24:28 +08:00
|
|
|
|
|
|
|
variant(
|
2022-07-31 06:19:18 +08:00
|
|
|
"microarch",
|
|
|
|
description="Micro arch: SSE, AVX, MIC.",
|
|
|
|
default="sse",
|
|
|
|
values=("sse", "avx", "MIC"),
|
2017-07-28 03:24:28 +08:00
|
|
|
)
|
|
|
|
|
|
|
|
@property
|
|
|
|
def build_targets(self):
|
|
|
|
|
|
|
|
targets = []
|
|
|
|
|
2022-07-31 06:19:18 +08:00
|
|
|
cxxflags = "-std=c++0x "
|
|
|
|
cxx_compile = ""
|
2017-07-28 03:24:28 +08:00
|
|
|
|
2022-07-31 06:19:18 +08:00
|
|
|
microarch = self.spec.variants["microarch"].value
|
2017-07-28 03:24:28 +08:00
|
|
|
|
|
|
|
arch = platform.machine()
|
|
|
|
|
2022-07-31 06:19:18 +08:00
|
|
|
if microarch == "MIC":
|
|
|
|
arch = "MIC"
|
|
|
|
elif arch == "x86_64" or arch == "x86_32":
|
|
|
|
arch = "x86"
|
|
|
|
elif arch == "aarch64":
|
|
|
|
arch = "aarch64"
|
2020-07-28 16:56:59 +08:00
|
|
|
else:
|
2022-07-31 06:19:18 +08:00
|
|
|
raise InstallError("unknown architecture.")
|
|
|
|
|
|
|
|
if self.compiler.name == "intel":
|
|
|
|
if arch == "MIC":
|
|
|
|
cxxflags += "-DLCALS_PLATFORM_X86_SSE -DLCALS_COMPILER_ICC "
|
|
|
|
cxx_compile += "-g -O3 -mmic -vec-report3 "
|
|
|
|
" -inline-max-total-size=10000 -inline-forceinline -ansi-alias"
|
|
|
|
elif microarch == "sse" and arch == "x86":
|
|
|
|
cxxflags += "-DLCALS_PLATFORM_X86_SSE -DLCALS_COMPILER_ICC "
|
|
|
|
cxx_compile += "-O3 -msse4.1 -inline-max-total-size=10000"
|
|
|
|
" -inline-forceinline -ansi-alias -std=c++0x "
|
|
|
|
elif microarch == "avx" and arch == "x86":
|
|
|
|
cxxflags += "-DLCALS_PLATFORM_X86_AVX -DLCALS_COMPILER_ICC "
|
|
|
|
cxx_compile += "-O3 -mavx -inline-max-total-size=10000"
|
|
|
|
" -inline-forceinline -ansi-alias -std=c++0x"
|
2017-07-28 03:24:28 +08:00
|
|
|
cxxflags += self.compiler.openmp_flag
|
2022-07-31 06:19:18 +08:00
|
|
|
elif self.compiler.name == "gcc":
|
|
|
|
if arch == "MIC" or (microarch == "sse" and arch == "x86"):
|
|
|
|
cxxflags += "-DLCALS_PLATFORM_X86_SSE -DLCALS_COMPILER_GNU "
|
|
|
|
cxx_compile += "-Ofast -msse4.1 -finline-functions"
|
|
|
|
" -finline-limit=10000 -std=c++11 "
|
|
|
|
elif microarch == "avx" and arch == "x86":
|
|
|
|
cxxflags += "-DLCALS_PLATFORM_X86_AVX -DLCALS_COMPILER_GNU "
|
|
|
|
cxx_compile += "-Ofast -mavx -finline-functions"
|
|
|
|
" -finline-limit=10000 -std=c++11"
|
|
|
|
elif arch == "aarch64":
|
|
|
|
cxxflags += "-DLCALS_COMPILER_GNU "
|
|
|
|
cxx_compile += "-Ofast -finline-functions"
|
|
|
|
" -finline-limit=10000 -std=c++11"
|
2017-07-28 03:24:28 +08:00
|
|
|
cxxflags += self.compiler.openmp_flag
|
|
|
|
|
2022-07-31 06:19:18 +08:00
|
|
|
targets.append("LCALS_ARCH=")
|
|
|
|
cxx_compile += " " + cxxflags
|
|
|
|
targets.append("CXX_COMPILE={0} {1}".format(spack_cxx, cxx_compile))
|
2017-07-28 03:24:28 +08:00
|
|
|
|
|
|
|
return targets
|
|
|
|
|
|
|
|
def install(self, spec, prefix):
|
|
|
|
mkdir(prefix.bin)
|
2022-07-31 06:19:18 +08:00
|
|
|
install("lcals.exe", prefix.bin)
|
|
|
|
install("lcalsversioninfo.txt", prefix)
|