# Multiprocess function locally with rpc?

**URL:** <https://discuss.pytorch.org/t/multiprocess-function-locally-with-rpc/136120>\
**Category:** distributed\
**Created:** [November 5, 2021, 7:02pm UTC](https://discuss.pytorch.org/t/multiprocess-function-locally-with-rpc/136120 "2021-11-05T19:02:52Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![ZimoNitrome](https://discuss.pytorch.org/user_avatar/discuss.pytorch.org/zimonitrome/32/27591_2.png) [@ZimoNitrome](https://discuss.pytorch.org/u/ZimoNitrome)\
**Post date:** [November 5, 2021, 7:02pm UTC](https://discuss.pytorch.org/t/multiprocess-function-locally-with-rpc/136120/1 "2021-11-05T19:02:52Z")

</div>

I noticed that a post-processing step in my model takes more than twice the time of the actual NN part. This post-processing involves sorting the outputs in each sample (sample by sample in a batch of 32+).

The sorting package is provided as “torchsort” and is already optimized as a C++ torchscript.  
I thus tried to multiprocess each of the sample sortings in a batch using `torch.multiprocessing`, but of course receive the warning that: `[...] autograd does not support crossing process boundaries.`.

So I wonder if I can “fake” distributed training locally somehow with rpc?

Would that be a good choice to solve my speed problems?

Could it be done easily?
