I am trying to restrict the number of threads that TensorFlow spawns. In python, I understand we need to use the following steps as pointed out Here. I was trying to do the same in CPP, but it doesn't seem that straight forward. Questions:
- How to modify intra_op_parallelism_threads and inter_op_parallelism_threads correctly?
- How to modify the device_count to control the core as well?
SessionOptions options;
ConfigProto* config = &options.config;
string key = "CPU";
//not sure if this is the correct way to do it.
(*config->mutable_device_count())[key] = 1;
config->set_inter_op_parallelism_threads(1);
config->set_intra_op_parallelism_threads(1);