# Tensorflow script to run on single core

**URL:** <https://ask.cyberinfrastructure.org/t/tensorflow-script-to-run-on-single-core/225>\
**Category:** Q&A\
**Tags:** machine-learning, ai, programming-for-hpc, tensorflow, scripting, researcher\
**Created:** [June 1, 2018, 1:43pm UTC](https://ask.cyberinfrastructure.org/t/tensorflow-script-to-run-on-single-core/225 "2018-06-01T13:43:40Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![ktrn](https://ask.cyberinfrastructure.org/user_avatar/ask.cyberinfrastructure.org/ktrn/32/554_2.png) [@ktrn](https://ask.cyberinfrastructure.org/u/ktrn)\
**Post date:** [June 1, 2018, 1:43pm UTC](https://ask.cyberinfrastructure.org/t/tensorflow-script-to-run-on-single-core/225/1 "2018-06-01T13:43:40Z")

</div>

I am running my tensorflow script on the cluster and it gets aborted with the message that I am using 6 cores when my job requested only 1. But I do not have any parallelization in my code. I use standard tensorflow functions and everything runs fine on my local machine. How do I fix this issue on the cluster?

**Curator** : Katia

---

<div class="post-metadata">

**Author:** ![raminder](https://ask.cyberinfrastructure.org/letter_avatar_proxy/v4/letter/r/58956e/32.png) [@raminder](https://ask.cyberinfrastructure.org/u/raminder)\
**Post date:** [June 22, 2018, 11:21am UTC](https://ask.cyberinfrastructure.org/t/tensorflow-script-to-run-on-single-core/225/2 "2018-06-22T11:21:27Z")

</div>

TensorFlow does indeed use multiple CPU cores by default and all cores are wrapped in cpu:0. Following has an example to run TensorFlow on a single core.

> <https://stackoverflow.com/questions/38187808/how-can-i-run-tensorflow-on-one-single-core>

---

<div class="post-metadata">

**Author:** ![ktrn](https://ask.cyberinfrastructure.org/user_avatar/ask.cyberinfrastructure.org/ktrn/32/554_2.png) [@ktrn](https://ask.cyberinfrastructure.org/u/ktrn)\
**Post date:** [June 22, 2018, 3:44pm UTC](https://ask.cyberinfrastructure.org/t/tensorflow-script-to-run-on-single-core/225/3 "2018-06-22T15:44:16Z")

</div>

From my experience, you still need to request 2 CPU cores when you set intra\_op\_parallelism\_threads=1 and inter\_op\_parallelism\_threads=1. It looks like with this setup there is still a master python script that uses 1 core and then the tf.Session() will use another one.
