nvcc --help 【命令备忘】

举报
ShaderJoy 发表于 2021/12/31 22:41:09 2021/12/31
【摘要】   C:\Users\panda>nvcc --help Usage : nvcc [options] <inputfile>    Options for specifying the compilation phase ===========================...

 


  
  1. C:\Users\panda>nvcc --help
  2. Usage : nvcc [options] <inputfile>

 

 Options for specifying the compilation phase


  
  1. ============================================
  2. More exactly, this option specifies up to which stage the input files must be compiled,
  3. according to the following compilation trajectories for different input file types:
  4. .c/.cc/.cpp/.cxx : preprocess, compile, link
  5. .o : link
  6. .i/.ii : compile, link
  7. .cu : preprocess, cuda frontend, PTX assemble,
  8. merge with host C code, compile, link
  9. .gpu : cicc compile into cubin
  10. .ptx : PTX assemble into cubin.
  11. --cuda (-cuda)
  12. Compile all .cu input files to .cu.cpp.ii output.
  13. --cubin (-cubin)
  14. Compile all .cu/.gpu/.ptx input files to device-only .cubin files. This
  15. step discards the host code for each .cu input file.
  16. --fatbin(-fatbin)
  17. Compile all .cu/.gpu/.ptx/.cubin input files to device-only .fatbin files.
  18. This step discards the host code for each .cu input file.
  19. --ptx (-ptx)
  20. Compile all .cu/.gpu input files to device-only .ptx files. This step discards
  21. the host code for each of these input file.
  22. --preprocess (-E)
  23. Preprocess all .c/.cc/.cpp/.cxx/.cu input files.
  24. --generate-dependencies (-M)
  25. Generate a dependency file that can be included in a make file for the .c/.cc/.cpp/.cxx/.cu
  26. input file (more than one are not allowed in this mode).
  27. --compile (-c)
  28. Compile each .c/.cc/.cpp/.cxx/.cu input file into an object file.
  29. --device-c (-dc)
  30. Compile each .c/.cc/.cpp/.cxx/.cu input file into an object file that contains
  31. relocatable device code. It is equivalent to '--relocatable-device-code=true
  32. --compile'.
  33. --device-w (-dw)
  34. Compile each .c/.cc/.cpp/.cxx/.cu input file into an object file that contains
  35. executable device code. It is equivalent to '--relocatable-device-code=false
  36. --compile'.
  37. --device-link (-dlink)
  38. Link object files with relocatable device code and .ptx/.cubin/.fatbin files
  39. into an object file with executable device code, which can be passed to the
  40. host linker.
  41. --link (-link)
  42. This option specifies the default behavior: compile and link all inputs.
  43. --lib (-lib)
  44. Compile all inputs into object files (if necessary) and add the results to
  45. the specified output library file.
  46. --run (-run)
  47. This option compiles and links all inputs into an executable, and executes
  48. it. Or, when the input is a single executable, it is executed without any
  49. compilation or linking. This step is intended for developers who do not want
  50. to be bothered with setting the necessary environment variables; these are
  51. set temporarily by nvcc).

 

File and path specifications. 


  
  1. =============================
  2. --output-file <file> (-o)
  3. Specify name and location of the output file. Only a single input file is
  4. allowed when this option is present in nvcc non-linking/archiving mode.
  5. --pre-include <file>,... (-include)
  6. Specify header files that must be preincluded during preprocessing.
  7. --library <library>,... (-l)
  8. Specify libraries to be used in the linking stage without the library file
  9. extension. The libraries are searched for on the library search paths that
  10. have been specified using option '--library-path'.
  11. --define-macro <def>,... (-D)
  12. Specify macro definitions to define for use during preprocessing or compilation.
  13. --undefine-macro <def>,... (-U)
  14. Undefine macro definitions during preprocessing or compilation.
  15. --include-path <path>,... (-I)
  16. Specify include search paths.
  17. --system-include <path>,... (-isystem)
  18. Specify system include search paths.
  19. --library-path <path>,... (-L)
  20. Specify library search paths.
  21. --output-directory <directory> (-odir)
  22. Specify the directory of the output file. This option is intended for letting
  23. the dependency generation step (see '--generate-dependencies') generate a
  24. rule that defines the target object file in the proper directory.
  25. --compiler-bindir <path> (-ccbin)
  26. Specify the directory in which the host compiler executable resides. The
  27. host compiler executable name can be also specified to ensure that the correct
  28. host compiler is selected. In addition, driver prefix options ('--input-drive-prefix',
  29. '--dependency-drive-prefix', or '--drive-prefix') may need to be specified,
  30. if nvcc is executed in a Cygwin shell or a MinGW shell on Windows.
  31. --cudart{none|shared|static} (-cudart)
  32. Specify the type of CUDA runtime library to be used: no CUDA runtime library,
  33. shared/dynamic CUDA runtime library, or static CUDA runtime library.
  34. Allowed values for this option: 'none','shared','static'.
  35. Default value: 'static'.
  36. --libdevice-directory <directory> (-ldir)
  37. Specify the directory that contains the libdevice library files when option
  38. '--dont-use-profile' is used. Libdevice library files are located in the
  39. 'nvvm/libdevice' directory in the CUDA toolkit.
  40. --cl-version <cl-version-number> --cl-version <cl-version-number>
  41. Specify the version of Microsoft Visual Studio installation. Note: this
  42. option is to be used in conjunction with '--use-local-env', and is ignored
  43. when '--use-local-env' is not specified. Support for VS2010 and earlier has
  44. been deprecated.
  45. Allowed values for this option: 2010,2012,2013,2015,2017.
  46. --use-local-env --use-local-env
  47. Specify whether the environment is already set up for the host compiler.

 

Options for specifying behavior of compiler/linker. 


  
  1. ===================================================
  2. --profile (-pg)
  3. Instrument generated code/executable for use by gprof (Linux only).
  4. --debug (-g)
  5. Generate debug information for host code.
  6. --device-debug (-G)
  7. Generate debug information for device code. Turns off all optimizations.
  8. Don't use for profiling; use -lineinfo instead.
  9. --generate-line-info (-lineinfo)
  10. Generate line-number information for device code.
  11. --optimize <level> (-O)
  12. Specify optimization level for host code.
  13. --ftemplate-backtrace-limit <limit> (-ftemplate-backtrace-limit)
  14. Set the maximum number of template instantiation notes for a single warning
  15. or error to <limit>. A value of 0 is allowed, and indicates that no limit
  16. should be enforced. This value is also passed to the host compiler if it
  17. provides an equivalent flag.
  18. --ftemplate-depth <limit> (-ftemplate-depth)
  19. Set the maximum instantiation depth for template classes to <limit>. This
  20. value is also passed to the host compiler if it provides an equivalent flag.
  21. --shared(-shared)
  22. Generate a shared library during linking. Use option '--linker-options'
  23. when other linker options are required for more control.
  24. --x {c|c++|cu} (-x)
  25. Explicitly specify the language for the input files, rather than letting
  26. the compiler choose a default based on the file name suffix.
  27. Allowed values for this option: 'c','c++','cu'.
  28. --std {c++03|c++11|c++14} (-std)
  29. Select a particular C++ dialect. Note that this flag also turns on the corresponding
  30. dialect flag for the host compiler.
  31. Allowed values for this option: 'c++03','c++11','c++14'.
  32. --no-host-device-initializer-list (-nohdinitlist)
  33. Do not implicitly consider member functions of std::initializer_list as __host__
  34. __device__ functions.
  35. --no-host-device-move-forward (-nohdmoveforward)
  36. Do not implicitly consider std::move and std::forward as __host__ __device__
  37. function templates.
  38. --expt-relaxed-constexpr (-expt-relaxed-constexpr)
  39. Experimental flag: Allow host code to invoke __device__ constexpr functions,
  40. and device code to invoke __host__ constexpr functions.
  41. --expt-extended-lambda (-expt-extended-lambda)
  42. Experimental flag: Allow __host__, __device__ annotations in lambda declaration.
  43. --machine {32|64} (-m)
  44. Specify 32 vs 64 bit architecture.
  45. Allowed values for this option: 32,64.
  46. Default value: 64.

 

Options for passing specific phase options 


  
  1. ==========================================
  2. These allow for passing options directly to the intended compilation phase. Using
  3. these, users have the ability to pass options to the lower level compilation tools,
  4. without the need for nvcc to know about each and every such option.
  5. --compiler-options <options>,... (-Xcompiler)
  6. Specify options directly to the compiler/preprocessor.
  7. --linker-options <options>,... (-Xlinker)
  8. Specify options directly to the host linker.
  9. --archive-options <options>,... (-Xarchive)
  10. Specify options directly to library manager.
  11. --ptxas-options <options>,... (-Xptxas)
  12. Specify options directly to ptxas, the PTX optimizing assembler.
  13. --nvlink-options <options>,... (-Xnvlink)
  14. Specify options directly to nvlink.

 

 Miscellaneous options for guiding the compiler driver.


  
  1. ======================================================
  2. --dont-use-profile (-noprof)
  3. Nvcc uses the nvcc.profiles file for compilation. When specifying this option,
  4. the profile file is not used.
  5. --dryrun(-dryrun)
  6. Do not execute the compilation commands generated by nvcc. Instead, list
  7. them.
  8. --verbose (-v)
  9. List the compilation commands generated by this compiler driver, but do not
  10. suppress their execution.
  11. --keep (-keep)
  12. Keep all intermediate files that are generated during internal compilation
  13. steps.
  14. --keep-dir <directory> (-keep-dir)
  15. Keep all intermediate files that are generated during internal compilation
  16. steps in this directory.
  17. --save-temps (-save-temps)
  18. This option is an alias of '--keep'.
  19. --clean-targets (-clean)
  20. This option reverses the behavior of nvcc. When specified, none of the compilation
  21. phases will be executed. Instead, all of the non-temporary files that nvcc
  22. would otherwise create will be deleted.
  23. --run-args <arguments>,... (-run-args)
  24. Used in combination with option --run to specify command line arguments for
  25. the executable.
  26. --input-drive-prefix <prefix> (-idp)
  27. On Windows, all command line arguments that refer to file names must be converted
  28. to the Windows native format before they are passed to pure Windows executables.
  29. This option specifies how the current development environment represents
  30. absolute paths. Use '/cygwin/' as <prefix> for Cygwin build environments,
  31. and '/' as <prefix> for MinGW.
  32. --dependency-drive-prefix <prefix> (-ddp)
  33. On Windows, when generating dependency files (see --generate-dependencies),
  34. all file names must be converted appropriately for the instance of 'make'
  35. that is used. Some instances of 'make' have trouble with the colon in absolute
  36. paths in the native Windows format, which depends on the environment in which
  37. the 'make' instance has been compiled. Use '/cygwin/' as <prefix> for a
  38. Cygwin make, and '/' as <prefix> for MinGW. Or leave these file names in
  39. the native Windows format by specifying nothing.
  40. --drive-prefix <prefix> (-dp)
  41. Specifies <prefix> as both --input-drive-prefix and --dependency-drive-prefix.
  42. --dependency-target-name <target> (-MT)
  43. Specify the target name of the generated rule when generating a dependency
  44. file (see '--generate-dependencies').
  45. --no-align-double --no-align-double
  46. Specifies that '-malign-double' should not be passed as a compiler argument
  47. on 32-bit platforms. WARNING: this makes the ABI incompatible with the cuda's
  48. kernel ABI for certain 64-bit types.
  49. --no-device-link (-nodlink)
  50. Skip the device link step when linking object files.

 

 Options for steering GPU code generation.


  
  1. =========================================
  2. --gpu-architecture <arch> (-arch)
  3. Specify the name of the class of NVIDIA 'virtual' GPU architecture for which
  4. the CUDA input files must be compiled.
  5. With the exception as described for the shorthand below, the architecture
  6. specified with this option must be a 'virtual' architecture (such as compute_50).
  7. Normally, this option alone does not trigger assembly of the generated PTX
  8. for a 'real' architecture (that is the role of nvcc option '--gpu-code',
  9. see below); rather, its purpose is to control preprocessing and compilation
  10. of the input to PTX.
  11. For convenience, in case of simple nvcc compilations, the following shorthand
  12. is supported. If no value for option '--gpu-code' is specified, then the
  13. value of this option defaults to the value of '--gpu-architecture'. In this
  14. situation, as only exception to the description above, the value specified
  15. for '--gpu-architecture' may be a 'real' architecture (such as a sm_50),
  16. in which case nvcc uses the specified 'real' architecture and its closest
  17. 'virtual' architecture as effective architecture values. For example, 'nvcc
  18. --gpu-architecture=sm_50' is equivalent to 'nvcc --gpu-architecture=compute_50
  19. --gpu-code=sm_50,compute_50'.
  20. Allowed values for this option: 'compute_30','compute_32','compute_35',
  21. 'compute_37','compute_50','compute_52','compute_53','compute_60','compute_61',
  22. 'compute_62','compute_70','compute_72','sm_30','sm_32','sm_35','sm_37','sm_50',
  23. 'sm_52','sm_53','sm_60','sm_61','sm_62','sm_70','sm_72'.
  24. --gpu-code <code>,... (-code)
  25. Specify the name of the NVIDIA GPU to assemble and optimize PTX for.
  26. nvcc embeds a compiled code image in the resulting executable for each specified
  27. <code> architecture, which is a true binary load image for each 'real' architecture
  28. (such as sm_50), and PTX code for the 'virtual' architecture (such as compute_50).
  29. During runtime, such embedded PTX code is dynamically compiled by the CUDA
  30. runtime system if no binary load image is found for the 'current' GPU.
  31. Architectures specified for options '--gpu-architecture' and '--gpu-code'
  32. may be 'virtual' as well as 'real', but the <code> architectures must be
  33. compatible with the <arch> architecture. When the '--gpu-code' option is
  34. used, the value for the '--gpu-architecture' option must be a 'virtual' PTX
  35. architecture.
  36. For instance, '--gpu-architecture=compute_35' is not compatible with '--gpu-code=sm_30',
  37. because the earlier compilation stages will assume the availability of 'compute_35'
  38. features that are not present on 'sm_30'.
  39. Allowed values for this option: 'compute_30','compute_32','compute_35',
  40. 'compute_37','compute_50','compute_52','compute_53','compute_60','compute_61',
  41. 'compute_62','compute_70','compute_72','sm_30','sm_32','sm_35','sm_37','sm_50',
  42. 'sm_52','sm_53','sm_60','sm_61','sm_62','sm_70','sm_72'.
  43. --generate-code <specification>,... (-gencode)
  44. This option provides a generalization of the '--gpu-architecture=<arch> --gpu-code=<code>,
  45. ...' option combination for specifying nvcc behavior with respect to code
  46. generation. Where use of the previous options generates code for different
  47. 'real' architectures with the PTX for the same 'virtual' architecture, option
  48. '--generate-code' allows multiple PTX generations for different 'virtual'
  49. architectures. In fact, '--gpu-architecture=<arch> --gpu-code=<code>,
  50. ...' is equivalent to '--generate-code arch=<arch>,code=<code>,...'.
  51. '--generate-code' options may be repeated for different virtual architectures.
  52. Allowed keywords for this option: 'arch','code'.
  53. --relocatable-device-code {true|false} (-rdc)
  54. Enable (disable) the generation of relocatable device code. If disabled,
  55. executable device code is generated. Relocatable device code must be linked
  56. before it can be executed.
  57. Default value: false.
  58. --entries entry,... (-e)
  59. Specify the global entry functions for which code must be generated. By
  60. default, code will be generated for all entry functions.
  61. --maxrregcount <amount> (-maxrregcount)
  62. Specify the maximum amount of registers that GPU functions can use.
  63. Until a function-specific limit, a higher value will generally increase the
  64. performance of individual GPU threads that execute this function. However,
  65. because thread registers are allocated from a global register pool on each
  66. GPU, a higher value of this option will also reduce the maximum thread block
  67. size, thereby reducing the amount of thread parallelism. Hence, a good maxrregcount
  68. value is the result of a trade-off.
  69. If this option is not specified, then no maximum is assumed.
  70. Value less than the minimum registers required by ABI will be bumped up by
  71. the compiler to ABI minimum limit.
  72. User program may not be able to make use of all registers as some registers
  73. are reserved by compiler.
  74. --use_fast_math (-use_fast_math)
  75. Make use of fast math library. '--use_fast_math' implies '--ftz=true --prec-div=false
  76. --prec-sqrt=false --fmad=true'.
  77. --ftz {true|false} (-ftz)
  78. This option controls single-precision denormals support. '--ftz=true' flushes
  79. denormal values to zero and '--ftz=false' preserves denormal values. '--use_fast_math'
  80. implies '--ftz=true'.
  81. Default value: false.
  82. --prec-div {true|false} (-prec-div)
  83. This option controls single-precision floating-point division and reciprocals.
  84. '--prec-div=true' enables the IEEE round-to-nearest mode and '--prec-div=false'
  85. enables the fast approximation mode. '--use_fast_math' implies '--prec-div=false'.
  86. Default value: true.
  87. --prec-sqrt {true|false} (-prec-sqrt)
  88. This option controls single-precision floating-point squre root. '--prec-sqrt=true'
  89. enables the IEEE round-to-nearest mode and '--prec-sqrt=false' enables the
  90. fast approximation mode. '--use_fast_math' implies '--prec-sqrt=false'.
  91. Default value: true.
  92. --fmad {true|false} (-fmad)
  93. This option enables (disables) the contraction of floating-point multiplies
  94. and adds/subtracts into floating-point multiply-add operations (FMAD, FFMA,
  95. or DFMA). '--use_fast_math' implies '--fmad=true'.
  96. Default value: true.

 

Options for steering cuda compilation. 


  
  1. ======================================
  2. --default-stream {legacy|null|per-thread} (-default-stream)
  3. Specify the stream that CUDA commands from the compiled program will be sent
  4. to by default.
  5. legacy
  6. The CUDA legacy stream (per context, implicitly synchronizes with
  7. other streams).
  8. per-thread
  9. A normal CUDA stream (per thread, does not implicitly
  10. synchronize with other streams).
  11. 'null' is a deprecated alias for 'legacy'.
  12. Allowed values for this option: 'legacy','null','per-thread'.
  13. Default value: 'legacy'.

 

Generic tool options. 


  
  1. =====================
  2. --disable-warnings (-w)
  3. Inhibit all warning messages.
  4. --keep-device-functions (-keep-device-functions)
  5. In whole program compilation mode, preserve user defined external linkage
  6. __device__ function definitions up to PTX.
  7. --source-in-ptx (-src-in-ptx)
  8. Interleave source in PTX. May only be used in conjunction with --device-debug
  9. or --generate-line-info.
  10. --restrict (-restrict)
  11. Programmer assertion that all kernel pointer parameters are restrict pointers.
  12. --Wreorder (-Wreorder)
  13. Generate warnings when member initializers are reordered.
  14. --Wno-deprecated-declarations (-Wno-deprecated-declarations)
  15. Suppress warning on use of deprecated entity.
  16. --Wno-deprecated-gpu-targets (-Wno-deprecated-gpu-targets)
  17. Suppress warnings about deprecated GPU target architectures.
  18. --Werror<kind>,... (-Werror)
  19. Make warnings of the specified kinds into errors. The following is the list
  20. of warning kinds accepted by this option:
  21. cross-execution-space-call
  22. Be more strict about unsupported cross execution space calls.
  23. The compiler will generate an error instead of a warning for a
  24. call from a __host__ __device__ to a __host__ function.
  25. reorder
  26. Generate errors when member initializers are reordered.
  27. deprecated-declarations
  28. Generate error on use of a deprecated entity.
  29. Allowed values for this option: 'cross-execution-space-call','deprecated-declarations',
  30. 'reorder'.
  31. --resource-usage (-res-usage)
  32. Show resource usage such as registers and memory of the GPU code.
  33. This option implies '--nvlink-options --verbose' when '--relocatable-device-code=true'
  34. is set. Otherwise, it implies '--ptxas-options --verbose'.
  35. --help (-h)
  36. Print this help information on this tool.
  37. --version (-V)
  38. Print version information on this tool.
  39. --options-file <file>,... (-optf)
  40. Include command line options from specified file.

 

文章来源: panda1234lee.blog.csdn.net,作者:panda1234lee,版权归原作者所有,如需转载,请联系作者。

原文链接:panda1234lee.blog.csdn.net/article/details/84564540

【版权声明】本文为华为云社区用户转载文章,如果您发现本社区中有涉嫌抄袭的内容,欢迎发送邮件进行举报,并提供相关证据,一经查实,本社区将立刻删除涉嫌侵权内容,举报邮箱: cloudbbs@huaweicloud.com
  • 点赞
  • 收藏
  • 关注作者

评论(0

0/1000
抱歉,系统识别当前为高风险访问,暂不支持该操作

全部回复

上滑加载中

设置昵称

在此一键设置昵称,即可参与社区互动!

*长度不超过10个汉字或20个英文字符,设置后3个月内不可修改。

*长度不超过10个汉字或20个英文字符,设置后3个月内不可修改。