I am working on a Kaggle notebook and whenever I run a cell that references the TensorFlow module at all, it prints out a huge warning about some sort of settings but still works. I looked up how to suppress warnings from TensorFlow, and everything I found said to do the following:
import os
os.environ["TF_CPP_MIN_LOG_LEVEL"] = "2" # Or "3", either one should work and I've tried both
I have tried putting this both before and after importing TensorFlow but to no avail. The message still prints out. This is the message I am getting:
User settings:
KMP_AFFINITY=granularity=fine,verbose,compact,1,0
KMP_BLOCKTIME=0
KMP_SETTINGS=1
KMP_WARNINGS=0
Effective settings:
KMP_ABORT_DELAY=0
KMP_ADAPTIVE_LOCK_PROPS='1,1024'
KMP_ALIGN_ALLOC=64
KMP_ALL_THREADPRIVATE=128
KMP_ATOMIC_MODE=2
KMP_BLOCKTIME=0
KMP_CPUINFO_FILE: value is not defined
KMP_DETERMINISTIC_REDUCTION=false
KMP_DEVICE_THREAD_LIMIT=2147483647
KMP_DISP_NUM_BUFFERS=7
KMP_DUPLICATE_LIB_OK=false
KMP_ENABLE_TASK_THROTTLING=true
KMP_FORCE_REDUCTION: value is not defined
KMP_FOREIGN_THREADS_THREADPRIVATE=true
KMP_FORKJOIN_BARRIER='2,2'
KMP_FORKJOIN_BARRIER_PATTERN='hyper,hyper'
KMP_GTID_MODE=3
KMP_HANDLE_SIGNALS=false
KMP_HOT_TEAMS_MAX_LEVEL=1
KMP_HOT_TEAMS_MODE=0
KMP_INIT_AT_FORK=true
KMP_LIBRARY=throughput
KMP_LOCK_KIND=queuing
KMP_MALLOC_POOL_INCR=1M
KMP_NUM_LOCKS_IN_BLOCK=1
KMP_PLAIN_BARRIER='2,2'
KMP_PLAIN_BARRIER_PATTERN='hyper,hyper'
KMP_REDUCTION_BARRIER='1,1'
KMP_REDUCTION_BARRIER_PATTERN='hyper,hyper'
KMP_SCHEDULE='static,balanced;guided,iterative'
KMP_SETTINGS=true
KMP_SPIN_BACKOFF_PARAMS='4096,100'
KMP_STACKOFFSET=64
KMP_STACKPAD=0
KMP_STACKSIZE=8M
KMP_STORAGE_MAP=false
KMP_TASKING=2
KMP_TASKLOOP_MIN_TASKS=0
KMP_TASK_STEALING_CONSTRAINT=1
KMP_TEAMS_THREAD_LIMIT=4
KMP_TOPOLOGY_METHOD=all
KMP_USE_YIELD=1
KMP_VERSION=false
KMP_WARNINGS=false
OMP_AFFINITY_FORMAT='OMP: pid %P tid %i thread %n bound to OS proc set {%A}'
OMP_ALLOCATOR=omp_default_mem_alloc
OMP_CANCELLATION=false
OMP_DEFAULT_DEVICE=0
OMP_DISPLAY_AFFINITY=false
OMP_DISPLAY_ENV=false
OMP_DYNAMIC=false
OMP_MAX_ACTIVE_LEVELS=1
OMP_MAX_TASK_PRIORITY=0
OMP_NESTED: deprecated; max-active-levels-var=1
OMP_NUM_THREADS: value is not defined
OMP_PLACES: value is not defined
OMP_PROC_BIND='intel'
OMP_SCHEDULE='static'
OMP_STACKSIZE=8M
OMP_TARGET_OFFLOAD=DEFAULT
OMP_THREAD_LIMIT=2147483647
OMP_WAIT_POLICY=PASSIVE
KMP_AFFINITY='verbose,warnings,respect,granularity=fine,compact,1,0'
Is there any way I can stop this from printing?
EDIT: Code to reproduce this message:
import tensorflow as tf
tf.constant(())
EDIT: Output of env
:
{'SHELL': '/bin/bash',
'KMP_WARNINGS': '0',
'DL_ANACONDA_HOME': '/opt/conda',
'KAGGLE_DATA_PROXY_TOKEN': '<hidden>',
'KAGGLE_URL_BASE': 'https://www.kaggle.com',
'KAGGLE_KERNEL_INTEGRATIONS': '',
'CONTAINER_NAME': 'tf2-cpu/2-6',
'PWD': '/kaggle/working',
'TESSERACT_PATH': '/usr/bin/tesseract',
'TENSORFLOW_VERSION': '2.6.0',
'HOME': '/root',
'LANG': 'C.UTF-8',
'KMP_SETTINGS': '1',
'JAX_VERSION': '0.2.19',
'CONTAINER_URL': 'gcr.io/deeplearning-platform-release/tf-cpu.2-6:nightly-2021-11-17',
'ANACONDA_PYTHON_VERSION': '3.7',
'PYTHONPATH': '/kaggle/lib/kagglegym:/kaggle/lib:/kaggle/input/tensorflow-great-barrier-reef',
'KMP_BLOCKTIME': '0',
'KAGGLE_DATA_PROXY_PROJECT': 'kaggle-161607',
'KAGGLE_USER_SECRETS_TOKEN': '<hidden>',
'SHLVL': '1',
'KAGGLE_KERNEL_RUN_TYPE': 'Interactive',
'PROJ_LIB': '/opt/conda/share/proj',
'MPLBACKEND': 'agg',
'LD_LIBRARY_PATH': '/usr/local/cuda/lib64:/usr/local/cuda/lib:/usr/local/lib/x86_64-linux-gnu:/usr/local/nvidia/lib:/usr/local/nvidia/lib64:',
'KMP_AFFINITY': 'granularity=fine,verbose,compact,1,0',
'MKL_THREADING_LAYER': 'GNU',
'LC_ALL': 'C.UTF-8',
'PATH': '/opt/conda/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin',
'PYTHONUSERBASE': '/root/.local',
'KAGGLE_DATA_PROXY_URL': 'https://dp.kaggle.net',
'_': '/opt/conda/bin/jupyter',
'GIT_PYTHON_REFRESH': 'quiet',
'PYDEVD_USE_FRAME_EVAL': 'NO',
'JPY_PARENT_PID': '9',
'TERM': 'xterm-color',
'CLICOLOR': '1',
'PAGER': 'cat',
'GIT_PAGER': 'cat',
'TF_CPP_MIN_LOG_LEVEL': '2',
'TF2_BEHAVIOR': '1'}
CodePudding user response:
So I managed to fix the problem with the following line:
os.environ["KMP_SETTINGS"] = "false"