|
|||||||||
VL soft met à disposition de la communauté un projet de calcul distribué développé en Java 1.6+ qui fonctionne sous Windows, Linux et Solaris et probablement sur tous les environnements qui supportent Java.
Ce projet s'appelle myfarm. Il est disponible sous licence LGPL, c'est à dire que le projet lui-même est entièrement libre et qu'il peut être incorporé dans des projets commerciaux sans compromettre les droits et la propriété de ces projets.
myfarm est déjà opérationnel dans sa première version et contient un exemple de calcul d'option européenne avec la méthode Monte-Carlo. Il reste cependant un peu de travail pour l'incorporer dans une solution professionnelle.
Pour décrire rapidement ce projet, myfarm est constitué de 4 agents qui communiquent entre eux régulièrement et d'une API:
myfarm peut fonctionner dans un environnement hétérogène, gère la charge des ressources et répartit au mieux les services sur les différents noeuds. Il est aussi tolérant aux pannes.
Pourquoi le faire en Java et pas en C++ ? Pour plusieurs raisons, souvent objectives:
Quels sont les principes de développement ?
Ce projet sera géré avec Subversion (à mettre en place) et un wiki (à mettre en place également) sera dédié à son utilisation, son support et tout autre sujet qui peut le concerner.
Voici un premier tutorial (en anglais) sur la manière de l'inclure dans un projet.
Suppose that you have a process that you want to split and distribute
on several computers.
Let's take the evaluation of an european option with Monte-Carlo method
as an example.
An option is described by its maturity,
its strike and its spot.
The evaluation of this option needs the volatility of the spot
and the risk free rate.
The basic algorithm consists in launching many simulations:
It is obvious that we can split the simulation part so that each
processor takes care of its range of simulations.
Then when all ranges are finished we can compute the average and the discount
to get the price.
With myfarm, this process is encapsulated in
2 classes: Service and Job.
Service class takes care of splitting
the process and to join or integrate individual results into one main result.
Job class is in charge of computing
an individual part of the process.
To put the process on the farm, we need the Client
class.
So, first thing to do is to extend the Service
and Job classes and to override some
methods by creating ServiceOption
and JobOption classes.
ServiceOption owns an option, number
of simulations and the option price.
JobOption will receive these parameters
and also additionnal infos when the service will split the process.
Don't forget when you create structures like Option
to add them Serializable property
because it is necessary to transport the service through the farm.
Override:
Now we can run this process on the farm by using a Client class:
For more explanations, read ServiceOption.java, JobOption.java and Test.java codes.
That's all folks!