This file contains hidden or 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
| @reserved_characters ~c":/?#[]@!$&'()*+,;=" | |
| @spec is_char_reserved(byte) :: boolean | |
| defguard is_char_reserved(character) when character in @reserved_characters |
This file contains hidden or 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
| MIX_ENV=prod mix run bench.exs | |
| Operating System: Linux | |
| CPU Information: Intel(R) Core(TM) i7-8665U CPU @ 1.90GHz | |
| Number of Available Cores: 8 | |
| Available memory: 15.30 GB | |
| Elixir 1.14.3 | |
| Erlang 25.3 | |
| Benchmark suite executing with the following configuration: | |
| warmup: 2 s |
This file contains hidden or 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
| // Generated by Futhark 0.25.0 (prerelease - include info below when reporting bugs) | |
| // git: 6a2e6e1 (Sun Apr 30 19:03:19 2023 +0200) [modified] | |
| // We need to define _GNU_SOURCE before | |
| // _any_ headers files are imported to get | |
| // the usage statistics of a thread (i.e. have RUSAGE_THREAD) on GNU/Linux | |
| // https://manpages.courier-mta.org/htmlman2/getrusage.2.html | |
| #ifndef _GNU_SOURCE // Avoid possible double-definition warning. | |
| #define _GNU_SOURCE | |
| #endif |
This file contains hidden or 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
| def cap [n] (xs: [n]f64) = | |
| map (\x -> x / f64.maximum xs) xs | |
| def comb' [n] (delay: i64) (intensity: f64) (xs: [n]f64): [n]f64 = | |
| loop xs = copy xs for i in delay..<n do | |
| let xs[i] = xs[i] + intensity * xs[i - delay] | |
| in xs | |
| entry comb delay intensity = map (cap <-< comb' delay intensity) |
This file contains hidden or 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
| -- # Generating audio with literate Futhark | |
| -- | |
| -- Sound is vibrations in the air that are picked up by our ears. Vibrations | |
| -- can be described using sine-curves. Computers are ultimately discrete in | |
| -- nature, so in order to produce sound we have to approximate sine-curves using | |
| -- sampling. Let's see how that works in practice. | |
| -- We start by defining some global variables that we're going to use. | |
| -- First, the volume which we wish to output at. |
This file contains hidden or 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
| .PHONY: all | |
| all: | |
| futhark c futmusic.fut | |
| rm -f output.wav | |
| echo "" | ./futmusic -b | tail -c+18 | head -c-1 | ffmpeg -f s8 -i - output.wav | |
| mpv output.wav |
This file contains hidden or 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
| let (y: Int) = 42 | |
| let (xss: [y][x]Int) = | |
| kernel x <= y do | |
| let (xs: [x]Int) = iota(x) | |
| in (xs) | |
| let (z: Int) = 42 | |
| let (xs: [x]Int) = | |
| if z then | |
| let (x: Int) = 4 |
This file contains hidden or 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
| maybeHead :: a -> [a] -> a | |
| maybeHead _ (x : _) = x | |
| maybeHead x _ = x | |
| treeFold :: Show a => (a -> a -> a) -> a -> [a] -> a | |
| treeFold f neutral = treeFold' [] | |
| where | |
| treeFold' ((i1, x1) : (i2, x2) : rest) xs | |
| | i1 == i2 = treeFold' ((i1 + 1, f x1 x2) : rest) xs | |
| treeFold' acc (x1 : x2 : rest) = treeFold' ((0, f x1 x2) : acc) rest |
This file contains hidden or 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
| .external-data/rodinia/hotspot/data/1024.in https://sid.erda.dk/share_redirect/FlhwY8rtfk/rodinia/hotspot/1024.in 3ead297c7a98339297ba0fd351aa3e364b476aac4afe9fb568271e73741adf7b | |
| .external-data/rodinia\ 5/hotspot/data/1024.in https://sid.erda.dk/share_redirect/FlhwY8rtfk/rodinia/hotspot/1024.in 3ead297c7a98339297ba0fd351aa3e364b476aac4afe9fb568271e73741adf7b |
This file contains hidden or 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
| FROM nvidia/cuda@sha256:01d41694d0b0be8b7d1ea8146c7d318474a0f4a90bfea17d3ac1af0328a0830b | |
| RUN apt-get update | |
| RUN apt-get upgrade -y | |
| RUN apt-get install -y libz3-4 libz3-dev haskell-stack libtinfo-dev libgmp-dev zlib1g-dev | |
| RUN git clone https://github.com/diku-dk/futhark | |
| WORKDIR "futhark" | |
| RUN stack upgrade |