Monte Carlo Simulation for Pi Estimation
Version 1

Workflow Type: COMPSs

Monte Carlo Pi Estimation Program Description

This program is a Monte Carlo simulation designed to estimate the value of Pi using PyCOMPSs.

Tasks in the Program

  1. Count Points in Circle Task (count_points_in_circle):

    • Generates random points within a square with side length 1.
    • Counts points falling within the inscribed circle (x^2 + y^2 <= 1).
    • Input: Number of points to generate (num_points)
    • Output: Tuple containing count of points within the circle and list of generated points
  2. Write Points to File Task (write_points_to_file):

    • Writes a list of points to a file named according to the task ID.
    • Input: List of points and task ID
    • Output: None

Main Function Operation

  • Takes num_points and num_tasks as input.
  • Divides points among tasks for parallel processing.
  • Launches count_points_in_circle tasks in parallel.
  • Launches write_points_to_file tasks after count tasks complete.
  • Calculates Pi estimate and writes to Result.txt.

Execution

To execute the script, use the following command-line format:

python script_name.py num_points num_tasks

Click and drag the diagram to pan, double click or use the controls to zoom.

Version History

Version 1 (earliest) Created 6th Jun 2024 at 11:19 by Archit Dabral

No revision comments

Open master 5f49e51
help Creators and Submitter
Creator
  • Archit Dabral
Additional credit

Under the guidance of Raül Sirvent

Submitter
Activity

Views: 460   Downloads: 137

Created: 6th Jun 2024 at 11:19

help Attributions

None

Total size: 302 KB
Powered by
(v.1.16.0-main)
Copyright © 2008 - 2024 The University of Manchester and HITS gGmbH