Does Mojo support cross-compilation for GPU targets on non-GPU platforms?

My current local machine doesn’t meet Mojo’s GPU runtime requirements, and I’m currently unable to compile on it. Given that most modern programming languages and compilers support cross-compilation, I was wondering: does the Mojo compiler currently support this feature? If not, is it on the roadmap for the future?

Right now, I’m relying on cloud GPUs to learn Mojo. However, keeping a cloud instance running continuously is quite expensive, and having to repeatedly spin up and reconfigure the environment from scratch every time. If I could compile the executable locally and only use the cloud instance for execution, it would significantly improve the workflow and save costs.

Hey! Yes there are flags for specifying the target you’re building for. Hopefully this page helps: Compilation targets | Mojo

thx! I will try it!!!

Yes, it is very useful! I can really compile the mojo file on my computer. But when I scp the executable to the remote GPU target and run it, it will complain about can't load shared libraries: libKGENCompilerRTShared.so. I guess I need to compile locally by using -Xlinker -static, but I don’t have static libraries like libKGENCompilerRTShare.a.

So the question has changed interestingly. How to statically link a mojo executable?

I can run it by copying all needed shared libraries to the remote GPU target, and exporting LD_LIBRARY_PATH before running it.

If you had mojo or max installed on your remote machine you should also have a copy of the library there too? But glad to see you got it working.