Getting OS thread ids from a thread pool

I’m trying to use tensorflow’s tracing to connect traces to some OS data which is broken down by thread. This is done on a debian system. I’m using a hook with an estimator:

hook = tf.estimator.ProfilerHook(save_secs=1, output_dir=output))
estimator = tf.estimator.tpu.TPUEstimator(...
estimator.train(input_fn=train_input_fn, max_steps=num_train_steps, hooks=[hook])

The thread data in the trace for the thread pool provides the thread ids for the pool but not the OS id. I concurrently inspect the thread details at the OS level through /proc/pid/task/tid/stat but the thread names aren’t useful. I also tried checking the threads by using threading.enumerate concurrently but it doesn’t report the threads in the pool. Is there a way to report the OS ids - thread pool id pairs without hacking into the thread implementation?

Hi @atpoverload

Welcome to the TensorFlow Forum!

tf.estimator and its’ APIs are deprecated since TensorFlow 2.12 as mentioned in this TensorFlow blog for Deprecating Estimator and Feature Column and migrated to Keras APIs. Could you please try again by referring the Migrate from TPUEstimator to TPUStrategy to use tf.estimator.tpu feature with the latest TensorFlow and let us know if the issue still persists. Thank you.