Last active
December 11, 2015 04:38
-
-
Save cronin101/4546020 to your computer and use it in GitHub Desktop.
HaDope syntax idea
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
gpu = HaDope::GPU.new | |
dataset = HaDope::Dataset.new { | |
type: :int, | |
size: 100, | |
data: (1..100).to_a | |
} | |
gpu.load(dataset) | |
add_two = HaDope::Map.new { | |
key: [:int, :i], | |
fn: | |
<<KERNEL | |
i += 1; | |
i += 1; | |
KERNEL | |
} | |
gpu.map(add_two) | |
greater_than_three = HaDope::Filter.new { | |
key: [:int, :i], | |
fn: | |
<<KERNEL | |
i > 3; | |
KERNEL | |
} | |
gpu.filter(greater_than_three) | |
results = gpu.perform |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment