NetSolve IDL - Simplified PDF

In an effort to help the library writers to easily integrate their problems into NetSolve, we are developing an IDL (Interface Definition Language) for NetSolve. The NetSolve IDL has a simpler format than the existing PDF (Problem Description File) mechanisms. Example 1: An example IDL is given below.


PROBLEM dgesv

Fortran ROUTINE dgesv(IN int N, IN int NRHS, INOUT double A[LDA][N],
                      IN int LDA, OUT int IPIV[N], INOUT double
                      B[LDB][NRHS], IN int LDB, OUT int INFO)

"From LAPACK -

Compute the solution to a real system of linear equations
  A * X = b
where A is an N-by-B matrix and X and B are N-by-NRHS matrices.

"
LIBS = "/usr/local/lib/liblapack.a
        /usr/local/lib/libf77blas.a
        /usr/local/lib/libatlas.a"

The above IDL describes a routine called dgesv written in Fortran. The routine accepts 8 parameters. Parameters 1, 2, 4 and 7 are input parameters of type integer. Parameter 8 is an output parameter of type integer. The fifth parameter, IPIV is an integer vector of N elements and is an output parameter. Parameters 3 and 6 are matrices of double precision numbers and act as both input and output parameters. The variables in the square brackets represent the rows and columns of the matrices respectively. For example, LDA represents the number of rows and N represents the number of columns of the matrix A.

The description of the function interface can be followed by comments about the problem in quotes. This is followed by a listing of the libraries needed for linking with the function. For example, in the above example, liblapack.a, libf77blas.a and libatlas.a are needed to link with the Fortran function dgesv.

The default type of the function is assumed to be sequential. Following is the Backus Normal Form (BNF) of the NetSolve IDL:

        <PROBLEMSTART>       -> <PROBLEMDESC> <FUNCTION>
    <PROBLEMDESC>        -> PROBLEM <PROBLEMNAME>
    <FUNCTION>           -> <LANGUAGE> FUNCTION <FUNCDEFN> <FUNCDESC>
                            <FUNCLIB> <FUNCMOVEABLE>
    <LANGUAGE>           -> C | FORTRAN
    <FUNCDEFN>           -> <FUNCNAME> ( <ARGLIST> )
    <FUNCDESC>           -> '' <STRING> ''
    <FUNCLIB>            -> LIBS = '' <STRING> ''
    <FUNCMOVEABLE>       -> empty | MOVEABLE | NONMOVEABLE
    <ARGLIST>            -> <ARGUMENT> | <ARGLIST> , <ARGUMENT>
    <ARGUMENT>           -> <INOUTSTRING> <DATATYPE> <VARNAME>
                            | <INOUTSTRING> <DATATYPE> <VARNAME>
                              <VACTORATTR>
                            | <INOUTSTRING> <DATATYPE> <VARNAME>
                              <MATRIXATTR>
                            | <INOUTSTRING> <DATATYPE> <VARNAME>
                              <SPARSEMATRIXATTR>
    <VECTORATTR>         -> [ <DIMENSIONEXPR> ]
    <MATRIXATTR>         -> [ <DIMENSIONEXPR> ] [ <DIMENSIONEXPR> ]
    <SPARSEMATRIXATTR>   -> <MATRIXATTR> <OPENANGLE> <NNZVAR> ,
                            <INDEXVAR> , <POINTERVAR> <CLOSEANGLE>
    <DIMENSIONEXPR>      -> <NUMBER> | <VARNAME>
    <OPENANGLE>          -> <
    <CLOSEANGLE>         -> >
    <NNZVAR>             -> IN int <VARNAME>
    <INDEXVAR>           -> IN int <VARNAME> <VECTORATTR>
    <POINTERVAR>         -> IN int <VARNAME> <VECTORATTR>
    <PROBLEMNAME>        -> <IDENTIFIER>
    <FUNCNAME>           -> <IDENTIFIER>
    <TYPESTRING>         -> sequential | parallel
    <INOUTSTRING>        -> IN | OUT | INOUT
    <DATATYPE>           -> int | float | double | char | scomplex |
                            dcomplex | string | file
    <VARNAME>            -> <IDENTIFIER>

Example 2: The following IDL file demonstrates the use of sparse matrix data structure in the IDL file.
PROBLEM sparse_direct_solve

C ROUTINE sparse_direct_solve(IN string package, IN int N, IN double
                              SM[N][N]<nnz, indices, pointer>, IN int
                              nnz, IN int indices[nnz], IN int
                              pointer[N], IN double rhs[N], IN double
                              pivot, IN int permutation, OUT double
                              sol[N])

"sparse direct solve - ma28 and superlu"
LIBS = "/home/vss/idltopdf/sparse_direct_wrapper.o
 -lm -L$(NETSOLVE_ROOT)/lib/$(NETSOLVE_ARCH) -lnetsolve_ma28
 -lnetsolve_superlu_serial -lnetsolve_aux -lnetsolve_direct_driver
 -lnetsolve_tester $(LIBDIR)/libma28.a $(SUPERLU_LIB_LINK)
 $(LAPACK_LIB_LINK) $(BLAS_LIB_LINK) -L$(MPI_DIR)/lib -lmpich"

In the above IDL file, the third parameter, SM, is a sparse matrix represented by a compressed-row format. N is the number of rows and columns of the sparse matrix, nnz is the number of non-zeros, indices is a vector of column indices and pointer is a vector containing a pointer to the first non-zero element in each row.

NoteLimitations
 

The NetSolve IDL is in the early stages of development and does not support all the features supported by PDF.

  1. The number of elements in a vector or the number of rows and columns in a matrix can be either constants or one of the input integer parameters. It cannot be an arithmetic expression.

  2. Files and strings are not supported by the NetSolve IDL.

  3. The IDL does not contain a code section where the user can write program statements.