# Parallel training on multicore single CPU

**URL:** <https://community.konduit.ai/t/parallel-training-on-multicore-single-cpu/408>\
**Category:** DL4J\
**Created:** [April 12, 2020, 4:46am UTC](https://community.konduit.ai/t/parallel-training-on-multicore-single-cpu/408 "2020-04-12T04:46:54Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![jin](https://avatars.discourse-cdn.com/v4/letter/j/4af34b/32.png) [@jin](https://community.konduit.ai/u/jin)\
**Post date:** [April 12, 2020, 4:46am UTC](https://community.konduit.ai/t/parallel-training-on-multicore-single-cpu/408/1 "2020-04-12T04:46:54Z")

</div>

I would like to understand how the parallel training on multicore single CPU work. I plan to write my own EvaluativeListener so that I can control when to stop the training. When I look at the original implementation [here](https://github.com/eclipse/deeplearning4j/blob/master/deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/optimize/listeners/EvaluativeListener.java), I noticed that iteration counter uses ThreadLocal. My question is what kind of parallel training approach is used by default. I am working in multicore single CPU environment. Does each thread uses portion of the training data to run the optimizer and update the weights synchronously? Or the parallel training happens in some other way? Thanks for info.

---

<div class="post-metadata">

**Author:** ![treo](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.konduit.ai/treo/32/47_2.png) [@treo](https://community.konduit.ai/u/treo)\
**Post date:** [April 13, 2020, 8:39am UTC](https://community.konduit.ai/t/parallel-training-on-multicore-single-cpu/408/2 "2020-04-13T08:39:11Z")

</div>

> [@jin](#):
>
> I plan to write my own EvaluativeListener so that I can control when to stop the training.

That is what you would typically use the [early stopping functionality](https://deeplearning4j.konduit.ai/tuning-and-training/early-stopping) for.

> [@jin](#):
>
> I noticed that iteration counter uses ThreadLocal.

That is because the listener _can_ be used in a multi thread environment, e.g. when multiple gpus or cpus are used. When training in a single cpu multi core environment, usually only the actual math is parallelized, as that can still be done efficiently enough.

---

<div class="post-metadata">

**Author:** ![jin](https://avatars.discourse-cdn.com/v4/letter/j/4af34b/32.png) [@jin](https://community.konduit.ai/u/jin)\
**Post date:** [April 13, 2020, 5:06pm UTC](https://community.konduit.ai/t/parallel-training-on-multicore-single-cpu/408/3 "2020-04-13T17:06:51Z")

</div>

Makes sense. Thanks.
