Communication Interface between SAC-2 and LiDIA

Gábor A. Simon

Universität Tübingen

Unfortunately, the pictures are missing in this archive.


There are a lot of computer algebra systems with different objectives. One possible way to make these innovative algorithms available outside their native system is standardization (E.g., OpenMath). But there is little indication that the trend towards this diversity will drastically change, and even if the standardization activities become more and more stronger, the adaptation of the standards for all of these systems will take a long time.

Our presented approach tries to use available industrial standards and techniques to solve these problems. We will discuss the advantages and disadvantages of this attempt and show what parts have to be supplied by the application developer and what can be automatically generated by tools.


Is it realistic?

Distributed object managers as e.g, CORBA (Common Object Request Broker Architecture) makes distributed application development easier, providing an infrastructure.

Inter-Language Unification (ILU)

Xerox Corporation PARC

ILU specific features

  • Network garbage collection for objects
  • Unicode support
  • The OPTIONAL type, which allows recursive data structures TYPE OptNode = OPTIONAL Node; TYPE Node = RECORD data: SomeType, left: OptNode, right: OptNode END;
  • ILU Interface Specification Language (ISL)

    Stubber and Runtime Library

    Sample Application

    Using the following sample problem, we will demonstrate the main steps the developer has to do to build an application based on interoperable objects.

    The client application generates a matrix with arbitrary precision coefficients, sending a request to the LiDIA server to compute its determinant, and receiving the result or some error messages.

    The first step is to build a server application, based on the interface definition using a selected subset of the LiDIA objects. The LiDIA package is implemented in C++.

    The client application is written in ALDES, using the SAC-2 library. We used an ANSI C backend for the ALDES implementation. That is why the communication specific part is written in C. The client application has to convert the arguments of the requested LiDIA methods, if the arguments do not match the interface used by the LiDIA server.

    As the next Figure shows, both the client and server applications have several parts, libraries and automatically generated stubs.

    Server and Client-side Components of the Application

    Server-side ISL Specification

    Defines the interface between client and server. INTERFACE det; EXCEPTION DivideByZero; EXCEPTION NumTooBig; TYPE BigIntBJEC = OBJECT METHODS isbiggerthan ( x : INTEGER) : BOOLEAN, setValue ( w : INTEGER), setbigValue ( bw : BigInteger), getValue () : INTEGER RAISES NumTooBig END, add ( a : INTEGER), bigadd ( ba : BigInteger), mul ( m : INTEGER), divrem (d : INTEGER) : INTEGER RAISES DivideByZero END END; TYPE BigIntMatriC = OBJECT METHODS setnorows (y : INTEGER), setnocolumns (x :INTEGER), setelem (x :INTEGER, y :INTEGER, e : BigInteger) END; TYPE bigintlib = OBJECT METHODS bigint ( wert : INTEGER ) : BigInteger, bigintmatrix () : BigIntMatrix, mul ( b : BigInteger, c : BigInteger) : BigInteger, determ ( a : BigIntMatrix) : BigInteger END; This defines an interface det, exceptions DivideByZero and NumTooBig, object types BigInteger, BigIntMatrix and bigintlib. The interface, det, is a way of grouping a number o f type and exception definitions. This is important to prevent collisions between names.

    Server-side Method Definitions

    The developer writes C++ definitions for the methods: ... class BigIntMatrix : public det_T_BigIntMatrix { public: BigIntMatrix(); // constructor // methods void setnorows (detStatus *_status, long int y); void setnocolumns (detStatus *_status, long int x); void setelem (detStatus *_status, long int x, long int y, class det_T_BigInteger *e); // data bigint_matrix M; }; ... void BigIntMatrix::setelem(detStatus *_status, long int x, long int y, class det_T_BigInteger *e) { M.sto(x,y, ((class BigInteger *)e)->Wert); _status->returnCode = detReply_Success; } ...

    Writing Main Server Program

    ... int main (int argc, char *argv[]) { det_T_bigintlib *i; iluServer s("det-server", NULL); s.AddPort (NULL, NULL, ilu_TRUE); ilu::SetDefaultServer(&s); i = new bigintlib("BIGINT", &s); if (!i->ILUPublish()) { cerr << "**** Error, couldn't publish object\n" ; exit(1); } cout << "Exported " << i->ILUStringBindingHandle() << "\n"; s.Run(); }

    Binding a Client to a Target Object

    Steps for binding a client to a target object:
    1. A client obtains an object reference from the server (det_server_ connect). This object reference serves as a local proxy for the remote target object.
    2. The client may then invoke methods on its proxy.

    Client-side Example

    The client programmer writes the following: #include "det.h" #define ERRCHECK if (!ILU_C_SUCCESSFUL(&env)) { fprintf (stderr, "error signalled <%s>.\n", ILU_C_EXCEPTION_ID(&env)); exit(1); } int LiDDET(int M) { int time; /* LiDIA variables */ det_bigintlib l; det_BigIntMatrix m; det_BigInteger e; det_BigInteger d; /* ALDES/SAC-2 variables */ extern int SPACE[], BETA, BETA1; /* ILU variables */ ILU_C_ENVIRONMENT env; ... extern int libi2abi(); extern det_BigInteger abi2libi(); extern det_bigintlib det_bigintlib_determ(); l = det_server_connect(); /* creating LiDIA - BigIntMatrix m */ ... d = det_bigintlib_determ (l, &env, m); ERRCHECK; time = CLOCK()-time; printf("execution time : %d ms\n", time); /* get back the result and convert to SAC-2 format */ time = CLOCK(); D = libi2abi( d); time = CLOCK()-time; printf("transf.+conv. of the determinant d : %d ms\n", time); return D; }


    Relation to OpenMath

    Future plans

    This page is part of the OpenMath Web archive, and is no longer kept up to date.