Matlab & Scilab Applications to Finance Fabien Viale, Denis Caromel, et al. http://ProActive.ObjectWeb.org OASIS Team INRIA -- CNRS - I3S -- Univ. of Nice Sophia-Antipolis, IUF 1. 2. 3. 4. 5. 1 Fabien Viale Introduction / Principles ProActive context Scilab integration Matlab integration Application to Finance Introduction 2 Fabien Viale Introduction - Matlab • • • • 3 Leading numerical computing environment Used by more than one million people Interactive mathematical shell => Matlab Language Expensive Fabien Viale Introduction - Scilab • • • • 4 Open source alternative to Matlab Used by many industrial and research projects Interactive mathematical shell => similar syntax with Matlab, not 100% compatible. Free Fabien Viale Introduction - ProActive • • • • 5 Open source middleware for the Grid Used by many industrial and research projects Powerful and standardized (ETSI) deployment framework Tools for the grid : Scheduler, Resource Manager, IC2D Monitoring, Timit Fabien Viale Introduction – State of the Art (quick) Licence type Parameters , return values , user function definition Matlab // computing toolbox Proprietary Star P Name Type of jobs Deployment Notes Any matlab Coarse grained + MPI + Data // LSF, PBS, Torque, SGE Requires NFS for I/O Proprietary Any matlab Coarse grained + Data // Paralize Open source Numeric/string arrays , built-in only Coarse grained Client / Server Uses NFS for cummunication PLab Open source Any matlab Coarse grained One level rsh or ssh dormant Only one //Scilab : Scilab PVM 6 Fabien Viale Requires NFS for I/O Introduction - Motivations & Challenges • Motivations : – – – – • Use grid infrastructure as resources for Matlab & Scilab Allow users to remain in their familiar environment Easily run Matlab & Scilab code in parallel Seamless retrieval of results Challenges : – Heterogeneous environment – Matlab not open source – Non-extensive list of features in Scilab 7 Fabien Viale ProActive context 8 Fabien Viale Scheduler – Resource Manager Scheduler : • controls user access ; task submission, results retrieval. • Manages jobs pending queue. • Manages job’s workflow. Resource Manager : • Deploys and monitor resources (nodes) • Make nodes available for the scheduler (with resource selection) 9 Fabien Viale Jobs & tasks • • A job contains several tasks Tasks can have dependency relationships • The Scheduler runs only one task per node 10 Fabien Viale Introduction – Job definition <?xml version="1.0" encoding="UTF-8"?> <job xmlns="urn:proactive:jobdescriptor:0.9" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:proactive:jobdescriptor:0.9 http://proactive.inria.fr/schemas/jobdescriptor/0.9/schedulerjob.xsd" name="job_nativ" priority="normal" logFile="${EXEC_PATH}/nativTask.log"> <description>Will execute 2 native C tasks</description> <variables> <variable name="EXEC_PATH" value="[working_dir]"/> </variables> <taskFlow> <task name="task1" preciousResult="true"> <description>Will display 10 dots every 1s</description> <nativeExecutable> <staticCommand value="${EXEC_PATH}/nativTask"> <arguments> <argument value="1"/> </arguments> </staticCommand> </nativeExecutable> </task> <task name="task2" preciousResult="true"> <description>Will display 10 dots every 2s</description> <depends> <task ref="task1"/> </depends> <nativeExecutable> <staticCommand value="${EXEC_PATH}/nativTask"> <arguments> <argument value="2"/> </arguments> </staticCommand> </nativeExecutable> </task> </taskFlow> </job> 11 Fabien Viale Scilab integration 12 Fabien Viale Scilab integration - Principles • Integration with the ProActive Scheduler • Schedule workflow of Scilab tasks • Transfer results between tasks 13 Fabien Viale Scilab integration - Example 14 Fabien Viale Matlab integration 15 Fabien Viale Matlab integration - Principles • Scilab extension functionalities • Integration with the Matlab environment 16 Fabien Viale How does it work ? Resource Proxy Cluster Manager login Matlab > PAsolve({arg1..argn}, @myfunc) Convert to textual / submit job Scheduler Receive results Select resources deploy Nodes Desktop ans = [ 1 2.354 0 7 ] Nodes Create Run tasks engines 17 Fabien Viale Matlab integration - API • PAconnect(<scheduler-url>) • PAsolve({arg1, … argn}, @function, [‘debug’]) 18 Fabien Viale Introduction – State of the Art (quick) Licence type Parameters , return values , user function definition Matlab // computing toolbox Proprietary Star P Name 19 Type of jobs Deployment Notes Any matlab Coarse grained + MPI + Data // LSF, PBS, Torque, SGE Requires NFS for I/O Proprietary Any matlab Coarse grained + Data // Paralize Open source Numeric/string arrays , built-in only Coarse grained Client / Server Uses NFS for cummunication PLab Open source Any matlab Coarse grained One level rsh or ssh, without password dormant ProActive Open source Any matlab Coarse grained LSF, PBS, SGE, RSH, SSH, Bridges Requires NFS for I/O Fabien Viale Requires NFS for I/O Demonstration : application to finance • Longstaff Schwarz method for American Put Option • Pure matlab code (no financial toolkit) 20 Fabien Viale Conclusion / Future Work • For Scilab, integration with the ProActive Scheduler, useful for doing batch jobs – Lacks a complete integration with Scilab • For Matlab, an easy to use/configure Parallel Matlab toolkit – – – – Dependant on NFS => Automatic File Transfer Automatic licencing control Only for coarse-grained problems => SPMD extension Blocks Matlab execution => Asynchronous PAsolve • Questions ? 21 Fabien Viale