This is documentation for Mathematica 8, which was
based on an earlier version of the Wolfram Language.
View current documentation (Version 11.2)

ParallelTry

Updated In 8 Graphic
ParallelTry
evaluates in parallel, returning the first result received.
ParallelTry
returns a list of the first k results.
  • ParallelTry automatically distributes computations among different available kernels and processors.
  • Any evaluations still underway after k results have been received are aborted.
  • If the result from evaluating one of the is $Failed, then it is ignored.
  • ParallelTry allocates evaluations of the to different kernels and processors, starting with .
  • If there are more than kernels, then some of the will not be tried unless earlier ones return $Failed.
Find the factorization of a number that is easy to factorize:
Nondeterministically find a prime in a given range:
Find the factorization of a number that is easy to factorize:
In[1]:=
Click for copyable input
Out[1]=
 
Nondeterministically find a prime in a given range:
In[1]:=
Click for copyable input
Out[1]=
Return the first two successful results:
If no successful results are found, ParallelTry returns $Failed:
By default, definitions in the current context are distributed automatically:
Do not distribute any definitions of functions:
Distribute definitions for all symbols in all contexts appearing in a parallel computation:
Distribute only definitions in the given contexts:
Restore the value of the DistributedContexts option to its default:
Find a random prime in parallel:
Find an irreducible polynomial with a random search on each parallel kernel:
Search for a Mersenne prime starting at a given prime exponent:
Try different methods for minimization and return the first one that succeeds:
Try different symbolic methods of summation and return the first one to succeed:
In this case only one method succeeded:
ParallelTry generally returns the first successful result received:
ParallelTry works like ParallelMap, but returns only one of the results:
ParallelTry is essentially implemented in terms of WaitNext:
Functions defined interactively are automatically distributed to all kernels when needed:
Distribute definitions manually and disable automatic distribution:
For functions from a package, use ParallelNeeds rather than DistributeDefinitions:
If there are more expressions than kernels, some will never be tried:
A function used that is not known on the parallel kernels may lead to sequential evaluation:
Define the function on all parallel kernels:
The function is now evaluated on the parallel kernels:
Definitions of functions in the current context are distributed automatically:
Definitions from contexts other than the default context are not distributed automatically:
Use DistributeDefinitions to distribute such definitions:
Alternatively, set the DistributedContexts option to include all contexts:
New in 7 | Last modified in 8