Skip to content

Latest commit

 

History

History
23 lines (18 loc) · 1.38 KB

File metadata and controls

23 lines (18 loc) · 1.38 KB
author jon_peck
categories
algo-dev
excerpt Multithreading: call many Algorithms in parallel, from a parent Algorithm or Client
excerpt-short Multithreading: call many Algorithms in parallel
image
teaser
/post_images/multithreading/multithreading.png
layout article
permalink /algorithm-development/advanced-algorithm-development/multithreading/
show_related true
tags
algo-dev
title Multithreading

Algorithmia can spin up many copies of your Algorithm in parallel, allowing you to break up a large batch job into many parts and have them all run at once.

To make this happen, use whatever multithreading or multiprocessing library you prefer, and create 2-16 parallel threads, each of which will make separate algo.pipe() calls over the data they need to process. This can be done from local code, or placed into a single "master" Algorithm which manages the others.

Here's a sample Algorithm which takes a single array of inputs, then runs up to four parallel threads at once to call a simple "hello world" Algorithm, reassembling the results into a single output:

VIEW CODESAMPLE