# Compilation/versions question

**URL:** <https://forums.developer.nvidia.com/t/compilation-versions-question/82384>\
**Category:** CUDA Programming and Performance\
**Created:** [September 26, 2019, 4:02pm UTC](https://forums.developer.nvidia.com/t/compilation-versions-question/82384 "2019-09-26T16:02:37Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![eyalhir74](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@eyalhir74](https://forums.developer.nvidia.com/u/eyalhir74)\
**Post date:** [September 26, 2019, 4:02pm UTC](https://forums.developer.nvidia.com/t/compilation-versions-question/82384/1 "2019-09-26T16:02:37Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Robert\_Crovella](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/robert_crovella/32/14043_2.png) [@Robert\_Crovella](https://forums.developer.nvidia.com/u/Robert_Crovella)\
**Post date:** [September 26, 2019, 4:12pm UTC](https://forums.developer.nvidia.com/t/compilation-versions-question/82384/2 "2019-09-26T16:12:29Z")

</div>

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.

[url][cuda - What is the purpose of using multiple "arch" flags in Nvidia's NVCC compiler? - Stack Overflow](https://stackoverflow.com/questions/17599189/what-is-the-purpose-of-using-multiple-arch-flags-in-nvidias-nvcc-compiler/17599585#17599585%5B/url%5D)

[url][nvcc - CUDA: How to use -arch and -code and SM vs COMPUTE - Stack Overflow](https://stackoverflow.com/questions/35656294/cuda-how-to-use-arch-and-code-and-sm-vs-compute/35657430#35657430%5B/url%5D)
