create-pl1-omp 1.0.2 → 1.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +10 -5
- package/package.json +1 -1
- package/template/PL2/PL2.c +16 -0
package/index.js
CHANGED
|
@@ -10,7 +10,9 @@ async function run() {
|
|
|
10
10
|
name: 'program',
|
|
11
11
|
message: 'Select the lab program to generate:',
|
|
12
12
|
choices: [
|
|
13
|
-
{ title: '
|
|
13
|
+
{ title: 'All Programs', value: 'ALL' },
|
|
14
|
+
{ title: 'PL1 - Parallel Merge Sort (OpenMP)', value: 'PL1' },
|
|
15
|
+
{ title: 'PL2 - OpenMP Static Loop Scheduling', value: 'PL2' }
|
|
14
16
|
],
|
|
15
17
|
initial: 0,
|
|
16
18
|
});
|
|
@@ -22,11 +24,14 @@ async function run() {
|
|
|
22
24
|
const targetDir = process.cwd();
|
|
23
25
|
const templateBase = path.join(__dirname, 'template');
|
|
24
26
|
|
|
25
|
-
const srcFolder = path.join(templateBase, response.program);
|
|
26
|
-
const destFolder = path.join(targetDir, response.program);
|
|
27
|
-
|
|
28
27
|
try {
|
|
29
|
-
|
|
28
|
+
if (response.program === 'ALL') {
|
|
29
|
+
await fs.copy(templateBase, targetDir, { overwrite: true });
|
|
30
|
+
} else {
|
|
31
|
+
const srcFolder = path.join(templateBase, response.program);
|
|
32
|
+
const destFolder = path.join(targetDir, response.program);
|
|
33
|
+
await fs.copy(srcFolder, destFolder, { overwrite: true });
|
|
34
|
+
}
|
|
30
35
|
console.log('done');
|
|
31
36
|
} catch (err) {
|
|
32
37
|
process.exit(1);
|
package/package.json
CHANGED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
#include <stdio.h>
|
|
2
|
+
#include <omp.h>
|
|
3
|
+
|
|
4
|
+
int main() {
|
|
5
|
+
int num_iterations;
|
|
6
|
+
printf("Enter the number of iterations: ");
|
|
7
|
+
scanf("%d", &num_iterations);
|
|
8
|
+
#pragma omp parallel
|
|
9
|
+
{
|
|
10
|
+
#pragma omp for schedule(static,2)
|
|
11
|
+
for (int i = 0; i < num_iterations; i++) {
|
|
12
|
+
printf("Thread %d: Iteration %d\n", omp_get_thread_num(), i);
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
return 0;
|
|
16
|
+
}
|