Blocking Call

The blocking call to NetSolve from C or Fortran77 is the easiest to implement. Specifically, if the main program is in C, one calls the function, netsl(), and if the main program is in Fortran77, one calls the function, FNETSL(). This C function returns an error code. It takes as arguments the name of a problem and the list of input data. These inputs are listed according to the calling sequence discussed in the section called What is the Calling Sequence?. The C prototype of the function is
int netsl(char *problem_name, ... < argument list > ...)
and the Fortran77 prototype is
 SUBROUTINE FNETSL( PROBLEM_NAME, STATUS, ...
&                  < argument list > ...)
where PROBLEM_NAME is a string and STATUS is the integer status code returned by NetSolve.

Let us resume our example of the call to dgesv. In Fortran77, the direct call to LAPACK looks like
CALL DGESV( N, 1, A, LDA, IPIV, B, LDB, INFO )
The equivalent blocking call to NetSolve is
 CALL FNETSL('DGESV()', STATUS, N, 1, A, LDA, IPIV,
&            B, LDB, INFO )

The call in C is
status = netsl('dgesv()',n,1,a,lda,ipiv,b,ldb,&info);
Notice that the name of the problem is case insensitive and that it is appended by an opening and a closing parenthesis. The parentheses are used by NetSolve to handle Fortran/C interoperability on certain platforms. In Fortran77, every identifier represents a pointer, but in C we actually had the choice to use pointers or not. We chose to use integer (int) for the sizes of the matrices/vectors, but pointers for everything else.

From the user's point of view, the call to NetSolve is exactly equivalent to a call to LAPACK. One detail, however, needs to be mentioned. Most numerical software is written in Fortran77 and requires users to provide workspace arrays as well as data, since there is no possibility for dynamic memory allocation. Because we preserved the exact calling sequence of the numerical software, we require the user to pass those arrays. But, since the computation is performed remotely, workspace on the client side is meaningless. It will, in fact, be dynamically created on the server side. Therefore, when the numerical software would require workspace, the NetSolve user may provide a one-length array for workspace.

This is signaled in the output of NS_probdesc by an argument description such as:
 - Argument #6:
   - ignored