![]() |
Langmuir
Simulation
|
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 | |
| World & | m_world |
| Reference to World object. More... | |
A class to run OpenCL calculations.
| LangmuirCore::OpenClHelper::OpenClHelper | ( | World & | world, |
| QObject * | parent = 0 |
||
| ) |
Create THE OpenClHelper; don't make more than one.
| world | reference to World Object |
| parent | QObject this belongs to |
| 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)
| index | position in host vectors |
| site | serial site-id |
| charge | charge of carrier |
| double LangmuirCore::OpenClHelper::getOutputHost | ( | int | index | ) | const |
Get the result stored in host memory (for current site)
| index | position in host vectors |
| double LangmuirCore::OpenClHelper::getOutputHostFuture | ( | int | index | ) | const |
Get the result stored in host memory (for future site)
| index | position 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.
| on | True if on |
For example, don't allow one to turn OpenCL on if OpenCL can't be used on this platform.