diff --git a/docker/README.md b/docker/README.md index 6ec039091..d4b32e6cf 100644 --- a/docker/README.md +++ b/docker/README.md @@ -20,7 +20,7 @@ Download and copy Intel® Extension for TensorFlow* wheel into ./models/binaries To use Intel® Optimization for Horovod* with the Intel® oneAPI Collective Communications Library (oneCCL), copy Horovod wheel into ./models/binaries as well. You can get the intel-optimization-for-horovod wheel link from https://pypi.org/project/intel-optimization-for-horovod/#files. ``` -mkdir ./models/binaries +mkdir -p ./models/binaries cd ./models/binaries wget wget @@ -31,13 +31,13 @@ wget config['latest_release']: + itex_version = "latest" + else: + itex_version = __version__ except Exception: print("Intel(R) Extension for TensorFlow* Version is Unknown.\n") python_major_version = sys.version_info.major @@ -35,23 +37,23 @@ def check_python(): python_micro_version = sys.version_info.micro if python_major_version < 2 : - exit("Python2 is not supported, please install Python3!") + exit("\033[31mPython2 is not supported, please install Python3!\033[0m") elif python_minor_version < config['python_version']['min_python_version'][itex_version]: - exit("Your Python version is too low, please upgrade to 3." + - str(config['python_version']['min_python_version'][itex_version]) + " or higher!") + exit("\033[31mYour Python version is too low, please upgrade to 3.\033[0m" + + str(config['python_version']['min_python_version'][itex_version]) + "\033[31m or higher!\033[0m") elif python_minor_version > config['python_version']['max_python_version'][itex_version]: - exit("Your Python version is too high, please downgrade to 3." + - str(config['python_version']['max_python_version'][itex_version]) + " or lower!") + exit("\033[31mYour Python version is too high, please downgrade to 3.\033[0m" + + str(config['python_version']['max_python_version'][itex_version]) + "\033[31m or lower!\033[0m") print("\t Python " + str(python_major_version) + "." + str(python_minor_version) + "." + str(python_micro_version) + " is Supported.") - print("Check Python Passed\n") + print("\033[32mCheck Python Passed\033[0m\n") return itex_version def check_os(): print("Check OS") system_type = platform.system() if system_type != 'Linux': - exit("We only Support Linux System\n") + exit("\033[31mWe only Support Linux System!\033[0m\n") with open('/etc/os-release', 'r') as f: for line in f: @@ -63,8 +65,8 @@ def check_os(): if os_version in config['os_version'][os_id][itex_version]: print("\tOS " + os_id + ":" + os_version + " is Supported") else: - exit("Intel GPU Driver Does Not Support OS " + os_id + " : " + os_version + "\n Check OS failed. \n") - print("Check OS Passed\n") + exit("\033[31mIntel GPU Driver Does Not Support OS \033[0m" + os_id + " : " + os_version + "\n \033[33mCheck OS failed. \033[0m\n") + print("\033[32mCheck OS Passed\033[0m\n") return os_id, os_version def check_tensorflow(): @@ -72,21 +74,20 @@ def check_tensorflow(): tf_found = importlib.util.find_spec("tensorflow") if tf_found is None: - exit("Please Install TensorFlow first.\n") + exit("\033[31mPlease Install TensorFlow first.\033[0m\n") file = ''.join(tf_found.submodule_search_locations) + "/tools/pip_package/setup.py" cmd = "cat " + file + '|grep "_VERSION ="' res = subprocess.run(cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) tf_version = str(res.stdout)[14:20] if tf_version < config['tensorflow_version']['min_tensorflow_version'][itex_version]: - exit("Your Tensorflow version is too low, please upgrade to " + - str(config['tensorflow_version']['min_tensorflow_version'][itex_version]) + "!") + exit("\033[31mYour Tensorflow version is too low, please upgrade to \033[0m" + + str(config['tensorflow_version']['min_tensorflow_version'][itex_version]) + "\033[31m!\033[0m") print("\tTensorflow " + tf_version + " is installed.") - print("Check Tensorflow Passed\n") + print("\033[32mCheck Tensorflow Passed\033[0m\n") def check_driver(): print("Check Intel GPU Driver") - # tf_version = str(res.stdout)[14:20] if os_id == "ubuntu": cmd = "dpkg -s " elif os_id == "rhel": @@ -95,11 +96,11 @@ def check_driver(): elif os_id == "sles": cmd = "zypper se --installed-only " else: - exit("Unsupported OS \n Check Intel GPU Driver Failed\n") + exit("\033[31mUnsupported OS \n Check Intel GPU Driver Failed\033[0m\n") for driver in config['intel_gpu_driver_list'][os_id]: if os.system(cmd + driver) != 0: - exit("\tCheck Intel GPU Driver Failed\n") + exit("\033[31m\tCheck Intel GPU Driver Failed\033[0m\n") print("Check Intel GPU Driver Passsed\n") @@ -108,25 +109,27 @@ def check_oneapi(): cmd = 'LD_DEBUG=libs python -c "import intel_extension_for_tensorflow" 2>&1 |tee /tmp/log' subprocess.run(cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) - for oneapi in config['oneapi_lib']: - cmd = 'grep ' + oneapi + ' /tmp/log' - res = os.system(cmd) - if res != 0: - exit("\tCan't find " + oneapi + "\n Check OneAPI Failed\n" ) + for oneapi in config['oneapi']: + for lib in config['oneapi_lib'][oneapi]: + cmd = 'grep ' + lib + ' /tmp/log' + res = os.system(cmd) + if res != 0: + exit("\033[31m\tCan't find \033[0m" + lib + "\n\033[31m Check OneAPI Failed\033[0m\n" ) print("\t" + config['oneapi'][oneapi] + " is Installed.") - print("Check OneAPI Passed\n") + print("Recommended " + oneapi + " version is " + config['oneapi_version'][itex_version][oneapi]) + print("\033[32mCheck OneAPI Passed\033[0m\n") def check_py_lib(): print("Check Tensorflow Requirements\n") for lib in config['tf_requirements']: lib_found = importlib.util.find_spec(lib) if lib_found is None: - print("\t" + lib + " should be installed.") - print("Check Intel(R) Extension for TensorFlow* Requirements") + print("\t" + lib + "\033[31m should be installed.\033[0m") + print("\033[32mCheck Intel(R) Extension for TensorFlow* Requirements Passed\033[0m") for lib in config['itex_requirements']: lib_found = importlib.util.find_spec(lib) if lib_found is None: - print("\t" + lib + " should be installed.") + print("\t" + lib + "\033[31m should be installed.\033[0m") print("\n") if __name__ == '__main__': @@ -134,7 +137,7 @@ def check_py_lib(): url="https://raw.githubusercontent.com/intel/intel-extension-for-tensorflow/master/tools/python/config.json" configfile="./config.json" os_id="" - config = getConfig(url) + config = get_config(url) itex_version = check_python() os_id, os_version = check_os() check_tensorflow()