Unverified 提交 704e1b98 authored 作者: Frédéric Bastien's avatar Frédéric Bastien 提交者: GitHub

Merge pull request #6530 from notoraptor/fix-buildbot-win

Fix GPU initialization checking on buildbot.
...@@ -14,7 +14,7 @@ set SUITE=--xunit-testsuite-name= ...@@ -14,7 +14,7 @@ set SUITE=--xunit-testsuite-name=
set THEANO_PARAM=theano --with-timer --timer-top-n 10 set THEANO_PARAM=theano --with-timer --timer-top-n 10
set THEANO_FLAGS=init_gpu_device=cuda set THEANO_FLAGS=init_gpu_device=cuda,dnn.base_path="%CUDNNPATH%"
REM Build libgpuarray REM Build libgpuarray
set GPUARRAY_CONFIG="Release" set GPUARRAY_CONFIG="Release"
...@@ -59,5 +59,5 @@ python -c "import theano.gpuarray; theano.gpuarray.use('%DEVICE%')" || exit /b ...@@ -59,5 +59,5 @@ python -c "import theano.gpuarray; theano.gpuarray.use('%DEVICE%')" || exit /b
REM Fast run and float32 REM Fast run and float32
set FILE=%BUILDBOT_DIR%\theano_python2_fastrun_f32_tests.xml set FILE=%BUILDBOT_DIR%\theano_python2_fastrun_f32_tests.xml
set NAME=win_fastrun_f32 set NAME=win_fastrun_f32
set THEANO_FLAGS=%THEANO_FLAGS%,compiledir=%COMPILEDIR:\=\\%,mode=FAST_RUN,warn.ignore_bug_before=all,on_opt_error=raise,on_shape_error=raise,floatX=float32,dnn.base_path="%CUDNNPATH%",gcc.cxxflags='-I%LIBDIR:\=\\%\\include -L%LIBDIR:\=\\%\\lib' set THEANO_FLAGS=%THEANO_FLAGS%,compiledir=%COMPILEDIR:\=\\%,mode=FAST_RUN,warn.ignore_bug_before=all,on_opt_error=raise,on_shape_error=raise,floatX=float32,gcc.cxxflags='-I%LIBDIR:\=\\%\\include -L%LIBDIR:\=\\%\\lib'
python bin\theano-nose %THEANO_PARAM% %XUNIT%%FILE% %SUITE%%NAME% python bin\theano-nose %THEANO_PARAM% %XUNIT%%FILE% %SUITE%%NAME%
...@@ -9,7 +9,7 @@ REM Set cache dir and copy from master ...@@ -9,7 +9,7 @@ REM Set cache dir and copy from master
set COMPILEDIR=%WORKSPACE%\cache set COMPILEDIR=%WORKSPACE%\cache
REM C:\Windows\System32\robocopy /E /purge C:\Jenkins\theano_cache\buildbot_windows %COMPILEDIR% > nul REM C:\Windows\System32\robocopy /E /purge C:\Jenkins\theano_cache\buildbot_windows %COMPILEDIR% > nul
set THEANO_FLAGS=init_gpu_device=cuda set THEANO_FLAGS=init_gpu_device=cuda,dnn.base_path="%CUDNNPATH%"
REM Build libgpuarray REM Build libgpuarray
set GPUARRAY_CONFIG="Release" set GPUARRAY_CONFIG="Release"
...@@ -52,5 +52,5 @@ python -c "import theano.gpuarray; theano.gpuarray.use('%DEVICE%')" || exit /b ...@@ -52,5 +52,5 @@ python -c "import theano.gpuarray; theano.gpuarray.use('%DEVICE%')" || exit /b
set THEANO_PARAM=theano --with-timer --timer-top-n 10 --with-xunit --xunit-file=theano_win_pr_tests.xml set THEANO_PARAM=theano --with-timer --timer-top-n 10 --with-xunit --xunit-file=theano_win_pr_tests.xml
set NAME=pr_win set NAME=pr_win
set THEANO_FLAGS=%THEANO_FLAGS%,mode=FAST_RUN,floatX=float32,on_opt_error=raise,on_shape_error=raise,cmodule.age_thresh_use=604800,compiledir=%COMPILEDIR:\=\\%,dnn.base_path="%CUDNNPATH%",gcc.cxxflags='-I%LIBDIR:\=\\%\\include -L%LIBDIR:\=\\%\\lib' set THEANO_FLAGS=%THEANO_FLAGS%,mode=FAST_RUN,floatX=float32,on_opt_error=raise,on_shape_error=raise,cmodule.age_thresh_use=604800,compiledir=%COMPILEDIR:\=\\%,gcc.cxxflags='-I%LIBDIR:\=\\%\\include -L%LIBDIR:\=\\%\\lib'
python bin\theano-nose %THEANO_PARAM% --xunit-testsuite-name=%NAME% python bin\theano-nose %THEANO_PARAM% --xunit-testsuite-name=%NAME%
...@@ -17,6 +17,8 @@ error = _logger.error ...@@ -17,6 +17,8 @@ error = _logger.error
info = _logger.info info = _logger.info
pygpu_activated = False pygpu_activated = False
# Used to skip initialization checking when we are in the same processus.
theano_gpu_is_already_active = False
try: try:
import pygpu import pygpu
import pygpu.gpuarray import pygpu.gpuarray
...@@ -58,7 +60,8 @@ def pygpu_parse_version(version_string): ...@@ -58,7 +60,8 @@ def pygpu_parse_version(version_string):
def init_dev(dev, name=None, preallocate=None): def init_dev(dev, name=None, preallocate=None):
global pygpu_activated global pygpu_activated
if os.environ.get('THEANO_GPU_IS_ALREADY_ACTIVE', '') == 'Yes': global theano_gpu_is_already_active
if not theano_gpu_is_already_active and os.environ.get('THEANO_GPU_IS_ALREADY_ACTIVE', '') == 'Yes':
raise RuntimeError("You can't initialize the GPU in a subprocess if the parent process already did it") raise RuntimeError("You can't initialize the GPU in a subprocess if the parent process already did it")
if not config.cxx: if not config.cxx:
raise RuntimeError("The new gpu-backend need a c++ compiler.") raise RuntimeError("The new gpu-backend need a c++ compiler.")
...@@ -95,6 +98,7 @@ def init_dev(dev, name=None, preallocate=None): ...@@ -95,6 +98,7 @@ def init_dev(dev, name=None, preallocate=None):
single_stream=config.gpuarray.single_stream, single_stream=config.gpuarray.single_stream,
**args) **args)
os.environ['THEANO_GPU_IS_ALREADY_ACTIVE'] = 'Yes' os.environ['THEANO_GPU_IS_ALREADY_ACTIVE'] = 'Yes'
theano_gpu_is_already_active = True
context.dev = dev context.dev = dev
init_dev.devmap[dev] = context init_dev.devmap[dev] = context
reg_context(name, context) reg_context(name, context)
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论