Welcome to BSPy!

This project is attempts to make the Bulk-Synchronous parallel (BSP) model available in Python. This model, first described by Leslie G. Valiant[1] is designed to be an efficient model for parallel computation while also promising to keep complexity analysis relatively simple.

How to use BSPy

Beyond the “Hello World” example shown here, please refer to the Documentation.

import BSPy

def hello_world(bsp: BSPy.BSPObject):
    cores = bsp.cores
    pid = bsp.pid
    print("Hello World (from processor %d / %d)" % (pid+1, cores))

if __name__ == '__main__':
    BSPy.run(hello_world, 4)
>> Hello World (from processor 1 / 4)
>> Hello World (from processor 2 / 4)
>> Hello World (from processor 3 / 4)
>> Hello World (from processor 4 / 4)

Note that processor ids are 0 indexed, so we have to add 1 in this usecase.

Indices and tables