1
\$\begingroup\$

Can modern compilers use the power of a graphics card to shorten compilation time?

Or is this solely based on the CPU and RAM?

For example, can GCC utilize an external graphics card connected via a thunderbolt cable when compiling C++ source code?

\$\endgroup\$
3
  • 1
    \$\begingroup\$ Game developers are not the only ones who compile code. That's something all programmers working in compiled languages do, so this should be asked on our general programming sister site StackOverflow - in fact, other people have already asked it there. \$\endgroup\$
    – DMGregory
    Oct 6 '21 at 11:56
  • \$\begingroup\$ CPUs are like small detail paint brushes, and GPUs are like paint rollers. Compiling definitely is a detail job. :) \$\endgroup\$
    – Almo
    Oct 6 '21 at 18:08
  • \$\begingroup\$ CPUs are like small detail paint brushes, and GPUs are like paint rollers. Compiling definitely is a detail job. :) \$\endgroup\$
    – Almo
    Oct 6 '21 at 18:08
2
\$\begingroup\$

No, it won't.

I have never heard of a compiler which uses GPU acceleration, and I don't think it would make sense to try to develop one. Compiling is one of those kinds of tasks where CPUs easily beat GPUs in performance.

But if you want to improve your compilation times without investing in a new computer: I do know of a couple technology stacks which offer "cloud build services". Like Unity, for example. The idea is that there is a powerful server on the Internet which does the compiling for you. You send your sourcecode to the server. The server compiles it for you, and sends you the compiled binary.

You could also set up something like that of your own with a bit of tinkering and an AWS on-demand high performance instance.

Or you could try to look into programming techniques which reduce the compilation times of your C++ code. Like compiler firewalls to reduce the amount of code which needs to be recompiled after each code change. Or try to implement as much as you can in your game using data files, configuration files or scripts instead of hardcoding stuff, so that you can iterate on your game design without recompiling each time you adjust a number.

\$\endgroup\$

Not the answer you're looking for? Browse other questions tagged .