[f2py] Issue on MPI/Fortran module generation
Razibul Islam <tamal105-/[email protected]> Thu, 24 Jan 2013 14:23:11 -0800 (PST)
| Newsgroups | gmane.comp.python.f2py.user |
|---|---|
| Message-ID | <[email protected]> |
--===============5341764196447355533==
Content-Type: multipart/alternative; boundary="-2114765872-412281623-1359066191=:61874"
---2114765872-412281623-1359066191=:61874
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: quoted-printable
Hi,=0AI need some information about wrapping MPI/Fortran code into Python m=
odule. So, suppose I have code below, which is MPI/Fortran code.=0AI wonder=
what procedure I need to use to wrap it and execute. I really would like t=
o know how to execute this code in Python, and I would like to =0Aknow what=
the set up of the Python should be : regular python, mpi4py, or some othe=
r Python distribution. I prefer to not change Fortran code and =0AI wonder =
if it is possible. if so, I would very much appreciate some advice on how t=
o do this. I have search the Internet and found info regarding =0Adifferent=
parallel version to compile with f2py. So far I understood that the proble=
m in my path of "mpif.h" file in f2py flag. It would be very helpful if som=
eone=0A=A0could give me some information on this. I have asked for help in =
here and this is really urgent as it is the last step of my master thesis. =
I would highly =0Aappreciate if anyone can give me some advice in this rega=
rd. I have tried the following code to compile using f2py with the option m=
entioned below and got =0Athe konsole output also mentioned below.=0A=0A#--=
-------------------------------------------Fortran code -------------------=
------------------------------=0A=0Aprogram hello_parallel ! Include the MP=
I library definitons: include 'mpif.h' integer numtasks, rank, ierr, rc, le=
n, i character*(MPI_MAX_PROCESSOR_NAME) name ! Initialize the MPI library: =
call MPI_INIT(ierr) if (ierr .ne. MPI_SUCCESS) then print *,'Error starting=
MPI program. Terminating.' call MPI_ABORT(MPI_COMM_WORLD, rc, ierr) end if=
! Get the number of processors this job is using: call MPI_COMM_SIZE(MPI_C=
OMM_WORLD, numtasks, ierr) ! Get the rank of the processor this thread is r=
unning on. (Each ! processor has a unique rank.) call MPI_COMM_RANK(MPI_CO=
MM_WORLD, rank, ierr) ! Get the name of this processor (usually the hostnam=
e) call MPI_GET_PROCESSOR_NAME(name, len, ierr) if (ierr .ne. MPI_SUCCESS) =
then print *,'Error getting processor name. Terminating.' call MPI_ABORT(MP=
I_COMM_WORLD, rc, ierr) end if print "('hello_parallel.f: Number of tasks=
=3D',I3,' My rank=3D',I3,' My name=3D',A,'')",& numtasks, rank, trim(name) =
! Tell the MPI library to release all
resources it is using: call MPI_FINALIZE(ierr) end program hello_parallel=
=0A=0A=0A#--------------------------------Used f2py command=A0 a python ext=
ension module---------------------------=0A=0Af2py -m partest01 -c hello_pa=
r_sub.f -lmpi -L/opt/mpi/lib -L/usr/lib/mpi/gcc -lgm=0A=0A=0A=0A#----------=
-----------------------------Konsole output begins-------------------------=
-------------=0A=0A=0Arunning build=0Arunning config_cc=0Aunifing config_cc=
, config,=0A build_clib, build_ext, build commands --compiler options=0Arun=
ning config_fc=0Aunifing config_fc, config, build_clib, build_ext, build co=
mmands=0A --fcompiler options=0Arunning build_src=0Abuild_src=0Abuilding ex=
tension "partest01" sources=0Af2py options: []=0Af2py:> /tmp/tmpSO6Ywv/src.=
linux-i686-2.7/partest01module.c=0Acreating /tmp/tmpSO6Ywv=0Acreating /tmp/=
tmpSO6Ywv/src.linux-i686-2.7=0AReading fortran codes...=0A=A0=A0=A0=A0=A0=
=A0=A0 Reading file 'hello_par_sub.f' (format:fix,strict)=0ALine #5 in hell=
o_par_sub.f:"=A0=A0=A0=A0=A0 include 'mpif.h'"=0A=A0=A0=A0=A0=A0=A0=A0 read=
fortrancode: could not find include file 'mpif.h' in . Ignoring.=0Armbadnam=
e1: Replacing "rank" with "rank_bn".=0Armbadname1: Replacing "len" with "le=
n_bn".=0Armbadname1: Replacing "rank" with "rank_bn".=0Armbadname1: Replaci=
ng "len" with "len_bn".=0APost-processing...=0A=A0=A0=A0=A0=A0=A0=A0 Block:=
=0A partest01=0A=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=
=A0=A0=A0=A0 Block: hello_parallel=0APost-processing (stage 2)...=0ABuildin=
g modules...=0A=A0=A0=A0=A0=A0=A0=A0 Building module "partest01"...=0A=A0=
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 Constructing wrapper function "h=
ello_parallel"...=0A=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 hel=
lo_parallel()=0A=A0=A0=A0=A0=A0=A0=A0 Wrote C/API module "partest01" to fil=
e "/tmp/tmpSO6Ywv/src.linux-i686-2.7/partest01module.c"=0A=A0 adding '/tmp/=
tmpSO6Ywv/src.linux-i686-2.7/fortranobject.c' to sources.=0A=A0 adding '/tm=
p/tmpSO6Ywv/src.linux-i686-2.7' to include_dirs.=0Acopying /usr/lib/python2=
.7/site-packages/numpy/f2py/src/fortranobject.c ->=0A /tmp/tmpSO6Ywv/src.li=
nux-i686-2.7=0Acopying /usr/lib/python2.7/site-packages/numpy/f2py/src/fort=
ranobject.h -> /tmp/tmpSO6Ywv/src.linux-i686-2.7=0Abuild_src: building npy-=
pkg config files=0Arunning build_ext=0Acustomize UnixCCompiler=0Acustomize =
UnixCCompiler using build_ext=0Acustomize GnuFCompiler=0ACould not locate e=
xecutable g77=0ACould not locate executable=0A f77=A0=A0=A0=A0=A0=A0=A0=A0=
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=
=A0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A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=
=A0=A0=A0=A0=A0 =0Acustomize VastFCompiler=0Acustomize=0A CompaqFCompiler=
=0ACould not locate executable fort=0Acustomize IntelItaniumFCompiler=0ACou=
ld not locate executable efort=0ACould not locate executable efc=0Acustomiz=
e IntelEM64TFCompiler=0Acustomize Gnu95FCompiler=0AFound executable /usr/bi=
n/gfortran=0Acustomize Gnu95FCompiler=0Acustomize Gnu95FCompiler using buil=
d_ext=0Abuilding 'partest01' extension=0Acompiling C sources=0AC compiler: =
gcc -pthread -fno-strict-aliasing -fomit-frame-pointer -fmessage-length=3D0=
-O2 -Wall -D_FORTIFY_SOURCE=3D2 -fstack-protector -funwind-tables -fasynch=
ronous-unwind-tables -g -DNDEBUG -fomit-frame-pointer -fmessage-length=3D0 =
-O2 -Wall -D_FORTIFY_SOURCE=3D2 -fstack-protector -funwind-tables -fasynchr=
onous-unwind-tables -g -fPIC=0A=0Acreating /tmp/tmpSO6Ywv/tmp=0Acreating /t=
mp/tmpSO6Ywv/tmp/tmpSO6Ywv=0Acreating /tmp/tmpSO6Ywv/tmp/tmpSO6Ywv/src.linu=
x-i686-2.7=0Acompile options: '-I/tmp/tmpSO6Ywv/src.linux-i686-2.7=0A -I/us=
r/lib/python2.7/site-packages/numpy/core/include -I/usr/include/python2.7 -=
c'=0Agcc: /tmp/tmpSO6Ywv/src.linux-i686-2.7/partest01module.c=0Agcc: /tmp/t=
mpSO6Ywv/src.linux-i686-2.7/fortranobject.c=0Acompiling Fortran sources=0AF=
ortran f77 compiler: /usr/bin/gfortran -Wall -ffixed-form -fno-second-under=
score -fPIC -O3 -funroll-loops=0AFortran f90 compiler: /usr/bin/gfortran -W=
all -fno-second-underscore -fPIC -O3 -funroll-loops=0AFortran fix compiler:=
/usr/bin/gfortran -Wall -ffixed-form -fno-second-underscore -Wall -fno-sec=
ond-underscore -fPIC -O3 -funroll-loops=0Acompile options: '-I/tmp/tmpSO6Yw=
v/src.linux-i686-2.7 -I/usr/lib/python2.7/site-packages/numpy/core/include =
-I/usr/include/python2.7 -c'=0Agfortran:f77: hello_par_sub.f=0Ahello_par_su=
b.f:4: Error: Can't open included file 'mpif.h'=0Ahello_par_sub.f:4: Error:=
Can't open included file 'mpif.h'=0Aerror: Command "/usr/bin/gfortran -Wal=
l -ffixed-form -fno-second-underscore -fPIC -O3=0A -funroll-loops -I/tmp/tm=
pSO6Ywv/src.linux-i686-2.7 -I/usr/lib/python2.7/site-packages/numpy/core/in=
clude -I/usr/include/python2.7 -c -c hello_par_sub.f -o /tmp/tmpSO6Ywv/hell=
o_par_sub.o" failed with exit status 1=0A=0A=0A=0A=0A=0A#------------------=
------------------------ End of Konsole Output=0A -------------------------=
--
---2114765872-412281623-1359066191=:61874
Content-Type: text/html; charset=iso-8859-1
Content-Transfer-Encoding: quoted-printable
<html><body><div style=3D"color:#000; background-color:#fff; font-family:ti=
mes new roman, new york, times, serif;font-size:10pt"><div id=3D"yiv1582118=
455"><div><div style=3D"color:#000;background-color:#fff;font-family:times =
new roman, new york, times, serif;font-size:10pt;"><div id=3D"yiv1582118455=
"><div id=3D"yiv1582118455yui_3_7_2_18_1359064332666_76"><div id=3D"yiv1582=
118455yui_3_7_2_18_1359064332666_75" class=3D"yiv1582118455yui_3_7_2_18_135=
9064332666_49" style=3D"color:#000;background-color:#fff;font-family:times =
new roman, new york, times, serif;font-size:10pt;"><div class=3D"yiv1582118=
455yui_3_7_2_17_1359034494621_59 yiv1582118455yui_3_7_2_18_1359064332666_50=
" id=3D"yiv1582118455yui_3_7_2_17_1359034494621_60" style=3D"font-family:ti=
mes new roman, new york, times, serif;font-size:10pt;"><div id=3D"yiv158211=
8455yui_3_7_2_17_1359034494621_93" class=3D"yiv1582118455yui_3_7_2_17_13590=
34494621_63 yiv1582118455yui_3_7_2_18_1359064332666_51" style=3D"font-famil=
y:times new roman,
new york, times, serif;font-size:12pt;"><div id=3D"yiv1582118455"><div id=
=3D"yiv1582118455yui_3_7_2_17_1359034494621_114"><div id=3D"yiv1582118455yu=
i_3_7_2_17_1359034494621_113" class=3D"yiv1582118455yui_3_7_2_17_1359034494=
621_69 yiv1582118455yui_3_7_2_18_1359064332666_52" style=3D"color:#000;back=
ground-color:#fff;font-family:times new roman, new york, times, serif;font-=
size:12pt;"><pre id=3D"yiv1582118455yui_3_7_2_16_1358775566147_68">Hi,=0AI =
need some information about wrapping MPI/Fortran code into Python module. S=
o, suppose I have code below, which is MPI/Fortran code.<br>I wonder what p=
rocedure I need to use to wrap it and execute. I really would like to know =
how to execute this code in Python, and I would like to <br>know what the s=
et up of the Python should be : regular python, mpi4py, or some other Pyth=
on distribution. I prefer to not change Fortran code and <br>I wonder if it=
is possible. if so, I would very much appreciate some advice on how to do =
this. I have search the Internet and found info regarding <br>different par=
allel version to compile with f2py. So far I understood that the problem in=
my path of "mpif.h" file in f2py flag. It would be very helpful if someone=
<br> could give me some information on this. I have asked for help in =
here and this is really urgent as it is the last step of my master thesis. =
I would highly <br>appreciate if anyone can give me some advice in
this regard. I have tried the following code to compile using f2py with th=
e option mentioned below and got <br id=3D"yiv1582118455yui_3_7_2_18_135906=
4332666_406">the konsole output also mentioned below.</pre><div id=3D"yiv15=
82118455yui_3_7_2_18_1359064332666_386" class=3D"yiv1582118455yui_3_7_2_17_=
1359034494621_74 yiv1582118455yui_3_7_2_18_1359064332666_57" style=3D"color=
:rgb(0, 0, 0);font-size:16px;font-family:times new roman, new york, times, =
serif;background-color:transparent;font-style:normal;"><br></div><div id=3D=
"yiv1582118455yui_3_7_2_17_1359034494621_134" class=3D"yiv1582118455yui_3_7=
_2_17_1359034494621_75 yiv1582118455yui_3_7_2_18_1359064332666_58" style=3D=
"color:rgb(0, 0,=0A 0);font-size:16px;font-family:times new roman, new york=
, times, serif;background-color:transparent;font-style:normal;">#----------=
-----------------------------------Fortran code=0A ------------------------=
-------------------------<br></div><pre><span style=3D"font-size:13px;">pro=
gram hello_parallel=0A=0A ! Include the MPI library definitons:=0A includ=
e 'mpif.h'=0A=0A integer numtasks, rank, ierr, rc, len, i=0A character*(M=
PI_MAX_PROCESSOR_NAME) name=0A=0A ! Initialize the MPI library:=0A call M=
PI_INIT(ierr)=0A if (ierr .ne. MPI_SUCCESS) then=0A print *,'Error sta=
rting MPI program. Terminating.'=0A call MPI_ABORT(MPI_COMM_WORLD, rc, =
ierr)=0A end if=0A=0A ! Get the number of processors this job is using:=
=0A call MPI_COMM_SIZE(MPI_COMM_WORLD, numtasks, ierr)=0A=0A ! Get the ra=
nk of the processor this thread is running on. (Each=0A ! processor has a=
unique rank.)=0A call MPI_COMM_RANK(MPI_COMM_WORLD, rank, ierr)=0A=0A ! =
Get the name of this processor (usually the hostname)=0A call MPI_GET_PROC=
ESSOR_NAME(name, len, ierr)=0A if (ierr .ne. MPI_SUCCESS) then=0A prin=
t *,'Error getting processor name. Terminating.'=0A call MPI_ABORT(MPI_=
COMM_WORLD, rc, ierr)=0A end if=0A=0A print "('hello_parallel.f: Number o=
f tasks=3D',I3,' My rank=3D',I3,' My name=3D',A,'')",&=0A numtask=
s, rank, trim(name)=0A=0A ! Tell the MPI library to release all resources =
it is using:=0A call MPI_FINALIZE(ierr)=0A=0Aend program hello_parallel</s=
pan></pre><div class=3D"yiv1582118455yui_3_7_2_17_1359034494621_77 yiv15821=
18455yui_3_7_2_18_1359064332666_60" style=3D"color:rgb(0, 0, 0);font-size:1=
6px;font-family:times new roman, new york, times, serif;background-color:tr=
ansparent;font-style:normal;"><br></div><div class=3D"yiv1582118455yui_3_7_=
2_17_1359034494621_78 yiv1582118455yui_3_7_2_18_1359064332666_61" style=3D"=
color:rgb(0, 0, 0);font-size:16px;font-family:times new roman, new york, ti=
mes, serif;background-color:transparent;font-style:normal;"><br></div><div =
class=3D"yiv1582118455yui_3_7_2_17_1359034494621_79 yiv1582118455yui_3_7_2_=
18_1359064332666_62" style=3D"color:rgb(0, 0, 0);font-size:16px;font-family=
:times new roman, new york, times, serif;background-color:transparent;font-=
style:normal;">#--------------------------------Used f2py command a p=
ython extension module---------------------------<br></div><div id=3D"yiv15=
82118455yui_3_7_2_18_1359064332666_417"
class=3D"yiv1582118455yui_3_7_2_17_1359034494621_80=0A yiv1582118455yui_3_=
7_2_18_1359064332666_63" style=3D"color:rgb(0, 0, 0);font-size:16px;font-fa=
mily:times new roman, new york, times, serif;background-color:transparent;f=
ont-style:normal;">f2py -m partest01 -c hello_par_sub.f -lmpi -L/opt/mpi/li=
b -L/usr/lib/mpi/gcc -lgm<br><br></div><div class=3D"yiv1582118455yui_3_7_2=
_17_1359034494621_81 yiv1582118455yui_3_7_2_18_1359064332666_64" style=3D"c=
olor:rgb(0, 0, 0);font-size:16px;font-family:times new roman, new york, tim=
es, serif;background-color:transparent;font-style:normal;"><br></div><div c=
lass=3D"yiv1582118455yui_3_7_2_17_1359034494621_82 yiv1582118455yui_3_7_2_1=
8_1359064332666_65" style=3D"color:rgb(0, 0, 0);font-size:16px;font-family:=
times new roman, new york, times, serif;background-color:transparent;font-s=
tyle:normal;">#---------------------------------------Konsole output begins=
--------------------------------------</div><div class=3D"yiv1582118455yui_=
3_7_2_17_1359034494621_83
yiv1582118455yui_3_7_2_18_1359064332666_66" style=3D"color:rgb(0, 0,=0A 0)=
;font-size:16px;font-family:times new roman, new york, times, serif;backgro=
und-color:transparent;font-style:normal;"><br></div><div class=3D"yiv158211=
8455yui_3_7_2_17_1359034494621_84 yiv1582118455yui_3_7_2_18_1359064332666_6=
7" style=3D"color:rgb(0, 0, 0);font-size:16px;font-family:times new roman, =
new york, times, serif;background-color:transparent;font-style:normal;"><br=
></div><div class=3D"yiv1582118455yui_3_7_2_17_1359034494621_85 yiv15821184=
55yui_3_7_2_18_1359064332666_68" style=3D"color:rgb(0, 0, 0);font-size:16px=
;font-family:times new roman, new york, times, serif;background-color:trans=
parent;font-style:normal;">running build<br>running config_cc<br>unifing co=
nfig_cc, config,=0A build_clib, build_ext, build commands --compiler option=
s<br>running config_fc<br>unifing config_fc, config, build_clib, build_ext,=
build commands=0A --fcompiler options<br>running build_src<br>build_src<br=
>building extension "partest01" sources<br>f2py options: []<br>f2py:> /t=
mp/tmpSO6Ywv/src.linux-i686-2.7/partest01module.c<br>creating /tmp/tmpSO6Yw=
v<br>creating /tmp/tmpSO6Ywv/src.linux-i686-2.7<br>Reading fortran codes...=
<br> Reading file 'hello_par_sub.=
f' (format:fix,strict)<br>Line #5 in hello_par_sub.f:" &nb=
sp; include 'mpif.h'"<br> r=
eadfortrancode: could not find include file 'mpif.h' in . Ignoring.<br>rmba=
dname1: Replacing "rank" with "rank_bn".<br>rmbadname1: Replacing "len" wit=
h "len_bn".<br>rmbadname1: Replacing "rank" with "rank_bn".<br>rmbadname1: =
Replacing "len" with "len_bn".<br>Post-processing...<br> &=
nbsp; Block:=0A partest01<br> &nbs=
p; &=
nbsp; Block: hello_parallel<br>Post-processin=
g (stage 2)...<br>Building modules...<br> &nbs=
p; Building module "partest01"...<br> &n=
bsp; Constructing wra=
pper function "hello_parallel"...<br> &n=
bsp; hello_para=
llel()<br> Wrote C/API module "pa=
rtest01" to file "/tmp/tmpSO6Ywv/src.linux-i686-2.7/partest01module.c"<br>&=
nbsp; adding '/tmp/tmpSO6Ywv/src.linux-i686-2.7/fortranobject.c' to sources=
.<br> adding '/tmp/tmpSO6Ywv/src.linux-i686-2.7' to include_dirs.<br>=
copying /usr/lib/python2.7/site-packages/numpy/f2py/src/fortranobject.c -&g=
t;=0A /tmp/tmpSO6Ywv/src.linux-i686-2.7<br>copying /usr/lib/python2.7/site-=
packages/numpy/f2py/src/fortranobject.h -> /tmp/tmpSO6Ywv/src.linux-i686=
-2.7<br>build_src: building npy-pkg config files<br>running build_ext<br>cu=
stomize UnixCCompiler<br>customize UnixCCompiler using build_ext<br>customi=
ze GnuFCompiler<br>Could not locate executable g77<br>Could not locate exec=
utable=0A f77 &n=
bsp;  =
; &n=
bsp;  =
; &n=
bsp;  =
; &n=
bsp;  =
; &n=
bsp;  =
; &n=
bsp;  =
; <br>customize=0A IntelFCompiler =
&nb=
sp; =
&nb=
sp; =
&nb=
sp; =
&nb=
sp; =
&nb=
sp; =
&nb=
sp; <br>Could n=
ot locate=0A executable ifort &nbs=
p; &=
nbsp; &nbs=
p; &=
nbsp; &nbs=
p; &=
nbsp; &nbs=
p; &=
nbsp; &nbs=
p; &=
nbsp; &nbs=
p; &=
nbsp; <br>Could not locate executable=0A ifc &=
nbsp; &nbs=
p; &=
nbsp; &nbs=
p; &=
nbsp; &nbs=
p; &=
nbsp; &nbs=
p; &=
nbsp; &nbs=
p; &=
nbsp; &nbs=
p; <br>customize=0A LaheyFCompiler  =
; &n=
bsp;  =
; &n=
bsp;  =
; &n=
bsp;  =
; &n=
bsp;  =
; &n=
bsp;  =
; &n=
bsp;  =
; <br>Could not locate=0A executable lf95 &nbs=
p; &=
nbsp; &nbs=
p; &=
nbsp; &nbs=
p; &=
nbsp; &nbs=
p; &=
nbsp; &nbs=
p; &=
nbsp; &nbs=
p; &=
nbsp; <br>customize=0A PGroupFCompiler&=
nbsp; &nbs=
p; &=
nbsp; &nbs=
p; &=
nbsp; &nbs=
p; &=
nbsp; &nbs=
p; &=
nbsp; &nbs=
p; &=
nbsp; &nbs=
p; &=
nbsp; <br>Could not locate=0A executable pgfortran &=
nbsp; &nbs=
p; &=
nbsp; &nbs=
p; &=
nbsp; &nbs=
p; &=
nbsp; &nbs=
p; &=
nbsp; &nbs=
p; &=
nbsp; &nbs=
p; <br>customize=0A AbsoftFCompiler &nbs=
p; &=
nbsp; &nbs=
p; &=
nbsp; &nbs=
p; &=
nbsp; &nbs=
p; &=
nbsp; &nbs=
p; &=
nbsp; &nbs=
p; &=
nbsp; &nbs=
p; <br>Could not locate=0A executable f90 &nbs=
p; &=
nbsp; &nbs=
p; &=
nbsp; &nbs=
p; &=
nbsp; &nbs=
p; &=
nbsp; &nbs=
p; &=
nbsp; &nbs=
p; &=
nbsp; <br>customize=0A NAGFCompiler &nbs=
p; &=
nbsp; &nbs=
p; &=
nbsp; &nbs=
p; &=
nbsp; &nbs=
p; &=
nbsp; &nbs=
p; &=
nbsp; &nbs=
p; &=
nbsp; &nbs=
p; <br>Could=0A not locate executable f95 &nbs=
p; &=
nbsp; &nbs=
p; &=
nbsp; &nbs=
p; &=
nbsp; &nbs=
p; &=
nbsp; &nbs=
p; &=
nbsp; &nbs=
p; &=
nbsp; <br>customize VastFCo=
mpiler<br>customize=0A CompaqFCompiler<br>Could not locate executable fort<=
br>customize IntelItaniumFCompiler<br>Could not locate executable efort<br>=
Could not locate executable efc<br>customize IntelEM64TFCompiler<br>customi=
ze Gnu95FCompiler<br>Found executable /usr/bin/gfortran<br>customize Gnu95F=
Compiler<br>customize Gnu95FCompiler using build_ext<br>building 'partest01=
' extension<br>compiling C sources<br>C compiler: gcc -pthread -fno-strict-=
aliasing -fomit-frame-pointer -fmessage-length=3D0 -O2 -Wall -D_FORTIFY_SOU=
RCE=3D2 -fstack-protector -funwind-tables -fasynchronous-unwind-tables -g -=
DNDEBUG -fomit-frame-pointer -fmessage-length=3D0 -O2 -Wall -D_FORTIFY_SOUR=
CE=3D2 -fstack-protector -funwind-tables -fasynchronous-unwind-tables -g -f=
PIC<br><br>creating /tmp/tmpSO6Ywv/tmp<br>creating /tmp/tmpSO6Ywv/tmp/tmpSO=
6Ywv<br>creating /tmp/tmpSO6Ywv/tmp/tmpSO6Ywv/src.linux-i686-2.7<br>compile=
options: '-I/tmp/tmpSO6Ywv/src.linux-i686-2.7=0A -I/usr/lib/python2.7/site=
-packages/numpy/core/include -I/usr/include/python2.7 -c'<br>gcc: /tmp/tmpS=
O6Ywv/src.linux-i686-2.7/partest01module.c<br>gcc: /tmp/tmpSO6Ywv/src.linux=
-i686-2.7/fortranobject.c<br>compiling Fortran sources<br>Fortran f77 compi=
ler: /usr/bin/gfortran -Wall -ffixed-form -fno-second-underscore -fPIC -O3 =
-funroll-loops<br>Fortran f90 compiler: /usr/bin/gfortran -Wall -fno-second=
-underscore -fPIC -O3 -funroll-loops<br>Fortran fix compiler: /usr/bin/gfor=
tran -Wall -ffixed-form -fno-second-underscore -Wall -fno-second-underscore=
-fPIC -O3 -funroll-loops<br>compile options: '-I/tmp/tmpSO6Ywv/src.linux-i=
686-2.7 -I/usr/lib/python2.7/site-packages/numpy/core/include -I/usr/includ=
e/python2.7 -c'<br>gfortran:f77: hello_par_sub.f<br>hello_par_sub.f:4: Erro=
r: Can't open included file 'mpif.h'<br>hello_par_sub.f:4: Error: Can't ope=
n included file 'mpif.h'<br>error: Command "/usr/bin/gfortran -Wall -ffixed=
-form -fno-second-underscore -fPIC -O3=0A -funroll-loops -I/tmp/tmpSO6Ywv/s=
rc.linux-i686-2.7 -I/usr/lib/python2.7/site-packages/numpy/core/include -I/=
usr/include/python2.7 -c -c hello_par_sub.f -o /tmp/tmpSO6Ywv/hello_par_sub=
.o" failed with exit status 1<br></div><div class=3D"yiv1582118455yui_3_7_2=
_17_1359034494621_86 yiv1582118455yui_3_7_2_18_1359064332666_69" style=3D"c=
olor:rgb(0, 0, 0);font-size:16px;font-family:times new roman, new york, tim=
es, serif;background-color:transparent;font-style:normal;"><br></div><div c=
lass=3D"yiv1582118455yui_3_7_2_17_1359034494621_87 yiv1582118455yui_3_7_2_1=
8_1359064332666_70" style=3D"color:rgb(0, 0, 0);font-size:16px;font-family:=
times new roman, new york, times, serif;background-color:transparent;font-s=
tyle:normal;"><br></div><div class=3D"yiv1582118455yui_3_7_2_17_13590344946=
21_88 yiv1582118455yui_3_7_2_18_1359064332666_71" style=3D"color:rgb(0, 0, =
0);font-size:16px;font-family:times new roman, new york, times,
serif;background-color:transparent;font-style:normal;"><br></div><div clas=
s=3D"yiv1582118455yui_3_7_2_17_1359034494621_89 yiv1582118455yui_3_7_2_18_1=
359064332666_72" style=3D"color:rgb(0, 0, 0);font-size:16px;font-family:tim=
es new roman, new york, times, serif;background-color:transparent;font-styl=
e:normal;"> <br>#------------------------------------------ End of Konsole =
Output=0A ---------------------------<br></div><div></div></div></div></div=
><br><br> </div> </div> </div></div></div></div></div></div></div></body><=
/html>
---2114765872-412281623-1359066191=:61874--
--===============5341764196447355533==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
_______________________________________________
f2py-users mailing list
f2py-users-Y4l6ocDipWCuvFJfX82//[email protected]
http://cens.ioc.ee/mailman/listinfo/f2py-users
--===============5341764196447355533==--