CUDALink`NVCCCompiler`
CUDALink`NVCCCompiler`

NVCCCompiler

CreateLibrary[src,name,"Compiler"->NVCCCompiler]

compiles a string of CUDA code in src into a library and returns the full path to the library.

CreateLibrary[{file,},name,"Compiler"->NVCCCompiler]

compiles a number of CUDA and C source files into a library and returns the full path to the library.

CreateExecutable[src,name,"Compiler"->NVCCCompiler]

compiles a string of CUDA code in src into an executable and returns the full path to the executable.

CreateExecutable[{file,},name,"Compiler"->NVCCCompiler]

compiles a number of CUDA, mprep, and C source files into an executable and returns the full path to the executable.

CreateObjectFile[src,name,"Compiler"->NVCCCompiler]

compiles a string of CUDA code in src into an object file and returns the full path to the object file.

CreateObjectFile[{file,},name,"Compiler"->NVCCCompiler]

compiles a number of CUDA and C source files into object files and returns the full path to the object files.

Details and Options

  • The CUDALink application must be loaded using Needs["CUDALink`"].
  • A supported C compiler must be installed on the system. This can be Visual Studio 2005 or 2008 on Windows, or GNU GCC 4.1, 4.2, or 4.3 on Unix.
  • If the source is a string, the NVCCCompiler treats it as CUDA code. If the source is a list of one or more strings, then the code is treated as a list of files containing CUDA code.
  • The extension given to the output file depends on the platform for which the file is created and the options used.
  • NVCCCompiler is used internally by CUDAFunctionLoad.
  • The following options can be given:
  • "CleanIntermediate"Truewhether temporary files should be deleted
    "CompileOptions"{}compile options passed directly to the NVCC compiler
    "CompilerInstallation"Automaticlocation of the CUDA Toolkit installation
    "CreateBinary"Truewhether the binary should be created
    "CreateCUBIN"Falsewhether to create a .cubin file (a GPU binary) rather than a library
    "CreatePTX"Falsewhether to create a .ptx file (a GPU bytecode) rather than a library
    "CUDAArchitecture"AutomaticCUDA architecture to target
    "Defines"{}defines passed to the NVCC preprocessor
    "ExtraObjectFiles"{}extra object files to compile with
    "IncludeDirectories"{}directories to include in the compilation
    "Libraries"{}libraries to link against
    "LibraryDirectories"{}library directories to include in the compilation
    "LinkerOptions"{}linker options passed from NVCC to the C linker
    "MprepOptions"""options passed to mprep
    "ShellCommandFunction"Nonefunction to call with the shell commands used for the compilation
    "ShellOutputFunction"Nonefunction to call with the shell output of running the compilation commands
    "SystemCompileOptions"{}base compile options
    "SystemIncludeDirectories"AutomaticCUDALink and the Wolfram Language include directories to include
    "SystemLibraries"AutomaticCUDALink and Wolfram Language libraries to link against
    "SystemLibraryDirectories"AutomaticCUDALink and Wolfram Language library directories to include
    "SystemLinkerOptions"Automaticsystem linker options passed from NVCC to the C linker
    "TargetDirectory"$CCompilerDefaultDirectorythe directory in which the library file should be generated
    "TargetSystemID"$SystemIDsystem to compile the library for
    "UnmangleCode"Falsewhether to surround code with external "C" to avoid C++ name mangling
    "WorkingDirectory"Automaticthe directory in which temporary files will be generated
    "XCompileOptions"Automaticcompile options passed from NVCC to the C compiler
    "XCompilerInstallation"Automaticdirectory where NVCC will find the C compiler is installed

Examples

Basic Examples  (3)

First, load the CUDALink application and the C compiler driver:

This is a sample CUDA source file:

This compiles the code into a library:

This reads the CUDA code into a Wolfram Language string:

This creates a CUDA library using the string imported:

This imports the CUDA program as a string:

This compiles the CUDA program into CUDA executable byte code (PTX) file, showing the compilation command used:

This displays the output PTX byte code in the Wolfram Language:

Wolfram Research (2010), NVCCCompiler, Wolfram Language function, https://reference.wolfram.com/language/CUDALink/ref/NVCCCompiler.html.

Text

Wolfram Research (2010), NVCCCompiler, Wolfram Language function, https://reference.wolfram.com/language/CUDALink/ref/NVCCCompiler.html.

CMS

Wolfram Language. 2010. "NVCCCompiler." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/CUDALink/ref/NVCCCompiler.html.

APA

Wolfram Language. (2010). NVCCCompiler. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/CUDALink/ref/NVCCCompiler.html

BibTeX

@misc{reference.wolfram_2023_nvcccompiler, author="Wolfram Research", title="{NVCCCompiler}", year="2010", howpublished="\url{https://reference.wolfram.com/language/CUDALink/ref/NVCCCompiler.html}", note=[Accessed: 29-March-2024 ]}

BibLaTeX

@online{reference.wolfram_2023_nvcccompiler, organization={Wolfram Research}, title={NVCCCompiler}, year={2010}, url={https://reference.wolfram.com/language/CUDALink/ref/NVCCCompiler.html}, note=[Accessed: 29-March-2024 ]}