alf*_*lfC 6 c++ linux hpc nvidia
我正在使用 Nvidia 的 HPC 编译器nvc++。
有没有办法检测程序是否正在使用特定的编译器和版本进行编译?
我在手册中找不到任何内容https://docs.nvidia.com/hpc-sdk/index.html。
另一个 Nvidia 相关的编译器nvcc有这些宏
__NVCC__
Defined when compiling C/C++/CUDA source files.
__CUDACC__
Defined when compiling CUDA source files.
__CUDACC_RDC__
Defined when compiling CUDA source files in relocatable device code mode (see NVCC Options for Separate Compilation).
__CUDACC_EWP__
Defined when compiling CUDA source files in extensible whole program mode (see Options for Specifying Behavior of Compiler/Linker).
__CUDACC_DEBUG__
Defined when compiling CUDA source files in the device-debug mode (see Options for Specifying Behavior of Compiler/Linker).
__CUDACC_RELAXED_CONSTEXPR__
Defined when the --expt-relaxed-constexpr flag is specified on the command line. Refer to CUDA C++ Programming Guide for more details.
__CUDACC_EXTENDED_LAMBDA__
Defined when the --expt-extended-lambda or --extended-lambda flag is specified on the command line. Refer to CUDA C++ Programming Guide for more details.
__CUDACC_VER_MAJOR__
Defined with the major version number of nvcc.
__CUDACC_VER_MINOR__
Defined with the minor version number of nvcc.
__CUDACC_VER_BUILD__
Defined with the build version number of nvcc.
__NVCC_DIAG_PRAGMA_SUPPORT__
Defined when the CUDA frontend compiler supports diagnostic control with the nv_diag_suppress, nv_diag_error, nv_diag_warning, nv_diag_default, nv_diag_once, nv_diagnostic pragmas.
Run Code Online (Sandbox Code Playgroud)
但我找不到 的等效项nvc++。该strings命令没有显示任何合适的宏名称候选。
$ strings /opt/nvidia/hpc_sdk/Linux_x86_64/22.1/compilers/bin/nvc++ | grep D
Run Code Online (Sandbox Code Playgroud)
__NVCOMPILER __NVCOMPILER_MAJOR__ __NVCOMPILER_MINOR__
在随机的第三方库中意外发现它们https://github.com/fmtlib/fmt/blob/master/include/fmt/core.h
#ifdef __NVCOMPILER
# define FMT_NVCOMPILER_VERSION \
(__NVCOMPILER_MAJOR__ * 100 + __NVCOMPILER_MINOR__)
#else
# define FMT_NVCOMPILER_VERSION 0
#endif
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1847 次 |
| 最近记录: |