Compilation/versions question

Hi,
Kinda silly questions… but…

  1. Can I compile my code with CUDA 10.1 (for Kepler and above archs) and run it on a machine with CUDA 8?
  2. Can I compile my code with CUDA 8 (or 9.x) for Kepler/Pascal and run it on a machine with CUDA 10.x and a Volta GPU?
  3. Would the JIT be used, and therefore all .cu files compiled upon the binary startup and will be seen as a delay?

thanks
Eyal

  1. Generally, no. You can if: a. you have a sufficiently new enough driver on the CUDA 8 machine and b. you have bundled (statically linked) all the necessary libraries such as CUDART
  2. Generally, yes, if you compile with appropriate compile switches, e.g. including PTX in the fat binary. -arch=sm_30 or -arch=sm_60 for example would do this.
  3. JIT will be used if appropriate PTX is available but appropriate SASS is not. So JIT would be used in case 2. There will be a JIT compile delay the first time the JIT is done on that executable, but subsequent runs should not trigger a JIT compile because there is a JIT cache. The cu files are not compiled. The thing that happens is the embedded PTX in the fatbinary gets converted to suitable SASS for the GPU in question.

There are many questions discussing these topics both here and on stack overflow.

https://stackoverflow.com/questions/17599189/what-is-the-purpose-of-using-multiple-arch-flags-in-nvidias-nvcc-compiler/17599585#17599585

https://stackoverflow.com/questions/35656294/cuda-how-to-use-arch-and-code-and-sm-vs-compute/35657430#35657430