I am doing a PhD on OO design of parallel iterative method
for eigenvalue problem. Our main goal with OO programming is
to free the application developer (our test applications
are iterative methods) from the use of parallel primitive such
as MPI calls in its (parallel) application.
This application programmer should program without knowing if
its application will be parallel or not in using sequential predefined
basic classes, lets say the Matrix class. After that we may give him
a descendant of Matrix class that handles parallelism, and its
application may polymorphically exploit parallelism without changing
the initial sequential code.
A trouble comes to bring parallelism through inheritance
and polymorphism.
Let's say our developper has built a class:
Itmethod(Matrix* A, Matrix* X, Matrix* Y)
whose method:
Itmethod::compute()
{
Y -> axpy(A,X);
}
uses the Matrix method:
Matrix::apxy(Matrix* A, Matrix* Y)
which computes the AXPY operation Y = A*X +Y.
If we derive a distributed matrix class DMatrix from Matrix
and we pass it to Itmethod, polymorphism will takes place
for the call to axpy(...) on Y in method Itmethod::compute()
but we won't be able to overload this method correctly since
A and X has been upcasted into Matrix* in Itmethod.
In fact we wanted to overload:
Matrix::apxy(Matrix* A, Matrix* Y)
in
DMatrix::axpy(DMatrix* A, DMatrix* Y)
which is not a proper overload.
After this several questions have been asked:
1) Is it reasonable to require that we go from sequential
to parallel version without changing anything in Itmethod?
Or in another way, should we provide only a DMatrix class?
2) As far as I know this problem is a "multiple dispatch problem".
If Matrix::apxy(...) has only 1 argument we can use the Visitor
pattern to solve it. Does anyone knows design pattern that solves
the multiple dispatch problem?
I did one of myself but may be others have already done this job.
3) Does anyone know a OO langage that handles multiple dispatch
directly? Someone told me about OO Lisp but was unable to
explain me how it was done.
Eric NOULARD
Eric.Noulard@prism.uvsq.fr
------------------------------------------------------------------
Societe ADULIS and Laboratoire PRiSM
3, rue Rene Cassin 45, av. des Etats-Unis
F-91742 MASSY Cedex F-78035 VERSAILLES Cedex
Tel: +33 1 60 13 06 28 Tel: +33 1 39 25 44 26
This archive was generated by hypermail 2b29 : Wed Feb 20 2002 - 03:20:06 EST