Workflow Type: COMPSs
Open
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
-
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
-
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
Creators and Submitter
Creator
Additional credit
Under the guidance of Raül Sirvent
Submitter
License
Activity
Views: 460 Downloads: 137
Created: 6th Jun 2024 at 11:19
Attributions
None