We have a customized compiling environment that /tmp
directory may not work well. When compiling cuda kernels with nvcc + gcc, temparory files like tmpxft_[digits]_[digits]-digit_[kernel name].ptx
format will be saved in /tmp
directory, for example: tmpxft_0000000e_00000017-6_matmul.ptx
.
If we add --keep
option in nvcc commands, the temporary files will be saved in current workdir as this post. And this make our compiling work well in the most time. Because /tmp
will not be read/write any files theoretically.
However, we still found a small number of temporary file like tmpxft_00000004_00000000-1.cpp
appearing in the /tmp
directory. The content of this temp file looks like:
#if defined(__cplusplus)
__NV_CPLUSPLUS __cplusplus
#endif /* defined(__cplusplus) */
#if defined(__GNUC__)
__NV_GNUC__ __GNUC__
#if defined(__GNUC_MINOR__)
__NV_GNUC_MINOR__ __GNUC_MINOR__
#endif /* defined(__GNUC_MINOR__) */
#if defined(__GNUC_PATCHLEVEL__)
__NV_GNUC_PATCHLEVEL__ __GNUC_PATCHLEVEL__
#endif /* defined(__GNUC_PATCHLEVEL__) */
...
__NV_HORIZON__
#endif /* defined(__HORIZON__) */
#if defined(_MSC_VER)
__NV_MSC_VER _MSC_VER
#endif /* defined(_MS_VER) */
#if defined(_MSC_FULL_VER)
__NV_MSC_FULL_VER _MSC_FULL_VER
#endif /* defined(_MSC_FULL_VER) */
#if defined(__CHAR_UNSIGNED__) || defined(_CHAR_UNSIGNED)
__NV_CHAR_UNSIGNED__
#endif /* defined(__CHAR_UNSIGNED__) || defined(_CHAR_UNSIGNED) */
It seems that --keep
doesn’t work all time? Is there any method to avoid any usage of /tmp
directory and nvcc only take current workdir for using?