简体   繁体   中英

cuPrintf cuda function

I want to use the cuPrintf function, and I get it from SDK. In the readme file they write the following

Use The cuPrintf package consists of two device functions (ie called from within a CUDA kernel) and three host functions (ie called from within the host application). These are packaged in a single cuPrintf.cu file, along with declarations included in a separate cuPrintf.cuh header file. To use cuPrintf in your application, you must do one of the following:

a) Either: Include the header-file cuPrintf.cuh at the top of your device code, and add cuPrintf.cu to your makefile or build command-line so that the file is included in your program.

b) Or: Directly “#include cuPrintf.cu” at the top of your device code. In this case you should not add this file to your makefile/build-command, and you should take care to only include it once in your entire project.

I tried some ways but all of them give me error, ( fatal error C1083: Cannot open include file: 'cuPrintf.cuh': No such file or directory )

  • I put the 'cuPrintf.cu' in the header folder in the VB 2008, and include but give me error, and change it to cuPrintf.cuh but also don't work.
  • I put both files in the extension of the project , and include them in the code , and also give me error.

Any suggestions about how to fix it, I need this function for my code.

I solved my error , by this way :

put both files ".cu & .cuh" in the same path of the project , and include "cuPrintf.cu" in the top of the code and delete the .cu file from the header

Hope this will help who face the same error

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM