提交 5ccdcace authored 作者: James Bergstra's avatar James Bergstra

moving and renaming cuda and nvcc config variables

上级 7362546f
...@@ -145,10 +145,6 @@ AddConfigVar('op.set_flops', ...@@ -145,10 +145,6 @@ AddConfigVar('op.set_flops',
BoolParam(False), BoolParam(False),
in_c_key=False) in_c_key=False)
AddConfigVar('nvcc.fastmath',
"",
BoolParam(False))
AddConfigVar('gpuelemwise.sync', AddConfigVar('gpuelemwise.sync',
"when true, wait that the gpu fct finished and check it error code.", "when true, wait that the gpu fct finished and check it error code.",
BoolParam(True)) BoolParam(True))
......
import atexit, logging, os, stat, sys import atexit, logging, os, stat, sys
from theano.compile import optdb from theano.compile import optdb
from theano import config
from theano.gof.cmodule import get_lib_extension from theano.gof.cmodule import get_lib_extension
from theano.configparser import config, AddConfigVar, StrParam
import nvcc_compiler import nvcc_compiler
_logger_name = 'theano.sandbox.cuda' _logger_name = 'theano.sandbox.cuda'
...@@ -20,6 +20,22 @@ def debug(*msg): ...@@ -20,6 +20,22 @@ def debug(*msg):
_logger.debug('DEBUG (%s): %s'% ( _logger_name, _logger.debug('DEBUG (%s): %s'% ( _logger_name,
' '.join(str(m) for m in msg))) ' '.join(str(m) for m in msg)))
AddConfigVar('cuda.root',
"""directory with bin/, lib/, include/ for cuda utilities.
This directory is included via -L and -rpath when linking dynamically
compiled modules. If AUTO, if nvcc is in the path, it will use one of
this parent directory. Otherwise /usr/local/cuda. Leave empty to
prevent extra linker directives.
Default: environment variable "CUDA_ROOT" or else "AUTO".
""",
StrParam(os.getenv('CUDA_ROOT', "AUTO")))
if config.cuda.root == "AUTO":
# set nvcc_path correctly and get the version
nvcc_compiler.set_cuda_root()
#is_nvcc_available called here to initialize global vars in nvcc_compiler module
nvcc_compiler.is_nvcc_available()
# Compile cuda_ndarray.cu # Compile cuda_ndarray.cu
# This need that nvcc (part of cuda) is installed. If it is not, a warning is # This need that nvcc (part of cuda) is installed. If it is not, a warning is
......
...@@ -7,20 +7,7 @@ import commands ...@@ -7,20 +7,7 @@ import commands
_logger=logging.getLogger("theano.sandbox.cuda.nvcc_compiler") _logger=logging.getLogger("theano.sandbox.cuda.nvcc_compiler")
_logger.setLevel(logging.WARN) _logger.setLevel(logging.WARN)
from theano.configparser import config, AddConfigVar, StrParam from theano.configparser import config, AddConfigVar, StrParam, BoolParam
AddConfigVar('nvcc.compiler_bindir',
"If defined, nvcc compiler driver will seek g++ and gcc in this directory",
StrParam(""))
AddConfigVar('nvcc.flags',
"Extra compiler flags for nvcc",
StrParam(""))
AddConfigVar('cuda.root',
"The directory with bin/, lib/, include/ for cuda utilities. Used to put this directory of nvidia lib in the compiled libraire. Usefull when people forget to update there LD_LIBRARY_PATH and LIBRARY_PATH environment variable. If AUTO, if nvcc is in the path, it will use one of this parent directory. Otherwise /usr/local/cuda. If empty, won't appen the directory in the compiled library",
StrParam(os.getenv('CUDA_ROOT', "AUTO")))
def error(*args): def error(*args):
#sys.stderr.write('ERROR:'+ ' '.join(str(a) for a in args)+'\n') #sys.stderr.write('ERROR:'+ ' '.join(str(a) for a in args)+'\n')
...@@ -35,6 +22,18 @@ def debug(*args): ...@@ -35,6 +22,18 @@ def debug(*args):
#sys.stderr.write('DEBUG:'+ ' '.join(str(a) for a in args)+'\n') #sys.stderr.write('DEBUG:'+ ' '.join(str(a) for a in args)+'\n')
_logger.debug("DEBUG: "+' '.join(str(a) for a in args)) _logger.debug("DEBUG: "+' '.join(str(a) for a in args))
AddConfigVar('nvcc.compiler_bindir',
"If defined, nvcc compiler driver will seek g++ and gcc in this directory",
StrParam(""))
AddConfigVar('nvcc.flags',
"Extra compiler flags for nvcc",
StrParam(""))
AddConfigVar('nvcc.fastmath',
"",
BoolParam(False))
nvcc_path = 'nvcc' nvcc_path = 'nvcc'
nvcc_version = None nvcc_version = None
def is_nvcc_available(): def is_nvcc_available():
...@@ -66,11 +65,6 @@ def set_cuda_root(): ...@@ -66,11 +65,6 @@ def set_cuda_root():
config.cuda.root = os.path.split(dir)[0] config.cuda.root = os.path.split(dir)[0]
return return
if config.cuda.root == "AUTO":
set_cuda_root()
is_nvcc_available()#to set nvcc_path correctly and get the version
rpath_defaults = [] rpath_defaults = []
def add_standard_rpath(rpath): def add_standard_rpath(rpath):
rpath_defaults.append(rpath) rpath_defaults.append(rpath)
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论