Skip to content
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

allow spack installation of issm to include wrappers #184

Open
justinh2002 opened this issue Jan 29, 2025 · 4 comments
Open

allow spack installation of issm to include wrappers #184

justinh2002 opened this issue Jan 29, 2025 · 4 comments
Assignees

Comments

@justinh2002
Copy link

justinh2002 commented Jan 29, 2025

The current spack installation script package.py for issm in /packages/issm is only configured to install without wrappers. That is, it only installs the binaries (issm.exe) without other modules. Adding an argument for including wrappers will allow spack installation to be used on local machines as well, or on clusters if pre- and post- processing can be done on them.

@justinh2002 justinh2002 self-assigned this Jan 29, 2025
@harshula
Copy link
Collaborator

Hi @justinh2002 ,

re: https://github.com/ACCESS-NRI/spack-packages/blob/main/packages/issm/package.py

You'll have to implement a variant (https://spack.readthedocs.io/en/latest/packaging_guide.html#id6) in the ISSM SPR (Autotools) and then add a conditional that sets --with-wrappers=no to "--with-wrappers=yes depending on the value of the variant.

The Cable SPR (CMake) does something similar: https://github.com/ACCESS-NRI/spack-packages/blob/main/packages/cable/package.py

@harshula
Copy link
Collaborator

Hi @justinh2002 ,

Just read the Zulip chat, looks like you already know how to do the above. See if this helps: https://spack.readthedocs.io/en/latest/build_systems/autotoolspackage.html#helper-functions

@justinh2002
Copy link
Author

justinh2002 commented Jan 30, 2025

Thanks Harshula, I've got the changes made, simply spack install issm +with_wrappers does the trick now with these changes.

`
from spack.package import *

class Issm(AutotoolsPackage):

homepage = "https://issm.jpl.nasa.gov/"
git = "https://github.com/ISSMteam/ISSM.git"

version("develop")
version("4.24", sha256="c71d870e63f0ce3ae938d6a669e80dc2cecef827084db31a4b2cfc3a26a44820")

variant("with_wrappers", default=False, description="Enable building with wrappers")

depends_on("autoconf", type="build")
depends_on("automake", type="build")
depends_on("libtool", type="build")
depends_on("m4", type="build")

depends_on("mpi")
depends_on("petsc+metis+mumps+scalapack")
depends_on("m1qn3")

def url_for_version(self, version):
    return "https://github.com/ISSMteam/ISSM/tarball/v{0}".format(version)

def autoreconf(self, spec, prefix):
    autoreconf("--install", "--verbose", "--force")

def configure_args(self):
    args = [
        "--enable-debugging",
        "--enable-development",
        "--enable-shared",
        "--without-kriging",
    ]

    # Add support for the `with_wrappers` variant
    if "+with_wrappers" in self.spec:
        args.append("--with-wrappers=yes")
    else:
        args.append("--with-wrappers=no")

    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.
    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)

    return args`

@harshula
Copy link
Collaborator

Hi @justinh2002 , See if you can use the autotoolspackage.html#helper-functions to simplify:

    if "+with_wrappers" in self.spec:
        args.append("--with-wrappers=yes")
    else:
        args.append("--with-wrappers=no")

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants