<p>Clément, </p>
<p> </p>
<p><!--[if gte mso 9]><xml>
 <o:OfficeDocumentSettings>
  <o:AllowPNG/>
 </o:OfficeDocumentSettings>
</xml><![endif]--></p>
<p><!--[if gte mso 9]><xml>
 <w:WordDocument>
  <w:View>Normal</w:View>
  <w:Zoom>0</w:Zoom>
  <w:TrackMoves/>
  <w:TrackFormatting/>
  <w:HyphenationZone>21</w:HyphenationZone>
  <w:PunctuationKerning/>
  <w:ValidateAgainstSchemas/>
  <w:SaveIfXMLInvalid>false</w:SaveIfXMLInvalid>
  <w:IgnoreMixedContent>false</w:IgnoreMixedContent>
  <w:AlwaysShowPlaceholderText>false</w:AlwaysShowPlaceholderText>
  <w:DoNotPromoteQF/>
  <w:LidThemeOther>FR</w:LidThemeOther>
  <w:LidThemeAsian>X-NONE</w:LidThemeAsian>
  <w:LidThemeComplexScript>X-NONE</w:LidThemeComplexScript>
  <w:Compatibility>
   <w:BreakWrappedTables/>
   <w:SnapToGridInCell/>
   <w:WrapTextWithPunct/>
   <w:UseAsianBreakRules/>
   <w:DontGrowAutofit/>
   <w:SplitPgBreakAndParaMark/>
   <w:EnableOpenTypeKerning/>
   <w:DontFlipMirrorIndents/>
   <w:OverrideTableStyleHps/>
  </w:Compatibility>
  <w:DoNotOptimizeForBrowser/>
  <m:mathPr>
   <m:mathFont m:val="Cambria Math"/>
   <m:brkBin m:val="before"/>
   <m:brkBinSub m:val="--"/>
   <m:smallFrac m:val="off"/>
   <m:dispDef/>
   <m:lMargin m:val="0"/>
   <m:rMargin m:val="0"/>
   <m:defJc m:val="centerGroup"/>
   <m:wrapIndent m:val="1440"/>
   <m:intLim m:val="subSup"/>
   <m:naryLim m:val="undOvr"/>
  </m:mathPr></w:WordDocument>
</xml><![endif]--><!--[if gte mso 9]><xml>
 <w:LatentStyles DefLockedState="false" DefUnhideWhenUsed="true"
  DefSemiHidden="true" DefQFormat="false" DefPriority="99"
  LatentStyleCount="267">
  <w:LsdException Locked="false" Priority="0" SemiHidden="false"
   UnhideWhenUsed="false" QFormat="true" Name="Normal"/>
  <w:LsdException Locked="false" Priority="9" SemiHidden="false"
   UnhideWhenUsed="false" QFormat="true" Name="heading 1"/>
  <w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 2"/>
  <w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 3"/>
  <w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 4"/>
  <w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 5"/>
  <w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 6"/>
  <w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 7"/>
  <w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 8"/>
  <w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 9"/>
  <w:LsdException Locked="false" Priority="39" Name="toc 1"/>
  <w:LsdException Locked="false" Priority="39" Name="toc 2"/>
  <w:LsdException Locked="false" Priority="39" Name="toc 3"/>
  <w:LsdException Locked="false" Priority="39" Name="toc 4"/>
  <w:LsdException Locked="false" Priority="39" Name="toc 5"/>
  <w:LsdException Locked="false" Priority="39" Name="toc 6"/>
  <w:LsdException Locked="false" Priority="39" Name="toc 7"/>
  <w:LsdException Locked="false" Priority="39" Name="toc 8"/>
  <w:LsdException Locked="false" Priority="39" Name="toc 9"/>
  <w:LsdException Locked="false" Priority="35" QFormat="true" Name="caption"/>
  <w:LsdException Locked="false" Priority="10" SemiHidden="false"
   UnhideWhenUsed="false" QFormat="true" Name="Title"/>
  <w:LsdException Locked="false" Priority="1" Name="Default Paragraph Font"/>
  <w:LsdException Locked="false" Priority="11" SemiHidden="false"
   UnhideWhenUsed="false" QFormat="true" Name="Subtitle"/>
  <w:LsdException Locked="false" Priority="22" SemiHidden="false"
   UnhideWhenUsed="false" QFormat="true" Name="Strong"/>
  <w:LsdException Locked="false" Priority="20" SemiHidden="false"
   UnhideWhenUsed="false" QFormat="true" Name="Emphasis"/>
  <w:LsdException Locked="false" Priority="59" SemiHidden="false"
   UnhideWhenUsed="false" Name="Table Grid"/>
  <w:LsdException Locked="false" UnhideWhenUsed="false" Name="Placeholder Text"/>
  <w:LsdException Locked="false" Priority="1" SemiHidden="false"
   UnhideWhenUsed="false" QFormat="true" Name="No Spacing"/>
  <w:LsdException Locked="false" Priority="60" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light Shading"/>
  <w:LsdException Locked="false" Priority="61" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light List"/>
  <w:LsdException Locked="false" Priority="62" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light Grid"/>
  <w:LsdException Locked="false" Priority="63" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Shading 1"/>
  <w:LsdException Locked="false" Priority="64" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Shading 2"/>
  <w:LsdException Locked="false" Priority="65" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium List 1"/>
  <w:LsdException Locked="false" Priority="66" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium List 2"/>
  <w:LsdException Locked="false" Priority="67" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 1"/>
  <w:LsdException Locked="false" Priority="68" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 2"/>
  <w:LsdException Locked="false" Priority="69" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 3"/>
  <w:LsdException Locked="false" Priority="70" SemiHidden="false"
   UnhideWhenUsed="false" Name="Dark List"/>
  <w:LsdException Locked="false" Priority="71" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful Shading"/>
  <w:LsdException Locked="false" Priority="72" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful List"/>
  <w:LsdException Locked="false" Priority="73" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful Grid"/>
  <w:LsdException Locked="false" Priority="60" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light Shading Accent 1"/>
  <w:LsdException Locked="false" Priority="61" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light List Accent 1"/>
  <w:LsdException Locked="false" Priority="62" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light Grid Accent 1"/>
  <w:LsdException Locked="false" Priority="63" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Shading 1 Accent 1"/>
  <w:LsdException Locked="false" Priority="64" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Shading 2 Accent 1"/>
  <w:LsdException Locked="false" Priority="65" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium List 1 Accent 1"/>
  <w:LsdException Locked="false" UnhideWhenUsed="false" Name="Revision"/>
  <w:LsdException Locked="false" Priority="34" SemiHidden="false"
   UnhideWhenUsed="false" QFormat="true" Name="List Paragraph"/>
  <w:LsdException Locked="false" Priority="29" SemiHidden="false"
   UnhideWhenUsed="false" QFormat="true" Name="Quote"/>
  <w:LsdException Locked="false" Priority="30" SemiHidden="false"
   UnhideWhenUsed="false" QFormat="true" Name="Intense Quote"/>
  <w:LsdException Locked="false" Priority="66" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium List 2 Accent 1"/>
  <w:LsdException Locked="false" Priority="67" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 1 Accent 1"/>
  <w:LsdException Locked="false" Priority="68" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 2 Accent 1"/>
  <w:LsdException Locked="false" Priority="69" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 3 Accent 1"/>
  <w:LsdException Locked="false" Priority="70" SemiHidden="false"
   UnhideWhenUsed="false" Name="Dark List Accent 1"/>
  <w:LsdException Locked="false" Priority="71" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful Shading Accent 1"/>
  <w:LsdException Locked="false" Priority="72" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful List Accent 1"/>
  <w:LsdException Locked="false" Priority="73" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful Grid Accent 1"/>
  <w:LsdException Locked="false" Priority="60" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light Shading Accent 2"/>
  <w:LsdException Locked="false" Priority="61" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light List Accent 2"/>
  <w:LsdException Locked="false" Priority="62" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light Grid Accent 2"/>
  <w:LsdException Locked="false" Priority="63" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Shading 1 Accent 2"/>
  <w:LsdException Locked="false" Priority="64" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Shading 2 Accent 2"/>
  <w:LsdException Locked="false" Priority="65" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium List 1 Accent 2"/>
  <w:LsdException Locked="false" Priority="66" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium List 2 Accent 2"/>
  <w:LsdException Locked="false" Priority="67" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 1 Accent 2"/>
  <w:LsdException Locked="false" Priority="68" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 2 Accent 2"/>
  <w:LsdException Locked="false" Priority="69" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 3 Accent 2"/>
  <w:LsdException Locked="false" Priority="70" SemiHidden="false"
   UnhideWhenUsed="false" Name="Dark List Accent 2"/>
  <w:LsdException Locked="false" Priority="71" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful Shading Accent 2"/>
  <w:LsdException Locked="false" Priority="72" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful List Accent 2"/>
  <w:LsdException Locked="false" Priority="73" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful Grid Accent 2"/>
  <w:LsdException Locked="false" Priority="60" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light Shading Accent 3"/>
  <w:LsdException Locked="false" Priority="61" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light List Accent 3"/>
  <w:LsdException Locked="false" Priority="62" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light Grid Accent 3"/>
  <w:LsdException Locked="false" Priority="63" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Shading 1 Accent 3"/>
  <w:LsdException Locked="false" Priority="64" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Shading 2 Accent 3"/>
  <w:LsdException Locked="false" Priority="65" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium List 1 Accent 3"/>
  <w:LsdException Locked="false" Priority="66" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium List 2 Accent 3"/>
  <w:LsdException Locked="false" Priority="67" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 1 Accent 3"/>
  <w:LsdException Locked="false" Priority="68" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 2 Accent 3"/>
  <w:LsdException Locked="false" Priority="69" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 3 Accent 3"/>
  <w:LsdException Locked="false" Priority="70" SemiHidden="false"
   UnhideWhenUsed="false" Name="Dark List Accent 3"/>
  <w:LsdException Locked="false" Priority="71" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful Shading Accent 3"/>
  <w:LsdException Locked="false" Priority="72" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful List Accent 3"/>
  <w:LsdException Locked="false" Priority="73" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful Grid Accent 3"/>
  <w:LsdException Locked="false" Priority="60" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light Shading Accent 4"/>
  <w:LsdException Locked="false" Priority="61" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light List Accent 4"/>
  <w:LsdException Locked="false" Priority="62" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light Grid Accent 4"/>
  <w:LsdException Locked="false" Priority="63" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Shading 1 Accent 4"/>
  <w:LsdException Locked="false" Priority="64" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Shading 2 Accent 4"/>
  <w:LsdException Locked="false" Priority="65" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium List 1 Accent 4"/>
  <w:LsdException Locked="false" Priority="66" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium List 2 Accent 4"/>
  <w:LsdException Locked="false" Priority="67" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 1 Accent 4"/>
  <w:LsdException Locked="false" Priority="68" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 2 Accent 4"/>
  <w:LsdException Locked="false" Priority="69" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 3 Accent 4"/>
  <w:LsdException Locked="false" Priority="70" SemiHidden="false"
   UnhideWhenUsed="false" Name="Dark List Accent 4"/>
  <w:LsdException Locked="false" Priority="71" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful Shading Accent 4"/>
  <w:LsdException Locked="false" Priority="72" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful List Accent 4"/>
  <w:LsdException Locked="false" Priority="73" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful Grid Accent 4"/>
  <w:LsdException Locked="false" Priority="60" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light Shading Accent 5"/>
  <w:LsdException Locked="false" Priority="61" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light List Accent 5"/>
  <w:LsdException Locked="false" Priority="62" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light Grid Accent 5"/>
  <w:LsdException Locked="false" Priority="63" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Shading 1 Accent 5"/>
  <w:LsdException Locked="false" Priority="64" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Shading 2 Accent 5"/>
  <w:LsdException Locked="false" Priority="65" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium List 1 Accent 5"/>
  <w:LsdException Locked="false" Priority="66" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium List 2 Accent 5"/>
  <w:LsdException Locked="false" Priority="67" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 1 Accent 5"/>
  <w:LsdException Locked="false" Priority="68" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 2 Accent 5"/>
  <w:LsdException Locked="false" Priority="69" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 3 Accent 5"/>
  <w:LsdException Locked="false" Priority="70" SemiHidden="false"
   UnhideWhenUsed="false" Name="Dark List Accent 5"/>
  <w:LsdException Locked="false" Priority="71" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful Shading Accent 5"/>
  <w:LsdException Locked="false" Priority="72" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful List Accent 5"/>
  <w:LsdException Locked="false" Priority="73" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful Grid Accent 5"/>
  <w:LsdException Locked="false" Priority="60" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light Shading Accent 6"/>
  <w:LsdException Locked="false" Priority="61" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light List Accent 6"/>
  <w:LsdException Locked="false" Priority="62" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light Grid Accent 6"/>
  <w:LsdException Locked="false" Priority="63" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Shading 1 Accent 6"/>
  <w:LsdException Locked="false" Priority="64" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Shading 2 Accent 6"/>
  <w:LsdException Locked="false" Priority="65" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium List 1 Accent 6"/>
  <w:LsdException Locked="false" Priority="66" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium List 2 Accent 6"/>
  <w:LsdException Locked="false" Priority="67" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 1 Accent 6"/>
  <w:LsdException Locked="false" Priority="68" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 2 Accent 6"/>
  <w:LsdException Locked="false" Priority="69" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 3 Accent 6"/>
  <w:LsdException Locked="false" Priority="70" SemiHidden="false"
   UnhideWhenUsed="false" Name="Dark List Accent 6"/>
  <w:LsdException Locked="false" Priority="71" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful Shading Accent 6"/>
  <w:LsdException Locked="false" Priority="72" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful List Accent 6"/>
  <w:LsdException Locked="false" Priority="73" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful Grid Accent 6"/>
  <w:LsdException Locked="false" Priority="19" SemiHidden="false"
   UnhideWhenUsed="false" QFormat="true" Name="Subtle Emphasis"/>
  <w:LsdException Locked="false" Priority="21" SemiHidden="false"
   UnhideWhenUsed="false" QFormat="true" Name="Intense Emphasis"/>
  <w:LsdException Locked="false" Priority="31" SemiHidden="false"
   UnhideWhenUsed="false" QFormat="true" Name="Subtle Reference"/>
  <w:LsdException Locked="false" Priority="32" SemiHidden="false"
   UnhideWhenUsed="false" QFormat="true" Name="Intense Reference"/>
  <w:LsdException Locked="false" Priority="33" SemiHidden="false"
   UnhideWhenUsed="false" QFormat="true" Name="Book Title"/>
  <w:LsdException Locked="false" Priority="37" Name="Bibliography"/>
  <w:LsdException Locked="false" Priority="39" QFormat="true" Name="TOC Heading"/>
 </w:LatentStyles>
</xml><![endif]--><!--[if gte mso 10]>
<style>
 /* Style Definitions */
 table.MsoNormalTable
        {mso-style-name:"Tableau Normal";
        mso-tstyle-rowband-size:0;
        mso-tstyle-colband-size:0;
        mso-style-noshow:yes;
        mso-style-priority:99;
        mso-style-parent:"";
        mso-padding-alt:0cm 5.4pt 0cm 5.4pt;
        mso-para-margin:0cm;
        mso-para-margin-bottom:.0001pt;
        mso-pagination:widow-orphan;
        font-size:11.0pt;
        font-family:"Calibri","sans-serif";
        mso-ascii-font-family:Calibri;
        mso-ascii-theme-font:minor-latin;
        mso-hansi-font-family:Calibri;
        mso-hansi-theme-font:minor-latin;
        mso-fareast-language:EN-US;}
</style>
<![endif]--></p>
<p class="MsoPlainText"><span style="mso-ansi-language: EN-US;">Would it be different if we had to create a X_cos block executing a single Scilab expression (block output = RHS (block input, t, state derivative)) ?</span></p>
<p class="MsoPlainText"><span style="mso-ansi-language: EN-US;"> </span></p>
<p class="MsoPlainText"><span style="mso-ansi-language: EN-US;">I noted that the actual Scifunc Block is very powerful and educational thus to me it should not be changed.</span></p>
<p class="MsoPlainText"><span style="mso-ansi-language: EN-US;"> </span></p>
<p class="MsoPlainText"><span style="mso-ansi-language: EN-US;">Also I started suspecting that, although Scifunc blocks alone are slow compared to c or already provided blocks, they may not always be the bottleneck in the context of a specific calculation. </span></p>
<p class="MsoPlainText"><span style="mso-ansi-language: EN-US;">I have to compare a few things and look at how many times each block is called by each solver.<br /></span></p>
<p class="MsoPlainText"><span style="mso-ansi-language: EN-US;"> </span></p>
<p>Regards, <span style="mso-ansi-language: EN-US;"> </span></p>
<p class="MsoPlainText"><span style="mso-ansi-language: EN-US;">Eric</span></p>
<p> </p>
<p> </p>
<p> </p>
<blockquote style="padding-left: 5px; margin-left: 5px; border-left: #ff0000 2px solid;">> Message du 09/04/18 15:27<br />> De : "Clément David" <Clement.David@esi-group.com><br />> A : "dev@lists.scilab.org" <dev@lists.scilab.org><br />> Copie à : <br />> Objet : Re: [Scilab-Dev] New xcos blocks executing scilab primitive functions<br />> <br />> Hello Eric,<br />> <br />> As described in some guides [1][2], the interpreter will call a gateway passing values using the C++<br />> / C object-oriented / C stack-oriented APIs depending how you declared it. On the gateway you are<br />> free to do whatever you want with the data. <br />> <br />> [1]: https://wiki.scilab.org/howto/Create%20a%20toolbox#Gateway<br />> [2]: https://wiki.scilab.org/Developers<br />> <br />> However for Xcos, the story is a bit different as the blocks will be called by a simulator (ODE /<br />> IDA solver) not an interpreter ; the API is different and called scicos_block4 ; using a C-block you<br />> have to describe the interface and write some code using the data passed as arguments.<br />> <br />> Note: Scilab2C is a toolbox which might (or might not) follow Scilab coding conventions.<br />> <br />> --<br />> Clément<br />> <br />> <br />> Le lundi 09 avril 2018 à 12:33 +0200, Eric GERNOT a écrit :<br />> > Hello Clement,<br />> > <br />> > Thank you for this very clear answer.<br />> > How does Scilab Gateways work? When we tap enter after entering the command line on the prompt,<br />> > let's say to call a primitive, does the gateway also need the API ?<br />> > Or is there a more direct way to do so ?<br />> > <br />> > Regarding my questions on the libraries.<br />> > Well, let's say I am a simple user of scilab, with no code development tools installed.<br />> > Editing a c-block, seeing the #include math.h line was a bit scary, because I thought "this will<br />> > require that I have put the math.h file at the good place on my computer".<br />> > So I insert nothing in the code, click "ok" and the compilation is succesful. <br />> > Now after running Scilab 2 c toolbox on my custom code, a number of subdirectories with multiple<br />> > files were created in my custom directory. I suppose if I want this scilab 2 c created code<br />> > running in the c-block, I have to put these files where the block can access them at compilation<br />> > time.<br />> > Same if I created the code on my own. That is why I asked where the c-block compiler looks to find<br />> > the files, or how do we configure this, as users.<br />> > <br />> > Best regards,<br />> > Eric<br />> > <br />> > <br />> > <br />> > <br />> > > > Message du 09/04/18 09:37<br />> > > > De : "Clément David" <Clement.David@esi-group.com><br />> > > > A : "dev@lists.scilab.org" <dev@lists.scilab.org><br />> > > > Copie à : <br />> > > > Objet : Re: [Scilab-Dev] New xcos blocks executing scilab primitive functions<br />> > > > <br />> > > > Hi Eric and welcome :)<br />> > > > <br />> > > > Nice to have some power users (and maybe futur developers) using big Xcos models, Xcos in<br />> > > 6.0.x have<br />> > > > some issues only visible on big diagrams and we currently do not spend too much time<br />> > > benchmarking<br />> > > > it.<br />> > > > <br />> > > > About the scifunc vs Superbloc vs C++ implementation speedup, the clear winner there would be<br />> > > C/C++<br />> > > > if (and only if) there is no event management (either discrete or zero-crossing) to perform.<br />> > > Zero<br />> > > > crossing detection is hard to implement even for small sub-systems and discrete events are<br />> > > only easy<br />> > > > for synchronous subsystem. Superblocs are straightforward to implement and manage very complex<br />> > > > events / continuous states intrication in a clean manner however they can be confusing to<br />> > > maintains<br />> > > > (for exemple if you want to preserve the same behavior across different blocks). Scifunc are<br />> > > in-<br />> > > > between to me in term of implementation however very poor in term of performance (and not<br />> > > optimized<br />> > > > at all).<br />> > > > <br />> > > > You could use the scicos_block4 API (the default one) in C or C++ ; if you take a look at our<br />> > > source<br />> > > > code there is only a few in C++ but they can be easily converted to. About the libraries, I<br />> > > did not<br />> > > > get it, do you want to link to different libraries ? The xcos_toolbox_skeleton and<br />> > > ilib_for_build()<br />> > > > flags are working well.<br />> > > > <br />> > > > To call Scilab script within the sciblk2 [1] and sciblk4 [2] blocks we are indeed using the<br />> > > Scilab<br />> > > > C++ API, the performance overhead is quiet clear as we are currently allocating Scilab<br />> > > types::Double<br />> > > > or a types::MList through createblklist() for each output on each simulation step. This does<br />> > > an<br />> > > > extra allocation (for the Scilab datatype) and a copy (for the data copy to scilab) whereas in<br />> > > C/C++<br />> > > > the data are passed by reference to the shared buffers. We clearly have to do better there ;<br />> > > maybe<br />> > > > by allocating only once (at Initialization time) or passing types:: views to the shared<br />> > > buffers.<br />> > > > There is a test case within xcos_toolbox_skeleton which switch the implementation of a NOOP<br />> > > block<br />> > > > (that compute nothing) between Scilab and C depending on a parameter in Scilab.<br />> > > > <br />> > > > [1]: http://cgit.scilab.org/scilab/tree/scilab/modules/scicos/src/cpp/sciblk2.cpp#n57<br />> > > > [2]: http://cgit.scilab.org/scilab/tree/scilab/modules/scicos/src/cpp/sciblk4.cpp#n217<br />> > > > <br />> > > > As a conclusion, yes you can call C++ functions from blocks and Scilab blocks issues comes<br />> > > from a<br />> > > > slow implementation of C->Scilab calls not from the Scilab code interpretation.<br />> > > > <br />> > > > NB: yes this a known problem and some users already reports that but no one is currently<br />> > > working on<br />> > > > that.<br />> > > > <br />> > > > Thanks,<br />> > > > <br />> > > > --<br />> > > > Clément<br />> > > > <br />> > > > Le vendredi 06 avril 2018 à 05:47 -0700, ericgernot a écrit :<br />> > > > > Hi, <br />> > > > > <br />> > > > > I am new to scilab, and I am not a developper, but I fear I may become one<br />> > > > > because of Scilab :-;<br />> > > > > I am on windows 7 /64, and installed some recent versions.<br />> > > > > <br />> > > > > I created a physic model (chemical process with compositions, streams, etc.)<br />> > > > > from a script and used xcos to solve it, only using Sci_func blocks calling<br />> > > > > my functions (so that it is easily portable to other scilab versions). It<br />> > > > > works as desired, so now I want to speed it up.<br />> > > > > <br />> > > > > After all the possible improvements from vectorization, I decided to convert<br />> > > > > 30% of my scifunc into superblocks, giving a 30% speedup boost to the model.<br />> > > > > I could have written these in c/c++ also, but I suspect it would have taken<br />> > > > > longer (for me)<br />> > > > > <br />> > > > > My remaining scifunc blocks are using some scilab gateways such as fsolve,<br />> > > > > diag, etc, thus the conversion is not as straighforward. <br />> > > > > <br />> > > > > I tried to convert it in c using the scilab 2 c toolbox, this is great for<br />> > > > > all operations exept scilab gateways.<br />> > > > > <br />> > > > > I had a look at how to create a new block, how the c-block work, and finally<br />> > > > > how existing blocks are coded in c++.<br />> > > > > <br />> > > > > If I understand well, the possibilities are<br />> > > > > 1. copy the c++ primitive function code in a c-block, it will not work<br />> > > > > because it is not c, and because I don't know which libraries should be<br />> > > > > included. By the way, where can I put them so that the compiler finds them ?<br />> > > > > 2. use scilab API from a xcos c-block and send jobs. Will it really skip the<br />> > > > > interpreter ?<br />> > > > > 3. create a new block as a user (from within scilab). But you can't use c++<br />> > > > > can you ? So I have to write or find c equivalent of scilab primitives, this<br />> > > > > is a pity !<br />> > > > > 4. create a new block source code, and compile a new version of scilab with<br />> > > > > the new block. I suppose that the same problem exists: converting to c<br />> > > > > scilab primitives ?<br />> > > > > <br />> > > > > So this raised a few questions:<br />> > > > > - In the block source code, why not call scilab built in functions in c/c++<br />> > > > > (not the gateway), only passing them the block arguments / parameters,<br />> > > > > instead of pasting the code there. That would ease the creation of new<br />> > > > > blocks isn't it ?<br />> > > > > - can users call these built in functions in their custom blocks (e.g.<br />> > > > > c-block) ? (I mean without invoking the parser etc., without linking already<br />> > > > > linked libraries, etc.)<br />> > > > > <br />> > > > > I suppose that many users ran through these problems.<br />> > > > > Thank you very mucn<br />> > > > > Regards, <br />> > > > > Eric<br />> > > > > <br />> > > > > <br />> > > > > <br />> > > > > <br />> > > > > --<br />> > > > > Sent from: http://mailinglists.scilab.org/Scilab-developers-Mailing-Lists-Archives-f2574944.<br />> > > html<br />> > > > > _______________________________________________<br />> > > > > dev mailing list<br />> > > > > dev@lists.scilab.org<br />> > > > > http://lists.scilab.org/mailman/listinfo/dev _______________________________________________<br />> > > dev mailing list dev@lists.scilab.org http://lists.scilab.org/mailman/listinfo/dev<br />> > <br />> > _______________________________________________<br />> > dev mailing list<br />> > dev@lists.scilab.org<br />> > http://lists.scilab.org/mailman/listinfo/dev _______________________________________________ dev mailing list dev@lists.scilab.org http://lists.scilab.org/mailman/listinfo/dev </blockquote>