[Scilab-users] calling a fortran subroutine inside scilab

Eduardo Torrecillas eduardo.torrecillas at gmail.com
Wed Aug 13 19:08:28 CEST 2014


Hi all,

My question is about calling a fortran subroutine inside scilab. I have
been doing this for quite some time now, using ilib_for_link, and it works
neatly.

Recently I have tried to use a subroutine that does parallel processing
using openmp, but scilab just seems to ignore the compiling flag to
parallelize calculations. I know the subroutine works because I have used
it already, compiling the program into an executable and running it through
a terminal. But on scilab, the subroutine runs as if no openmp directives
had been called, even though I add the flag -fopenmp when calling
ilib_for_link.

Does anyone have an idea why this could be happening? I'll put some of my
code below. I'm using linux ubuntu 12.04 32bits and scilab 5.3.3. I also
tried using Ubuntu 12.04 64bits without success.

----------------------------------------------------------------------------------------------------------------------
function principal()

clear

clc

ulink()

stacksize(2.68e8)

    chdir('./Bibliotecas/Fortran/');

    link_name = ['fteste_openmp','fteste_openmp2'];
    flag  = "f";
    files = ['tipos.mod','fteste_openmp.f90','fteste_openmp2.f90'];
    libs  = [];


ilib_for_link(link_name,files,libs,flag,'','floader.sce','','','','-fopenmp','');

    exec floader.sce

    chdir('../')
    chdir('../')

end

n=100000

for i=1:n
    vec1(i,:)=[i 2*i 3*i]
end

tic()
//serial processing
[vec2]=call('fteste_openmp',npanel,1,'i',vec1,2,'d','out',[npanel,3],3,'d');
time=toc()

mprintf('T: %f s\n',tempo)

tic()
//parallel processing
[vec2]=call('fteste_openmp2',npanel,1,'i',vec1,2,'d','out',[npanel,3],3,'d');
time=toc()

mprintf('T: %f s\n',tempo)

endfunction
-----------------------------------------------------------------------------------------------------------------

Thanks a lot,

-- 
Eduardo Torrecillas
AER-09
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.scilab.org/pipermail/users/attachments/20140813/9074924a/attachment.htm>


More information about the users mailing list