sourcelibs/Accel/demos/host-data.xtl

1⍝!/usr/bin/env xetal 2⍝ Data prepared outside the subset: a sort, a grade and a where make 3⍝ the arrays, which the device cannot (their shapes or orders depend 4⍝ on the data), so the lowering has the evaluator compute them and 5⍝ binds them as inputs; the products, sums and the mask run on the 6⍝ device; the last line, a where, is printed by the evaluator. Run 7⍝ with "just demo-lib Accel host-data". 8ᵃᶜ⁼u̲se< "Accel" 9v ← s̲ort 5 3 9 1 7 10m ← 3 3 r̲eshape g̲rade 9 1 8 2 7 3 6 4 5 11ᵃᶜr̲owSums m 12v ᵃᶜd̲ot v 13m ᵃᶜm̲atmul o̲\ m 14f ← (f̲loat v) ÷ 2.0 150.5 ᵃᶜt̲hreshold f × 1 0 1 0 1 16w̲here v > 4