OmniRPC User's Guide Version 1.2: http://www.omni.hpcc.jp/omnirpc/ <omnirpc@omni.hpcc.jp> | ||
---|---|---|
Prev | Appendix B. IDL (Interface Description Language) | Next |
We show an example as follows.
Module mat_mult; Define dmmul(mode_in int n, mode_in double A[n][n], mode_in double B[n][n], mode_out double C[n][n]) { double t; int i,j,k; for (i=0;i<n;i++){ for (j=0;j<n;j++){ t = 0; for (k=0;k<n;k++){ t += A[i*n + k] * B[k*n+j]; /* inner product */ } C[i*n+j] = t; } } }
The module statement defines the module name. The functions inside this module are described by the "Define" statement The definitions of the arguments are similar to those in C language, but some differences exist, as follows.
You can specify whether a variable is input (mode_in or IN) or output (mode_out or OUT).
For an array, you can specify its size with an input parameter.
It is impossible to use the return value of the function itself.
After the Define statement, you can describe any program in C language inside of brace ({...}). Argument names can be used as the arguments in C language without modification.
You can call a library function, like the example, below.
Define dmmul(mode_in int n, mode_in double A[n][n], mode_in double B[n][n], mode_out double C[n][n]) Calls "C" mmul(n,A,B,C);
This above example calls "mmul
"
function, which writes in C language.
And, you can define multiple functions inside the module's definition file. These descriptions should be in the remote executable program.
At the time of this writing, fundamental data types and their arrays are supported. We are going to support structure data types in a future release.