英伟达在CUDA代码文件夹中埋藏了《战争与和平》全文彩蛋

科技2yrs ago (2022)update cnBeta
861 0
网站公众号快速收录
Reddit 网友 CHDuckie 在 NVIDIA 子版块上发帖称,其在硬盘上的英伟达 CUDA 文件夹中发现了一个不同寻常的“大文件”。与其它一众 10 KB 不到的代码相比,该文档的体积竟然高达 3212 KB 。当时 CHDuckie 正在检索自己的硬盘驱动器,结果意外发现了这个包含《战争与和平》全文的 txt 文档“彩蛋”。

0.png

(图 via WCCFTech)

出于好奇,他用 VS Code 打开了该文件。毕竟对于常规的记事本(notepad.exe)应用程序来说,该 txt 文档的体型着实大得有些离谱。

结果在这个包含 65340 行的文档中,首先映入眼帘的就是 —— 列夫·托尔斯泰的古腾堡计划,《战争与和平》电子书。

1.jpg

尽管让人感到有些疑惑,还是有网友给出了相对合理的解释。据悉,作为计算平台和编程模型的 NVIDIA CUDA,开发者可在该公司的 GPU 上开展一系列通用加速计算。

然后 Jlouis8 在评论中贴出了 GitHub 上的一个代码示例(传送门),演示了如何通过创建一个小型的 CUDA 内核,以计算某些数据(比如《战争与和平》电子书)中,w、x、y 和 z 的字母数量。

2.jpg

之所以选择这本电子书,其原因也不难理解。首先,NVIDIA 可在不侵犯版权的情况下自由包含;其次,原始文本量足够庞大、但又足够在 CUDA(GPU)硬件上快速完成。

(figure via WCCFTech)

Out of curiosity, he opened the file with VS Code. After all, for a regular notepad.exe application, the txt document is ridiculously large.

As a result, the first thing to see in this 65340-line document is Leo Tolstoy’s Gutenberg Project, the ebook War and Peace.

Although there is some confusion, some netizens have given a relatively reasonable explanation. It is reported that NVIDIA CUDA, as a computing platform and programming model, developers can carry out a series of general accelerated computing on the company’s GPU.

In the comments, Jlouis8 then posted a code example (portal) on GitHub, demonstrating how to create a small CUDA kernel to count the letters w, x, y, and z in some data, such as the war and peace ebook.

The reason for choosing this e-book is not difficult to understand. First, NVIDIA can be included freely without copyright infringement; second, the amount of original text is large enough, but fast enough to be done on CUDA (GPU) hardware.

© Copyright notes

Related posts

网站公众号快速收录