CUV
0.9.201304091348
|
Classes | |
struct | cuv::allocator< value_type, size_type, memory_space_type > |
Allocator allows allocation, deallocation and copying depending on memory_space_type. More... | |
struct | cuv::allocator< value_type, size_type, host_memory_space > |
specialization of template allocator for host_memory_space More... | |
class | ProgressBar |
A progressbar :-) More... | |
class | Timing |
Simple class to perfom timing measurements. More... |
Macros | |
#define | cuvAssert(X) if(!(X)){ cuv::cuvAssertFailed(#X); } |
use this macro to ensure that a condition is true. | |
#define | DBG(X) #X <<":"<<(X)<<" " |
print the argument and its value to a stream |
Functions | |
template<class V , class V2 , class M , class M2 , class L > | |
bool | cuv::equal_shape (const tensor< V, M, L > &a, const tensor< V2, M2, L > &b) |
test whether two tensors have the same shape | |
void | cuv::cuvAssertFailed (const char *msg) |
fail with an error message, a stack trace and a runtime_exception (the nicest failures you've seen ^^!) | |
void | cuv::checkCudaError (const char *msg) |
check whether cuda thinks there was an error and fail with msg, if this is the case | |
void | cuv::initCUDA (int dev=0) |
Initializes CUDA context. | |
void | cuv::exitCUDA () |
quit cuda | |
void | cuv::safeThreadSync () |
synch threads from plain (non-cuda) C++ | |
int | cuv::getFreeDeviceMemory () |
Get available memory on device. | |
int | cuv::getMaxDeviceMemory () |
Get device memory. | |
int | cuv::countDevices () |
Returns number of CUDA devices. | |
int | cuv::getCurrentDevice () |
Get device id of current CUDA context. | |
Timing::Timing () | |
Creates a new Timing instance. | |
double | Timing::diff () const |
Returns the time difference between start and end. | |
void | Timing::update (int inc=1) |
Updates the end time of the Timing instance and increments the counter. | |
double | Timing::perf () |
Computes the performance measured by the Timing instance. | |
void | Timing::reset () |
Initializes the Timing instance. | |
int | Timing::count () const |
Returns the current value of the counter. |
#define cuvAssert | ( | X | ) | if(!(X)){ cuv::cuvAssertFailed(#X); } |
use this macro to ensure that a condition is true.
in contrast to assert(), this will throw a runtime_exception, which can be translated to python. Additionally, when using Linux, you get a full stack trace printed
Definition at line 60 of file cuv_general.hpp.
#define DBG | ( | X | ) | #X <<":"<<(X)<<" " |
print the argument and its value to a stream
Example:
Definition at line 74 of file cuv_general.hpp.
|
inline |
Returns the current value of the counter.
Definition at line 136 of file timing.hpp.
int cuv::countDevices | ( | ) |
Returns number of CUDA devices.
|
inline |
Returns the time difference between start and end.
Definition at line 111 of file timing.hpp.
bool cuv::equal_shape | ( | const tensor< V, M, L > & | a, |
const tensor< V2, M2, L > & | b | ||
) |
test whether two tensors have the same shape
a | first tensor |
a | second tensor |
Definition at line 2010 of file tensor.hpp.
int cuv::getCurrentDevice | ( | ) |
Get device id of current CUDA context.
int cuv::getFreeDeviceMemory | ( | ) |
Get available memory on device.
int cuv::getMaxDeviceMemory | ( | ) |
Get device memory.
void cuv::initCUDA | ( | int | dev = 0 | ) |
Initializes CUDA context.
dev | Device to use. If passed dev<0, does not call cudaInit. Then CUDA tries to automatically find a free device. |
|
inline |
Computes the performance measured by the Timing instance.
The performance is defined as follows m_counter / diff()
Definition at line 122 of file timing.hpp.
|
inline |
Initializes the Timing instance.
The initialization sets start and end time to the current time.
Definition at line 129 of file timing.hpp.
|
inline |
Creates a new Timing instance.
The start and endtime are initialized to the current time.
Definition at line 105 of file timing.hpp.
|
inline |
Updates the end time of the Timing instance and increments the counter.
inc | amount to increment the counter |
Definition at line 116 of file timing.hpp.