Adding e3sm-kernels to Spack (#32341)

* Initial Draft of E3SM-Kernels Spackage

Initial draft of E3SM-Kernels. Currently no support for nested_loops due
to build system limitations

* Style Check and Fixed gfortran Check

Fixed style issues and changed gnu toolchain check to a gfortran check
due to hybrid compilers (e.g. clang+gfortran)

* Fixed Style Issues
This commit is contained in:
Robert Pavel 2022-08-25 11:01:07 -07:00 committed by GitHub
parent 06ba4d5c28
commit 7214a438dc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -0,0 +1,57 @@
# Copyright 2013-2022 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
import os
from spack.package import *
class E3smKernels(MakefilePackage):
"""
Climate kernels for Co-design that originate from the Energy
Exascale Earth System Model (E3SM).
"""
homepage = "https://github.com/e3SM-Project/codesign-kernels"
url = "https://github.com/E3SM-Project/codesign-kernels/archive/refs/tags/v1.0.tar.gz"
git = "https://github.com/E3SM-Project/codesign-kernels.git"
maintainers = ["sarats", "philipwjones"]
version("master", branch="master")
version("1.0", sha256="358249785ba9f95616feecbb6f37f7694646568499c11b2094c9233999c6cc95")
variant(
"kernel",
default="atmosphere",
values=(
"atmosphere",
"mmf-mpdata-tracer",
),
description="Specify E3SM Kernel to Build",
multi=False,
)
@property
def build_directory(self):
return self.spec.variants["kernel"].value
@property
def build_targets(self):
# Spack will provide optimization flags
# But we still need to pass in fortran flags for gfortran
args = []
# Test for gfortran specifically due to hybrid compilers like llvm
if "gfortran" in self.compiler.fc:
args.append("FFLAGS=-ffree-line-length-none")
return args
def install(self, spec, prefix):
# Manually copy binaries over
mkdir(prefix.bin)
if self.spec.variants["kernel"].value == "atmosphere":
install(os.path.join("atmosphere", "atm"), prefix.bin.atm)
elif self.spec.variants["kernel"].value == "mmf-mpdata-tracer":
install(os.path.join("mmf-mpdata-tracer", "advect"), prefix.bin.advect)