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: DirectProgramming/DPC++/N-BodyMethods/Nbody/README.md
+122Lines changed: 122 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -23,6 +23,9 @@ Third party program Licenses can be found here: [third-party-programs.txt](https
23
23
24
24
## Building the Program for CPU and GPU
25
25
26
+
### Running Samples In DevCloud
27
+
Running samples in the Intel DevCloud requires you to specify a compute node. For specific instructions, jump to [Run the Nbody sample on the DevCloud](#run-nbody-on-devcloud)
28
+
26
29
### Include Files
27
30
The include folder is located at `%ONEAPI_ROOT%\dev-utilities\latest\include` on your development system.
28
31
@@ -92,3 +95,122 @@ Below are the default parameters:
92
95
# Average Performance : 112.09 +- 0.56002
93
96
===============================
94
97
Built target run
98
+
99
+
### Running the Hidden Markov Model sample in the DevCloud<a name="run-nbody-on-devcloud"></a>
4. Change directories to the Hidden Markov Model sample directory.
111
+
```
112
+
cd ~/oneAPI-samples/DirectProgramming/DPC++/N-bodyMethods/Nbody
113
+
```
114
+
#### Build and run the sample in batch mode
115
+
The following describes the process of submitting build and run jobs to PBS.
116
+
A job is a script that is submitted to PBS through the qsub utility. By default, the qsub utility does not inherit the current environment variables or your current working directory. For this reason, it is necessary to submit jobs as scripts that handle the setup of the environment variables. In order to address the working directory issue, you can either use absolute paths or pass the -d \<dir\> option to qsub to set the working directory.
117
+
118
+
#### Create the Job Scripts
119
+
1. Create a build.sh script with your preferred text editor:
Jobs submitted in batch mode are placed in a queue waiting for the necessary resources (compute nodes) to become available. The jobs will be executed on a first come basis on the first available node(s) having the requested property or label.
149
+
1. Build the sample on a gpu node.
150
+
151
+
```
152
+
qsub -l nodes=1:gpu:ppn=2 -d . build.sh
153
+
```
154
+
155
+
Note: -l nodes=1:gpu:ppn=2 (lower case L) is used to assign one full GPU node to the job.
156
+
Note: The -d . is used to configure the current folder as the working directory for the task.
157
+
158
+
2. In order to inspect the job progress, use the qstat utility.
159
+
```
160
+
watch -n 1 qstat -n -1
161
+
```
162
+
Note: The watch -n 1 command is used to run qstat -n -1 and display its results every second. If no results are displayed, the job has completed.
163
+
164
+
3. After the build job completes successfully, run the sample on a gpu node:
165
+
```
166
+
qsub -l nodes=1:gpu:ppn=2 -d . run.sh
167
+
```
168
+
4. When a job terminates, a couple of files are written to the disk:
169
+
170
+
<script_name>.sh.eXXXX, which is the job stderr
171
+
172
+
<script_name>.sh.oXXXX, which is the job stdout
173
+
174
+
Here XXXX is the job ID, which gets printed to the screen after each qsub command.
175
+
176
+
5. Inspect the output of the sample.
177
+
```
178
+
cat run.sh.oXXXX
179
+
```
180
+
You should see output similar to this:
181
+
182
+
```
183
+
Scanning dependencies of target run
184
+
===============================
185
+
Initialize Gravity Simulation
186
+
nPart = 16000; nSteps = 10; dt = 0.1
187
+
------------------------------------------------
188
+
s dt kenergy time (s) GFLOPS
189
+
------------------------------------------------
190
+
1 0.1 26.405 0.43625 17.019
191
+
2 0.2 313.77 0.02133 348.07
192
+
3 0.3 926.56 0.021546 344.59
193
+
4 0.4 1866.4 0.02152 345
194
+
5 0.5 3135.6 0.021458 346
195
+
6 0.6 4737.6 0.021434 346.38
196
+
7 0.7 6676.6 0.02143 346.45
197
+
8 0.8 8957.7 0.021482 345.6
198
+
9 0.9 11587 0.021293 348.68
199
+
10 1 14572 0.021324 348.16
200
+
201
+
# Total Time (s) : 0.62911
202
+
# Average Performance : 346.36 +- 1.3384
203
+
===============================
204
+
Built target run
205
+
```
206
+
207
+
6. Remove the stdout and stderr files and clean-up the project files.
208
+
```
209
+
rm build.sh.*; rm run.sh.*; make clean
210
+
```
211
+
7. Disconnect from the Intel DevCloud.
212
+
```
213
+
exit
214
+
```
215
+
### Build and run additional samples
216
+
Several sample programs are available for you to try, many of which can be compiled and run in a similar fashion to this sample. Experiment with running the various samples on different kinds of compute nodes or adjust their source code to experiment with different workloads.
0 commit comments