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

access-fms: create an SPD for ACCESS-NRI's FMS fork #162

Merged
merged 1 commit into from
Nov 14, 2024
Merged

Conversation

harshula
Copy link
Collaborator

No description provided.

@harshula harshula self-assigned this Nov 13, 2024
@penguian
Copy link
Contributor

Can you please describe why a fork was needed, and provide a diff?

@harshula
Copy link
Collaborator Author

Hi @penguian , The FMS SPR was forked because we do not want to use the upstream FMS repository. We want to use https://github.com/ACCESS-NRI/FMS.git. The reason we don't want to use the upstream FMS repository is because the MOM5 FMS apparently diverged.

@harshula
Copy link
Collaborator Author

$ diff -u ../spack-upstream.git/var/spack/repos/builtin/packages/fms/package.py packages/access-fms/package.py 
--- ../spack-upstream.git/var/spack/repos/builtin/packages/fms/package.py	2024-11-07 14:17:58.359988958 +1100
+++ packages/access-fms/package.py	2024-11-14 15:16:58.439667317 +1100
@@ -1,90 +1,31 @@
 # Copyright 2013-2024 Lawrence Livermore National Security, LLC and other
 # Spack Project Developers. See the top-level COPYRIGHT file for details.
 #
+# Copyright 2024 ACCESS-NRI
+#
 # SPDX-License-Identifier: (Apache-2.0 OR MIT)
 
-from spack.package import *
-
+from spack.package import find_headers, find_libraries
 
-class Fms(CMakePackage):
+# Based on upstream $spack/var/spack/repos/builtin/packages/fms/package.py
+class AccessFms(CMakePackage):
     """GFDL's Flexible Modeling System (FMS) is a software environment
     that supports the efficient development, construction, execution,
     and scientific interpretation of atmospheric, oceanic, and climate
-    system models."""
+    system models. This is ACCESS-NRI's fork."""
 
-    homepage = "https://github.com/NOAA-GFDL/FMS"
-    url = "https://github.com/NOAA-GFDL/FMS/archive/refs/tags/2022.04.tar.gz"
-    git = "https://github.com/NOAA-GFDL/FMS.git"
+    homepage = "https://github.com/ACCESS-NRI/FMS"
+    git = "https://github.com/ACCESS-NRI/FMS.git"
 
     license("LGPL-3.0-or-later")
 
-    maintainers("AlexanderRichert-NOAA", "Hang-Lei-NOAA", "edwardhartnett", "rem1776", "climbfuji")
-    version("2023.04", sha256="feb895ea2b3269ca66df296199a36af335f0dc281e2dab2f1bfebb19fd9c22c4")
-    version("2023.02", sha256="dc029ffadfd82c334f104268bedd8635c77976485f202f0966ae4cf06d2374be")
-    version(
-        "2023.01.01", sha256="f83e2814a1e3ba439ab847ec8bb251f3889d5ca14fb20849507590adbbe8e899"
-    )
-    version("2023.01", sha256="6079ea885e9365513b453c77aadfc7c305bf413b840656bb333db1eabba0f18e")
-    version("2022.04", sha256="f741479128afc2b93ca8291a4c5bcdb024a8cbeda1a26bf77a236c0f629e1b03")
-    version("2022.03", sha256="42d2ac53d3c889a8177a6d7a132583364c0f6e5d5cbde0d980443b6797ad4838")
-    version("2022.02", sha256="ad4978302b219e11b883b2f52519e1ee455137ad947474abb316c8654f72c874")
-    version("2022.01", sha256="a1cba1f536923f5953c28729a28e5431e127b45d6bc2c15d230939f0c02daa9b")
-    version("2021.04", sha256="dcb4fe80cb3b7846f7cf89b812afff09a78a10261ea048a851f28935d6b241b1")
-    version(
-        "2021.03.01", sha256="1f70e2a57f0d01e80fceb9ca9ce9661f5c1565d0437ab67618c2c4dfea0da6e9"
-    )
-    version("2021.03", sha256="a9fb6e85f44ff79e6f9e61e65f42a5ffd38fa661fe1a3e4da6f85ffacd2697ac")
-    version(
-        "2021.02.01", sha256="9b11d9474d7c90464af66d81fb86c4798cfa309b9a0da20b0fccf33c4f65386b"
-    )
-    version("2021.02", sha256="db810b2452a6952239f064b52c0c5c58fc62126057982111b9fcd64f1b3bd879")
-    version("2021.01", sha256="38c748e2edb94ffeb021095d8bde4d74b7834610ce0ef1dbb4dce353eeb5cd96")
-    version(
-        "2020.04.02", sha256="bd6ce752b1018d4418398f14b9fc486f217de76bcbaaf2cdbf4c43e0b3f39f69"
-    )
-    version(
-        "2020.04.01", sha256="2c409242de7dea0cf29f8dbf7495698b6bcac1eeb5c4599a728bdea172ffe37c"
-    )
+    maintainers("harshula")
 
-    variant(
-        "precision",
-        values=("32", "64"),
-        description="Build a version of the library with default 32 or 64 bit reals or both",
-        default="32",
-        multi=True,
-    )
-    conflicts(
-        "precision=32,64",
-        when="@:2022.03",
-        msg="FMS versions prior to 2022.04 do not support both 32 and 64 bit precision",
-    )
+    version("master", branch="master")
+    # TODO: Needs to be changed once changes to build system enter master.
+    version("development", branch="development", preferred=True)
 
     variant("gfs_phys", default=True, description="Use GFS Physics")
-    variant("openmp", default=True, description="Use OpenMP")
-    variant("quad_precision", default=True, description="quad precision reals")
-    variant(
-        "yaml",
-        default=False,
-        description="yaml input file support(requires libyaml)",
-        when="@2021.04:",
-    )
-    variant(
-        "constants",
-        default="GFDL",
-        description="Build with <X> constants parameter definitions",
-        values=("GFDL", "GEOS", "GFS"),
-        multi=False,
-        when="@2022.02:",
-    )
-    variant(
-        "pic", default=False, description="Build with position independent code", when="@2022.02:"
-    )
-    variant(
-        "deprecated_io",
-        default=False,
-        description="Compiles with support for deprecated io modules fms_io and mpp_io",
-        when="@2023.02:",
-    )
     variant("large_file", default=False, description="Enable compiler definition -Duse_LARGEFILE.")
     variant(
         "internal_file_nml",
@@ -95,21 +36,28 @@
     depends_on("netcdf-c")
     depends_on("netcdf-fortran")
     depends_on("mpi")
-    depends_on("libyaml", when="+yaml")
+
+    def url_for_version(self, version):
+        return "https://github.com/ACCESS-NRI/FMS/tarball/{0}".format(version)
+
+    @property
+    def headers(self):
+        return find_headers(
+            "*", root=self.prefix, recursive=True
+        )
+
+    @property
+    def libs(self):
+        libraries = ["libfms_r4", "libfms_r8"]
+        return find_libraries(
+            libraries, root=self.prefix, shared=False, recursive=True
+        )
 
     def cmake_args(self):
         args = [
             self.define_from_variant("GFS_PHYS"),
-            self.define_from_variant("OPENMP"),
-            self.define_from_variant("ENABLE_QUAD_PRECISION", "quad_precision"),
-            self.define_from_variant("WITH_YAML", "yaml"),
-            self.define_from_variant("CONSTANTS"),
             self.define_from_variant("LARGEFILE", "large_file"),
             self.define_from_variant("INTERNAL_FILE_NML"),
-            self.define("32BIT", "precision=32" in self.spec),
-            self.define("64BIT", "precision=64" in self.spec),
-            self.define_from_variant("FPIC", "pic"),
-            self.define_from_variant("USE_DEPRECATED_IO", "deprecated_io"),
         ]
 
         return args

@penguian
Copy link
Contributor

I created the diff myself.

[pcl851@gadi-login-02 ACCESS-NRI]$ diff -w -U0 spack/var/spack/repos/builtin/packages/fms/package.py spack-packages/packages/access-fms/package.py 
--- spack/var/spack/repos/builtin/packages/fms/package.py	2024-09-24 17:21:38.000000000 +1000
+++ spack-packages/packages/access-fms/package.py	2024-11-14 15:09:43.000000000 +1100
@@ -3,0 +4,2 @@
+# Copyright 2024 ACCESS-NRI
+#
@@ -6 +8 @@
-from spack.package import *
+from spack.package import find_headers, find_libraries
@@ -8,2 +10,2 @@
-
-class Fms(CMakePackage):
+# Based on upstream $spack/var/spack/repos/builtin/packages/fms/package.py
+class AccessFms(CMakePackage):
@@ -13 +15 @@
-    system models."""
+    system models. This is ACCESS-NRI's fork."""
@@ -15,3 +17,2 @@
-    homepage = "https://github.com/NOAA-GFDL/FMS"
-    url = "https://github.com/NOAA-GFDL/FMS/archive/refs/tags/2022.04.tar.gz"
-    git = "https://github.com/NOAA-GFDL/FMS.git"
+    homepage = "https://github.com/ACCESS-NRI/FMS"
+    git = "https://github.com/ACCESS-NRI/FMS.git"
@@ -21,27 +22 @@
-    maintainers("AlexanderRichert-NOAA", "Hang-Lei-NOAA", "edwardhartnett", "rem1776", "climbfuji")
-    version("2023.04", sha256="feb895ea2b3269ca66df296199a36af335f0dc281e2dab2f1bfebb19fd9c22c4")
-    version("2023.02", sha256="dc029ffadfd82c334f104268bedd8635c77976485f202f0966ae4cf06d2374be")
-    version(
-        "2023.01.01", sha256="f83e2814a1e3ba439ab847ec8bb251f3889d5ca14fb20849507590adbbe8e899"
-    )
-    version("2023.01", sha256="6079ea885e9365513b453c77aadfc7c305bf413b840656bb333db1eabba0f18e")
-    version("2022.04", sha256="f741479128afc2b93ca8291a4c5bcdb024a8cbeda1a26bf77a236c0f629e1b03")
-    version("2022.03", sha256="42d2ac53d3c889a8177a6d7a132583364c0f6e5d5cbde0d980443b6797ad4838")
-    version("2022.02", sha256="ad4978302b219e11b883b2f52519e1ee455137ad947474abb316c8654f72c874")
-    version("2022.01", sha256="a1cba1f536923f5953c28729a28e5431e127b45d6bc2c15d230939f0c02daa9b")
-    version("2021.04", sha256="dcb4fe80cb3b7846f7cf89b812afff09a78a10261ea048a851f28935d6b241b1")
-    version(
-        "2021.03.01", sha256="1f70e2a57f0d01e80fceb9ca9ce9661f5c1565d0437ab67618c2c4dfea0da6e9"
-    )
-    version("2021.03", sha256="a9fb6e85f44ff79e6f9e61e65f42a5ffd38fa661fe1a3e4da6f85ffacd2697ac")
-    version(
-        "2021.02.01", sha256="9b11d9474d7c90464af66d81fb86c4798cfa309b9a0da20b0fccf33c4f65386b"
-    )
-    version("2021.02", sha256="db810b2452a6952239f064b52c0c5c58fc62126057982111b9fcd64f1b3bd879")
-    version("2021.01", sha256="38c748e2edb94ffeb021095d8bde4d74b7834610ce0ef1dbb4dce353eeb5cd96")
-    version(
-        "2020.04.02", sha256="bd6ce752b1018d4418398f14b9fc486f217de76bcbaaf2cdbf4c43e0b3f39f69"
-    )
-    version(
-        "2020.04.01", sha256="2c409242de7dea0cf29f8dbf7495698b6bcac1eeb5c4599a728bdea172ffe37c"
-    )
+    maintainers("harshula")
@@ -49,12 +24,3 @@
-    variant(
-        "precision",
-        values=("32", "64"),
-        description="Build a version of the library with default 32 or 64 bit reals or both",
-        default="32",
-        multi=True,
-    )
-    conflicts(
-        "precision=32,64",
-        when="@:2022.03",
-        msg="FMS versions prior to 2022.04 do not support both 32 and 64 bit precision",
-    )
+    version("master", branch="master")
+    # TODO: Needs to be changed once changes to build system enter master.
+    version("development", branch="development", preferred=True)
@@ -63,25 +28,0 @@
-    variant("openmp", default=True, description="Use OpenMP")
-    variant("quad_precision", default=True, description="quad precision reals")
-    variant(
-        "yaml",
-        default=False,
-        description="yaml input file support(requires libyaml)",
-        when="@2021.04:",
-    )
-    variant(
-        "constants",
-        default="GFDL",
-        description="Build with <X> constants parameter definitions",
-        values=("GFDL", "GEOS", "GFS"),
-        multi=False,
-        when="@2022.02:",
-    )
-    variant(
-        "pic", default=False, description="Build with position independent code", when="@2022.02:"
-    )
-    variant(
-        "deprecated_io",
-        default=False,
-        description="Compiles with support for deprecated io modules fms_io and mpp_io",
-        when="@2023.02:",
-    )
@@ -98 +39,16 @@
-    depends_on("libyaml", when="+yaml")
+
+    def url_for_version(self, version):
+        return "https://github.com/ACCESS-NRI/FMS/tarball/{0}".format(version)
+
+    @property
+    def headers(self):
+        return find_headers(
+            "*", root=self.prefix, recursive=True
+        )
+
+    @property
+    def libs(self):
+        libraries = ["libfms_r4", "libfms_r8"]
+        return find_libraries(
+            libraries, root=self.prefix, shared=False, recursive=True
+        )
@@ -103,4 +58,0 @@
-            self.define_from_variant("OPENMP"),
-            self.define_from_variant("ENABLE_QUAD_PRECISION", "quad_precision"),
-            self.define_from_variant("WITH_YAML", "yaml"),
-            self.define_from_variant("CONSTANTS"),
@@ -109,4 +60,0 @@
-            self.define("32BIT", "precision=32" in self.spec),
-            self.define("64BIT", "precision=64" in self.spec),
-            self.define_from_variant("FPIC", "pic"),
-            self.define_from_variant("USE_DEPRECATED_IO", "deprecated_io"),
@@ -114,4 +61,0 @@
-
-        args.append(self.define("CMAKE_C_COMPILER", self.spec["mpi"].mpicc))
-        args.append(self.define("CMAKE_CXX_COMPILER", self.spec["mpi"].mpicxx))
-        args.append(self.define("CMAKE_Fortran_COMPILER", self.spec["mpi"].mpifc))

@penguian
Copy link
Contributor

penguian commented Nov 14, 2024

Could you please explain why the package is called access-fms instead of fms? Is this an ACCESS-NRI standard naming convention? For example, this repository contains a Spack package definition for fiat that shadows the Spack builtin fiat package. Should that be called access-fiat instead?

Also, could you briefly describe the reasoning for the other differences between the builtin fms package definition and the access-fms package definition?

@harshula
Copy link
Collaborator Author

Hi @penguian , IIRC, ACCESS-OM3 uses the upstream FMS SPR and ACCESS-OM2, with generic-tracer support, needs to use an older FMS. We needed to be able to build both and I think that's the reason for the access prefix.

Do you need to be able to build the upstream fiat package and the 'access' fiat package? If so, then access-fiat would be better. Or is the 'access' fiat package replacing the upstream fiat package? If so, the current naming is appropriate.

IIRC, some of the differences are due to our FMS being much older. The decorators are because the Spack package name doesn't match the library name. I've tried to only include functionality we need in the SPR.

BTW, The diff I pasted above is comparing our access-fms SPR to the releases/v0.22 branch's FMS SPR.

Copy link
Contributor

@penguian penguian left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved. See the Conversation for comments.

@harshula harshula merged commit 279851d into main Nov 14, 2024
1 check passed
@harshula harshula deleted the add-fms branch November 14, 2024 08:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Status: Done
Status: Done
Development

Successfully merging this pull request may close these issues.

2 participants