Scilab 6.0.1 and OMP

classic Classic list List threaded Threaded
2 messages Options
mobile_ghost mobile_ghost
Reply | Threaded
Open this post in threaded view
|

Scilab 6.0.1 and OMP

There is a very simple Fortran progmam calculating
gravity, in which I used OMP code ( grav3d_omp.f90
<https://drive.google.com/file/d/1ytver7e3yY6rKGSy7_XFMUc7NlCmTXY5/view?usp=sharing>
)
Here is a row in .bashrc
export OMP_NUM_THREADS=8

I ran grav3d_omp from a terminal window and
htop shows (Figure  htop_2019-01-14_16-36-52.png
<https://drive.google.com/file/d/1Ab_XeUFN0WdpozxZhP_yNy8smIXpcZ4i/view?usp=sharing>
) that OMP works OK.

The same program I ran from Scilab 6.0.1 command window

--> unix("bin/grav3d_omp");
and saw that OMP does not work (screen shot
htop_scilab_2019-01-14_16-41-29.png
<https://drive.google.com/file/d/1Rj8cHwbDy6LHdxLAmOrn9xv2sd5exgYF/view?usp=sharing>
)


My OS is Ubuntu 16.04
nick@:$ uname -a
Linux ghost7 4.15.0-43-lowlatency #46-Ubuntu SMP PREEMPT Thu Dec 6 17:28:08
UTC
2018 x86_64 x86_64 x86_64 GNU/Linux

nick@:$ ifort -v
ifort version 17.0.4
nick@:$

The same behavior (as shown on figure  htop_scilab_2019-01-14_16-41-29.png
<https://drive.google.com/file/d/1Rj8cHwbDy6LHdxLAmOrn9xv2sd5exgYF/view?usp=sharing>
)
you can see if you make so-module
ifort -qopenmp -FPIC -shared grav3d_omp.f90 -o grav3d_omp.so
and then
link it to Scilab  and call it
a29=link('modules/gravda_omp.so','gravda','f');
 [mgrdm]=call("gravda",a_cells,1,"d",ipar,2,"i",...
                 xgrd,3,"d",ygrd,4,"d", zgrd,5,"d",...
                 mgrdm,6,"d",indsub,7,"i",...
                 frm3d,8,"d",srf,9,"i",logfiles3d,10,"i",...
         "out",[nr_mgrdm,nc_mgrdm],6,"d");

How to make OMP code working from inside Scilab?
A question for the developers. What the reason and how to bypass the problem
?
Maybe I sent the question to the wrong place so I would like to ask someone
to
tell me were should I send it to get an answer or any hint.

The references to grav3d_omp, the program source code and input data to run
it are attached:

Input data to grav3d_omp is in  grav3d_omp.rar
<https://drive.google.com/file/d/16RjHmPVsyTE1FVlxg8-tfDcxJVKwxs-f/view?usp=sharing>  
https://drive.google.com/file/d/16RjHmPVsyTE1FVlxg8-tfDcxJVKwxs-f/view?usp=sharing

grav3d_omp.f90
<https://drive.google.com/file/d/1ytver7e3yY6rKGSy7_XFMUc7NlCmTXY5/view?usp=sharing>  
https://drive.google.com/file/d/1ytver7e3yY6rKGSy7_XFMUc7NlCmTXY5/view?usp=sharing

htop_2019-01-14_16-36-52.png
<https://drive.google.com/file/d/1Ab_XeUFN0WdpozxZhP_yNy8smIXpcZ4i/view?usp=sharing>  
https://drive.google.com/file/d/1Ab_XeUFN0WdpozxZhP_yNy8smIXpcZ4i/view?usp=sharing

htop_scilab_2019-01-14_16-41-29.png
<https://drive.google.com/file/d/1Rj8cHwbDy6LHdxLAmOrn9xv2sd5exgYF/view?usp=sharing>  
https://drive.google.com/file/d/1Rj8cHwbDy6LHdxLAmOrn9xv2sd5exgYF/view?usp=sharing


Thanks in advance.

Nick





--
Sent from: http://mailinglists.scilab.org/Scilab-developers-Mailing-Lists-Archives-f2574944.html
_______________________________________________
dev mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/dev
PedroArthur PedroArthur
Reply | Threaded
Open this post in threaded view
|

Re: Scilab 6.0.1 and OMP

Em seg, 14 de jan de 2019 às 10:44, mobile_ghost <[hidden email]> escreveu:

>
> There is a very simple Fortran progmam calculating
> gravity, in which I used OMP code ( grav3d_omp.f90
> <https://drive.google.com/file/d/1ytver7e3yY6rKGSy7_XFMUc7NlCmTXY5/view?usp=sharing>
> )
> Here is a row in .bashrc
> export OMP_NUM_THREADS=8
>
> I ran grav3d_omp from a terminal window and
> htop shows (Figure  htop_2019-01-14_16-36-52.png
> <https://drive.google.com/file/d/1Ab_XeUFN0WdpozxZhP_yNy8smIXpcZ4i/view?usp=sharing>
> ) that OMP works OK.
>
> The same program I ran from Scilab 6.0.1 command window
>
> --> unix("bin/grav3d_omp");
> and saw that OMP does not work (screen shot
> htop_scilab_2019-01-14_16-41-29.png
> <https://drive.google.com/file/d/1Rj8cHwbDy6LHdxLAmOrn9xv2sd5exgYF/view?usp=sharing>
> )
>
>
> My OS is Ubuntu 16.04
> nick@:$ uname -a
> Linux ghost7 4.15.0-43-lowlatency #46-Ubuntu SMP PREEMPT Thu Dec 6 17:28:08
> UTC
> 2018 x86_64 x86_64 x86_64 GNU/Linux
>
> nick@:$ ifort -v
> ifort version 17.0.4
> nick@:$
>
> The same behavior (as shown on figure  htop_scilab_2019-01-14_16-41-29.png
> <https://drive.google.com/file/d/1Rj8cHwbDy6LHdxLAmOrn9xv2sd5exgYF/view?usp=sharing>
> )
> you can see if you make so-module
> ifort -qopenmp -FPIC -shared grav3d_omp.f90 -o grav3d_omp.so
> and then
> link it to Scilab  and call it
> a29=link('modules/gravda_omp.so','gravda','f');
>  [mgrdm]=call("gravda",a_cells,1,"d",ipar,2,"i",...

There is no function named gravda in the code you provide. I'm
supposing the function name is GRA.
It seems that your OMP directives are in the program (lines 158-160)
and not inside the function. If you want the function to be
parallelized you have to use the directives in a loop inside the
function.
_______________________________________________
dev mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/dev