#Otherwise False. default_openmp = True #Test if the env variable is set var = os.getenv('OMP_NUM_THREADS', None) if var: try: int(var) except ValueError: raise TypeError("The environment variable OMP_NUM_THREADS" " should be a number, got '%s'." % var) else: default_openmp = not int(var) == 1 else: #Check the number of cores availables. count = cpuCount() if count == -1: _logger.warning("We are not able to detect the number of CPU cores." " We disable openmp by default. To remove this" " warning, set the environment variable" " OMP_NUM_THREADS to the number of threads you" " want theano to use.") default_openmp = count > 1 dummy_stdin = open(os.devnull) if default_openmp and theano.configdefaults.gxx_avail: #check if g++ supports openmp. We need to compile a file as the EPD #version has openmp enabled in the specs file but does not include #the OpenMP files. try:
EnumStr('low', 'high'), in_c_key=False) # Test if the env variable is set var = os.getenv('OMP_NUM_THREADS', None) if var: try: int(var) except ValueError: raise TypeError("The environment variable OMP_NUM_THREADS" " should be a number, got '%s'." % var) else: default_openmp = not int(var) == 1 else: # Check the number of cores availables. count = cpuCount() if count == -1: _logger.warning("We are not able to detect the number of CPU cores." " We disable openmp by default. To remove this" " warning, set the environment variable" " OMP_NUM_THREADS to the number of threads you" " want theano to use.") default_openmp = count > 1 # Disable it by default for now as currently only the ConvOp supports # it, and this causes slowdown by default as we do not disable it for # too small convolution. default_openmp = False AddConfigVar('openmp', "Allow (or not) parallel computation on the CPU with OpenMP. "