Next: , Up: Tutorials


3.1 Tutorial 1 - First Application

This is a short tutorial to help you getting started with YML. It requires you already configure, build and install YML. This tutorial does not make use of the manager. We will make use of the following program:

In YML you interact with the various program using queries. All queries have the following form. replace XXX with a valid account information. Note that the default account is called admin and come with passord 1010.

<?xml version="1.0"?>
<yml-query login="XXX" password="XXX">
    <!-- request content here -->
</yml-query>

There's several kind of queries available in YML. We will focus on the two following :

  1. Component generation
  2. Application execution

Let's start with the study of the definition of an abstract component. The query bellow stored in a file named test_abstract.query contains the definition of the only component we will use.

 
<?xml version="1.0"?>
<yml-query login="XXX" password="XXX">
   <component type="abstract" name="test" 
  description="This component sum two doubles and store the result in res">
      <param type="real" mode="out" name="res" />
      <param type="real" mode="in" name="a" />
      <param type="real" mode="in" name="b" />
   </component>
</yml-query>

To register an abstract component, one have to use ymld_component. using the following command :

$> ymld_component test_abstract.query 
The file test_impl.query contains the following :
<?xml version="1.0"?>
<yml-query login="XXX" password="XXX">
    <component type="impl" name="test_impl" 
     description="An mplementation component for sum" abstract="test">
        <globals><![CDATA[
#include <stdlib.h>
]]>
        </globals>
        <source lang="CXX" libs="">
res = a + b;
        </source>
    </component>
</yml-query>

An implementation component is used to describe the computation executed remotely. It's compiled in a static binary application integrating communication mechanism required by YML.

Once again we can build this component using the component generator

 
$> ymld_component test_impl.query
Finally the latest query we need is the application query which describe the graph to be executed. In this example we will make two sequential sum. The application is described in the file test_app.query.
<?xml version="1.0"?>
<yml-query login="XXX" password="XXX">
    <application>
        <source>
compute test(results, 1.0, 2.0);         # results contains 3.0
compute test(results, results, results); # results contains 6.0 
        </source>
    </application>
</yml-query>

One can compile this application using :

$> ymld_compiler . test_app 
This operation generate several file containing the description of the application in its intermediate representation adapted to its execution using the scheduler.
$> ymld_scheduler . test_app 
Once the execution is finished the result of the application are available in the folder : test_app_data. In this folder a file named results is available and should be of size 8 bytes which is the binary representation of a real.