Learn GPU Programming With Simple Puzzles

Have you wanted to get into GPU programming with CUDA but found the usual textbooks and guides a bit too intense? Well, help is at hand in the form of a series of increasingly difficult programming ‘puzzles’ created by [Sasha Rush]. The first part of the simplification is to utilise the excellent NUMBA python JIT compiler to allow easy-to-understand code to be deployed as GPU machine code. Working on these puzzles is even easier if you use this linked Google Colab as your programming environment, launching you straight into a Jupyter notebook with the puzzles laid out. You can use your own GPU if you have one, but that’s not detailed.

The puzzles start, assuming you know nothing at all about GPU programming, which is totally the case for some of us! What’s really nice is the way the result of the program operation is displayed, showing graphically how data are read and written to the input and output arrays you’re working with. Each essential concept for CUDA programming is identified one at a time with a real programming example, making it a breeze to follow along. Just make sure you don’t watch the video below all the way through the first time, as in it [Sasha] explains all the solutions!

Confused about why you’d want to do this? Then perhaps check out our guide to CUDA first. We know what you’re thinking: how do we use non-nVIDIA hardware? Well, there’s SCALE for that! Finally, once you understand CUDA, why not have a play with WebGPU?

Continue reading “Learn GPU Programming With Simple Puzzles”

3D Printing On Top Of Laser Cut Acrylic

[Julius Curt] needed to mark acrylic panels with a bit more clarity than the usual way of rastering the surface, so they attempted to 3D print directly to an acrylic sheet, which worked perfectly. The obvious way to do this was to bond the acrylic sheet to the bed with glue temporarily, but another way was tried, and it’s much less messy and precarious.

The bond between a 3D print and acrylic is very strong

The first step was to create a 3D model which combined a constraining ‘fence’ to contain the acrylic panel with the required artwork floating above. It was easy enough to run the print long enough to build the fence, then pause the print mid-way to add the pristine panel and restart after a quick re-prime and wipe.

There were a few simple takeaways from the video below. First, to ensure sufficient tolerance between the fence and the panel, consider the layer width (plus associated tolerance when printed) and the laser kerf of your machines to ensure a not-too-sloppy fit. Secondly, that hot nozzle won’t do the acrylic surface any favours during travel moves, so enabling Z-hopping is essential!

Another use for this simple technique is to fully incorporate an acrylic sheet within a print by pausing at an appropriate height again, dropping the panel in, and continuing the print. A degree of overlap will lock the panel tight, with the plastic bonding very firmly to the acrylic, as [Julius] demonstrates in the video.

It’s always a delight to see how techniques can combine to create the desired effects. Here’s how to use a color laser printer and toner transfer paper to apply designs to a 3D printing front panel. Whilst we’re thinking about the multitude of uses for hacking with acrylic, what about not doing that and using corrugated plastic instead?

Continue reading “3D Printing On Top Of Laser Cut Acrylic”

Revisiting 1990’s Mac Games That Never Were

[John Calhoun] was digging around their old MAC hard drives, revisiting some abandoned shareware games they wrote over three decades ago, and has uploaded the recovered disk images to GitHub for everyone to take apart and play with. This repository has a few of the games complete with their development files and the compiler environment, a mixture of Think Pascal and C.

Back then, [John] had a solid mantra when creating projects, specifically prototyping fast and abandoning things quickly if they were not working out. The blog shows a list of twenty-eight projects, of which only five ever made it to release, with all the rest left to rot. This is reminiscent of the attitude around Silicon Valley of moving fast and breaking things. Anyway, reasons for ditching a project ranged from ‘too much sprite work’ for a D’n’D style game to simply ‘not fun’ for some with clunky control mechanisms. [John] even abandoned a neat-looking steampunk flight simulator due to the sheer amount of work needed. Of course, it’s not all lost effort. Much of the code written was reused across multiple projects; after all, there’s no point in re-writing a cosine lookup table if you’ve already got one kicking around in another project.

Still, it’s a fun trip down memory lane, looking deep into projects that never were and the development journey to becoming a successful programmer.

While it isn’t hard to find old Macintosh hardware, some are not in great shape. Here’s a fun Hackintosh project that uses retro parts. [John] was featured a while back, with his homage to his first mac, a sleek Rpi-powered eInk desk ornament. Finally, we can’t talk about recovering retro software without looking in detail at the floppy disk themselves.

Get Your Lisp On With The Dune Shell

Lisp is one of those programming languages that seems to keep taunting us for not learning it properly. It is still used for teaching functional languages today. [Adam McDaniel] has an obvious fondness for this fifty-year-old language and has used it in several projects, including their own shell, Dune.

Dune is a shell designed for powerful scripting. Think of it as an unholy combination of bash and Lisp.

Dune is designed to be highly customisable, allowing you to create a super-optimised workstation for your admin and programming tasks. [Adam] describes the front end for Dune as having turned up the cosiness dial to eleven, and we can see that. A cosy home is personalised, and Dune lets you customise everything.

Dune is a useable functional programming environment with a reasonably complete standard library to back it up, which should simplify some of the more complicated sysadmin tasks. [Adam] says the language also supports a few metaprogramming concepts, such as a quote operator, operator overloading, and macro programming. It’s difficult to describe much more about what you can do with Dune, as it’s a general-purpose programming language wrapped in a shell. The possibilities are endless, and [Adam] is looking forward to seeing what you lot out there do with his project!

The shell can be personalised by editing the prelude file, which allows you to overload functions for the prompt text, the incomplete prompt text (so you can implement intelligent completion options), and a function that deals with the formatting of the command response text. [Adam] gives us his personal prelude file, which defines many helper functions displaying useful things such as the current weather, a calendar, and an ASCII art cat. You never know when that might come in handy. This file is written in Lisp, so we reckon that’s where many people will start as they come up the Lisp (re)learning curve before embarking on more involved automation. Dune was written in Rust, so you need that infrastructure to install it with Cargo.

As we said earlier, Lisp is not a new language. We found a hack for porting a Lisp interpreter to any old language and also running Lisp bare metal on a Lisp machine. Finally, [Al] takes a look at some alternative shells.

Reverse Engineering A Keyboard Driver Uncovers A Self-Destruct Code

Should you be able to brick a keyboard just by writing a driver to flash the lights on it? We don’t think so either. [TheNotary] got quite the shock when embarking on a seemingly straightforward project to learn C++ on the x86-64 architecture with Windows and sent it straight to Silicon Heaven with only a few seemingly innocent USB packets.

The project was a custom driver for the XVX S-K80 mechanical keyboard, aiming to flash LED patterns across the key LEDs and perhaps send custom images to the integrated LCD. When doing this sort of work, the first thing you need is the documentation of the communications protocols. Obviously, this was not an option with a closed-source project, so the next best thing is to spy on the existing Windows drivers and see how they worked. Using Wireshark to monitor the USB traffic whilst twiddling with the colour settings, it was clear that communications were purely over HID messages, simplifying subsequent analysis. Next, they used x32dbg (now x64dbg, but whatever) to attach to the existing driver process and trap a few interesting Windows system calls. After reading around the Windows API, a few candidate functions were identified and trapped. This gave them enough information to begin writing code to reproduce this behaviour. Then things got a bit odd.

Continue reading “Reverse Engineering A Keyboard Driver Uncovers A Self-Destruct Code”

Embossing Graphics By 3D Printing On Wood

Embossing (making raised shapes) and debossing (making sunken shapes) on 3D-printed surfaces is not a new idea; we do it all the time. [Cory] from Vancouver Hack Space was playing around with 3D printing on wood, and came up with the idea of creating raised tactile surfaces using a simple transfer process.

We don’t often try to print directly onto a wooden surface for various reasons, but [Cory] wanted to give it a go. They hoped to get some grain patterns to transfer to the surface, but as they say in the blog entry, the beauty of wood patterns is in the colouration, which doesn’t transfer. Next, they laser etched a logo into the wood surface to see how well that would transfer. It did create a discernable raised impression, but they forgot to mirror the image (oops!) and relevel the bed, so the results are less impressive than they could be. Still, it’s another useful technique to consider.

Embossing is the process by which braille sheets are made. This DIY braille encoder is pretty sweet. Of course, the process can simply be decorative. Here’s how to use a laser cutter to create your own embossing seals. The traditional way to emboss paper for a fancy effect was to use embossing powder to selectively change the properties of drying paper. But how can you make the stuff for cheap?

Upgraded Raster Laser Projector Goes RGB

We’ve covered a scanning laser project by Ben Make’s Everything last year, and now he’s back with a significant update. [Ben]’s latest project now offers a higher resolution and RGB lasers. A couple of previous versions of the device used the same concept of a rotating segmented mirror synchronised to a pulsed laser diode to create scanlines. When projected onto a suitable surface, the distorted, pixelated characters looked quite funky, but there was clearly room for improvement.

More scanlines and a faster horizontal pixel rate

The previous device used slightly inclined mirrors to deflect the beam into scanlines, with one mirror per scanline limiting the vertical resolution. To improve resolution, the mirrors were replaced with identically aligned mirrors of the type used in laser printers for horizontal scanning. An off-the-shelf laser galvo was used for vertical scanning, allowing faster scanning due to its small deflection angle. This setup is quicker than then usual vector galvo application, as the smaller movements require less time to complete. Once the resolution improvement was in hand, the controller upgrade to a Teensy 4 gave more processing bandwidth than the previous Arduino and a consequent massive improvement in image clarity.

Finally, monochrome displays don’t look anywhere near as good as an RGB setup. [Ben] utilised a dedicated RGB laser setup since he had trouble sourcing the appropriate dichroic mirrors to match available lasers. This used four lasers (with two red ones) and the correct dichroic mirrors to combine each laser source into a single beam path, which was then sent to the galvo. [Ben] tried to find a DAC solution fast enough to drive the lasers for a proper colour-mixing input but ended up shelving that idea for now and sticking with direct on-off control. This resulted in a palette of just seven colours, but that’s still a lot better than monochrome.

The project’s execution is excellent, and care was taken to make it operate outdoors with a battery. Even with appropriate safety measures, you don’t really want to play with high-intensity lasers around the house!

Here’s the previous version we covered, a neat DIY laser galvo using steppers, and a much older but very cool RGB vector projector.

Continue reading “Upgraded Raster Laser Projector Goes RGB”