HPXCL
 All Classes Functions
Public Member Functions
hpx::cuda::program Class Reference

This class represents a specific CUDA program containing the CUDA kernel. More...

#include <program.hpp>

List of all members.

Public Member Functions

 program (hpx::future< hpx::naming::id_type > &&gid)
hpx::lcos::future< void > build (std::vector< std::string > compilerFlags, std::vector< std::string > modulenames, unsigned int debug=0)
 This method compiles the set source code.
void build_sync (std::vector< std::string > compilerFlags, std::string modulename, unsigned int debug=0)
 Synchronous compilation of the source code.
hpx::lcos::future< void > build (std::vector< std::string > compilerFlags, std::string modulename, unsigned int debug=0)
void build_sync (std::vector< std::string > compilerFlags, std::vector< std::string > modulenames, unsigned int debug=0)
 Synchronous compilation of the source code.
void set_source_sync (std::string source)
 Synchronous setting source code.
hpx::lcos::future< void > run (std::vector< hpx::cuda::buffer > args, std::string modulename, hpx::cuda::server::program::Dim3 grid, hpx::cuda::server::program::Dim3 block, int stream=-1)
 This method executes the kernel, compiled or set to this program.
hpx::lcos::future< void > run (std::vector< hpx::cuda::buffer > args, std::string modulename, hpx::cuda::server::program::Dim3 grid, hpx::cuda::server::program::Dim3 block, std::vector< hpx::cuda::buffer > dependencies, int stream=-1)
 This method executes the kernel, compiled or set to this program.
hpx::lcos::future< void > run (std::vector< hpx::cuda::buffer > args, std::string modulename, hpx::cuda::server::program::Dim3 grid, hpx::cuda::server::program::Dim3 block, hpx::cuda::buffer dependency, int stream=-1)
hpx::lcos::future< unsigned int > get_streams_size ()
 This method returns the number of streams at this device.
hpx::lcos::future< unsigned int > create_stream ()
 This method returns the id of this created stream at the device.

Detailed Description

This class represents a specific CUDA program containing the CUDA kernel.

This class manage the execution of a specific CUDA kernel. The CUDA kernel is compiled on run time with the nvrtc library.

A program contain one default cudaStream where the kernel are attached to, if there is no stream defined. For multi-streaming applications new streams can be created within a program. The kernel related to this program are pinned to this streams.

Examples:
build_kernel.cpp, build_kernel_from_file.cpp, and streams.cpp.

Member Function Documentation

hpx::lcos::future<void> hpx::cuda::program::build ( std::vector< std::string >  compilerFlags,
std::vector< std::string >  modulenames,
unsigned int  debug = 0 
) [inline]

This method compiles the set source code.

This methods uses the nvrtc library to compile the CUDA source code. You should use this method only for compiling small CUDA kernels for testing or for only accelerating small parts of your existing code.

Parameters:
compilerFlagsA list with all compiler flags passed to the nvcc compiler
modulenameName of the kernel, which to be compiled
debugCompile with debug flags
Note:
It is not possible to use included headers.
Compiling a program in debug modus adds -G and -lineinfo to the nvcc compiler flags
Examples:
build_kernel.cpp, and streams.cpp.
hpx::lcos::future<unsigned int> hpx::cuda::program::create_stream ( ) [inline]

This method returns the id of this created stream at the device.

Returns:
Future containing the streams id
hpx::lcos::future<unsigned int> hpx::cuda::program::get_streams_size ( ) [inline]

This method returns the number of streams at this device.

Returns:
Future containing the number of streams created on the device
hpx::lcos::future<void> hpx::cuda::program::run ( std::vector< hpx::cuda::buffer args,
std::string  modulename,
hpx::cuda::server::program::Dim3  grid,
hpx::cuda::server::program::Dim3  block,
int  stream = -1 
) [inline]

This method executes the kernel, compiled or set to this program.

Parameters:
modulenameThe name of the kernel
argsThe function arguments passed to the kernel
gridThe dimensions of the grid size
blockThe dimensions of the block size
streamThe stream at which the kernel is attached to
Note:
Each program has a default stream, which is not the same as the default stream of the CUDA API. Not setting the last parameter implies that the kernel is executed on the default stream of this program.
Examples:
build_kernel.cpp, build_kernel_from_file.cpp, and streams.cpp.
hpx::lcos::future<void> hpx::cuda::program::run ( std::vector< hpx::cuda::buffer args,
std::string  modulename,
hpx::cuda::server::program::Dim3  grid,
hpx::cuda::server::program::Dim3  block,
std::vector< hpx::cuda::buffer dependencies,
int  stream = -1 
) [inline]

This method executes the kernel, compiled or set to this program.

Parameters:
modulenameThe name of the kernel
argsThe function arguments passed to the kernel
gridThe dimensions of the grid size
blockThe dimensions of the block size
dependenciesThe data, the kernel execution depends on
streamThe stream at which the kernel is attached to
Note:
Each program has a default stream, which is not the same as the default stream of the CUDA API. Not setting the last parameter implies that the kernel is executed on the default stream.

The documentation for this class was generated from the following file:
 All Classes Functions