-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
enable building of spack issm installation with wrappers #186
Draft
justinh2002
wants to merge
8
commits into
main
Choose a base branch
from
184-spack-issm_wrappers
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+185
−21
Draft
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
73d42ee
enable building of spack issm installation with wrappers
1165414
now using ACCESS-NRI fork of ISSM instead of upstream repo
justinh2002 f913959
added access-nri triangle dependency with others required for wrapper…
justinh2002 7016b14
spack packaging of triangle follows issm compilation method
justinh2002 d8b5f95
include all build config for triangle required by issm
justinh2002 579d144
created new access triangle spack directory, SPR brings all files int…
justinh2002 9d7196c
cleanup docstrings and comments
justinh2002 88ee4a8
added packaging features for +wrappers installation
justinh2002 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
# Copyright 2013-2024 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) | ||
# ---------------------------------------------------------------------------- | ||
# | ||
# spack install access-triangle-git | ||
# | ||
# You can edit this file again by typing: | ||
# | ||
# spack edit access-triangle-git | ||
# | ||
# ---------------------------------------------------------------------------- | ||
|
||
from spack.package import * | ||
import glob | ||
import os | ||
|
||
|
||
class AccessTriangle(MakefilePackage): | ||
"""Spack package for the ISSM Triangle library.""" | ||
|
||
homepage = "https://github.com/ACCESS-NRI/issm-triangle" | ||
git = 'https://github.com/ACCESS-NRI/issm-triangle.git' | ||
|
||
version('main') | ||
|
||
# # If on some systems 'gmake' is truly required, keep it. Otherwise, 'make' | ||
# # is often sufficient because Spack sets MAKE appropriately. | ||
depends_on('gmake', type='build') | ||
depends_on('libx11', type='link') | ||
|
||
def url_for_version(self, version): | ||
return "https://github.com/ACCESS-NRI/issm-triangle/archive/refs/heads/{0}.tar.gz".format(version) | ||
|
||
def edit(self, spec, prefix): | ||
""" | ||
Below, we just copy in the 'configs' | ||
so that the build can find them in `self.build_directory`. | ||
""" | ||
src_dir = join_path(self.stage.source_path, "src") | ||
mkdirp(src_dir) | ||
|
||
# Copy necessary files to src directory | ||
install('configs/makefile', src_dir) | ||
install('configs/linux/configure.make', src_dir) | ||
install('triangle.c', src_dir) | ||
install('triangle.h', src_dir) | ||
|
||
def build(self, spec, prefix): | ||
""" | ||
This is where we actually call `make shared`. | ||
Using MakefilePackage, you *could* rely on build_targets, | ||
but we'll be explicit here so you can see it clearly. | ||
""" | ||
with working_dir(join_path(self.stage.source_path, "src")): | ||
make('shared') | ||
|
||
#raise an exception | ||
|
||
def install(self, spec, prefix): | ||
""" | ||
Copy the resulting library and headers into the Spack prefix. | ||
""" | ||
src = join_path(self.stage.source_path, "src") | ||
|
||
# Create prefix directories | ||
mkdirp(prefix.include) | ||
mkdirp(prefix.lib) | ||
|
||
with working_dir(src): | ||
# Make sure we see what's actually there, for debugging: | ||
ls_output = Executable('ls')('-l', '.', output=str, error=str) | ||
print("Files in build directory:\n", ls_output) | ||
|
||
install('triangle.h', prefix.include) | ||
|
||
for libfile in glob.glob("libtriangle.*"): | ||
install(libfile, prefix.lib) | ||
|
||
|
||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,57 +1,137 @@ | ||
# Copyright 2013-2023 Lawrence Livermore National Security, LLC and other | ||
# Spack Project Developers. See the top-level COPYRIGHT file for details. | ||
# Copyright 2013-2023 Lawrence Livermore National Security, | ||
# LLC and other Spack Project Developers. See the top-level COPYRIGHT | ||
# file for details. | ||
# | ||
# Copyright 2023 Angus Gibson | ||
# Modified by Justin Kin Jun Hew, 2025 | ||
# | ||
# SPDX-License-Identifier: (Apache-2.0 OR MIT) | ||
|
||
from spack.package import * | ||
import os | ||
import subprocess | ||
|
||
|
||
class Issm(AutotoolsPackage): | ||
"""Ice-sheet and Sea-Level System Model""" | ||
|
||
homepage = "https://issm.jpl.nasa.gov/" | ||
git = "https://github.com/ISSMteam/ISSM.git" | ||
git = "https://github.com/ACCESS-NRI/ISSM.git" | ||
|
||
version("develop") | ||
version("4.24", sha256="0487bd025f37be4a39dfd48b047de6a6423e310dfe5281dbd9a52aa35b26151a") | ||
#version("4.24", sha256="c71d870e63f0ce3ae938d6a669e80dc2cecef827084db31a4b2cfc3a26a44820") | ||
|
||
version("main", branch="main", git="https://github.com/ACCESS-NRI/ISSM.git") | ||
version("access-development", branch="access-development", git="https://github.com/ACCESS-NRI/ISSM.git") | ||
|
||
# | ||
# Variants | ||
# | ||
variant("wrappers", default=False, | ||
description="Enable building with MPI wrappers") | ||
|
||
# If you want to make external Fortran linking optional or specialized, | ||
# you can create a separate variant for it, but typically you might | ||
# rely on Spack's compiler wrappers for Fortran libraries. | ||
|
||
# | ||
# Build dependencies | ||
# | ||
depends_on("autoconf", type="build") | ||
depends_on("automake", type="build") | ||
depends_on("libtool", type="build") | ||
depends_on("m4", type="build") | ||
|
||
depends_on("libtool", type="build") | ||
depends_on("m4", type="build") | ||
|
||
# Required libraries | ||
# | ||
depends_on("mpi") | ||
depends_on("petsc+metis+mumps+scalapack") | ||
depends_on("m1qn3") | ||
|
||
# | ||
# Optional libraries | ||
# | ||
depends_on('access-triangle', when='+wrappers') | ||
depends_on("parmetis", when="+wrappers") | ||
# depends_on("python@3.9.0:3.9", when="+wrappers", type=("build", "run")) | ||
# depends_on("py-numpy", when="+wrappers", type=("build", "run")) | ||
|
||
def url_for_version(self, version): | ||
return "https://github.com/ISSMteam/ISSM/tarball/v{0}".format(version) | ||
# Example of how you might form a URL for a particular version: | ||
#branch = "access-development" | ||
return "https://github.com/ACCESS-NRI/ISSM/archive/refs/heads/{0}.tar.gz".format(version) | ||
|
||
def autoreconf(self, spec, prefix): | ||
# If the repo has an Autotools build system, run autoreconf: | ||
autoreconf("--install", "--verbose", "--force") | ||
|
||
def setup_run_environment(self, env): | ||
env.prepend_path("LD_LIBRARY_PATH", self.prefix.lib) | ||
|
||
def configure_args(self): | ||
"""Populate configure arguments, including optional flags to mimic | ||
your manual `./configure` invocation on Gadi.""" | ||
args = [ | ||
"--with-wrappers=no", | ||
"--enable-debugging", | ||
"--enable-development", | ||
"--enable-shared", | ||
"--without-kriging", | ||
"--enable-debugging", | ||
"--enable-development", | ||
"--enable-shared", | ||
"--without-kriging", | ||
] | ||
args.append("--with-petsc-dir={0}".format(self.spec["petsc"].prefix)) | ||
args.append("--with-metis-dir={0}".format(self.spec["metis"].prefix)) | ||
args.append("--with-mumps-dir={0}".format(self.spec["mumps"].prefix)) | ||
args.append("--with-m1qn3-dir={0}".format(self.spec["m1qn3"].prefix.lib)) | ||
|
||
# Even though we set the MPI compilers manually, the build system | ||
# wants us to explicitly request an MPI-enabled build by telling | ||
# it the MPI include directory. | ||
# | ||
# Wrappers | ||
# | ||
if "+wrappers" in self.spec: | ||
args.append("--with-wrappers=yes") | ||
else: | ||
args.append("--with-wrappers=no") | ||
|
||
# | ||
# MPI: Even if we use Spack's MPI wrappers, the build system may | ||
# want explicit mention of MPI includes and compilers: | ||
# | ||
args.append("--with-mpi-include={0}".format(self.spec["mpi"].prefix.include)) | ||
args.append("CC=" + self.spec["mpi"].mpicc) | ||
args.append("CXX=" + self.spec["mpi"].mpicxx) | ||
args.append("FC=" + self.spec["mpi"].mpifc) | ||
args.append("F77=" + self.spec["mpi"].mpif77) | ||
|
||
# | ||
# PETSc, MUMPS, METIS, SCALAPACK, etc. | ||
# (Spack typically puts these in the compiler/link environment, | ||
# but if the ISSM configure script looks for explicit --with-* | ||
# flags, we pass them.) | ||
# | ||
args.append("--with-petsc-dir={0}".format(self.spec["petsc"].prefix)) | ||
args.append("--with-metis-dir={0}".format(self.spec["metis"].prefix)) | ||
args.append("--with-mumps-dir={0}".format(self.spec["mumps"].prefix)) | ||
# If you rely on sca/lapack from PETSc, these lines might | ||
# not be strictly necessary. If ISSM's configure script | ||
# checks them individually, add them: | ||
args.append("--with-scalapack-dir={0}".format(self.spec["scalapack"].prefix)) | ||
args.append("--with-parmetis-dir={0}".format(self.spec["parmetis"].prefix)) | ||
args.append("--with-triangle-dir={0}".format(self.spec["access-triangle"].prefix)) | ||
|
||
# | ||
# M1QN3 | ||
# | ||
# Some codes want the actual library subdir for m1qn3, | ||
# e.g. "prefix.lib" or "prefix" depending on the configure logic: | ||
# | ||
args.append("--with-m1qn3-dir={0}".format(self.spec["m1qn3"].prefix.lib)) | ||
args.append("--with-python-version=3.9") | ||
args.append("--with-python-dir=/apps/python3/3.9.2") | ||
|
||
|
||
numpy_site_packages = "/apps/python3/3.9.2/lib/python3.9/site-packages/numpy-1.20.0-py3.9-linux-x86_64.egg/numpy" | ||
numpy_core_dir = "/apps/python3/3.9.2/lib/python3.9/site-packages/numpy-1.20.0-py3.9-linux-x86_64.egg/numpy" | ||
args.append("--with-python-numpy-dir={0}".format(numpy_core_dir)) | ||
|
||
return args | ||
|
||
def install(self, spec, prefix): | ||
# Run the normal Autotools install logic | ||
super().install(spec, prefix) | ||
|
||
# Copy the entire source tree into an additional directory | ||
install_tree(self.stage.source_path, prefix.src) | ||
Comment on lines
+135
to
+136
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Are you sure that the ISSM Spack package should install all the source? That's very unusual. |
||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Stick to the style used in the rest of the SPRs.