[prev in list] [next in list] [prev in thread] [next in thread]
List: scilab-users
Subject: [Scilab-users] calling a fortran subroutine inside scilab
From: Eduardo Torrecillas <eduardo.torrecillas () gmail ! com>
Date: 2014-08-13 17:08:28
Message-ID: CADqPe=tie-W0aun-gTFRSR2+kq2zQFLF-Y8AsBDn-eNNKh9NEg () mail ! gmail ! com
[Download RAW message or body]
[Attachment #2 (multipart/alternative)]
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
[Attachment #5 (text/html)]
<div dir="ltr"><div>Hi all,</div><div><br></div><div>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.</div><div><br>
</div><div>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.</div>
<div><br></div><div>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.</div>
<div><br></div><div>----------------------------------------------------------------------------------------------------------------------</div><div>function \
principal()</div><div> </div><div>clear</div><div><br></div>
<div>clc</div><div><br></div><div>ulink()</div><div><br></div><div>stacksize(2.68e8)</div><div><br></div><div> \
chdir('./Bibliotecas/Fortran/');</div><div> </div><div> link_name \
= ['fteste_openmp','fteste_openmp2'];</div>
<div> flag = "f";</div><div> files = \
['tipos.mod','fteste_openmp.f90','fteste_openmp2.f90'];</div><div> \
libs = [];</div><div> </div><div> \
ilib_for_link(link_name,files,libs,flag,'','floader.sce','','','','-fopenmp','');</div>
<div> </div><div> exec floader.sce</div><div> </div><div> \
chdir('../')</div><div> chdir('../')</div><div> \
</div><div>end</div><div><br></div><div>n=100000</div><div><br></div><div>for \
i=1:n</div>
<div> vec1(i,:)=[i 2*i \
3*i]</div><div>end</div><div><br></div><div>tic()</div><div>//serial \
processing</div><div>[vec2]=call('fteste_openmp',npanel,1,'i',vec1,2,'d','out',[npanel,3],3,'d');</div>
<div>time=toc()</div><div><br></div><div>mprintf('T: %f \
s\n',tempo)</div><div><br></div><div>tic()</div><div>//parallel \
processing</div><div>[vec2]=call('fteste_openmp2',npanel,1,'i',vec1,2,'d','out',[npanel,3],3,'d');</div>
<div>time=toc()</div><div><br></div><div>mprintf('T: %f \
s\n',tempo)</div><div> \
</div><div>endfunction</div><div>-----------------------------------------------------------------------------------------------------------------</div>
<div><br></div><div>Thanks a lot,</div><div><br></div>-- <br>Eduardo \
Torrecillas<br>AER-09 </div>
_______________________________________________
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic