You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: PROJECT.md
+227Lines changed: 227 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -58,3 +58,230 @@ My_Ganga/
58
58
│ ├── output_pages/ # Stores individual PDF pages
59
59
│── gangadir/ # Ganga workspace
60
60
```
61
+
62
+
***
63
+
64
+
## **Interfacing Ganga Job**
65
+
66
+
### **Description**
67
+
This task is to demonstrate programmatic interaction with a Large Language Model (LLM) to generate and execute a Ganga job. The generated job will calculate an approximation of π using the accept-reject simulation method. The total number of simulations will be 1 million, split into 1000 subjobs, each performing 1000 simulations.
68
+
69
+
### **Workflow Execution**
70
+
71
+
#### **Step 1: LLM Setup & Communication**
72
+
73
+
- Initialize interaction with the chosen LLM (deepseek-coder-v2:latest on Ollama CLI in this case).
74
+
- Install Ollama and deepseek-coder-v2:latest on Ollama
75
+
-- To install ollama on linux ,execute:
76
+
```sh
77
+
curl -fsSL https://ollama.com/install.sh | sh
78
+
```
79
+
- - To install and run deepseek-coder-v2:latest on Ollama CLI ,execute:
80
+
```sh
81
+
ollama run deepseek-coder-v2:latest
82
+
```
83
+
84
+
#### **Step 2: Prompting the LLM for Code Generation**
85
+
86
+
- Send a prompt to generate a structured prompt.
87
+
88
+
```
89
+
generate me a prompt to get me a plan for"code that can execute a jobin Ganga that will
90
+
calculate an approximation to the number pi using an accept-reject simulation method will one
91
+
million simulations. The job should be split into a number of subjobs that each do thousand
92
+
simulations."
93
+
94
+
```
95
+
96
+

97
+
98
+
- Send the Structured prompt to generate the output.
99
+
100
+
```
101
+
Create a Python script that will:
102
+
103
+
1. Set up and submit a job in Ganga to perform one million simulations using the Monte Carlo
104
+
accept-reject method for calculating an approximation of π.
105
+
2. Split this job into multiple subjobs, where each subjob conducts 1000 independent
106
+
simulations.
107
+
3. Collect the results from all subjobs and compute the final approximation of π.
108
+
109
+
Please provide a detailed breakdown of:
110
+
111
+
1. A job submission script that sets up and submits the Ganga job.
112
+
2. A simulation script that performs the Monte Carlo estimation for π, executed within each
113
+
subjob.
114
+
3. A result aggregation script that gathers outputs from all subjobs and computes the final
115
+
approximation of π.
116
+
4. Any necessary parallelization strategies to ensure efficient execution across distributed
117
+
resources.
118
+
5. Best practices for running distributed computations in Ganga, including resource allocation
119
+
and monitoring.
120
+
121
+
```
122
+
123
+

124
+
125
+
#### **Step 3: The LLM Output**
126
+
127
+
To implement the task you've outlined using Python and Ganga, we need to break down the process
128
+
into three main parts: the job submission script, the simulation script, and the result
129
+
aggregation script. Below is a detailed guide on how these components can be implemented along
130
+
with some best practices for running distributed computations in Ganga.
131
+
132
+
### 1. Job Submission Script
133
+
The job submission script (`create_pi_job.py`) will set up and submit the Ganga job to run
134
+
multiple
135
+
subjobs, each performing 1000 simulations independently. Here's how you can do it:
136
+
137
+
```python
138
+
from GangaCore.GPI import Job, ArgSplitter, Local, Executable
0 commit comments