技术大神破解苹果M1 MacBook Air 挖矿,性能却被吊打了

{"type":"doc","content":[{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"blockquote","content":[{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"苹果 M1 MacBook Air 可以用来挖矿了,挖矿效率如何?"}]}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"heading","attrs":{"align":null,"level":2},"content":[{"type":"text","text":"如何用M1 MacBook Air挖矿"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"显卡供不应求,NVIDIA限制挖矿功能,矿工们只好另寻挖矿装备。"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"近日,软件开发者Yifan Gu(顾一凡)找到了在 M1 MacBook Air 中实现以太坊挖矿的方法,并在GitHub上开源了:"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"https:\/\/github.com\/gyf304\/ethminer-m1"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"image","attrs":{"src":"https:\/\/static001.geekbang.org\/resource\/image\/7e\/05\/7ec7d8bdcac29b23d4dd02d7cb0ca605.png","alt":null,"title":null,"style":[{"key":"width","value":"75%"},{"key":"bordertype","value":"none"}],"href":null,"fromPaste":true,"pastePass":true}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":"center","origin":null},"content":[{"type":"text","marks":[{"type":"size","attrs":{"size":10}}],"text":"在M1上挖矿"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"在M1 Mac上的挖矿性能怎么样呢?"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"首先是运行现成的ethminer,出现了以下错误:"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"image","attrs":{"src":"https:\/\/static001.geekbang.org\/resource\/image\/e2\/4e\/e2fbf65fab9f8371dd23d55367dff44e.png","alt":null,"title":null,"style":[{"key":"width","value":"75%"},{"key":"bordertype","value":"none"}],"href":null,"fromPaste":true,"pastePass":true}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"显然,Apple GPU 没有在ethminer中列入白名单。不过这应该很容易解决。相关行在中libethash-cl\/CLMiner.cpp,我将Apple GPU添加到了白名单中,“假装”它是英特尔GPU。"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"然后,boost将无法编译,因为它正试图使用-fcoalesce-templates参数进行编译,而该参数在最新的clang版本中并不存在。所以我必须将boost更新到最新版本,并修复相关的asio代码,因为ethminer使用的是弃用的asio api。"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"我还需要将OpenSSL升级到最新版本,以使其支持darwin + arm64。"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"一切都编译好之后。结果如下:"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"image","attrs":{"src":"https:\/\/static001.geekbang.org\/resource\/image\/fd\/cd\/fd169a53ff58933559b1db8da0c830cd.png","alt":null,"title":null,"style":[{"key":"width","value":"75%"},{"key":"bordertype","value":"none"}],"href":null,"fromPaste":true,"pastePass":true}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"image","attrs":{"src":"https:\/\/static001.geekbang.org\/resource\/image\/be\/4b\/bea7577fef1ab806f4f3906f4d196a4b.png","alt":null,"title":null,"style":[{"key":"width","value":"75%"},{"key":"bordertype","value":"none"}],"href":null,"fromPaste":true,"pastePass":true}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"按照顾一凡的实验,M1 MBA挖矿效率一般,仅为2MH\/s,功耗大约17~20瓦。"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"比起NVIDIA的CMP专用矿芯,日收益0.14美元左右,还不到1块钱人民币。"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"image","attrs":{"src":"https:\/\/static001.geekbang.org\/resource\/image\/16\/9c\/165yyfa1107fdb27a486db5byyf40e9c.png","alt":null,"title":null,"style":[{"key":"width","value":"75%"},{"key":"bordertype","value":"none"}],"href":null,"fromPaste":true,"pastePass":true}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"与独立显卡所提供的性能相比,这些数字显得有些相形见绌。特别是,可能他们已经针对挖矿场景进行了优化,即使是英伟达最弱的加密货币挖掘处理器也拥有26 MH\/s的哈希率。"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"image","attrs":{"src":"https:\/\/static001.geekbang.org\/resource\/image\/a3\/8c\/a3cc4c66f64b19a2fc6b3b7fcbd6e98c.png","alt":null,"title":null,"style":[{"key":"width","value":"75%"},{"key":"bordertype","value":"none"}],"href":null,"fromPaste":true,"pastePass":true}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"如上图所看到的,M1也不能与以太坊的游戏GPU散列率相提并论。当然,这一差异归结于英伟达的显卡有更高的功耗预算,如果将八核设计扩展到更大的设备,具有更强的计算能力,很难判断苹果的GPU架构会如何。有报道称,苹果正在研发128核的GPU来取代AMD的显卡,因此,我们可能不用等太久就能找到答案。"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"顾一凡不是第一个应用 M1 CPU尝试挖矿的人。去年12月,XMRig 开发人员们就用 M1 Mac 挖门罗币。"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"XMRig 利用带有新M1 ARM处理器的新Mac mini,以3.725 kh \/ s的峰值开采了一整夜,在免缴电费的情况下,获得的利润很微薄。与专业矿机相比,该方案似乎也只适合小白。"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"heading","attrs":{"align":null,"level":2},"content":[{"type":"text","text":"英特尔等芯片巨头纷纷入局挖矿芯片"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"过去几年间,随着比特币价格猛涨,市场对挖矿芯片的需求上升,众多芯片巨头纷纷入局挖矿芯片,到虚拟货币领域掘金。"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"2018年年末,Intel 开发出全新的挖矿芯片,并声称将比标准的专用集成电路(ASIC)挖矿技术更进一步。此举引发了业界热议,成为芯片巨头入局挖矿芯片领域的标志性事件,同时也促进了虚拟货币市场的进一步火热。"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"Intel 入局引发业界热议,其实英伟达、台积电、华硕、AMD等芯片巨头都早已是领域内玩家。"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"2017年12月,华硕推出了首款专业矿板——B250 Mining Expert“矿长”,挖矿主板支持19卡同开,主打超耐久性和稳定性。华硕还为其开发了采矿BIOS模式,有大量CSM丰富配置可自定义。"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"2018年7月,AMD在接受采访时声称,专门用于挖矿的APU处理器即将发售,而且在不远的将来。而后AMD的5600XT和5700XT成为市场上最后欢迎的挖矿显卡之一。"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"今年2月18日,英伟达宣布,将发布一系列专门用于开采加密货币的芯片处理器。英伟达的新型芯片系列命名为CMP(Cryptocurrency Mining Processor),专用于以太币的开采。英伟达表示,第一批CMP显卡将于今年三月份发售,但具体定价尚未公布。"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"2月24日,英伟达公布了最新一个财政年度(截至今年1月底)的财报,数据显示,英特尔在该财年收入167亿美元,同比上升53%,其中游戏GPU销售在四季度增长超出市场预期。英特尔CFO Colette Kress估计,第四季度中有1亿-3亿美元的销售额来自于“矿工”。"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"heading","attrs":{"align":null,"level":2},"content":[{"type":"text","text":"搭载M1的Mac 办公体验如何"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"M1芯片的发布备受关注,除了挖矿之外,搭载M1的Mac 办公体验如何呢?"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"image","attrs":{"src":"https:\/\/static001.geekbang.org\/resource\/image\/77\/65\/7708a21a0d96917ae700ed8fd4f7c265.png","alt":null,"title":null,"style":[{"key":"width","value":"75%"},{"key":"bordertype","value":"none"}],"href":null,"fromPaste":true,"pastePass":true}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"苹果公司正式发布 M1 处理器是在2020 年 11 月。截至当年底,苹果总计推出三款搭载 M1 芯片的产品,即 MacBook Air、13 英寸 MacBook Pro 和 Mac Mini。这些设备在基准性能与电池续航等方面均广受好评。"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"公众号“MacTalk”号主,资深开发者池老师测评后给了一个客观的测评结果(测试机型为MacBook Pro 13.3寸 M1 芯片):"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"1、超强的续航功能,20 个小时真不是吹的。我周二出差,断断续续用了三天没充电,现在还有 45%。这一点终于让我拿着 Mac 出差的时候不用担心电量了,非常的踏实。"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"2、这个冬天,M1 非常冷,我正常使用这款电脑的时候,M1 永远冰冷和安静,像一个高傲的姑娘,无论你做点啥,都冷冷的看着你,冷酷,默然不语。"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"3、之前 Mac Book 接外部显示器的时候,屏幕总会抖动,我的 16 寸在长时间熄屏后,外部显示器就点不亮了。M1 完全没有这些问题。接上,亮了,之前的 App 会自动平移到外接显示器里,断开,外接显示器里的 App 会顺滑的平移到 M1 的显示器里,没有任何闪烁。为什么接显示器要闪一下,也许是闪了太久的原因。"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"4、图像和视频处理确实很快,简直是惊人的快。具备强悍的机器学习能力,这些对专业用户非常友好。"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"5、屏幕永不止息,开盖即亮,一如 iPhone 和 iPad。这个感受非常的,每次你打开电脑的时候,无一刻等待,直接指纹识别进入电脑处理工作,屏幕就像从来没有灭过。"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"6、日常的 App 兼容度非常好,如果不是原生的 ARM 架构 App,M1 会通过Rosetta 2来转译启动,第一次会慢一点,后面就感觉不到什么了。苹果自己的原生 App,比如 XCode、Safari 等,应该是做了优化,打开和使用都快如闪电。"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"不过,因为这款笔记本内存只有 16 G,如果你打开的 App 足够多的话,比如几十款。我因为一直用 64 G 内存,打开 App 基本不关,App 开多了会耗尽内存,这个导致的问题是系统切换的时候会有卡顿。这个问题也很好解决,比如加内存就够了。可惜的是,M1 13 寸顶配就是 16G 的。"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"7、第一次,你能直接在 macOS 上使用 iPhone 和 iPad App,这是个新的起点,一种融合的趋势跃然纸上,想一下 iOS App Store 上海量的应用,还是很让人期待的。不过,我用了微信读书、极客时间、豆瓣等 App,各有各的问题,字体、交互、排版和架构,都有很多需要迭代的地方,无论是 macOS 还是 iOS App 的技术架构,都需要持续完善,目前使用体验并不好。"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"8、M1 对后台的研发人员,没有那么友好,比如 Homebrew,想用的话,需要装两套:"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"1、arch -x86_64 \/bin\/bash -c"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"2、$(curl -fsSLhttps:\/\/raw.githubusercontent.com\/Homebrew\/install\/master\/install.sh)"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"这是 x86 的,还得来一套原生的,安装系统服务的时候,有的只支持 x86,有的已经可以支持 Arm 了,需要试一下才能决定用什么方式安装。"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"比如 Docker 和虚拟机等,在 M1 上运行都会有各种各样的问题,Multipass 也不能用了。不过,迁移需要时间,一切都会好起来的。至少常用的 IDE 使用起来都没有问题,或者问题可以解决。"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"参考链接:"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"https:\/\/blog.yifangu.com\/2021\/02\/26\/mining-ethereum-on-a-m1-mac-gpu\/"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"https:\/\/www.tomshardware.com\/news\/apple-m1-chip-mining-ethereum\/"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}}]}
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章