Hello everybody.
I am really interested in GPU programming with Mojo. However, I cannot compile my code for GPU architectures other than my current device. I was looking for solutions in the official documentation but I didn’t find anything useful as the architecture seems to be automatically inferred.
Thank you in advance.
Mojo currently uses a JIT compiler to target GPUs. This means that, no matter where you run the binary, it will have high performance because the JIT compiler will take a look at the hardware it’s about to run the code on before compiling. Since you select a particular GPU to run a given piece of GPU code on, this should work even if you have an RTX 3050 (the weakest GPU which should technically still work) in the same systems as a PCIe H100 Datacenter GPU (officially supported). The tradeoff for this is that users of Mojo programs have to run a part of the compiler on their systems, so their may be higher startup times on systems with weak CPUs like Nvidia’s Jetson SBCs. This is inline with how Mojo generally works, since it also compiles with the equivalent of -O3 -march=native
by default for CPU code, with the option to set a lower target.
If you have a use-case that requires AOT compilation to a given GPU architecture, such as an application which needs fast startup on a Nvidia Jetson SBC, you can raise that with the team in a feature request.
1 Like