|
| 1 | +# Copyright 2023 Lawrence Livermore National Security, LLC and other |
| 2 | +# Benchpark Project Developers. See the top-level COPYRIGHT file for details. |
| 3 | +# |
| 4 | +# SPDX-License-Identifier: Apache-2.0 |
| 5 | + |
| 6 | +import json |
| 7 | +import subprocess |
| 8 | + |
| 9 | +from benchpark.directives import maintainers, variant |
| 10 | +from benchpark.openmpsystem import OpenMPSystem |
| 11 | +from benchpark.paths import hardware_descriptions |
| 12 | +from benchpark.system import System |
| 13 | + |
| 14 | + |
| 15 | +class AwsTutorial(System): |
| 16 | + # Taken from https://aws.amazon.com/ec2/instance-types/ |
| 17 | + # With boto3, we could determine this dynamically vs. storing a static table |
| 18 | + |
| 19 | + maintainers("stephanielam3211") |
| 20 | + |
| 21 | + id_to_resources = { |
| 22 | + "c7i.48xlarge": { |
| 23 | + "system_site": "aws", |
| 24 | + "hardware_key": str(hardware_descriptions) |
| 25 | + + "/AWS_Tutorial-zen-EFA/hardware_description.yaml", |
| 26 | + }, |
| 27 | + "c7i.metal-48xl": { |
| 28 | + "system_site": "aws", |
| 29 | + "hardware_key": str(hardware_descriptions) |
| 30 | + + "/AWS_Tutorial-zen-EFA/hardware_description.yaml", |
| 31 | + }, |
| 32 | + "c7i.24xlarge": { |
| 33 | + "system_site": "aws", |
| 34 | + "hardware_key": str(hardware_descriptions) |
| 35 | + + "/AWS_Tutorial-zen-EFA/hardware_description.yaml", |
| 36 | + }, |
| 37 | + "c7i.metal-24xl": { |
| 38 | + "system_site": "aws", |
| 39 | + "hardware_key": str(hardware_descriptions) |
| 40 | + + "/AWS_Tutorial-zen-EFA/hardware_description.yaml", |
| 41 | + }, |
| 42 | + } |
| 43 | + |
| 44 | + variant( |
| 45 | + "instance_type", |
| 46 | + values=("c7i.48xlarge", "c7i.metal-48xl", "c7i.24xlarge", "c7i.metal-24xl"), |
| 47 | + default="c7i.24xlarge", |
| 48 | + description="AWS instance type", |
| 49 | + ) |
| 50 | + |
| 51 | + def __init__(self, spec): |
| 52 | + super().__init__(spec) |
| 53 | + self.programming_models = [OpenMPSystem()] |
| 54 | + |
| 55 | + self.scheduler = "flux" |
| 56 | + # TODO: for some reason I have to index to get value, even if multi=False |
| 57 | + attrs = self.id_to_resources.get(self.spec.variants["instance_type"][0]) |
| 58 | + for k, v in attrs.items(): |
| 59 | + setattr(self, k, v) |
| 60 | + |
| 61 | + json_resource_spec = subprocess.check_output("flux resource R", shell=True) |
| 62 | + resource_dict = json.loads(json_resource_spec) |
| 63 | + self.sys_cores_per_node = resource_dict["execution"]["R_lite"][0]["children"][ |
| 64 | + "core" |
| 65 | + ] |
| 66 | + self.sys_cores_per_node = [int(c) for c in self.sys_cores_per_node.split("-")] |
| 67 | + self.sys_cores_per_node[-1] += 1 |
| 68 | + self.sys_cores_per_node = len(list(range(*self.sys_cores_per_node))) |
| 69 | + self.sys_nodes = resource_dict["execution"]["R_lite"][0]["rank"] |
| 70 | + self.sys_nodes = [int(n) for n in self.sys_nodes.split("-")] |
| 71 | + self.sys_nodes[-1] += 1 |
| 72 | + self.sys_nodes = len(list(range(*self.sys_nodes))) |
| 73 | + |
| 74 | + # def system_specific_variables(self): |
| 75 | + # return { |
| 76 | + # "extra_cmd_opts": '--mpi=pmix --export=ALL,FI_EFA_USE_DEVICE_RDMA=1,FI_PROVIDER="efa",OMPI_MCA_mtl_base_verbose=100', |
| 77 | + # } |
| 78 | + |
| 79 | + def compute_packages_section(self): |
| 80 | + return { |
| 81 | + "packages": { |
| 82 | + "tar": { |
| 83 | + "externals": [{"spec": "tar@1.34", "prefix": "/usr"}], |
| 84 | + "buildable": False, |
| 85 | + }, |
| 86 | + "gmake": {"externals": [{"spec": "gmake@4.3", "prefix": "/usr"}]}, |
| 87 | + "blas": { |
| 88 | + "externals": [{"spec": "blas@0.29.2", "prefix": "/usr"}], |
| 89 | + "buildable": False, |
| 90 | + }, |
| 91 | + "lapack": { |
| 92 | + "externals": [{"spec": "lapack@0.29.2", "prefix": "/usr"}], |
| 93 | + "buildable": False, |
| 94 | + }, |
| 95 | + "mpi": {"buildable": False}, |
| 96 | + "openmpi": { |
| 97 | + "externals": [ |
| 98 | + { |
| 99 | + "spec": "openmpi@4.0%gcc@11.4.0", |
| 100 | + "prefix": "/usr", |
| 101 | + } |
| 102 | + ] |
| 103 | + }, |
| 104 | + "cmake": { |
| 105 | + "externals": [{"spec": "cmake@4.0.2", "prefix": "/usr"}], |
| 106 | + "buildable": False, |
| 107 | + }, |
| 108 | + "git": { |
| 109 | + "externals": [{"spec": "git@2.34.1~tcltk", "prefix": "/usr"}], |
| 110 | + "buildable": False, |
| 111 | + }, |
| 112 | + "openssl": { |
| 113 | + "externals": [{"spec": "openssl@3.0.2", "prefix": "/usr"}], |
| 114 | + "buildable": False, |
| 115 | + }, |
| 116 | + "automake": { |
| 117 | + "externals": [{"spec": "automake@1.16.5", "prefix": "/usr"}], |
| 118 | + "buildable": False, |
| 119 | + }, |
| 120 | + "openssh": { |
| 121 | + "externals": [{"spec": "openssh@8.9p1", "prefix": "/usr"}], |
| 122 | + "buildable": False, |
| 123 | + }, |
| 124 | + "m4": { |
| 125 | + "externals": [{"spec": "m4@1.4.18", "prefix": "/usr"}], |
| 126 | + "buildable": False, |
| 127 | + }, |
| 128 | + "sed": { |
| 129 | + "externals": [{"spec": "sed@4.8", "prefix": "/usr"}], |
| 130 | + "buildable": False, |
| 131 | + }, |
| 132 | + "autoconf": { |
| 133 | + "externals": [{"spec": "autoconf@2.71", "prefix": "/usr"}], |
| 134 | + "buildable": False, |
| 135 | + }, |
| 136 | + "diffutils": { |
| 137 | + "externals": [{"spec": "diffutils@3.8", "prefix": "/usr"}], |
| 138 | + "buildable": False, |
| 139 | + }, |
| 140 | + "coreutils": { |
| 141 | + "externals": [{"spec": "coreutils@8.32", "prefix": "/usr"}], |
| 142 | + "buildable": False, |
| 143 | + }, |
| 144 | + "findutils": { |
| 145 | + "externals": [{"spec": "findutils@4.8.0", "prefix": "/usr"}], |
| 146 | + "buildable": False, |
| 147 | + }, |
| 148 | + "binutils": { |
| 149 | + "externals": [ |
| 150 | + {"spec": "binutils@2.38+gold~headers", "prefix": "/usr"} |
| 151 | + ], |
| 152 | + "buildable": False, |
| 153 | + }, |
| 154 | + "perl": { |
| 155 | + "externals": [ |
| 156 | + { |
| 157 | + "spec": "perl@5.34.0~cpanm+opcode+open+shared+threads", |
| 158 | + "prefix": "/usr", |
| 159 | + } |
| 160 | + ], |
| 161 | + "buildable": False, |
| 162 | + }, |
| 163 | + "caliper": { |
| 164 | + "externals": [ |
| 165 | + { |
| 166 | + "spec": "caliper@master%gcc@11.4.0+adiak+mpi", |
| 167 | + "prefix": "/usr", |
| 168 | + } |
| 169 | + ], |
| 170 | + "buildable": False, |
| 171 | + }, |
| 172 | + "adiak": { |
| 173 | + "externals": [{"spec": "adiak@0.4.1", "prefix": "/usr"}], |
| 174 | + "buildable": False, |
| 175 | + }, |
| 176 | + "groff": { |
| 177 | + "externals": [{"spec": "groff@1.22.4", "prefix": "/usr"}], |
| 178 | + "buildable": False, |
| 179 | + }, |
| 180 | + "curl": { |
| 181 | + "externals": [ |
| 182 | + {"spec": "curl@7.81.0+gssapi+ldap+nghttp2", "prefix": "/usr"} |
| 183 | + ], |
| 184 | + "buildable": False, |
| 185 | + }, |
| 186 | + "ccache": { |
| 187 | + "externals": [{"spec": "ccache@4.5.1", "prefix": "/usr"}], |
| 188 | + "buildable": False, |
| 189 | + }, |
| 190 | + "flex": { |
| 191 | + "externals": [{"spec": "flex@2.6.4+lex", "prefix": "/usr"}], |
| 192 | + "buildable": False, |
| 193 | + }, |
| 194 | + "pkg-config": { |
| 195 | + "externals": [{"spec": "pkg-config@0.29.2", "prefix": "/usr"}], |
| 196 | + "buildable": False, |
| 197 | + }, |
| 198 | + "zlib": { |
| 199 | + "externals": [{"spec": "zlib@1.2.11", "prefix": "/usr"}], |
| 200 | + "buildable": False, |
| 201 | + }, |
| 202 | + "ninja": { |
| 203 | + "externals": [{"spec": "ninja@1.10.1", "prefix": "/usr"}], |
| 204 | + "buildable": False, |
| 205 | + }, |
| 206 | + "libtool": { |
| 207 | + "externals": [{"spec": "libtool@2.4.6", "prefix": "/usr"}], |
| 208 | + "buildable": False, |
| 209 | + }, |
| 210 | + } |
| 211 | + } |
| 212 | + |
| 213 | + def compute_compilers_section(self): |
| 214 | + return { |
| 215 | + "compilers": [ |
| 216 | + { |
| 217 | + "compiler": { |
| 218 | + "spec": "gcc@11.4.0", |
| 219 | + "paths": { |
| 220 | + "cc": "/usr/bin/gcc", |
| 221 | + "cxx": "/usr/bin/g++", |
| 222 | + "f77": "/usr/bin/gfortran-11", |
| 223 | + "fc": "/usr/bin/gfortran-11", |
| 224 | + }, |
| 225 | + "flags": {}, |
| 226 | + "operating_system": "ubuntu22.04", |
| 227 | + "target": "x86_64", |
| 228 | + "modules": [], |
| 229 | + "environment": {}, |
| 230 | + "extra_rpaths": [], |
| 231 | + } |
| 232 | + } |
| 233 | + ] |
| 234 | + } |
| 235 | + |
| 236 | + def compute_software_section(self): |
| 237 | + return { |
| 238 | + "software": { |
| 239 | + "packages": { |
| 240 | + "default-compiler": {"pkg_spec": "gcc@11.4.0"}, |
| 241 | + "default-mpi": {"pkg_spec": "openmpi@4.0%gcc@11.4.0"}, |
| 242 | + "compiler-gcc": {"pkg_spec": "gcc@11.4.0"}, |
| 243 | + "lapack": {"pkg_spec": "lapack@0.29.2"}, |
| 244 | + "mpi-gcc": {"pkg_spec": "openmpi@4.0%gcc@11.4.0"}, |
| 245 | + } |
| 246 | + } |
| 247 | + } |
| 248 | + |
| 249 | + def compute_spack_config_section(self): |
| 250 | + return { |
| 251 | + "config": {}, |
| 252 | + "concretizer": {}, |
| 253 | + "modules": {}, |
| 254 | + "packages": {}, |
| 255 | + "repos": [], |
| 256 | + "compilers": [], |
| 257 | + "mirrors": {}, |
| 258 | + "providers": {"mpi": ["openmpi"]}, |
| 259 | + } |
0 commit comments