File size: 3,949 Bytes
0c19b9d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "import pandas as pd\n",
    "import os\n",
    "import gzip\n",
    "import pickle\n",
    "import openai\n",
    "import torch.nn.functional as F\n",
    "import torch\n",
    "import re\n",
    "import copy\n",
    "from tqdm import tqdm\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from hardware_mapping import map_hardware_to_table\n",
    "hardware_instances = pd.read_csv('hardware_instances.csv') # columns: date,hardware\n",
    "hardware_instances = hardware_instances.assign(hardware_mapped = hardware_instances[\"hardware\"].apply(map_hardware_to_table))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "for index, row in hardware_instances.iterrows():\n",
    "    if row[\"hardware_mapped\"] == \"bfl single 'sc'\" and row[\"date\"] < \"2013-04-01\":\n",
    "        hardware_instances.at[index, \"hardware_mapped\"] = \"bitforce sha256 single\""
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "hardware_instances.head(10)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "len(hardware_instances)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "efficiency = pd.read_csv('../../hardwarelist/hardware_merged.csv') # columns: hardware_name,Mhash/J\n",
    "efficiency = efficiency.rename(columns={\"hardware_name\":\"hardware_mapped\"})\n",
    "\n",
    "efficiency.head(2)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "joined = hardware_instances.merge(efficiency, on=\"hardware_mapped\", how=\"left\")\n",
    "joined = joined.dropna(subset=[\"Mhash/J\"])\n",
    "joined.head(4)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "print(len(joined))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "table = joined[[\"date\",\"hardware_mapped\",\"Mhash/J\"]]\n",
    "table = table.rename(columns={\"hardware_mapped\":\"hardware_name\"})\n",
    "table[\"Mhash/J\"] = table[\"Mhash/J\"].astype(float).map(lambda x: x/1000000).map(lambda x: f\"{x:.10f}\")\n",
    "table = table.rename(columns={\"Mhash/J\":\"TH/J\"})\n",
    "table = table.sort_values([\"date\",\"hardware_name\"])\n",
    "table = table.reset_index(drop=True)\n",
    "table.head(8)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "import numpy as np\n",
    "# all of these are manually verified to be random noobs trying to use a gpu during the asic era\n",
    "for index, row in table.iterrows():\n",
    "    eff = float(row[\"TH/J\"])\n",
    "    if row[\"date\"] > \"2015-07-01\" and np.log10(eff*1000000) < 1.5:\n",
    "        print(\"a\")\n",
    "        # delete the row\n",
    "        table = table.drop(index)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "table.to_csv(\"hardware_instances_with_efficiency.csv\", index=False)"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "py310",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.10.13"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}