Langmuir
Simulation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
LangmuirCore::OpenClHelper Class Reference

A class to run OpenCL calculations. More...

#include <openclhelper.h>

Public Member Functions

 OpenClHelper (World &world, QObject *parent=0)
 Create THE OpenClHelper; don't make more than one. More...
 
void initializeOpenCL (int gpuID=-1)
 Perform the tedious boilerplate code to initialize OpenCL. More...
 
void launchCoulombKernel1 ()
 Kernel1 calculates the coulomb potential at every site. More...
 
void launchCoulombKernel2 ()
 Kernel2 calculates the coulomb potential at current and future sites only. More...
 
void launchGaussKernel1 ()
 Kernel1 calculates the coulomb potential with erf at every site. More...
 
void launchGaussKernel2 ()
 Kernel2 calculates the coulomb potential with erf at current and future sites only. More...
 
void copySiteAndChargeToHostVector (int index, int site, int charge=-1)
 Does exactly what it says (host means the memory on the CPU) More...
 
double getOutputHost (int index) const
 Get the result stored in host memory (for current site) More...
 
double getOutputHostFuture (int index) const
 Get the result stored in host memory (for future site) More...
 
void compareHostAndDeviceForAllCarriers ()
 Compare GPU and CPU results. More...
 
bool toggleOpenCL (bool on)
 Turn on/off OpenCL in a smart-way. More...
 

Private Attributes

Worldm_world
 Reference to World object. More...
 

Detailed Description

A class to run OpenCL calculations.

Constructor & Destructor Documentation

LangmuirCore::OpenClHelper::OpenClHelper ( World world,
QObject *  parent = 0 
)

Create THE OpenClHelper; don't make more than one.

Parameters
worldreference to World Object
parentQObject this belongs to
Warning
initializeOpenCL() must be called seperately

Member Function Documentation

void LangmuirCore::OpenClHelper::compareHostAndDeviceForAllCarriers ( )

Compare GPU and CPU results.

void LangmuirCore::OpenClHelper::copySiteAndChargeToHostVector ( int  index,
int  site,
int  charge = -1 
)

Does exactly what it says (host means the memory on the CPU)

Parameters
indexposition in host vectors
siteserial site-id
chargecharge of carrier
double LangmuirCore::OpenClHelper::getOutputHost ( int  index) const

Get the result stored in host memory (for current site)

Parameters
indexposition in host vectors
double LangmuirCore::OpenClHelper::getOutputHostFuture ( int  index) const

Get the result stored in host memory (for future site)

Parameters
indexposition in host vectors

There is a fixed offset in the host memory between the current and future site results

void LangmuirCore::OpenClHelper::initializeOpenCL ( int  gpuID = -1)

Perform the tedious boilerplate code to initialize OpenCL.

void LangmuirCore::OpenClHelper::launchCoulombKernel1 ( )

Kernel1 calculates the coulomb potential at every site.

This is extremely expensive on the CPU, it would take forever. The GPU will do it in a few seconds. Luckily, the only reason to ever call this kernel is if we want to save a snapshot of the coulomb potential - something that is not needed during a normal simulation.

void LangmuirCore::OpenClHelper::launchCoulombKernel2 ( )

Kernel2 calculates the coulomb potential at current and future sites only.

void LangmuirCore::OpenClHelper::launchGaussKernel1 ( )

Kernel1 calculates the coulomb potential with erf at every site.

void LangmuirCore::OpenClHelper::launchGaussKernel2 ( )

Kernel2 calculates the coulomb potential with erf at current and future sites only.

bool LangmuirCore::OpenClHelper::toggleOpenCL ( bool  on)

Turn on/off OpenCL in a smart-way.

Parameters
onTrue if on
Returns
The on/off status

For example, don't allow one to turn OpenCL on if OpenCL can't be used on this platform.

Member Data Documentation

World& LangmuirCore::OpenClHelper::m_world
private

Reference to World object.


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