acfl: add version 23.04 (#36775)
This commit is contained in:
		 Annop Wongwathanarat
					Annop Wongwathanarat
				
			
				
					committed by
					
						 GitHub
						GitHub
					
				
			
			
				
	
			
			
			 GitHub
						GitHub
					
				
			
						parent
						
							6cfb9339ee
						
					
				
				
					commit
					575bd1c3f8
				
			| @@ -2,21 +2,74 @@ | |||||||
| # Spack Project Developers. See the top-level COPYRIGHT file for details. | # Spack Project Developers. See the top-level COPYRIGHT file for details. | ||||||
| # | # | ||||||
| # SPDX-License-Identifier: (Apache-2.0 OR MIT) | # SPDX-License-Identifier: (Apache-2.0 OR MIT) | ||||||
|  | import os | ||||||
| import re | import re | ||||||
| 
 | 
 | ||||||
| from spack.package import * | from spack.package import * | ||||||
| 
 | 
 | ||||||
| _os_map = { | _os_map_before_23 = { | ||||||
|     "ubuntu18.04": "Ubuntu-18.04", |     "ubuntu18.04": "Ubuntu-18.04", | ||||||
|     "ubuntu20.04": "Ubuntu-20.04", |     "ubuntu20.04": "Ubuntu-20.04", | ||||||
|  |     "ubuntu22.04": "Ubuntu-20.04", | ||||||
|     "sles15": "SLES-15", |     "sles15": "SLES-15", | ||||||
|     "centos7": "RHEL-7", |     "centos7": "RHEL-7", | ||||||
|     "centos8": "RHEL-8", |     "centos8": "RHEL-8", | ||||||
|  |     "rhel7": "RHEL-7", | ||||||
|  |     "rhel8": "RHEL-8", | ||||||
|  |     "rocky8": "RHEL-8", | ||||||
|     "amzn2": "RHEL-7", |     "amzn2": "RHEL-7", | ||||||
|  |     "amzn2023": "RHEL-7", | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | _os_map = { | ||||||
|  |     "ubuntu20.04": "Ubuntu-20.04", | ||||||
|  |     "ubuntu22.04": "Ubuntu-22.04", | ||||||
|  |     "sles15": "SLES-15", | ||||||
|  |     "centos7": "RHEL-7", | ||||||
|  |     "centos8": "RHEL-8", | ||||||
|  |     "rhel7": "RHEL-7", | ||||||
|  |     "rhel8": "RHEL-8", | ||||||
|  |     "rhel9": "RHEL-9", | ||||||
|  |     "rocky8": "RHEL-8", | ||||||
|  |     "amzn2": "AmazonLinux-2", | ||||||
|  |     "amzn2023": "AmazonLinux-2023", | ||||||
|  | } | ||||||
| 
 | 
 | ||||||
| _versions = { | _versions = { | ||||||
|  |     "23.04": { | ||||||
|  |         "RHEL-7": ( | ||||||
|  |             "6526218484e87c195c1145f60536552fabbd25ba98c05cf096f54de18381a422", | ||||||
|  |             "https://developer.arm.com/-/media/Files/downloads/hpc/arm-compiler-for-linux/23-04/arm-compiler-for-linux_23.04_RHEL-7_aarch64.tar", | ||||||
|  |         ), | ||||||
|  |         "RHEL-8": ( | ||||||
|  |             "e658c9d85693cc818f2be9942d8aa71465a84e00046d6f8da72c46a76cc8a747", | ||||||
|  |             "https://developer.arm.com/-/media/Files/downloads/hpc/arm-compiler-for-linux/23-04/arm-compiler-for-linux_23.04_RHEL-8_aarch64.tar", | ||||||
|  |         ), | ||||||
|  |         "RHEL-9": ( | ||||||
|  |             "b71431a16e09ae910737f920aab9c720b5ec83586dba8041b0daa45fa13521d1", | ||||||
|  |             "https://developer.arm.com/-/media/Files/downloads/hpc/arm-compiler-for-linux/23-04/arm-compiler-for-linux_23.04_RHEL-9_aarch64.tar", | ||||||
|  |         ), | ||||||
|  |         "SLES-15": ( | ||||||
|  |             "5dc880272942f5ac2cad7556bdbdf177b62a0736061c1acb1c80ca51ccaba3be", | ||||||
|  |             "https://developer.arm.com/-/media/Files/downloads/hpc/arm-compiler-for-linux/23-04/arm-compiler-for-linux_23.04_SLES-15_aarch64.tar", | ||||||
|  |         ), | ||||||
|  |         "Ubuntu-20.04": ( | ||||||
|  |             "a0b3bcec541a1e78b1a48d6fa876cc0ef2846f40219c95c60ab9852882ee05d2", | ||||||
|  |             "https://developer.arm.com/-/media/Files/downloads/hpc/arm-compiler-for-linux/23-04/arm-compiler-for-linux_23.04_Ubuntu-20.04_aarch64.tar", | ||||||
|  |         ), | ||||||
|  |         "Ubuntu-22.04": ( | ||||||
|  |             "10cf29da14830b3a9f0f51cda893e4255ffd1093297a71886865f97958d100f7", | ||||||
|  |             "https://developer.arm.com/-/media/Files/downloads/hpc/arm-compiler-for-linux/23-04/arm-compiler-for-linux_23.04_Ubuntu-22.04_aarch64.tar", | ||||||
|  |         ), | ||||||
|  |         "AmazonLinux-2": ( | ||||||
|  |             "65637a34abd076906bcbd56f2a7861ec873bc8d62e321217ade6008939a0bf6b", | ||||||
|  |             "https://developer.arm.com/-/media/Files/downloads/hpc/arm-compiler-for-linux/23-04/arm-compiler-for-linux_23.04_AmazonLinux-2_aarch64.tar", | ||||||
|  |         ), | ||||||
|  |         "AmazonLinux-2023": ( | ||||||
|  |             "415f8e908baf550e92ef21d4146904fac0a339132cb7921b4046e47ac71cf4c9", | ||||||
|  |             "https://developer.arm.com/-/media/Files/downloads/hpc/arm-compiler-for-linux/23-04/arm-compiler-for-linux_23.04_AmazonLinux-2023_aarch64.tar", | ||||||
|  |         ), | ||||||
|  |     }, | ||||||
|     "22.1": { |     "22.1": { | ||||||
|         "RHEL-7": ( |         "RHEL-7": ( | ||||||
|             "bfbfef9099bf0e90480d48b3a1a741d583fc939284f869958e9c09e177098c73", |             "bfbfef9099bf0e90480d48b3a1a741d583fc939284f869958e9c09e177098c73", | ||||||
| @@ -86,8 +139,11 @@ | |||||||
| } | } | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| def get_os(): | def get_os(ver): | ||||||
|     spack_os = spack.platforms.host().default_os |     spack_os = spack.platforms.host().default_os | ||||||
|  |     if ver.startswith("22."): | ||||||
|  |         return _os_map_before_23.get(spack_os, "") | ||||||
|  |     else: | ||||||
|         return _os_map.get(spack_os, "RHEL-7") |         return _os_map.get(spack_os, "RHEL-7") | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| @@ -102,20 +158,40 @@ def get_armpl_version_to_3(spec): | |||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| def get_armpl_prefix(spec): | def get_armpl_prefix(spec): | ||||||
|  |     if spec.version.string.startswith("22."): | ||||||
|         return join_path( |         return join_path( | ||||||
|             spec.prefix, |             spec.prefix, | ||||||
|             "armpl-{}_AArch64_{}_arm-linux-compiler_aarch64-linux".format( |             "armpl-{}_AArch64_{}_arm-linux-compiler_aarch64-linux".format( | ||||||
|             get_armpl_version_to_3(spec), get_os() |                 get_armpl_version_to_3(spec), get_os(spec.version.string) | ||||||
|  |             ), | ||||||
|  |         ) | ||||||
|  |     else: | ||||||
|  |         return join_path( | ||||||
|  |             spec.prefix, | ||||||
|  |             "armpl-{}_{}_arm-linux-compiler".format( | ||||||
|  |                 get_armpl_version_to_3(spec), get_os(spec.version.string) | ||||||
|             ), |             ), | ||||||
|         ) |         ) | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| def get_acfl_prefix(spec): | def get_acfl_prefix(spec): | ||||||
|     acfl_prefix = spec.prefix |     if spec.version.string.startswith("22."): | ||||||
|         return join_path( |         return join_path( | ||||||
|         acfl_prefix, |             spec.prefix, | ||||||
|         "arm-linux-compiler-{0}_Generic-AArch64_{1}_aarch64-linux".format(spec.version, get_os()), |             "arm-linux-compiler-{0}_Generic-AArch64_{1}_aarch64-linux".format( | ||||||
|  |                 spec.version, get_os(spec.version.string) | ||||||
|  |             ), | ||||||
|         ) |         ) | ||||||
|  |     else: | ||||||
|  |         return join_path( | ||||||
|  |             spec.prefix, | ||||||
|  |             "arm-linux-compiler-{0}_{1}".format(spec.version, get_os(spec.version.string)), | ||||||
|  |         ) | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | def get_gcc_prefix(spec): | ||||||
|  |     dirlist = next(os.walk(spec.prefix))[1] | ||||||
|  |     return join_path(spec.prefix, next(dir for dir in dirlist if dir.startswith("gcc"))) | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| class Acfl(Package): | class Acfl(Package): | ||||||
| @@ -128,11 +204,9 @@ class Acfl(Package): | |||||||
| 
 | 
 | ||||||
|     maintainers("annop-w") |     maintainers("annop-w") | ||||||
| 
 | 
 | ||||||
|     # Build Versions: establish OS for URL |  | ||||||
|     acfl_os = get_os() |  | ||||||
| 
 |  | ||||||
|     # Build Versions |     # Build Versions | ||||||
|     for ver, packages in _versions.items(): |     for ver, packages in _versions.items(): | ||||||
|  |         acfl_os = get_os(ver) | ||||||
|         pkg = packages.get(acfl_os) |         pkg = packages.get(acfl_os) | ||||||
|         if pkg: |         if pkg: | ||||||
|             version(ver, sha256=pkg[0], url=pkg[1]) |             version(ver, sha256=pkg[0], url=pkg[1]) | ||||||
| @@ -162,7 +236,9 @@ class Acfl(Package): | |||||||
| 
 | 
 | ||||||
|     # Run the installer with the desired install directory |     # Run the installer with the desired install directory | ||||||
|     def install(self, spec, prefix): |     def install(self, spec, prefix): | ||||||
|         exe = Executable("./arm-compiler-for-linux_{0}_{1}.sh".format(spec.version, get_os())) |         exe = Executable( | ||||||
|  |             "./arm-compiler-for-linux_{0}_{1}.sh".format(spec.version, get_os(spec.version.string)) | ||||||
|  |         ) | ||||||
|         exe("--accept", "--force", "--install-to", prefix) |         exe("--accept", "--force", "--install-to", prefix) | ||||||
| 
 | 
 | ||||||
|     @classmethod |     @classmethod | ||||||
| @@ -269,19 +345,45 @@ def headers(self): | |||||||
|     def setup_run_environment(self, env): |     def setup_run_environment(self, env): | ||||||
|         arm_dir = get_acfl_prefix(self.spec) |         arm_dir = get_acfl_prefix(self.spec) | ||||||
|         armpl_dir = get_armpl_prefix(self.spec) |         armpl_dir = get_armpl_prefix(self.spec) | ||||||
|  |         gcc_dir = get_gcc_prefix(self.spec) | ||||||
|  | 
 | ||||||
|         env.set("ARM_LINUX_COMPILER_DIR", arm_dir) |         env.set("ARM_LINUX_COMPILER_DIR", arm_dir) | ||||||
|         env.set("ARM_LINUX_COMPILER_INCLUDES", join_path(arm_dir, "includes")) |         env.set("ARM_LINUX_COMPILER_INCLUDES", join_path(arm_dir, "includes")) | ||||||
|         env.prepend_path("LD_LIBRARY_PATH", join_path(arm_dir, "lib")) |         env.append_path("ARM_LINUX_COMPILER_LIBRARIES", join_path(arm_dir, "lib")) | ||||||
|         env.prepend_path("LD_LIBRARY_PATH", join_path(armpl_dir, "lib")) |  | ||||||
|         env.prepend_path("PATH", join_path(arm_dir, "bin")) |         env.prepend_path("PATH", join_path(arm_dir, "bin")) | ||||||
|         env.prepend_path("CPATH", join_path(arm_dir, "include")) |         env.prepend_path("CPATH", join_path(arm_dir, "include")) | ||||||
|  |         env.prepend_path("LD_LIBRARY_PATH", join_path(arm_dir, "lib")) | ||||||
|  |         env.append_path("LD_LIBRARY_PATH", join_path(armpl_dir, "lib")) | ||||||
|  |         env.prepend_path("LIBRARY_PATH", join_path(arm_dir, "lib")) | ||||||
|         env.prepend_path("MANPATH", join_path(arm_dir, "share", "man")) |         env.prepend_path("MANPATH", join_path(arm_dir, "share", "man")) | ||||||
| 
 | 
 | ||||||
|  |         env.set("GCC_DIR", gcc_dir) | ||||||
|  |         env.set("GCC_INCLUDES", join_path(gcc_dir, "include")) | ||||||
|  |         env.append_path("GCC_LIBRARIES", join_path(gcc_dir, "lib")) | ||||||
|  |         env.append_path("GCC_LIBRARIES", join_path(gcc_dir, "lib64")) | ||||||
|  |         env.set("COMPILER_PATH", gcc_dir) | ||||||
|  |         env.prepend_path("PATH", join_path(gcc_dir, "binutils_bin")) | ||||||
|  |         env.prepend_path("CPATH", join_path(gcc_dir, "include")) | ||||||
|  |         env.prepend_path("LD_LIBRARY_PATH", join_path(gcc_dir, "lib")) | ||||||
|  |         env.prepend_path("LD_LIBRARY_PATH", join_path(gcc_dir, "lib64")) | ||||||
|  |         env.prepend_path("LIBRARY_PATH", join_path(gcc_dir, "lib")) | ||||||
|  |         env.prepend_path("LIBRARY_PATH", join_path(gcc_dir, "lib64")) | ||||||
|  |         env.prepend_path("MANPATH", join_path(gcc_dir, "share", "man")) | ||||||
|  | 
 | ||||||
|     @run_after("install") |     @run_after("install") | ||||||
|     def check_install(self): |     def check_install(self): | ||||||
|  |         arm_dir = get_acfl_prefix(self.spec) | ||||||
|         armpl_dir = get_armpl_prefix(self.spec) |         armpl_dir = get_armpl_prefix(self.spec) | ||||||
|  |         gcc_dir = get_gcc_prefix(self.spec) | ||||||
|         armpl_example_dir = join_path(armpl_dir, "examples") |         armpl_example_dir = join_path(armpl_dir, "examples") | ||||||
|         # run example makefile |         # run example makefile | ||||||
|         make("-C", armpl_example_dir, "CC=" + self.cc, "F90=" + self.fortran) |         make( | ||||||
|  |             "-C", | ||||||
|  |             armpl_example_dir, | ||||||
|  |             "CC=" + self.cc, | ||||||
|  |             "F90=" + self.fortran, | ||||||
|  |             "CPATH=" + join_path(arm_dir, "include"), | ||||||
|  |             "COMPILER_PATH=" + gcc_dir, | ||||||
|  |         ) | ||||||
|         # clean up |         # clean up | ||||||
|         make("-C", armpl_example_dir, "clean") |         make("-C", armpl_example_dir, "clean") | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user