Wolfram Function Repository
Instant-use add-on functions for the Wolfram Language
Function Repository Resource:
Distribute resource function definitions to parallel kernels
ResourceFunction["DistributeResourceFunctions"][rf] distributes metadata and definitions for the ResourceFunction given by rf to parallel kernels. | |
ResourceFunction["DistributeResourceFunctions"][{rf1,rf2,…}] distributes multiple resource functions. | |
ResourceFunction["DistributeResourceFunctions"][rfs,ker] distributes only to the kernels specified in ker. |
| "name" | the name of a resource function |
| "uuid" | the UUID of a resource function |
| ResourceObject[…] | a resource object with type "Function" |
| ResourceFunction[…] | a resource function |
| All | all resource functions loaded in the current session |
Distribute resource function definitions to parallel kernels:
| In[1]:= |
| Out[1]= | ![]() |
Now the function can be used quickly on each kernel:
| In[2]:= |
| Out[2]= |
Compare to a function that has not been distributed:
| In[3]:= |
| Out[3]= |
Distribute multiple resource functions at once:
| In[4]:= |
| Out[4]= | ![]() |
Using a resource function loads it into the current session:
| In[5]:= |
| Out[5]= | ![]() |
Distribute all currently loaded resource functions to parallel kernels:
| In[6]:= |
| Out[6]= | ![]() |
Only functions that have not been distributed yet will be sent to parallel kernels:
| In[7]:= |
| Out[7]= |
| In[8]:= |
| Out[8]= |
Distribute to specific kernels:
| In[9]:= |
| Out[9]= |
Compare initial timing with other kernels:
| In[10]:= |
| Out[10]= |
| In[11]:= |
| Out[11]= | ![]() |
Normally, initial loading time for resource functions increases with the number of parallel kernels, because each kernel must read the definition sequentially:
| In[12]:= |
| Out[12]= |
| In[13]:= |
| Out[13]= | ![]() |
The number of slow evaluations will correspond to the number of kernels:
| In[14]:= |
| Out[14]= |
| In[15]:= |
| Out[15]= |
Distribute a local resource function to parallel kernels to bypass initial loading time:
| In[16]:= |
| Out[16]= |
| In[17]:= |
| Out[17]= |
Now there is no initial loading overhead:
| In[18]:= |
| Out[18]= | ![]() |
| In[19]:= |
| Out[19]= |
This work is licensed under a Creative Commons Attribution 4.0 International License