Famous Tolstoy literature finds use in NVIDIA CUDA, and not just as an easter egg
User CHDuckie over at the NVIDIA subreddit noticed a large file located in the NVIDIA CUDA folder on their hard drive. The file was named "warandpeace.txt." The file was much larger than the other codes in the folder, weighing in at 3,212 KB compared to the files less than 10 KB.
Tolstoy's novel War and Peace found buried in NVIDIA CUDA file folders, An Easter Egg?
CHDuckie was looking around his hard drive when he located the .txt file. Upon his curiosity, the user used VS Code to open the file due to the large file size being too girthy for the standard Notepad application. Suddenly, 65,340 appear, with the first line reading "The Project Gutenberg EBook of War and Peace, by Leo Tolstoy."
It almost seems fitting to put this specific quote from the author's work:
“The ancients left us examples of heroic poems in which heroes constitute the entire interest of history, and we still cannot get used to the fact that, for our human time, history of this sort has no meaning.”
But why was the file there? It would appear an odd choice for an Easter Egg, but the reasoning for the placement of Tolstoy's masterpiece has practical use in the NVIDIA CUDA folder.
Readers will remember that NVIDIA CUDA doubles as a computing platform and programming model for use in general computing on GPUs. CUDA allows users to increase the speed of applications by using the power of the GPU.
In the post's comments, Reddit user jlouis8 explains the probability of why the file is there.
It is used in the code here: https://github.com/NVIDIA/cuda-samples/blob/master/Samples/0_Introduction/c%2B%2B11_cuda/c%2B%2B11_cuda.cu#L97
The example creates a small CUDA kernel which counts letters w,x,y, and z in some data. It then proceeds to load war and peace into the GPU memory and run that kernel on the data.
The reason this text is chosen is probably that it is free to include without infringing on copyright, and it is large enough that you can measure a difference depending on method used, yet small enough it completes quickly.
It is quite common to include sample data with your example code so the execution is self-contained. Or provide a way to load said data from a stable URI off of the internet. Some systems, R for instance, includes sample data in the standard library, so you can demonstrate methods easily.
And you thought you weren't going to get a literature and coding lesson today.
Stay in the loop
GET A DAILY DIGEST OF LATEST TECHNOLOGY NEWS
Straight to your inbox
Subscribe to our newsletter