Skip to content

Commit 2ce05cc

Browse files
committed
add image support for gpu version
Signed-off-by: Jade Abraham <jade.abraham@hpe.com>
1 parent 49368af commit 2ce05cc

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

06-heat-1D-gpu.chpl

+6
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
use ImageUtils;
2+
3+
14
config const nx = 100000;
25
config const N = 10000;
36
config const alpha = 0.1;
@@ -10,10 +13,13 @@ on here.gpus[0] {
1013
u[nx/4..3*nx/4] = 2.0;
1114
var un = u;
1215

16+
writeImage(u);
17+
1318
for 1..N {
1419
un <=> u;
1520
forall i in omegaHat do
1621
u[i] = un[i] + alpha *
1722
(un[i-1] - 2*un[i] + un[i+1]);
23+
writeImage(u);
1824
}
1925
}

ImageUtils.chpl

+5-3
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,11 @@ module ImageUtils {
4343

4444
checkDims(u);
4545

46-
@functionStatic
47-
ref pipe = try! new mediaPipe("heat.mp4", imageType.bmp, framerate);
46+
on Locales[0] {
47+
@functionStatic
48+
ref pipe = try! new mediaPipe("heat.mp4", imageType.bmp, framerate);
4849

49-
pipe.writeFrame(processFrameData(u));
50+
pipe.writeFrame(processFrameData(u));
51+
}
5052
}
5153
}

0 commit comments

Comments
 (0)