diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..9ddca45 --- /dev/null +++ b/.gitignore @@ -0,0 +1,4 @@ +*.pyc + +*.swp +*.swo diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md new file mode 100644 index 0000000..83f431e --- /dev/null +++ b/CODE_OF_CONDUCT.md @@ -0,0 +1,80 @@ +# Code of Conduct + +## Our Pledge + +In the interest of fostering an open and welcoming environment, we as +contributors and maintainers pledge to make participation in our project and +our community a harassment-free experience for everyone, regardless of age, body +size, disability, ethnicity, sex characteristics, gender identity and expression, +level of experience, education, socio-economic status, nationality, personal +appearance, race, religion, or sexual identity and orientation. + +## Our Standards + +Examples of behavior that contributes to creating a positive environment +include: + +* Using welcoming and inclusive language +* Being respectful of differing viewpoints and experiences +* Gracefully accepting constructive criticism +* Focusing on what is best for the community +* Showing empathy towards other community members + +Examples of unacceptable behavior by participants include: + +* The use of sexualized language or imagery and unwelcome sexual attention or +advances +* Trolling, insulting/derogatory comments, and personal or political attacks +* Public or private harassment +* Publishing others' private information, such as a physical or electronic +address, without explicit permission +* Other conduct which could reasonably be considered inappropriate in a +professional setting + +## Our Responsibilities + +Project maintainers are responsible for clarifying the standards of acceptable +behavior and are expected to take appropriate and fair corrective action in +response to any instances of unacceptable behavior. + +Project maintainers have the right and responsibility to remove, edit, or +reject comments, commits, code, wiki edits, issues, and other contributions +that are not aligned to this Code of Conduct, or to ban temporarily or +permanently any contributor for other behaviors that they deem inappropriate, +threatening, offensive, or harmful. + +## Scope + +This Code of Conduct applies within all project spaces, and it also applies when +an individual is representing the project or its community in public spaces. +Examples of representing a project or community include using an official +project e-mail address, posting via an official social media account, or acting +as an appointed representative at an online or offline event. Representation of +a project may be further defined and clarified by project maintainers. + +This Code of Conduct also applies outside the project spaces when there is a +reasonable belief that an individual's behavior may have a negative impact on +the project or its community. + +## Enforcement + +Instances of abusive, harassing, or otherwise unacceptable behavior may be +reported by contacting the project team at . All +complaints will be reviewed and investigated and will result in a response that +is deemed necessary and appropriate to the circumstances. The project team is +obligated to maintain confidentiality with regard to the reporter of an incident. +Further details of specific enforcement policies may be posted separately. + +Project maintainers who do not follow or enforce the Code of Conduct in good +faith may face temporary or permanent repercussions as determined by other +members of the project's leadership. + +## Attribution + +This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, +available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html + +[homepage]: https://www.contributor-covenant.org + +For answers to common questions about this code of conduct, see +https://www.contributor-covenant.org/faq diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..b2bb61b --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,33 @@ +# Contributing to ACT +We want to make contributing to this project as easy and transparent as +possible. + +## Our Development Process + +## Pull Requests +We actively welcome your pull requests. + +1. Fork the repo and create your branch from `main`. +2. If you've added code that should be tested, add tests. +3. If you've changed APIs, update the documentation. +4. Ensure the test suite passes. +5. Make sure your code lints. +6. If you haven't already, complete the Contributor License Agreement ("CLA"). + +## Contributor License Agreement ("CLA") +In order to accept your pull request, we need you to submit a CLA. You only need +to do this once to work on any of Meta's open source projects. + +Complete your CLA here: + +## Issues +We use GitHub issues to track public bugs. Please ensure your description is +clear and has sufficient instructions to be able to reproduce the issue. + +Meta has a [bounty program](https://www.facebook.com/whitehat/) for the safe +disclosure of security bugs. In those cases, please go through the process +outlined on that page and do not file a public issue. + +## License +By contributing to ACT, you agree that your contributions will be licensed +under the LICENSE file in the root directory of this source tree. diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..0eb714d --- /dev/null +++ b/LICENSE @@ -0,0 +1,22 @@ + +MIT License + +Copyright (c) Meta Platforms, Inc. and affiliates. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README.md b/README.md new file mode 100644 index 0000000..79e9de9 --- /dev/null +++ b/README.md @@ -0,0 +1,101 @@ +# ACT: Architectural Carbon Modeling Tool + +ACT is an carbon modeling tool to enable carbon-aware design space exploration. ACT comprises an analytical, architectural carbon-footprint model +and use-case dependent optimization metrics to estimate the carbon footprint of hardware. The proposed model estimates emissions from hardware manufacturing (i.e., embodied carbon) based on workload characteristics, hardware specifications, semiconductor fab characteristics, and environmental factors. + +ACT addresses a crucial gap in quantifying and enabling sustainability-driven hardware design space exploration, and serves as a call-to-action for com- +puter architects to consider sustainability as a first-order citizen, alongside performance, power, and area (PPA). + +# Carbon Footprint Modeling +Central to ACT is an analytical, architectural carbon model to estimate operational and embodied carbon. We describe the model below and details can be found in our paper (see "Link to the Paper" below). + +At the highest level the analytical carbon model combines operational and embodied carbon. As embodied carbon is generated at design and manufacturing time, we amortize emissions across the duration of a software application (T) over the lifetime of a hardware platform (LT). +

+ +

+ +The operational carbon owes to the product of the carbon intensity of energy consumed and the energy expenditure of running an application on hardware device. +

+ +

+ +The embodied carbon owes to both packaging overhead and the embodied carbon of individual hardware components. For packaging overheads we multiply the number of integrated circuits (Nr) with a packaging footprint (Kr). The embodied carbon of all integrated circuits (e.g., application processors and SoC's, DRAM memory, SSD storage, HDD storage) are aggregated. +

+ +

+ +The embodied footprint of application processors and SoC's depends on the die area, carbon intensity of the energy consumed by the fab and energy consumed per unit area manufactured, the GHG footprint of gasses and chemicals per unit area manufactured, the footprint of procuruing raw materials per unit area, and fabrication yield. +

+ +

+ +

+ +

+ +Finally, the embodied carbon of the memory and storage devices depends on the carbon per storage intensity and the storage capacity of the modules. + + +

+ +

+ +

+ +

+ +

+ +

+ +# Carbon Optimization Metrics +In addition to the architectural carbon model, it is crucial to have use-case dependent carbon optimization metrics to quantitatively explore sustainable system design spaces. ACT proposes four sustainability-driven optimization metrics to aid early design space exploration. Here _C_ stands for embodied carbon, _D_ for delay, and _E_ for energy. + +| Metric | Description | Use case | +| :-------------: |:-------------:| :-----:| +| CDP | Carbon-delay-product | Balance carbon and performance (e.g., sustainable data center) | +| CEP | Carbon-energy-product | Balance carbon and energy (e.g., sustainable mobile device) | +| C^2EP | Carbon square-energy-product | Sustainable device dominated by embodied carbon | +| CE^2P | Carbon-energy squared-product | Sustainable device dominated by operational carbon | + + +# Getting Started +To get you started quickly, the code is structured to flexibly study various use-cases and easily extend the framework. + +1. The top-level is found in ```model.py```. This co-ordinates the underlying embodied architectural carbon model for logic, memory, and storage. +2. The logic model (e.g., application processors) can be found in the ```logic_model.py``` and the ```logic``` directory. +3. The memory model can be found in the ```dram_model.py``` and the ```dram``` directory. +4. The NAND Flash storage model can be found in the ```ssd_model.py``` and the ```ssd``` directory. +5. The HDD storage model can be found in the ```hdd_model.py``` and the ```hdd``` directory. +6. The carbon intensity of different energy sources and geographic locations across the world can be found in ```carbon_intensity```. + +Data for the architectural carbon model draw from sustainability literature and industry sources (additional information can be found in our paper, see details below). + +The code is built on ```Python 3.7.7``` and no special packages are required. + +## Example carbon analyses +As examples we have provided two comparisons with ACT against life cycle analyses (LCA's). The first with Fairphone 3 and the second with the Dell R740 LCA's. + +# Link to the Paper +To read the paper please visit this [link](https://github.com/fairinternal/ACT) + + +# Citation +If you use `ACT`, please cite us: + +``` + @conference{Gupta2022, + title = {ACT: Designing Sustainable Computer Systems With An Architectural Carbon Modeling Tool}, + author = {Udit Gupta, Mariam Elgamal, Gage Hills, Gu-Yeon Wei, Hsien-Hsin S. Lee, David Brooks, Carole-Jean Wu}, + url = {}, + year = {2022}, + date = {2022-06-01}, + publisher = {The 49th IEEE/ACM International Symposium on Computer Architecture (ISCA 2022)}, + keywords = {Computer Architecture, sustainable computing, mobile, energy, manufacturing}, + pubstate = {published}, + tppubtype = {conference} + } +``` + +# License +ACT is MIT licensed, as found in the LICENSE file. diff --git a/carbon_intensity/location.json b/carbon_intensity/location.json new file mode 100644 index 0000000..fd625b1 --- /dev/null +++ b/carbon_intensity/location.json @@ -0,0 +1,11 @@ +{ + "world" : 301, + "india" : 725, + "australia" : 597, + "taiwan" : 583, + "singapore" : 495, + "usa" : 380, + "europe" : 295, + "brazil" : 82, + "iceland" : 28 +} diff --git a/carbon_intensity/source.json b/carbon_intensity/source.json new file mode 100644 index 0000000..ea0f3a4 --- /dev/null +++ b/carbon_intensity/source.json @@ -0,0 +1,10 @@ +{ + "coal" : 820, + "gas" : 490, + "biomass" : 230, + "solar" : 41, + "geothermal" : 38, + "hydropower" : 24, + "nuclear" : 12, + "wind" : 11 +} diff --git a/dram/dram_hynix.json b/dram/dram_hynix.json new file mode 100644 index 0000000..29546f5 --- /dev/null +++ b/dram/dram_hynix.json @@ -0,0 +1,10 @@ +{ +"ddr3_50nm" : 600, +"ddr3_40nm" : 315, +"ddr3_30nm" : 230, +"lpddr3_30nm" : 201, +"lpddr3_20nm" : 184, +"lpddr2_20nm" : 159, +"lpddr4" : 48, +"ddr4_10nm" : 65 +} diff --git a/dram_model.py b/dram_model.py new file mode 100644 index 0000000..d79b8f7 --- /dev/null +++ b/dram_model.py @@ -0,0 +1,37 @@ + +# Copyright (c) Meta Platforms, Inc. and affiliates. + +# This source code is licensed under the MIT license found in the +# LICENSE file in the root directory of this source tree. + +import json +import sys + +class Fab_DRAM(): + def __init__(self, config = "ddr4_10nm", fab_yield=0.875): + + ############################### + # Carbon per capacity + ############################### + with open("dram/dram_hynix.json", 'r') as f: + dram_config = json.load(f) + + assert config in dram_config.keys() and "DRAM configuration not found" + + self.fab_yield = fab_yield + + self.carbon_per_gb = dram_config[config] / self.fab_yield + self.carbon = 0 + + def get_cpg(self, ): + return self.carbon_per_gb + + def set_capacity(self, capacity): + self.capacity = capacity + self.carbon = self.carbon_per_gb * self.capacity + + return + + def get_carbon(self, ): + return self.carbon + diff --git a/exps/dellr740/dellr740.py b/exps/dellr740/dellr740.py new file mode 100644 index 0000000..45a7610 --- /dev/null +++ b/exps/dellr740/dellr740.py @@ -0,0 +1,112 @@ + +# Copyright (c) Meta Platforms, Inc. and affiliates. + +# This source code is licensed under the MIT license found in the +# LICENSE file in the root directory of this source tree. + +import json +import sys + +from dram_model import Fab_DRAM +from hdd_model import Fab_HDD +from ssd_model import Fab_SSD +from logic_model import Fab_Logic + +debug = False + +############################## +# Original Dell 740 LCA +############################## +#https://corporate.delltechnologies.com/content/dam/digitalassets/active/en/unauth/data-sheets/products/servers/lca_poweredge_r740.pdf + +############################## +# Main Dell R740 integrated circuits +############################## +dellr740_large_ssd = 3840 # GB (3.84 TB x 8 SSD's) +dellr740_ssd = 400 # GB (400GB x 1 SSD) +dellr740_ssd_dram = 68 # GB (64 + 4GB ECC) +dellr740_dram = 36 # GB (32 + 4 ECC GB x 12) +ic_yield = 0.875 + +cpu_area = 6.98 #cm^2 + +############################## +# Estimated process technology node to mimic fairphone LCA process node +############################## +CPU_Logic = Fab_Logic(gpa = "95", + carbon_intensity = "src_coal", + process_node = 28, + fab_yield=ic_yield) + +SSD_main = Fab_SSD(config = "nand_30nm", fab_yield = ic_yield) +SSD_secondary = Fab_SSD(config = "nand_30nm", fab_yield = ic_yield) +DRAM_SSD_main = Fab_DRAM(config = "ddr3_50nm", fab_yield = ic_yield) +DRAM_SSD_secondary = Fab_DRAM(config = "ddr3_50nm", fab_yield = ic_yield) +DRAM = Fab_DRAM(config = "ddr3_50nm", fab_yield = ic_yield) + +############################## +# Computing carbon footprint of IC's +############################## +CPU_Logic.set_area(cpu_area) +DRAM.set_capacity(dellr740_dram) + +DRAM_SSD_main.set_capacity(dellr740_ssd_dram) +SSD_main.set_capacity(dellr740_large_ssd) + +DRAM_SSD_secondary.set_capacity(dellr740_ssd_dram) +SSD_secondary.set_capacity(dellr740_ssd) + +################################## +# Computing the packaging footprint +################################## +# number of packages +ssd_main_nr = 12 + 1 +ssd_secondary_nr = 12 + 1 +dram_nr = 18 + 1 +cpu_nr = 2 +packaging_intensity = 150 # gram CO2 + +SSD_main_packaging = packaging_intensity * ssd_main_nr +SSD_secondary_packaging = packaging_intensity * ssd_secondary_nr +DRAM_packging = packaging_intensity * dram_nr +CPU_packaging = packaging_intensity * cpu_nr + +total_packaging = SSD_main_packaging + \ + SSD_secondary_packaging + \ + DRAM_packging + \ + CPU_packaging +total_packaging = total_packaging / 1000. + +################################## +# Compute end-to-end carbon footprints +################################## +SSD_main_count = 8 # There are 8x3.84TB SSD's +SSD_main_co2 = (SSD_main.get_carbon() + \ + DRAM_SSD_main.get_carbon() + \ + SSD_main_packaging) / 1000. +SSD_main_co2 = SSD_main_co2 * SSD_main_count + +SSD_secondary_count = 1 # There are 1x400GB SSD's +SSD_secondary_co2 = (SSD_secondary.get_carbon() + \ + DRAM_SSD_secondary.get_carbon() + \ + SSD_secondary_packaging) / 1000. +SSD_secondary_co2 = SSD_secondary_co2 * SSD_secondary_count + +DRAM_count = 12 # There are 12 x (32GB+4GB ECC DRAM modules) +DRAM_co2 = (DRAM.get_carbon() + DRAM_packging) / 1000. * DRAM_count + +CPU_count = 2 +CPU_co2 = (CPU_Logic.get_carbon() + CPU_packaging) * CPU_count / 1000. + +if debug: + print("ACT SSD main", SSD_main_co2, "kg CO2") + print("ACT SSD secondary", SSD_secondary_co2, "kg CO2") + print("ACT DRAM", DRAM_co2, "kg CO2") + print("ACT CPU", CPU_co2, "kg CO2") + print("ACT Packaging", total_packaging, "kg CO2") + +print("--------------------------------") +print("ACT SSD main", SSD_main_co2, "kg CO2 vs. LCA 3373 kg CO2") +print("ACT SSD secondary", SSD_secondary_co2, "kg CO2 vs. LCA 64.1 kg CO2") +print("ACT DRAM", DRAM_co2, "kg CO2 vs. LCA 533 kg CO2") +print("ACT CPU", CPU_co2, "kg CO2 vs. LCA 47 kg CO2") diff --git a/exps/fairphone3/fairphone3.py b/exps/fairphone3/fairphone3.py new file mode 100644 index 0000000..502d281 --- /dev/null +++ b/exps/fairphone3/fairphone3.py @@ -0,0 +1,127 @@ + +# Copyright (c) Meta Platforms, Inc. and affiliates. + +# This source code is licensed under the MIT license found in the +# LICENSE file in the root directory of this source tree. + +import json +import sys + +from dram_model import Fab_DRAM +from hdd_model import Fab_HDD +from ssd_model import Fab_SSD +from logic_model import Fab_Logic + +debug = False + +# Main Fairphone integrated circuits +fairphone3_ICs = ["IC analog switch", + "LED Flash", + "LED Flash", + "CMOS image sensor", + "Light sensor", + "Light sensor", + "LED Full Color", + "Image sensor", + "I.C WLAN", + "I.C WLAN", + "Audio power amplifier", + "IC analog switch", + "IC power amplifier", + "IC PMU", + "IC PMU", + "IC PMU", + "Sensor", + "NFC Microcontroller", + "IC transceiver", + "IC audio power", + ] + +# Main Fairphone integrated circuits' areas in mm^2 +fairphone3_IC_areas = [0.85, + 1.2, + 1.2, + 35, + 0.89, + 0.08, + 0.25, + 18, + 11.6, + 1.44, + 12.96, + 1.61, + 6.3, + 26.88, + 0.77, + 11.36, + 7, + 8.69, + 11, + 9.6] + +fairphone_cpu_area = 46.4 #mm^2 +fairphone_ram = 4 # GB +fairphone_storage = 64 # GB +ic_yield = 0.875 + +################################## +# Estimated process technology node to mimic fairphone LCA process node +# This initializes ACT with an older technology node. +################################## + +# IC Logic node +IC_Logic = Fab_Logic(gpa = "95", + carbon_intensity = "src_coal", + process_node = 28, + fab_yield=ic_yield) + +# CPU Application processor node +CPU_Logic = Fab_Logic(gpa = "95", + carbon_intensity = "src_coal", + process_node = 28, + fab_yield=ic_yield) + +# DRAM Logic node +DRAM = Fab_DRAM(config = "ddr3_50nm", fab_yield=ic_yield) + +# SSD Logic node +SSD = Fab_SSD(config = "nand_30nm", fab_yield=ic_yield) + + +################################## +# Computing the IC footprint +################################## +IC_Logic.set_area(sum(fairphone3_IC_areas)/100.) +CPU_Logic.set_area(fairphone_cpu_area/100.) +DRAM.set_capacity(fairphone_ram) +SSD.set_capacity(fairphone_storage) + +################################## +# Computing the packaging footprint +################################## +#Number of packages +nr = len(fairphone3_ICs) + 1 + 1 + 1 # Fairphone ICs + CPU + DRAM + SSD +packaging_intensity = 150 # gram CO2 + +PackagingFootprint = nr * packaging_intensity + +if debug: + print("ACT IC", IC_Logic.get_carbon(), "g CO2") + print("ACT CPU", CPU_Logic.get_carbon(), "g CO2") + print("ACT DRAM", DRAM.get_carbon(), "g CO2") + print("ACT SSD", SSD.get_carbon(), "g CO2") + print("ACT Packaging", PackagingFootprint, "g CO2") + +print("--------------------------------") +ram_flash = (DRAM.get_carbon() + SSD.get_carbon() + packaging_intensity * 2) / 1000. +fairphone_ram_flash = 11 +print("ACT RAM + Flash", ram_flash, "kg CO2 vs. LCA", fairphone_ram_flash, "kg CO2") + +cpu = (CPU_Logic.get_carbon() + packaging_intensity) / 1000. +fairphone_cpu = 1.07 +print("ACT CPU", cpu, "kg CO2 vs. LCA", fairphone_cpu, "kg CO2") + +ics = (IC_Logic.get_carbon() + packaging_intensity * len(fairphone3_ICs)) / 1000. +fairphone_ics = 5.3 +print("ACT ICs", ics, "kg CO2 vs. LCA", fairphone_ics, "kg CO2") + diff --git a/hdd/hdd_consumer.json b/hdd/hdd_consumer.json new file mode 100644 index 0000000..1645560 --- /dev/null +++ b/hdd/hdd_consumer.json @@ -0,0 +1,14 @@ +{ + "BarraCuda": 4.57, + "BarraCuda2": 10.32, + "BarraCuda Pro": 2.35, + "FireCuda": 5.1, + "FireCuda2": 9.1, + "IronWolf":4.78, + "IronWolfPro":3.63, + "SkyWalk3TB":3.04, + "Skyhawk Surveillance": 4.09, + "Skyhawk-6TB": 3.74, + "VideoHDD": 7.62, + "VideoPipelineHDD": 8.86 +} diff --git a/hdd/hdd_enterprise.json b/hdd/hdd_enterprise.json new file mode 100644 index 0000000..27091ee --- /dev/null +++ b/hdd/hdd_enterprise.json @@ -0,0 +1,9 @@ +{ + "Exos2x14":1.653, + "Exosx12":1.14, + "Exosx16":1.334, + "Exos15e900":20.46, + "Exos10e2400":10.323, + "Exos5e8":3.8556, + "Exos7e8":4.747 +} diff --git a/hdd_model.py b/hdd_model.py new file mode 100644 index 0000000..07d4122 --- /dev/null +++ b/hdd_model.py @@ -0,0 +1,38 @@ + +# Copyright (c) Meta Platforms, Inc. and affiliates. + +# This source code is licensed under the MIT license found in the +# LICENSE file in the root directory of this source tree. + +import json +import sys + +class Fab_HDD(): + def __init__(self, config="BarraCuda"): + ############################### + # Carbon per capacity + ############################### + with open("hdd/hdd_consumer.json", 'r') as f: + hdd_config = json.load(f) + + with open("hdd/hdd_enterprise.json", 'r') as f: + hdd_config.update(json.load(f)) + + assert config in hdd_config.keys() and "HDD configuration not found" + + self.carbon_per_gb = hdd_config[config] + self.carbon = 0 + return + + def get_cpg(self, ): + return self.carbon_per_gb + + def set_capacity(self, capacity): + self.capacity = capacity + self.carbon = carbon_per_gb + + return + + def get_carbon(self, ): + return self.carbon + diff --git a/logic/README.md b/logic/README.md new file mode 100644 index 0000000..3b25c5a --- /dev/null +++ b/logic/README.md @@ -0,0 +1,6 @@ +# Logic carbon footprint modeling + +`epa.json` provides electricity per unit area consumed by manufacturing +`gpa_99.json` provides carbon footprint of gases per unit area produced by manufacturing with 99% abatement +`gpa_95.json` provides carbon footprint of gases per unit area produced by manufacturing with 95% abatement +`materials.json` provides carbon footprint of procuring raw materials unit area consumed by manufacturing diff --git a/logic/epa.json b/logic/epa.json new file mode 100644 index 0000000..da2c478 --- /dev/null +++ b/logic/epa.json @@ -0,0 +1,10 @@ +{ + "28nm" : 0.90, + "20nm" : 1.200, + "14nm" : 1.200, + "10nm" : 1.475, + "8nm" : 1.520, + "7nm" : 2.150, + "5nm" : 2.750, + "3nm" : 3.250 +} diff --git a/logic/gpa_95.json b/logic/gpa_95.json new file mode 100644 index 0000000..afc94c1 --- /dev/null +++ b/logic/gpa_95.json @@ -0,0 +1,11 @@ +{ + "28nm" : 175, + "20nm" : 190, + "14nm" : 200, + "10nm" : 240, + "8nm" : 240, + "7nm" : 350, + "5nm" : 430, + "3nm" : 470 +} + diff --git a/logic/gpa_99.json b/logic/gpa_99.json new file mode 100644 index 0000000..5ff135e --- /dev/null +++ b/logic/gpa_99.json @@ -0,0 +1,10 @@ +{ + "28nm" : 100, + "20nm" : 110, + "14nm" : 125, + "10nm" : 150, + "8nm" : 150, + "7nm" : 200, + "5nm" : 225, + "3nm" : 275 +} diff --git a/logic/materials.json b/logic/materials.json new file mode 100644 index 0000000..49e3c81 --- /dev/null +++ b/logic/materials.json @@ -0,0 +1,10 @@ +{ + "28nm" : 500 , + "20nm" : 500 , + "14nm" : 500 , + "10nm" : 500 , + "8nm" : 500 , + "7nm" : 500 , + "5nm" : 500 , + "3nm" : 500 +} diff --git a/logic_model.py b/logic_model.py new file mode 100644 index 0000000..da25290 --- /dev/null +++ b/logic_model.py @@ -0,0 +1,120 @@ + +# Copyright (c) Meta Platforms, Inc. and affiliates. + +# This source code is licensed under the MIT license found in the +# LICENSE file in the root directory of this source tree. + +import json +import sys + +class Fab_Logic(): + def __init__(self, process_node=14, + gpa="97", + carbon_intensity="loc_taiwan", + debug=False, + fab_yield=0.875): + + self.debug = debug + + ############################### + # Energy per unit area + ############################### + with open("logic/epa.json", 'r') as f: + epa_config = json.load(f) + + ############################### + # Raw materials per unit area + ############################### + with open("logic/materials.json", 'r') as f: + materials_config = json.load(f) + + ############################### + # Gasses per unit area + ############################### + if gpa == "95": + with open("logic/gpa_95.json", 'r') as f: + gpa_config = json.load(f) + + elif gpa == "99": + with open("logic/gpa_99.json", 'r') as f: + gpa_config = json.load(f) + + elif gpa == "97": + with open("logic/gpa_95.json", 'r') as f: + gpa_95_config = json.load(f) + with open("logic/gpa_99.json", 'r') as f: + gpa_99_config = json.load(f) + + gpa_config = {} + for c in gpa_95_config.keys(): + gas = (gpa_95_config[c] + gpa_99_config[c]) / 2. + gpa_config[c] = gas + + else: + print("Error: Unsupported GPA value for FAB logic") + sys.exit() + + ############################### + # Carbon intensity of fab + ############################### + if "loc" in carbon_intensity: + with open("carbon_intensity/location.json", 'r') as f: + loc_configs = json.load(f) + + loc = carbon_intensity.replace("loc_", "") + + assert loc in loc_configs.keys() + + fab_ci = loc_configs[loc] + + elif "src" in carbon_intensity: + with open("carbon_intensity/source.json", 'r') as f: + src_configs = json.load(f) + + src = carbon_intensity.replace("src_", "") + + assert src in src_configs.keys() + + fab_ci = src_configs[src] + + else: + print("Error: Carbon intensity must either be loc | src dependent") + sys.exit() + + ############################### + # Aggregating model + ############################### + process_node = str(process_node) + "nm" + assert process_node in epa_config.keys() + assert process_node in gpa_config.keys() + assert process_node in materials_config.keys() + + carbon_energy = fab_ci * epa_config[process_node] + carbon_gas = gpa_config[process_node] + carbon_materials = materials_config[process_node] + + self.carbon_per_area = (carbon_energy + carbon_gas + carbon_materials) + self.carbon_per_area = self.carbon_per_area / fab_yield + + if self.debug: + print("[Fab logic] Carbon/area from energy consumed" , carbon_energy) + print("[Fab logic] Carbon/area from gasses" , carbon_gas) + print("[Fab logic] Carbon/area from materials" , carbon_materials) + print("[Fab logic] Carbon/area aggregate" , self.carbon_per_area) + + self.carbon = 0 + + return + + + def get_cpa(self,): + return self.carbon_per_area + + def set_area(self, area): + self.area = area + self.carbon = self.area * self.carbon_per_area + + def get_carbon(self, ): + return self.carbon + + diff --git a/model.py b/model.py new file mode 100644 index 0000000..d5335f6 --- /dev/null +++ b/model.py @@ -0,0 +1,26 @@ + +# Copyright (c) Meta Platforms, Inc. and affiliates. + +# This source code is licensed under the MIT license found in the +# LICENSE file in the root directory of this source tree. + +import json +import sys + +from dram_model import Fab_DRAM +from ssd_model import Fab_SSD +from logic_model import Fab_Logic + +def main(): + Fab_DRAM(config="ddr4_10nm") + Fab_SSD(config="nand_10nm") + + Fab_Logic(gpa="95", carbon_intensity = "src_coal", debug=True, + process_node=10) + +# Fab_Logic(gpa="97", carbon_intensity = "loc_taiwan", debug=True, +# process_node=14) + + +if __name__=="__main__": + main() diff --git a/setup.sh b/setup.sh new file mode 100644 index 0000000..c080cdb --- /dev/null +++ b/setup.sh @@ -0,0 +1,8 @@ +#/bin/bash + +# Copyright (c) Meta Platforms, Inc. and affiliates. + +# This source code is licensed under the MIT license found in the +# LICENSE file in the root directory of this source tree. + +export PYTHONPATH=$(pwd)/:$PYTHONPATH diff --git a/ssd/ssd_hynix.json b/ssd/ssd_hynix.json new file mode 100644 index 0000000..0946a31 --- /dev/null +++ b/ssd/ssd_hynix.json @@ -0,0 +1,7 @@ +{ + "nand_30nm":31, + "nand_20nm":15, + "nand_10nm":10, + "nand_tlc_1z":5.6, + "nand_tlc_v3":6.3 +} diff --git a/ssd/ssd_seagate.json b/ssd/ssd_seagate.json new file mode 100644 index 0000000..40bb08b --- /dev/null +++ b/ssd/ssd_seagate.json @@ -0,0 +1,6 @@ +{ + "seagate_nytro_3530": 6.21, + "seagate_nytro_1551": 3.948, + "seagate_nytro_3331": 16.916 +} + diff --git a/ssd/ssd_western.json b/ssd/ssd_western.json new file mode 100644 index 0000000..296ce99 --- /dev/null +++ b/ssd/ssd_western.json @@ -0,0 +1,6 @@ +{ + "western_digital_2016": 24.4, + "western_digital_2017": 17.9, + "western_digital_2018": 12.5, + "western_digital_2019": 10.7 +} diff --git a/ssd_model.py b/ssd_model.py new file mode 100644 index 0000000..1e83c84 --- /dev/null +++ b/ssd_model.py @@ -0,0 +1,44 @@ + +# Copyright (c) Meta Platforms, Inc. and affiliates. + +# This source code is licensed under the MIT license found in the +# LICENSE file in the root directory of this source tree. + +import json +import sys + +class Fab_SSD(): + def __init__(self, config="nand_10nm", fab_yield=0.875): + ############################### + # Carbon per capacity + ############################### + with open("ssd/ssd_hynix.json", 'r') as f: + ssd_config = json.load(f) + + with open("ssd/ssd_seagate.json", 'r') as f: + ssd_config.update(json.load(f)) + + with open("ssd/ssd_western.json", 'r') as f: + ssd_config.update(json.load(f)) + + assert config in ssd_config.keys() and "SSD configuration not found" + + self.fab_yield = fab_yield + + self.carbon_per_gb = ssd_config[config] / self.fab_yield + self.carbon = 0 + return + + def get_cpg(self, ): + return self.carbon_per_gb + + def set_capacity(self, capacity): + self.capacity = capacity + self.carbon = self.carbon_per_gb * self.capacity + + return + + def get_carbon(self, ): + return self.carbon + +