提交 de11ad82 authored 作者: Frédéric Bastien's avatar Frédéric Bastien

Merge pull request #2290 from abergeron/use_clang

Use clang++ on mac (if present).
import os import os
import sys
import logging import logging
import theano import theano
...@@ -139,6 +140,15 @@ try: ...@@ -139,6 +140,15 @@ try:
except OSError: except OSError:
param = StrParam("") param = StrParam("")
rc = 1 rc = 1
# On Mac we test for 'clang++' and use it by default
if sys.platform == 'darwin':
try:
rc = call_subprocess_Popen(['clang++', '-v'])
param = StrParam("clang++")
except OSError:
pass
AddConfigVar('cxx', AddConfigVar('cxx',
"The C++ compiler to use. Currently only g++ is" "The C++ compiler to use. Currently only g++ is"
" supported, but supporting additional compilers should not be " " supported, but supporting additional compilers should not be "
......
...@@ -1572,13 +1572,14 @@ class GCC_compiler(object): ...@@ -1572,13 +1572,14 @@ class GCC_compiler(object):
GCC_compiler.march_flags = [] GCC_compiler.march_flags = []
break break
if not "g++" in theano.config.cxx: if ('g++' not in theano.config.cxx and
'clang++' not in theano.config.cxx):
_logger.warn( _logger.warn(
"OPTIMIZATION WARNING: your Theano flag `cxx` seems not to be" "OPTIMIZATION WARNING: your Theano flag `cxx` seems not to be"
" the g++ compiler. So we disable the compiler optimization" " the g++ compiler. So we disable the compiler optimization"
" specific to g++ that tell to compile for a specific CPU." " specific to g++ that tell to compile for a specific CPU."
" At worst, this could cause slow down.\n" " At worst, this could cause slow down.\n"
" You can add yourself those parameters to the compiler" " You can add those parameters to the compiler yourself"
" via the Theano flag `gcc.cxxflags`." " via the Theano flag `gcc.cxxflags`."
) )
detect_march = False detect_march = False
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论