Straight Dope Message Board

Straight Dope Message Board (https://boards.straightdope.com/sdmb/index.php)
-   General Questions (https://boards.straightdope.com/sdmb/forumdisplay.php?f=3)
-   -   CUDA and CUDA compiler (proprietary vs open-source) (https://boards.straightdope.com/sdmb/showthread.php?t=889958)

MaverocK 02-12-2020 05:45 PM

CUDA and CUDA compiler (proprietary vs open-source)
 
I came across interesting information in a professor's lecture slides. Some information on them got me confused:

1.) In one of his slides, it says: "CUDA has an open-sourced CUDA compiler": https://i.imgur.com/m8UW0lO.png
2.) In one of the next slides, it says: "CUDA is Nvidia's proprietary technology that targets Nvidia devices only": https://i.imgur.com/z7ipon2.png

AFAIK, if something is open source, it cannot be proprietary as only the original owner(s) of the software are legally allowed to inspect and modify the source code.

So, the way that I understand it is that the technology CUDA itself is proprietary but the compiler is open source. How does this work? I don't understand exactly how the technology can be proprietary while the compiler can be open source. Isn't that self-contradictory?

Heracles 02-12-2020 09:38 PM

In my ordinary Lenovo desktop PC, the Intel Core i5 microprocessor is Intel's proprietary technology. However, the hardware interfaces, the processor's instruction set and timing are documented by Intel, so that people can actually use the chip to build computers and operating systems. The same goes for other components of the PC: memory, disk controllers, video chips, etc. So it's possible to design an open-source compiler, such as gcc, to compile programs for the Core i5, and to create an open-source kernel, such as Linux, to run on this microprocessor, and build an entire open-source operating system around this kernel.

This doesn't mean that the microcode running inside the Core i5 is publicly documented: it isn't. We only found out a couple of years ago that there was a version of MINIX running inside the processor, fer cryin' out loud.

For CUDA, nVidia has intellectual property (patents) that it can use to legally prevent any other manufacturer from making hardware that behaves exactly like a CUDA chip; so CUDA itself is proprietary. The plans for the CUDA hardware are not made public. However, like Intel, nVidia wants people to use its amazing chips, so it publishes documentation and libraries that programmers can use to target CUDA, and has also chosen to contribute some source code to the LLVM compiler project so that people can more easily write programs that target the CUDA hardware. So there is an open-source compiler for CUDA, but CUDA itself remains the property of nVidia.

si_blakely 02-12-2020 09:41 PM

Quote:

Originally Posted by MaverocK (Post 22135534)
So, the way that I understand it is that the technology CUDA itself is proprietary but the compiler is open source. How does this work? I don't understand exactly how the technology can be proprietary while the compiler can be open source. Isn't that self-contradictory?

This is the correct understanding.

CUDA defines a public interface (or instruction set) that the compiler targets - the implementation in hardware is still proprietary, but as long as the compiler targets that public interface, it can be as open-source as it likes.

In another space, Intel's implementation of the x86 instruction set is proprietary. But gcc is open source - it just uses the public instruction set documentation and some hard-won knowledge about what actually works to compile code.

MaverocK 02-13-2020 09:50 PM

Thank you very much for the answers. I just learnt that CUDA is compiled in two steps: first CUDA code to PTX, then PTX to ptxas. The first is open sourced process, and the second is closed because it is targeted at specific hardware. This second compiler is part of the GPU driver.


All times are GMT -5. The time now is 01:51 AM.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2020, vBulletin Solutions, Inc.

Send questions for Cecil Adams to: cecil@straightdope.com

Send comments about this website to: webmaster@straightdope.com

Terms of Use / Privacy Policy

Advertise on the Straight Dope!
(Your direct line to thousands of the smartest, hippest people on the planet, plus a few total dipsticks.)

Copyright 2019 STM Reader, LLC.