Create remote executable program

As in a C program, we create a program which executes a subroutine on remote hosts. So, we define an interface to innerprod. We set the module name as f_innerprod, and the function name as innerprod.

Module f_innerprod;

Define innerprod(IN int n, IN double a[n], IN double b[n],
        OUT double result[1])
Calls "Fortran" innerprod_(n,a,b,result);

The argument which specifies the array size must be a scalar variable. The double precision type in FORTRAN is "double", the real type is "float". If you directly call a FORTRAN function with calls, you specify "Fortran". Calling a function can mangle the function name in FORTRAN. Usually, in the case of the FORTRAN compiler, a mangled name is a name to which "_" has been added. Please pay attention to whether a function name contains "_"; if it is mangled, add "__" in g77 (gcc).

This definition is the same as the above definition. As scalar variable is taken as the address pointer.

Module f_innerprod;

Define innerprod(IN int n, IN double a[n], IN double b[n],
        OUT double result[1])
{
    innerprod_(&n,a,b,result);
}

Generate OmniRPC's remote executable modules from this IDL file. We name this IDL file f_ip.idl.

%  omrpc-fc f_ip.idl ip.f
      

When you run this command, the remote executable program f_ip.rex is generated. To register with omrpc-register, the method is the same as in C language.

%  omrpc-register -register f_ip.rex
      

The command omrpc-fc, it compiles FORTRAN program with f77. If you want to use another compiler, use the "-fc" option. For example, if you want to use the intel Fortran compiler of ifc, run the following command.

%  omrpc-fc -fc ifc f_ip.idl ip.f