|Description||This function initializes the multi-processor libraries. It takes the number of processor cores as argument and creates the appropriate number of additional worker threads, so that subsequent OptiVec functions can distribute their work-load over the available processor cores. nProcCores can presently take on values of 2, 4, 8, 16, or 32. When Intel, AMD or others shall announce the development of systems with even more processor cores, future versions of OptiVec shall make provisions for as many cores as may become available. At the time of writing, the highest number publicly mentioned as a development project by Intel is 32.
V_initMT must be called once (and only once), before any of the OptiVec routines present in the multi-processor libraries can be executed. On the other hand, calling V_initMT, when you are using a general-purpose (non-threaded) OptiVec library, does not harm. V_initMT is present as an empty function also in these libraries. Calling it just does not have any effect. Thereby, switching back and forth between the various versions of OptiVec libraries for testing purposes is facilitated.
In case you use V_setFPAccuracy in order to modify the floating-point accuracy of the FPU, be sure that the call to V_initMT stands after the call to V_setFPAccuracy. The reason is that V_initMT creates the additional threads with the same FPU settings as found at the moment when the function is invoked.
nProcCores need not be your actual number of processor cores. For testing purposes, you can enter any of the legal values. Of course, optimum performance will be attained only for the correct value. For applications distributed to others, where you do not have control over the configuration of the systems they will ultimately run on, it is recommended to determine nProcCores either through user input or more elegantly through a system detection routine. Consult the processor documentations by Intel and AMD for details.
Although it is not absolutely necessary, it is recommended that you delete the extra threads by calling V_closeMT at the end of your programme.
V_initMT stores the number of processor cores in the public variable V_nProcCores which is defined as (extern "C") unsigned in C/C++, and as UInt in Delphi. Reading this variable, one can determine if V_initMT has already been called.