▲ 60 ▼ [2023 day 8] some guy on reddit manged to brute force part 2 in 57 seconds on a gpu (lemmy.ml) submitted 2 years ago by morrowind@lemmy.ml to c/advent_of_code@programming.dev 16 comments fedilink hide all child comments https://www.reddit.com/r/adventofcode/comments/18dry49/2023_day_8_part_2glsl_brute_forced_in_under_a/
[+] velox_vulnus@lemmy.ml 4 points 2 years ago* (last edited 2 years ago) (2 children) [deleted] permalink fedilink source parent hideshow 4 child comments replies: [–] ICEMAN@hexbear.net 1 point 2 years ago Thank you! permalink fedilink source parent [–] coloredgrayscale@programming.dev 1 point 2 years ago (1 child) One way to get the data is to render to a (hidden) surface/canvas. It's just bytes to the computer, so just dump the result data in the display buffer. Then you take a "screenshot" and interpret the RGBA values as data. permalink fedilink source parent hideshow 2 child comments replies: [–] graphicsguy@programming.dev 3 points 2 years ago Graphics Programmer here. More likely you would just write data to a buffer (basically an array of whatever element type you want) rather than a render target and then read it back to the cpu. Dx, vulkan, etc. all have APIs to upload / download to / from the GPU quite easily, and CUDA makes it even easier, so a simple compute shader or CUDA kernel that writes to a buffer would make the most sense for general purpose computation like an advent of code problem. permalink fedilink source parent
[–] coloredgrayscale@programming.dev 1 point 2 years ago (1 child) One way to get the data is to render to a (hidden) surface/canvas. It's just bytes to the computer, so just dump the result data in the display buffer. Then you take a "screenshot" and interpret the RGBA values as data. permalink fedilink source parent hideshow 2 child comments replies: [–] graphicsguy@programming.dev 3 points 2 years ago Graphics Programmer here. More likely you would just write data to a buffer (basically an array of whatever element type you want) rather than a render target and then read it back to the cpu. Dx, vulkan, etc. all have APIs to upload / download to / from the GPU quite easily, and CUDA makes it even easier, so a simple compute shader or CUDA kernel that writes to a buffer would make the most sense for general purpose computation like an advent of code problem. permalink fedilink source parent
[–] graphicsguy@programming.dev 3 points 2 years ago Graphics Programmer here. More likely you would just write data to a buffer (basically an array of whatever element type you want) rather than a render target and then read it back to the cpu. Dx, vulkan, etc. all have APIs to upload / download to / from the GPU quite easily, and CUDA makes it even easier, so a simple compute shader or CUDA kernel that writes to a buffer would make the most sense for general purpose computation like an advent of code problem. permalink fedilink source parent