Re: [Scilab-users] ipcv vs scicv

2020-12-03 Thread Chin Luh Tan
Hi all,

Stephane, Thanks for the quick  examples to illustrate this.

Claus, as shown by Stephane, this could be now by ourselves now from our
own modules. Stephane has illustrated a quick demo on this, while the one I
was testing with is the copy of toolbox skeleton inside the Scilab contrib,
modified to 2 modules, installed with atoms and let it load at start,
results are the same.

There are 2 potential issues which we should take notes:
1. The module which is loaded last, will have the "dominant" in the base
function. for e.g.: the example that Stephane showed, we could call
"lib1.foo" and "lib2.foo", and calling just "foo" will be the same as
"lib2.foo".
2. Only macros function could be called this way, if a module has a scilab
gateway that called direct from Scilab, (such as scicv), you could not call
scicvlib.imread as the imread is directly expose from the C lib to Scilab.
So during the design of the module, you could have a macros wrapper to call
the gateway functions so that they could be listed in the library's macros
list.

Thanks.

rgds,
CL

On Fri, 4 Dec 2020 at 00:36, Stéphane Mottelet 
wrote:

> This is the way it works in scilab for libraries:
>
> mkdir lib1mputl("function 
> y=foo(x);y=x;end","lib1/foo.sci")genlib("lib1","lib1")mkdir 
> lib2mputl("function 
> y=foo(x);y=2*x;end","lib2/foo.sci")genlib("lib2","lib2")lib("lib1")lib("lib2")
> -> lib1.foo(1)
>  ans  =
>
>1.
> --> lib2.foo(1)
>  ans  =
>
>2.
>
>
> S.
>
> Le 03/12/2020 à 17:28, Antoine Monmayrant a écrit :
>
>
> On 03/12/2020 02:10, TanCL wrote:
>
> Hi, my previous message seems like not able to get posted due to some reason,
> just to add some comment on this, I think the functions with same name under
> 2 different modules could be possibly called by:
>
> That is exactly how things are working in Ada:
>
> myfunc : local definition in the current file
> somepackage.myfunc : definition one can find in somepackage that is
> included in the current file by "with somepackage;"
>
> And one can rename the package with "package S renames somepackage" which
> allow writting "s.myfunc"
> I assume it's similar in Python too.
>
> Antoine
>
> moduleA.myfunc
>
> moduleB.myfunc
>
>
> __
>
> Start Toolbox A
>   Load macros
>
> Start Toolbox B
>   Load macros
>
>
> --> toolboxAlib.scilab_sum(2,1)
>
>   "This is function from ToolboxA"
>  ans  =
>
>3.
>
> --> toolboxBlib.scilab_sum(2,1)
>
>   "This is function from ToolboxB"
>  ans  =
>
>3.
>
>
>
>
>
> --
> Sent from: 
> http://mailinglists.scilab.org/Scilab-users-Mailing-Lists-Archives-f2602246.html
>  
> 
> ___
> users mailing 
> listusers@lists.scilab.orghttp://lists.scilab.org/mailman/listinfo/users 
> 
>
>
> ___
> users mailing 
> listusers@lists.scilab.orghttps://antispam.utc.fr/proxy/1/c3RlcGhhbmUubW90dGVsZXRAdXRjLmZy/lists.scilab.org/mailman/listinfo/users
>
> --
> Stéphane Mottelet
> Ingénieur de recherche
> EA 4297 Transformations Intégrées de la Matière Renouvelable
> Département Génie des Procédés Industriels
> Sorbonne Universités - Université de Technologie de Compiègne
> CS 60319, 60203 Compiègne cedex
> Tel : +33(0)344234688http://www.utc.fr/~mottelet
>
> ___
> users mailing list
> users@lists.scilab.org
> http://lists.scilab.org/mailman/listinfo/users
>
___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users


Re: [Scilab-users] ipcv vs scicv

2020-12-03 Thread Stéphane Mottelet

This is the way it works in scilab for libraries:

mkdir  lib1
mputl("function y=foo(x);y=x;end","lib1/foo.sci")
genlib("lib1","lib1")
mkdir  lib2
mputl("function y=foo(x);y=2*x;end","lib2/foo.sci")
genlib("lib2","lib2")
lib("lib1")
lib("lib2")

->  lib1.foo(1)
 ans   =

   1.

-->  lib2.foo(1)
 ans   =

   2.


S.

Le 03/12/2020 à 17:28, Antoine Monmayrant a écrit :



On 03/12/2020 02:10, TanCL wrote:

Hi, my previous message seems like not able to get posted due to some reason,
just to add some comment on this, I think the functions with same name under
2 different modules could be possibly called by:


That is exactly how things are working in Ada:

myfunc : local definition in the current file
somepackage.myfunc : definition one can find in somepackage that
is included in the current file by "with somepackage;"

And one can rename the package with "package S renames somepackage" 
which allow writting "s.myfunc"

I assume it's similar in Python too.

Antoine


moduleA.myfunc

moduleB.myfunc


__

Start Toolbox A
Load macros

Start Toolbox B
Load macros


--> toolboxAlib.scilab_sum(2,1)

   "This is function from ToolboxA"
  ans  =

3.

--> toolboxBlib.scilab_sum(2,1)

   "This is function from ToolboxB"
  ans  =

3.





--
Sent 
from:http://mailinglists.scilab.org/Scilab-users-Mailing-Lists-Archives-f2602246.html
___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users



___
users mailing list
users@lists.scilab.org
https://antispam.utc.fr/proxy/1/c3RlcGhhbmUubW90dGVsZXRAdXRjLmZy/lists.scilab.org/mailman/listinfo/users


--
Stéphane Mottelet
Ingénieur de recherche
EA 4297 Transformations Intégrées de la Matière Renouvelable
Département Génie des Procédés Industriels
Sorbonne Universités - Université de Technologie de Compiègne
CS 60319, 60203 Compiègne cedex
Tel : +33(0)344234688
http://www.utc.fr/~mottelet

___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users


Re: [Scilab-users] ipcv vs scicv

2020-12-03 Thread Antoine Monmayrant


On 03/12/2020 02:10, TanCL wrote:

Hi, my previous message seems like not able to get posted due to some reason,
just to add some comment on this, I think the functions with same name under
2 different modules could be possibly called by:


That is exactly how things are working in Ada:

   myfunc : local definition in the current file
   somepackage.myfunc : definition one can find in somepackage that is
   included in the current file by "with somepackage;"

And one can rename the package with "package S renames somepackage" 
which allow writting "s.myfunc"

I assume it's similar in Python too.

Antoine


moduleA.myfunc

moduleB.myfunc


__

Start Toolbox A
Load macros

Start Toolbox B
Load macros


--> toolboxAlib.scilab_sum(2,1)

   "This is function from ToolboxA"
  ans  =

3.

--> toolboxBlib.scilab_sum(2,1)

   "This is function from ToolboxB"
  ans  =

3.





--
Sent from: 
http://mailinglists.scilab.org/Scilab-users-Mailing-Lists-Archives-f2602246.html
___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users

___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users


Re: [Scilab-users] ipcv vs scicv

2020-12-03 Thread Claus Futtrup

Hi Tan

I agree. The proposal, is it something we can do ourselves now, or will 
it require implementation into Scilab first? Thank you for resending.


/Claus

On 03-12-2020 02:10, TanCL wrote:

Hi, my previous message seems like not able to get posted due to some reason,
just to add some comment on this, I think the functions with same name under
2 different modules could be possibly called by:

moduleA.myfunc

moduleB.myfunc


__

Start Toolbox A
Load macros

Start Toolbox B
Load macros


--> toolboxAlib.scilab_sum(2,1)

   "This is function from ToolboxA"
  ans  =

3.

--> toolboxBlib.scilab_sum(2,1)

   "This is function from ToolboxB"
  ans  =

3.





--
Sent from: 
http://mailinglists.scilab.org/Scilab-users-Mailing-Lists-Archives-f2602246.html
___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users



___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users


Re: [Scilab-users] Headless graphics in scilab: time & memory issues

2020-12-03 Thread Stéphane Mottelet

The xmllab is actually still working, try e.g.

http://marguerite.lmac.utc.fr/~xmllab/cgi-bin/XMLlabServer.cgi?timing=no=english=/home/xmllab/scilab-5.5.2/share/scilab/contrib/xmllab/1.7.6//examples/Image-Processing/clown.xml=launch

S.

Le 03/12/2020 à 11:20, Stéphane Mottelet a écrit :


Le 03/12/2020 à 11:01, Antoine Monmayrant a écrit :


On 03/12/2020 10:46, Stéphane Mottelet wrote:
In headless mode the rendering cannot use joGL and there is the same 
overhead as when you try to export a figure to a vectorial format 
(svg,pdf,eps) :



OK thanks for the clarification.
That's a weird and unexpected limitation, no?


No. In fact fast offscreen rendering is possible in joGL. In my 
previous answer I should have said "In headless mode the rendering 
*does not* use joGL". The pity is that the main author of Scilab 
Graphics Java backend has left the team long time ago. It would have 
been an easy task for him.


If your project is hosted on a Linux server, I would advise you to 
redirect the display of your Scilab instance to a virtual frame buffer 
by using any flavor of VNC (TurboVNC is nice as the server can use the 
hardware GPU capabilities of the server). In this case you can stick 
to the Rec driver and j xs2png (or any bitmap variant) will be fast. 
That's what I used with xmllab many years ago...


S.

I would not have guessed that going headless and using a bitmap 
format would result in facing this limitation.
Moreover, there is still a memory issue as I can crash scilab when 
pushing things a bit further.


Antoine

___
users mailing list
users@lists.scilab.org
https://antispam.utc.fr/proxy/2/c3RlcGhhbmUubW90dGVsZXRAdXRjLmZy/antispam.utc.fr/proxy/1/c3RlcGhhbmUubW90dGVsZXRAdXRjLmZy/lists.scilab.org/mailman/listinfo/users 




--
Stéphane Mottelet
Ingénieur de recherche
EA 4297 Transformations Intégrées de la Matière Renouvelable
Département Génie des Procédés Industriels
Sorbonne Universités - Université de Technologie de Compiègne
CS 60319, 60203 Compiègne cedex
Tel : +33(0)344234688
http://www.utc.fr/~mottelet

___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users


Re: [Scilab-users] Headless graphics in scilab: time & memory issues

2020-12-03 Thread Stéphane Mottelet


Le 03/12/2020 à 11:01, Antoine Monmayrant a écrit :


On 03/12/2020 10:46, Stéphane Mottelet wrote:
In headless mode the rendering cannot use joGL and there is the same 
overhead as when you try to export a figure to a vectorial format 
(svg,pdf,eps) :



OK thanks for the clarification.
That's a weird and unexpected limitation, no?


No. In fact fast offscreen rendering is possible in joGL. In my previous 
answer I should have said "In headless mode the rendering *does not* use 
joGL". The pity is that the main author of Scilab Graphics Java backend 
has left the team long time ago. It would have been an easy task for him.


If your project is hosted on a Linux server, I would advise you to 
redirect the display of your Scilab instance to a virtual frame buffer 
by using any flavor of VNC (TurboVNC is nice as the server can use the 
hardware GPU capabilities of the server). In this case you can stick to 
the Rec driver and j xs2png (or any bitmap variant) will be fast. That's 
what I used with xmllab many years ago...


S.

I would not have guessed that going headless and using a bitmap format 
would result in facing this limitation.
Moreover, there is still a memory issue as I can crash scilab when 
pushing things a bit further.


Antoine

___
users mailing list
users@lists.scilab.org
https://antispam.utc.fr/proxy/1/c3RlcGhhbmUubW90dGVsZXRAdXRjLmZy/lists.scilab.org/mailman/listinfo/users 



--
Stéphane Mottelet
Ingénieur de recherche
EA 4297 Transformations Intégrées de la Matière Renouvelable
Département Génie des Procédés Industriels
Sorbonne Universités - Université de Technologie de Compiègne
CS 60319, 60203 Compiègne cedex
Tel : +33(0)344234688
http://www.utc.fr/~mottelet

___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users


Re: [Scilab-users] Headless graphics in scilab: time & memory issues

2020-12-03 Thread Stéphane Mottelet

Hello Antoine,

Exporting in headless mode (all drivers but the default "Rec") is 
fundamentally different from the default "Rec" mode where graphics are 
actually rendered on screen on a joGL Canvas. In this case there is 
virtually no overhead when exporting this Canvas to a bitmap image 
format (png,jpeg,gif,...). In headless mode the rendering cannot use 
joGL and there is the same overhead as when you try to export a figure 
to a vectorial format (svg,pdf,eps) :


nx=4000;
ny=300;
nc=100;

x=1:nx;
y=[1:ny].';
z=(y*x);

driver Rec
h=scf();
h.color_map=hotcolormap(nc);
Sgrayplot(x,y,z.');
xs2pdf(h,"screen.pdf")

at line    13 of executed file /Users/mottelet/Desktop/xend_test.sce

xs2pdf: Unable to create export file, not enough memory. Decreasing the 
number of elements or the size of the figure should fix this error.


S.

Le 03/12/2020 à 09:48, Antoine Monmayrant a écrit :


Hello all,

In these days of remote working, I need to use again scilab in 
headless mode to generate graphics.


In other words, I connect  in command line only to a remote server 
where scilab is installed and I want it to generate graphics using a 
combination of driver, xinit and xend.


There seems to be some issues with driver/xinit/xend: huge memory 
overhead and long computation time that makes it impossible to 
generate some plots in headless mode.


For example, a simple Sgrayplot that takes ~1 second to plot and save 
to a png in normal mode takes more than 200 seconds and huge amount of 
ram in headless mode (see attached test script).


I also have some plots that works without a problem in normal mode, 
but fail in headless mode because of some memory limitation:


xend: An error occurred: Unable to create export file, not enough
memory. Decreasing the number of elements or the size of the
figure should fix this error.

Is there a way to get around these problems?

Thanks for your help,

Antoine







___
users mailing list
users@lists.scilab.org
https://antispam.utc.fr/proxy/1/c3RlcGhhbmUubW90dGVsZXRAdXRjLmZy/lists.scilab.org/mailman/listinfo/users


--
Stéphane Mottelet
Ingénieur de recherche
EA 4297 Transformations Intégrées de la Matière Renouvelable
Département Génie des Procédés Industriels
Sorbonne Universités - Université de Technologie de Compiègne
CS 60319, 60203 Compiègne cedex
Tel : +33(0)344234688
http://www.utc.fr/~mottelet

___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users


Re: [Scilab-users] {EXT} Re: Headless graphics in scilab: time & memory issues

2020-12-03 Thread Dang Ngoc Chan, Christophe
Hello Antoine,

> De : Antoine Monmayrant
> Envoyé : jeudi 3 décembre 2020 10:00
>
> Can any of you confirm this bug?

I don't know what you mean by headless mode but I get the same error as you 
error when I run your script (except it is in Franch):
"xs2png : Impossible de créer le fichier d'export, pas assez de mémoire 
disponible. Diminuer le nombre d'éléments ou la taille de la figure devrait 
corriger cette erreur."

Regards

--
Christophe Dang Ngoc Chan
Mechanical calculation engineer

General
This e-mail may contain confidential and/or privileged information. If you are 
not the intended recipient (or have received this e-mail in error), please 
notify the sender immediately and destroy this e-mail. Any unauthorized 
copying, disclosure or distribution of the material in this e-mail is strictly 
forbidden.
___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users


Re: [Scilab-users] Headless graphics in scilab: time & memory issues

2020-12-03 Thread Antoine Monmayrant

Hello again,

Just to add to my previous message: increasing nx or ny in my script can 
crash scilab during the call to xend().

On my small local machine, this occurs for:

   nx=4000;
   ny=3000;

for which scilab takes ~7 seconds to create the png in "normal" mode...

Can any of you confirm this bug?

Antoine

On 03/12/2020 09:48, Antoine Monmayrant wrote:


Hello all,

In these days of remote working, I need to use again scilab in 
headless mode to generate graphics.


In other words, I connect  in command line only to a remote server 
where scilab is installed and I want it to generate graphics using a 
combination of driver, xinit and xend.


There seems to be some issues with driver/xinit/xend: huge memory 
overhead and long computation time that makes it impossible to 
generate some plots in headless mode.


For example, a simple Sgrayplot that takes ~1 second to plot and save 
to a png in normal mode takes more than 200 seconds and huge amount of 
ram in headless mode (see attached test script).


I also have some plots that works without a problem in normal mode, 
but fail in headless mode because of some memory limitation:


xend: An error occurred: Unable to create export file, not enough
memory. Decreasing the number of elements or the size of the
figure should fix this error.

Is there a way to get around these problems?

Thanks for your help,

Antoine







___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users
___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users


[Scilab-users] Headless graphics in scilab: time & memory issues

2020-12-03 Thread Antoine Monmayrant

Hello all,

In these days of remote working, I need to use again scilab in headless 
mode to generate graphics.


In other words, I connect  in command line only to a remote server where 
scilab is installed and I want it to generate graphics using a 
combination of driver, xinit and xend.


There seems to be some issues with driver/xinit/xend: huge memory 
overhead and long computation time that makes it impossible to generate 
some plots in headless mode.


For example, a simple Sgrayplot that takes ~1 second to plot and save to 
a png in normal mode takes more than 200 seconds and huge amount of ram 
in headless mode (see attached test script).


I also have some plots that works without a problem in normal mode, but 
fail in headless mode because of some memory limitation:


   xend: An error occurred: Unable to create export file, not enough
   memory. Decreasing the number of elements or the size of the figure
   should fix this error.

Is there a way to get around these problems?

Thanks for your help,

Antoine








xend_test.sce
Description: application/scilab-sce
___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users