Skip to content

CodingVanGogh/parallelization

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Parallelization for python2.7

This is a generic package for parallelization using Threads and Processes

Install using pip
  • pip install plmap
Install from the source

Example Usage

def add(a, b):     # Function to be called parallely
    return a + b
input = [ [2, 3], [4, 5], [10, 11] ]  # Set of inputs to the add function
  • Parallelization using Multi-Threading
        from plmap import plmapt
        errors, outputs = plmapt(add, input, [], 3, None) 
        errors :  [('0', 'None'), ('0', 'None'), ('0', 'None')]
        # [ ('<error_code>', '<error_description>') ..... ]
        
        outputs : [5, 9, 21]
        # [ <output for the first set of inputs>, <output for the second set of inputs> , ..... ]
  • Parallelization using Multi-Processing
        from plmap import plmapp
        errors, outputs = plmapp(add, input, [], 3, None) 
        errors :  [('0', 'None'), ('0', 'None'), ('0', 'None')]
        # [ ('<error_code>', '<error_description>') ..... ]
        
        outputs : [5, 9, 21]
        # [ <output for the first set of inputs>, <output for the second set of inputs> , ..... ]

Releases

No releases published

Packages

No packages published

Languages