Skip to content

carnationcrab/ParallelArrayProcessing_Python

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Parallel Array Processing in Python

This program is designed to model simple implicit parallelism using Python's concurrent.futures.ThreadPoolExecutor. The program demonstrates how multi-threading can be used to speed up the process of summing a large array. It achieves this by dividing the work into chunks and processing them concurrently.

What it does:

  • Utilizes multi-threading to achieve parallelism.
  • Divides a large array into chunks and processes them in parallel.

How it works:

  • The program generates an array of integers from 1 to 1,000,000.
  • This array is divided into a thread count quantity of equal-sized chunks.
  • Using ThreadPoolExecutor, each chunk is processed concurrently by a separate thread to calculate its sum.
  • The chunk sums are then combined to form the total sum.

Running the program:

Run the .sln file in Visual Studio (2022), or

Install the dependencies and run the script in testingParallelism.py using Python cmd: python thread_test.py

The program will start, and you’ll see detailed logs of the execution steps.

To run without logs, change log level from INFO to WARN.

image


Reference

Project derived from learnings from my reading of Game Engine Architecture 3rd Ed. By Jason Gregory, Chapter 4.

About

Computes the sum of a large array using implicit parallelism for efficiency

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages