GCVL
Multi-platform (Windows, Unix and Mac OS) C++/OpenCL/CUDA library with several Computer Vision algorithms.
src/gcvl/opencl/oclutils.cpp File Reference
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <cerrno>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <sstream>
#include <stdint.h>
#include <boost/interprocess/sync/file_lock.hpp>
#include <boost/filesystem.hpp>
#include <unistd.h>
#include <sys/time.h>
#include <sys/file.h>
#include "oclutils.h"
#include "../gcvlutils.h"

Defines

#define _QUOTEME(x)   #x
#define QUOTEME(x)   _QUOTEME(x)
#define assert(x)

Functions

std::string Get_Lock_Filename (const int device_id, const int platform_id_offset, const std::string &platform_name, const std::string &device_name)
int Lock_File (const char *path, const bool quiet=false)
void Unlock_File (int f, const bool quiet=false)
void Wait (const double duration_sec)
std::string Bytes_in_String (const uint64_t bytes)
bool Verify_if_Device_is_Used (const int device_id, const int platform_id_offset, const std::string &platform_name, const std::string &device_name)
char * read_opencl_kernel (const std::string filename, int *length)
std::string OpenCL_Error_to_String (cl_int error)
 Obtains the error string associated to an OpenCL error id.

Variables

const double B_to_KiB = 9.76562500000000e-04
const double B_to_MiB = 9.53674316406250e-07
const double B_to_GiB = 9.31322574615479e-10
const double KiB_to_B = 1024.0
const double KiB_to_MiB = 9.76562500000000e-04
const double KiB_to_GiB = 9.53674316406250e-07
const double MiB_to_B = 1048576.0
const double MiB_to_KiB = 1024.0
const double MiB_to_GiB = 9.76562500000000e-04
const double GiB_to_B = 1073741824.0
const double GiB_to_KiB = 1048576.0
const double GiB_to_MiB = 1024.0

Define Documentation

#define _QUOTEME (   x)    #x
#define assert (   x)
Value:
if (!(x)) {                                         \
        std_cout                                        \
            << "##########################"             \
            << "##########################"             \
            << "##########################\n"           \
            << "Assertion failed in \"" << __FILE__     \
            << "\", line " << __LINE__ << ": "          \
            << "!(" << QUOTEME(x) << ")\n"              \
            << "##########################"             \
            << "##########################"             \
            << "##########################\n"           \
            << std::flush;                              \
        abort();                                        \
    }
#define QUOTEME (   x)    _QUOTEME(x)

Function Documentation

std::string Bytes_in_String ( const uint64_t  bytes) [inline]
std::string Get_Lock_Filename ( const int  device_id,
const int  platform_id_offset,
const std::string &  platform_name,
const std::string &  device_name 
)
int Lock_File ( const char *  path,
const bool  quiet 
)

Attempt to lock file, and check lock status on lock file

Returns:
file handle if locked, or -1 if failed
std::string OpenCL_Error_to_String ( cl_int  error)

Obtains the error string associated to an OpenCL error id.

Parameters:
errorOpenCL error id.
Returns:
OpenCL error string.
char* read_opencl_kernel ( const std::string  filename,
int *  length 
)
void Unlock_File ( int  f,
const bool  quiet 
)

Unlock file

bool Verify_if_Device_is_Used ( const int  device_id,
const int  platform_id_offset,
const std::string &  platform_name,
const std::string &  device_name 
)
void Wait ( const double  duration_sec)

Variable Documentation

const double B_to_GiB = 9.31322574615479e-10
const double B_to_KiB = 9.76562500000000e-04
const double B_to_MiB = 9.53674316406250e-07
const double GiB_to_B = 1073741824.0
const double GiB_to_KiB = 1048576.0
const double GiB_to_MiB = 1024.0
const double KiB_to_B = 1024.0
const double KiB_to_GiB = 9.53674316406250e-07
const double KiB_to_MiB = 9.76562500000000e-04
const double MiB_to_B = 1048576.0
const double MiB_to_GiB = 9.76562500000000e-04
const double MiB_to_KiB = 1024.0
 All Classes Namespaces Files Functions Variables Defines