Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
wiseplat
GitHub Repository: wiseplat/python-code
Path: blob/master/ invest-robot-contest_TinkoffBotTwitch-main/venv/lib/python3.8/site-packages/numpy/distutils/intelccompiler.py
7757 views
1
import platform
2
3
from distutils.unixccompiler import UnixCCompiler
4
from numpy.distutils.exec_command import find_executable
5
from numpy.distutils.ccompiler import simple_version_match
6
if platform.system() == 'Windows':
7
from numpy.distutils.msvc9compiler import MSVCCompiler
8
9
10
class IntelCCompiler(UnixCCompiler):
11
"""A modified Intel compiler compatible with a GCC-built Python."""
12
compiler_type = 'intel'
13
cc_exe = 'icc'
14
cc_args = 'fPIC'
15
16
def __init__(self, verbose=0, dry_run=0, force=0):
17
UnixCCompiler.__init__(self, verbose, dry_run, force)
18
19
v = self.get_version()
20
mpopt = 'openmp' if v and v < '15' else 'qopenmp'
21
self.cc_exe = ('icc -fPIC -fp-model strict -O3 '
22
'-fomit-frame-pointer -{}').format(mpopt)
23
compiler = self.cc_exe
24
25
if platform.system() == 'Darwin':
26
shared_flag = '-Wl,-undefined,dynamic_lookup'
27
else:
28
shared_flag = '-shared'
29
self.set_executables(compiler=compiler,
30
compiler_so=compiler,
31
compiler_cxx=compiler,
32
archiver='xiar' + ' cru',
33
linker_exe=compiler + ' -shared-intel',
34
linker_so=compiler + ' ' + shared_flag +
35
' -shared-intel')
36
37
38
class IntelItaniumCCompiler(IntelCCompiler):
39
compiler_type = 'intele'
40
41
# On Itanium, the Intel Compiler used to be called ecc, let's search for
42
# it (now it's also icc, so ecc is last in the search).
43
for cc_exe in map(find_executable, ['icc', 'ecc']):
44
if cc_exe:
45
break
46
47
48
class IntelEM64TCCompiler(UnixCCompiler):
49
"""
50
A modified Intel x86_64 compiler compatible with a 64bit GCC-built Python.
51
"""
52
compiler_type = 'intelem'
53
cc_exe = 'icc -m64'
54
cc_args = '-fPIC'
55
56
def __init__(self, verbose=0, dry_run=0, force=0):
57
UnixCCompiler.__init__(self, verbose, dry_run, force)
58
59
v = self.get_version()
60
mpopt = 'openmp' if v and v < '15' else 'qopenmp'
61
self.cc_exe = ('icc -std=c99 -m64 -fPIC -fp-model strict -O3 '
62
'-fomit-frame-pointer -{}').format(mpopt)
63
compiler = self.cc_exe
64
65
if platform.system() == 'Darwin':
66
shared_flag = '-Wl,-undefined,dynamic_lookup'
67
else:
68
shared_flag = '-shared'
69
self.set_executables(compiler=compiler,
70
compiler_so=compiler,
71
compiler_cxx=compiler,
72
archiver='xiar' + ' cru',
73
linker_exe=compiler + ' -shared-intel',
74
linker_so=compiler + ' ' + shared_flag +
75
' -shared-intel')
76
77
78
if platform.system() == 'Windows':
79
class IntelCCompilerW(MSVCCompiler):
80
"""
81
A modified Intel compiler compatible with an MSVC-built Python.
82
"""
83
compiler_type = 'intelw'
84
compiler_cxx = 'icl'
85
86
def __init__(self, verbose=0, dry_run=0, force=0):
87
MSVCCompiler.__init__(self, verbose, dry_run, force)
88
version_match = simple_version_match(start=r'Intel\(R\).*?32,')
89
self.__version = version_match
90
91
def initialize(self, plat_name=None):
92
MSVCCompiler.initialize(self, plat_name)
93
self.cc = self.find_exe('icl.exe')
94
self.lib = self.find_exe('xilib')
95
self.linker = self.find_exe('xilink')
96
self.compile_options = ['/nologo', '/O3', '/MD', '/W3',
97
'/Qstd=c99']
98
self.compile_options_debug = ['/nologo', '/Od', '/MDd', '/W3',
99
'/Qstd=c99', '/Z7', '/D_DEBUG']
100
101
class IntelEM64TCCompilerW(IntelCCompilerW):
102
"""
103
A modified Intel x86_64 compiler compatible with
104
a 64bit MSVC-built Python.
105
"""
106
compiler_type = 'intelemw'
107
108
def __init__(self, verbose=0, dry_run=0, force=0):
109
MSVCCompiler.__init__(self, verbose, dry_run, force)
110
version_match = simple_version_match(start=r'Intel\(R\).*?64,')
111
self.__version = version_match
112
113