To use a Charisma module library, the programmer first needs to create an instance of the library. There are two steps: including the module and creating an instance.
{foodecl}
use FFT3D;
library f1 : FFT3D(CHUNK=10,M=10,N=100);
library f2 : FFT3D(CHUNK=8,M=8,N=64);
The keyword use and the module name includes the module in the program, and the keyword library creates an instance with the instance name, followed by the module name with value assignment of configuration variables. These statements must appear in the declaration section before the library instance can be used in the main program's orchestration code.
Invoking the library is like calling a publish statement; the input and output parameters are the same, and the object name and function name are replaced with the library instance name and the keyword call connected with a colon.
{foodecl}
(f1_outdata[*]) <- f1:call(f1_indata[*]);
Multiple instances can be created out of the same module. Their execution can interleave without interfering with one another.
November 23, 2009
Charisma Homepage
Charm Homepage