1
$\begingroup$

I have an issue when trying to use parallelization when loading a stand-alone Package. To simplify the question I have a few scenarios:

  1. The first scenario, with single-kernel evaluation, works fine:

    Needs["MyPackage`"] then run   
    Map[function_call_from_package, {data}]
    
  2. Now on to multiple kernels and parallel evalution:

    ParallelNeeds["MyPackage`"]
    ParallelMap[function_call_from_package, {data},  DistributedContexts -> {"MyPackage`", "Global`"}] 
    

    this fails, reporting "Cannot open MyPackage`"

  3. I also tried tips from a previous discussion (Package found with `Needs`, but not with `ParallelNeeds`). This reports "Import::nffil: File not found during Import"

    It's trying to load stuff from ".m" files which have generic paths

    "profilePath"-> "/Package/

    because this is later joined as

    Import[StringJoin[Directory[],OptionValue["profilePath"]],"Table"];
    
  4. If I put absolute paths to "profilePath" -> "Absolute paths", it works.

The latter is an ugly solution, so I would appreciate your help on this.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.