How to include a Distributed into a package?

I am writing a package where at some point a big loop appears.
What is the proper way to allow using the Distributed.jl package to replace map by pmap?

  1. Should we do like that:
module MyPackage
using Distributed

### code
fit_function() = pmap(long function)
### code
export fit_function

and then

using MyPackage

when we are using personal laptop with no multiprocessor.
On a cluster

using Distributed
@everywhere using MyPackage
  1. is there another preferable architecture like two different packages with/without Distributed pmap/map ?
  2. maybe always do using Distributed but defining two functions fit_function() with pmap and another one pfit_function() with pmap.

What is the best way to go in terms of

  • “code”
  • Julia spirtit,
  • Dependency,
  • Performances (from what I recall pmap was slightly longer than map when used on one proc).