General¶
General Usage¶
fluxEngine is distributed as as single Python module, and may be imported via:
import fluxEngine
Error Handling¶
Errors are reported via the RuntimeError
exception class at the
moment.
Initializing the Library¶
To initialize the library a license file is required. The user must read that license file into memory and supply fluxEngine with it.
The following code demonstrates how to properly initialize fluxLicense:
with open('fluxEngine.lic', 'rb') as f:
licenseData = f.read()
handle = fluxEngine.Handle(licenseData)
Setting up processing threads¶
fluxEngine supports parallel processing, but it has to be set up at the
very beginning. This is done via the createProcessingThreads
method.
The following example code demonstrates how to perform processing with 4 threads, assuming a handle has already been created:
handle.createProcessingThreads(4)
Note
This will only create 3 (not 4!) background threads that will
help with data processing. The thread that calls
fluxEngine.ProcessingContext.processNext()
will be
considered the first thread (with index 0) that participates
in parallel processing.
Note
Modern processors support Hyperthreading (Intel) or SMT (AMD) to provide more logical cores that are phyiscally available. It is generally not recommended to use more threads than are phyiscally available, as workloads such as fluxEngine will typically slow down when using more cores in a system than are physically available.
Note
When running fluxEngine with very small amounts of data, in the extreme case with cubes that have only one pixel, parallelization will not improve performance. In cases where cubes consisting of only one pixel are processed, it is recommended to not parallelize at all and skip this step.
Note
Only one fluxEngine operation may be performed per handle at the same time; executing multiple processing contexts from different threads will cause them to be run sequentially.
Since it is currently possible to only create a single handle for fluxEngine, this means only one operation can be active at the same time; though the limitation of only a single handle will be lifted in a later version of fluxEngine.