Mercurial > hg > vamp-build-and-test
comparison DEPENDENCIES/mingw32/Python27/Lib/site-packages/numpy/distutils/fcompiler/intel.py @ 87:2a2c65a20a8b
Add Python libs and headers
author | Chris Cannam |
---|---|
date | Wed, 25 Feb 2015 14:05:22 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
86:413a9d26189e | 87:2a2c65a20a8b |
---|---|
1 # http://developer.intel.com/software/products/compilers/flin/ | |
2 from __future__ import division, absolute_import, print_function | |
3 | |
4 import sys | |
5 | |
6 from numpy.distutils.ccompiler import simple_version_match | |
7 from numpy.distutils.fcompiler import FCompiler, dummy_fortran_file | |
8 | |
9 compilers = ['IntelFCompiler', 'IntelVisualFCompiler', | |
10 'IntelItaniumFCompiler', 'IntelItaniumVisualFCompiler', | |
11 'IntelEM64VisualFCompiler', 'IntelEM64TFCompiler'] | |
12 | |
13 def intel_version_match(type): | |
14 # Match against the important stuff in the version string | |
15 return simple_version_match(start=r'Intel.*?Fortran.*?(?:%s).*?Version' % (type,)) | |
16 | |
17 class BaseIntelFCompiler(FCompiler): | |
18 def update_executables(self): | |
19 f = dummy_fortran_file() | |
20 self.executables['version_cmd'] = ['<F77>', '-FI', '-V', '-c', | |
21 f + '.f', '-o', f + '.o'] | |
22 | |
23 class IntelFCompiler(BaseIntelFCompiler): | |
24 | |
25 compiler_type = 'intel' | |
26 compiler_aliases = ('ifort',) | |
27 description = 'Intel Fortran Compiler for 32-bit apps' | |
28 version_match = intel_version_match('32-bit|IA-32') | |
29 | |
30 possible_executables = ['ifort', 'ifc'] | |
31 | |
32 executables = { | |
33 'version_cmd' : None, # set by update_executables | |
34 'compiler_f77' : [None, "-72", "-w90", "-w95"], | |
35 'compiler_f90' : [None], | |
36 'compiler_fix' : [None, "-FI"], | |
37 'linker_so' : ["<F90>", "-shared"], | |
38 'archiver' : ["ar", "-cr"], | |
39 'ranlib' : ["ranlib"] | |
40 } | |
41 | |
42 pic_flags = ['-fPIC'] | |
43 module_dir_switch = '-module ' # Don't remove ending space! | |
44 module_include_switch = '-I' | |
45 | |
46 def get_flags_free(self): | |
47 return ["-FR"] | |
48 | |
49 def get_flags(self): | |
50 return ['-fPIC'] | |
51 | |
52 def get_flags_opt(self): | |
53 #return ['-i8 -xhost -openmp -fp-model strict'] | |
54 return ['-xhost -openmp -fp-model strict'] | |
55 | |
56 def get_flags_arch(self): | |
57 return [] | |
58 | |
59 def get_flags_linker_so(self): | |
60 opt = FCompiler.get_flags_linker_so(self) | |
61 v = self.get_version() | |
62 if v and v >= '8.0': | |
63 opt.append('-nofor_main') | |
64 if sys.platform == 'darwin': | |
65 # Here, it's -dynamiclib | |
66 try: | |
67 idx = opt.index('-shared') | |
68 opt.remove('-shared') | |
69 except ValueError: | |
70 idx = 0 | |
71 opt[idx:idx] = ['-dynamiclib', '-Wl,-undefined,dynamic_lookup'] | |
72 return opt | |
73 | |
74 class IntelItaniumFCompiler(IntelFCompiler): | |
75 compiler_type = 'intele' | |
76 compiler_aliases = () | |
77 description = 'Intel Fortran Compiler for Itanium apps' | |
78 | |
79 version_match = intel_version_match('Itanium|IA-64') | |
80 | |
81 possible_executables = ['ifort', 'efort', 'efc'] | |
82 | |
83 executables = { | |
84 'version_cmd' : None, | |
85 'compiler_f77' : [None, "-FI", "-w90", "-w95"], | |
86 'compiler_fix' : [None, "-FI"], | |
87 'compiler_f90' : [None], | |
88 'linker_so' : ['<F90>', "-shared"], | |
89 'archiver' : ["ar", "-cr"], | |
90 'ranlib' : ["ranlib"] | |
91 } | |
92 | |
93 class IntelEM64TFCompiler(IntelFCompiler): | |
94 compiler_type = 'intelem' | |
95 compiler_aliases = () | |
96 description = 'Intel Fortran Compiler for 64-bit apps' | |
97 | |
98 version_match = intel_version_match('EM64T-based|Intel\\(R\\) 64|64|IA-64|64-bit') | |
99 | |
100 possible_executables = ['ifort', 'efort', 'efc'] | |
101 | |
102 executables = { | |
103 'version_cmd' : None, | |
104 'compiler_f77' : [None, "-FI"], | |
105 'compiler_fix' : [None, "-FI"], | |
106 'compiler_f90' : [None], | |
107 'linker_so' : ['<F90>', "-shared"], | |
108 'archiver' : ["ar", "-cr"], | |
109 'ranlib' : ["ranlib"] | |
110 } | |
111 | |
112 def get_flags(self): | |
113 return ['-fPIC'] | |
114 | |
115 def get_flags_opt(self): | |
116 #return ['-i8 -xhost -openmp -fp-model strict'] | |
117 return ['-xhost -openmp -fp-model strict'] | |
118 | |
119 def get_flags_arch(self): | |
120 return [] | |
121 | |
122 # Is there no difference in the version string between the above compilers | |
123 # and the Visual compilers? | |
124 | |
125 class IntelVisualFCompiler(BaseIntelFCompiler): | |
126 compiler_type = 'intelv' | |
127 description = 'Intel Visual Fortran Compiler for 32-bit apps' | |
128 version_match = intel_version_match('32-bit|IA-32') | |
129 | |
130 def update_executables(self): | |
131 f = dummy_fortran_file() | |
132 self.executables['version_cmd'] = ['<F77>', '/FI', '/c', | |
133 f + '.f', '/o', f + '.o'] | |
134 | |
135 ar_exe = 'lib.exe' | |
136 possible_executables = ['ifort', 'ifl'] | |
137 | |
138 executables = { | |
139 'version_cmd' : None, | |
140 'compiler_f77' : [None, "-FI", "-w90", "-w95"], | |
141 'compiler_fix' : [None, "-FI", "-4L72", "-w"], | |
142 'compiler_f90' : [None], | |
143 'linker_so' : ['<F90>', "-shared"], | |
144 'archiver' : [ar_exe, "/verbose", "/OUT:"], | |
145 'ranlib' : None | |
146 } | |
147 | |
148 compile_switch = '/c ' | |
149 object_switch = '/Fo' #No space after /Fo! | |
150 library_switch = '/OUT:' #No space after /OUT:! | |
151 module_dir_switch = '/module:' #No space after /module: | |
152 module_include_switch = '/I' | |
153 | |
154 def get_flags(self): | |
155 opt = ['/nologo', '/MD', '/nbs', '/Qlowercase', '/us'] | |
156 return opt | |
157 | |
158 def get_flags_free(self): | |
159 return ["-FR"] | |
160 | |
161 def get_flags_debug(self): | |
162 return ['/4Yb', '/d2'] | |
163 | |
164 def get_flags_opt(self): | |
165 return ['/O1'] # Scipy test failures with /O2 | |
166 | |
167 def get_flags_arch(self): | |
168 return ["/arch:IA-32", "/QaxSSE3"] | |
169 | |
170 class IntelItaniumVisualFCompiler(IntelVisualFCompiler): | |
171 compiler_type = 'intelev' | |
172 description = 'Intel Visual Fortran Compiler for Itanium apps' | |
173 | |
174 version_match = intel_version_match('Itanium') | |
175 | |
176 possible_executables = ['efl'] # XXX this is a wild guess | |
177 ar_exe = IntelVisualFCompiler.ar_exe | |
178 | |
179 executables = { | |
180 'version_cmd' : None, | |
181 'compiler_f77' : [None, "-FI", "-w90", "-w95"], | |
182 'compiler_fix' : [None, "-FI", "-4L72", "-w"], | |
183 'compiler_f90' : [None], | |
184 'linker_so' : ['<F90>', "-shared"], | |
185 'archiver' : [ar_exe, "/verbose", "/OUT:"], | |
186 'ranlib' : None | |
187 } | |
188 | |
189 class IntelEM64VisualFCompiler(IntelVisualFCompiler): | |
190 compiler_type = 'intelvem' | |
191 description = 'Intel Visual Fortran Compiler for 64-bit apps' | |
192 | |
193 version_match = simple_version_match(start='Intel\(R\).*?64,') | |
194 | |
195 def get_flags_arch(self): | |
196 return ["/arch:SSE2"] | |
197 | |
198 | |
199 if __name__ == '__main__': | |
200 from distutils import log | |
201 log.set_verbosity(2) | |
202 from numpy.distutils.fcompiler import new_fcompiler | |
203 compiler = new_fcompiler(compiler='intel') | |
204 compiler.customize() | |
205 print(compiler.get_version()) |