Hi, 1) To compile my fortran code, I use the command line: ifort call_func.f -limf -Wl,--rpath -Wl,/usr/local/share/intel/fc/9.1.045/lib funcs.o -o call_func_f which works fine. 2) I want to use the same trick with f2py. So, from f2py manpage, my Makefile looks like: IFCVER = 9.1.045 PATH = /bin:/usr/bin:/usr/local/share/intel/fc/$(IFCVER)/bin LD_LIBRARY_PATH_INTEL = /usr/local/share/intel/fc/$(IFCVER)/lib LD_LIBRARY_PATH = /usr/local/lib:${LD_LIBRARY_PATH_INTEL} LDFLAGS = -limf -Wl,--rpath -Wl,$(LD_LIBRARY_PATH_INTEL) OPTIMIZATION = -O3 -xT -ipo all: funcs.o calc_KM.so calc_KV.so calc_output.so funcs.o: funcs.c gcc -Wall funcs.c -c -o funcs.o calc_KM.so: calc_KM.f funcs.o f2py --fcompiler=intel --opt="$(OPTIMIZATION)" --f90flags="$(LDFLAGS)" -c calc_KM.f funcs.o -m calc_KM .../... but this has no effect, ie intel libs are not linked. What am I doing wrong ? Cheers, -- http://scipy.org/FredericPetit
fred wrote:
Hi,
1) To compile my fortran code, I use the command line: ifort call_func.f -limf -Wl,--rpath -Wl,/usr/local/share/intel/fc/9.1.045/lib funcs.o -o call_func_f which works fine.
2) I want to use the same trick with f2py. So, from f2py manpage, my Makefile looks like: IFCVER = 9.1.045 PATH = /bin:/usr/bin:/usr/local/share/intel/fc/$(IFCVER)/bin LD_LIBRARY_PATH_INTEL = /usr/local/share/intel/fc/$(IFCVER)/lib LD_LIBRARY_PATH = /usr/local/lib:${LD_LIBRARY_PATH_INTEL} LDFLAGS = -limf -Wl,--rpath -Wl,$(LD_LIBRARY_PATH_INTEL) OPTIMIZATION = -O3 -xT -ipo
all: funcs.o calc_KM.so calc_KV.so calc_output.so
funcs.o: funcs.c gcc -Wall funcs.c -c -o funcs.o
calc_KM.so: calc_KM.f funcs.o f2py --fcompiler=intel --opt="$(OPTIMIZATION)" --f90flags="$(LDFLAGS)" -c calc_KM.f funcs.o -m calc_KM
.../...
but this has no effect, ie intel libs are not linked.
What am I doing wrong ?
--f90flags are used in compilation of fortran codes, not when linking. For linking libraries use `-lname` and `-Lpath` in f2py command line. But note that numpy/distutils/fcompiler/intel.py should take care of linking intel compiler libraries. If it does not work for your compiler, try to fix intel.py and send us your changes. Pearu
Pearu Peterson a écrit : Hi Pearu,
--f90flags are used in compilation of fortran codes, not when linking. Ok for this point. For linking libraries use `-lname` and `-Lpath` in f2py command line. But note that numpy/distutils/fcompiler/intel.py should take care of linking intel compiler libraries. If it does not work for your compiler, try to fix intel.py and send us your changes.
Ok, so how intel.py could guess that I want to add some args such as -limf -Wl,--rpath -Wl,/usr/local/share/intel/fc/9.1.045/lib ? I don't know. In others words, how can I set these args that f2py can understand and take in account ? For the fix, I got one. But I guess you won't like it: I have hardcoded it, so it fits only my own needs. This look like this, line 61 of intel.py: opt.append('-limf -Wl,--rpath -Wl,/usr/local/share/intel/fc/9.1.045/lib') I think a real fix should be to set some f2py option like --f90ldflags='...' but this is only my 2 cents... Others few notes: - intel.py does not take in account Core 2 Duo CPU, for whose you need to set the '-xT' option. - -xM option does not exist anymore in recent ifort release; thus it conflicts with other options, such as -xP, -xT, etc... I think I can write a "real" fix, if you have no time and give me some information about how things work in distutils/... Cheers, -- http://scipy.org/FredericPetit
fred wrote:
Pearu Peterson a écrit :
Hi Pearu,
--f90flags are used in compilation of fortran codes, not when linking. Ok for this point. For linking libraries use `-lname` and `-Lpath` in f2py command line. But note that numpy/distutils/fcompiler/intel.py should take care of linking intel compiler libraries. If it does not work for your compiler, try to fix intel.py and send us your changes.
Ok, so how intel.py could guess that I want to add some args such as -limf -Wl,--rpath -Wl,/usr/local/share/intel/fc/9.1.045/lib ? I don't know. In others words, how can I set these args that f2py can understand and take in account ?
At the moment this is not possible via f2py command line.
For the fix, I got one. But I guess you won't like it: I have hardcoded it, so it fits only my own needs. This look like this, line 61 of intel.py:
opt.append('-limf -Wl,--rpath -Wl,/usr/local/share/intel/fc/9.1.045/lib')
I think a real fix should be to set some f2py option like --f90ldflags='...' but this is only my 2 cents...
Yes, I agree. Could you file a numpy issue ticket for this feature and sign it to me?
Others few notes:
- intel.py does not take in account Core 2 Duo CPU, for whose you need to set the '-xT' option.
This flag should be added via cpu.is_Core2() check to .get_arch_flags() methods.
- -xM option does not exist anymore in recent ifort release; thus it conflicts with other options, such as -xP, -xT, etc...
Do you know which version of the compiler dropped -xM option? Then we can disable it by checking the value of self.get_version().
I think I can write a "real" fix, if you have no time and give me some information about how things work in distutils/...
When you make changes to intel.py, for instance, then you can run python intel.py to see the effect of your changes.
Pearu Peterson a écrit :
fred wrote:
Ok, so how intel.py could guess that I want to add some args such as -limf -Wl,--rpath -Wl,/usr/local/share/intel/fc/9.1.045/lib ? I don't know. In others words, how can I set these args that f2py can understand and take in account ?
At the moment this is not possible via f2py command line.
Ok, so we agree ;-) Thanks to have clarified this point.
For the fix, I got one. But I guess you won't like it: I have hardcoded it, so it fits only my own needs. This look like this, line 61 of intel.py:
opt.append('-limf -Wl,--rpath -Wl,/usr/local/share/intel/fc/9.1.045/lib')
I think a real fix should be to set some f2py option like --f90ldflags='...' but this is only my 2 cents...
Yes, I agree. Could you file a numpy issue ticket for this feature and sign it to me?
No problem.
Others few notes:
- intel.py does not take in account Core 2 Duo CPU, for whose you need to set the '-xT' option.
This flag should be added via cpu.is_Core2() check to .get_arch_flags() methods.
- -xM option does not exist anymore in recent ifort release; thus it conflicts with other options, such as -xP, -xT, etc...
Do you know which version of the compiler dropped -xM option? Then we can disable it by checking the value of self.get_version().
No, but I can ask some people at intel, if there is none here... Cheers, -- http://scipy.org/FredericPetit
Pearu Peterson a écrit :
This flag should be added via cpu.is_Core2() check to .get_arch_flags() methods.
Do you agree with something like this ?: --- intel.py 2007-05-25 11:00:11.000000000 +0200 +++ intel.py.orig 2007-05-25 10:59:34.000000000 +0200 @@ -56,8 +56,6 @@ opt.append('-tpp5') elif cpu.is_PentiumIV() or cpu.is_Xeon(): opt.extend(['-tpp7','-xW']) - elif cpu.is_Core2(): - opt.extend(['-tpp7','-xT']) if cpu.has_mmx() and not cpu.is_Xeon(): opt.append('-xM') if cpu.has_sse2():
- -xM option does not exist anymore in recent ifort release; thus it conflicts with other options, such as -xP, -xT, etc...
Do you know which version of the compiler dropped -xM option? Then we can disable it by checking the value of self.get_version().
I'll reply when I get the answer from intel team. Cheers, -- http://scipy.org/FredericPetit
fred wrote:
Pearu Peterson a écrit :
This flag should be added via cpu.is_Core2() check to .get_arch_flags() methods.
Do you agree with something like this ?: --- intel.py 2007-05-25 11:00:11.000000000 +0200 +++ intel.py.orig 2007-05-25 10:59:34.000000000 +0200 @@ -56,8 +56,6 @@ opt.append('-tpp5') elif cpu.is_PentiumIV() or cpu.is_Xeon(): opt.extend(['-tpp7','-xW']) - elif cpu.is_Core2(): - opt.extend(['-tpp7','-xT']) if cpu.has_mmx() and not cpu.is_Xeon(): opt.append('-xM') if cpu.has_sse2():
Yes.
- -xM option does not exist anymore in recent ifort release; thus it conflicts with other options, such as -xP, -xT, etc...
Do you know which version of the compiler dropped -xM option? Then we can disable it by checking the value of self.get_version().
I'll reply when I get the answer from intel team.
That would be great, thanks! Pearu
Pearu Peterson a écrit :
Yes, I agree. Could you file a numpy issue ticket for this feature and sign it to me?
I have filed a ticket to numpy-tickets@ this morning, but no news since. Did something wrong ? -- http://scipy.org/FredericPetit
fred wrote:
Pearu Peterson a écrit :
Yes, I agree. Could you file a numpy issue ticket for this feature and sign it to me?
I have filed a ticket to numpy-tickets@ this morning, but no news since. Did something wrong ?
Tickets can be submitted in http://projects.scipy.org/scipy/numpy/ (you may need to log in) Pearu
Pearu Peterson a écrit :
Tickets can be submitted in
http://projects.scipy.org/scipy/numpy/
(you may need to log in)
Ok, that's what I was looking for. Anyway, I did not see any "Assign to" field, as for enthought trac, for example... Cheers, -- http://scipy.org/FredericPetit
fred wrote:
Pearu Peterson a écrit :
Tickets can be submitted in
http://projects.scipy.org/scipy/numpy/
(you may need to log in)
Ok, that's what I was looking for. Anyway, I did not see any "Assign to" field, as for enthought trac, for example...
enthought trac?, you should use http://projects.scipy.org/scipy/numpy/newticket to send numpy tickets. Pearu
Pearu Peterson wrote:
fred wrote:
Pearu Peterson a écrit :
Tickets can be submitted in
http://projects.scipy.org/scipy/numpy/
(you may need to log in)
Ok, that's what I was looking for. Anyway, I did not see any "Assign to" field, as for enthought trac, for example...
enthought trac?, you should use
http://projects.scipy.org/scipy/numpy/newticket
to send numpy tickets.
Pearu _______________________________________________ SciPy-user mailing list SciPy-user@scipy.org http://projects.scipy.org/mailman/listinfo/scipy-user
I guess he was looking for a field where he can assign the ticket directly to you. I cannot find it, too. Nils
Nils Wagner a écrit :
I guess he was looking for a field where he can assign the ticket directly to you. I cannot find it, too.
You got the trick, Nils ;-) Thanks to explain better than I did :-) Cheers, -- http://scipy.org/FredericPetit
fred wrote:
Nils Wagner a écrit :
I guess he was looking for a field where he can assign the ticket directly to you. I cannot find it, too.
You got the trick, Nils ;-) Thanks to explain better than I did :-)
Hmm, I can see my name in the assign to list: http://cens.ioc.ee/~pearu/sh.jpg Anyway, just file the ticket and I'll reassign it to myself. Pearu
Pearu Peterson a écrit :
fred wrote:
Nils Wagner a écrit :
I guess he was looking for a field where he can assign the ticket directly to you. I cannot find it, too.
You got the trick, Nils ;-) Thanks to explain better than I did :-)
Hmm, I can see my name in the assign to list: http://cens.ioc.ee/~pearu/sh.jpg
Yes, you got the "Assign to" field, unlike I and Nils. http://fredantispam.free.fr/numpy.png
Anyway, just file the ticket and I'll reassign it to myself.
Already done. Cheers, -- http://scipy.org/FredericPetit
On Fri, May 25, 2007 at 04:02:04PM +0200, Pearu Peterson wrote:
fred wrote:
Nils Wagner a écrit :
I guess he was looking for a field where he can assign the ticket directly to you. I cannot find it, too.
You got the trick, Nils ;-) Thanks to explain better than I did :-)
Hmm, I can see my name in the assign to list: http://cens.ioc.ee/~pearu/sh.jpg
Anyway, just file the ticket and I'll reassign it to myself.
I'm guessing only those on the assignee list can assign. -- |>|\/|< /--------------------------------------------------------------------------\ |David M. Cooke http://arbutus.physics.mcmaster.ca/dmc/ |cookedm@physics.mcmaster.ca
Pearu Peterson a écrit :
enthought trac?, you should use
http://projects.scipy.org/scipy/numpy/newticket
to send numpy tickets.
No, no, I did not mean this ;-) I only wanted to say that I do not see "Assign to" field in the numpy trac as I can see it in enthought trac, so I could not assign to you...
I wanted to post this message with snapshot attached to show the issue with numpy trac,but scipy.org refused it. -- http://scipy.org/FredericPetit
On Fri, May 25, 2007 at 09:43:53AM +0200, Pearu Peterson wrote:
fred wrote:
Pearu Peterson a écrit :
Hi Pearu,
--f90flags are used in compilation of fortran codes, not when linking. Ok for this point. For linking libraries use `-lname` and `-Lpath` in f2py command line. But note that numpy/distutils/fcompiler/intel.py should take care of linking intel compiler libraries. If it does not work for your compiler, try to fix intel.py and send us your changes.
Ok, so how intel.py could guess that I want to add some args such as -limf -Wl,--rpath -Wl,/usr/local/share/intel/fc/9.1.045/lib ? I don't know. In others words, how can I set these args that f2py can understand and take in account ?
At the moment this is not possible via f2py command line.
For the fix, I got one. But I guess you won't like it: I have hardcoded it, so it fits only my own needs. This look like this, line 61 of intel.py:
opt.append('-limf -Wl,--rpath -Wl,/usr/local/share/intel/fc/9.1.045/lib')
I've merged in my distutils-rework branch into numpy, which should let you specify this either with the LDFLAGS environment variable, or put this in your setup.cfg or ~/.pydistutils.cfg: [config_fc] ldflags=-limf -Wl,--rpath -Wl,/usr/local/share/intel/fc/9.1.045/lib -- |>|\/|< /--------------------------------------------------------------------------\ |David M. Cooke http://arbutus.physics.mcmaster.ca/dmc/ |cookedm@physics.mcmaster.ca
Pearu Peterson a écrit :
- -xM option does not exist anymore in recent ifort release; thus it conflicts with other options, such as -xP, -xT, etc...
Do you know which version of the compiler dropped -xM option? Then we can disable it by checking the value of self.get_version().
Hi, I just got the answer from intel: -xM was supported in the 7.1 compilers, but support was discontinued in the 8.0 compiler.Please note that the 7.1 compilers might not work on more recent Linux distributions, though they should work on older ones. If you have a Pentium 4 or more recent processor, you should use -xW or similar switch in place of -xM. The SSE2 and later instructions are more powerful than the old MMX. Cheers, -- http://scipy.org/FredericPetit
fred wrote:
Pearu Peterson a écrit :
- -xM option does not exist anymore in recent ifort release; thus it conflicts with other options, such as -xP, -xT, etc...
Do you know which version of the compiler dropped -xM option? Then we can disable it by checking the value of self.get_version().
Hi,
I just got the answer from intel:
-xM was supported in the 7.1 compilers, but support was discontinued in the 8.0 compiler.Please note that the 7.1 compilers might not work on more recent Linux distributions, though they should work on older ones.
If you have a Pentium 4 or more recent processor, you should use -xW or similar switch in place of -xM. The SSE2 and later instructions are more powerful than the old MMX.
Ok, thanks. I will add the following codelet to intel compiler get_flags_arch() method: if v and v <= '7.1': if cpu.has_mmx() and (cpu.is_PentiumII() or cpu.is_PentiumIII()): opt.append('-xM') Do you have references how the processor types map to options such as -xP, -xT, etc...? Pearu
Pearu Peterson a écrit :
Do you have references how the processor types map to options such as -xP, -xT, etc...?
From the manpage: -x<p> (i32 and i32em) Generates specialized and optimized code for the processor that executes your program. The characters K, W, N, B, P, and T denote the processor types (<p>). The following are -x options: · -xK Generates code for Intel Pentium III processors and compatible Intel processors. · -xW Generates code for Intel Pentium 4 processors and compatible Intel processors. · -xN Generates code for Intel Pentium 4 and compatible Intel processors with Streaming SIMD Extensions 2. The resulting code may contain unconditional use of features that are not supported on other proces- sors. This option also enables new optimizations in addition to Intel processor-specific optimizations including advanced data layout and code restructuring optimizations to improve memory accesses for Intel processors. · -xB Generates code for Intel Pentium M processors and compatible Intel processors. Also enables new optimizations in addition to Intel processor-specific optimizations. · -xP Generates code for Intel(R) Core(TM) Duo processors, Intel(R) Core(TM) Solo processors, Intel(R) Pen- tium(R) 4 processors with Streaming SIMD Extensions 3, and compatible Intel processors with Streaming SIMD Extensions 3. The resulting code may contain unconditional use of features that are not sup- ported on other processors. This option also enables new optimizations in addition to Intel processor-specific optimizations including advanced data layout and code restructuring optimizations to improve memory accesses for Intel processors. · -xT Generates code for Intel(R) Core(TM)2 Duo processors, Intel(R) Core(TM)2 Extreme processors, and the Dual-Core Intel(R) Xeon(R) processor 5100 series. This option also enables new optimizations in addition to Intel processor-specific optimizations including advanced data layout and code restructuring optimizations to improve memory accesses for Intel processors. The only options available on Intel(R) EM64T systems are -xW, -xP, and -xT. On Mac OS systems, the only valid option is -xP. On these systems, it is the default and is always set. If you specify more than one processor value, code is generated for only the highest-performing proces- sor specified. The highest-performing to lowest-performing processor values are: T, P, B, N, W, K. Cheers, -- http://scipy.org/FredericPetit
Others few notes:
- intel.py does not take in account Core 2 Duo CPU, for whose you need >to set the '-xT' option.
- -xM option does not exist anymore in recent ifort release; thus it conflicts with other options, such as -xP, -xT, etc...
I forgot to mention, as third note: -KPIC option is deprecated and should be replaced by -fpic. -- http://scipy.org/FredericPetit
participants (4)
-
David M. Cooke -
fred -
Nils Wagner -
Pearu Peterson