Skip to content

Instantly share code, notes, and snippets.

View athas's full-sized avatar
🐈
how did this get here i am not good with compute

Troels Henriksen athas

🐈
how did this get here i am not good with compute
View GitHub Profile
SUB delay(numTicks%)
FOR i% = 1 TO numTicks%
st# = TIMER
WHILE TIMER = st#: WEND 'TIMER will change 1/18.2 of a second after the previous line
NEXT i%
END SUB
2 SEK=10
3 PRINT "JEG TAGER EN LUR"
4 GOSUB 20
5 PRINT "NU ER JEG OPPE IGEN"
9 END
20 FOR I = 1 TO SEK*18.2 'SOV SEK SEKUNDER
30 ST = TIMER
40 WHILE TIMER = ST: WEND
50 NEXT I
60 RETURN
cabal-version: 1.12
-- This file has been generated from package.yaml by hpack version 0.32.0.
--
-- see: https://github.com/sol/hpack
--
-- hash: 9d4a43ecb1bc10c7d81688595d935b332ab744237723424505b6cf5af4eba400
name: futhark
version: 0.13.0
File monitor 'config' unchanged.
this build was affected by the following (project) config files:
File monitor 'improved-plan' changed: first run
File monitor 'elaborated-plan' changed: first run
File monitor 'compiler' unchanged.
File monitor 'solver-plan' changed: first run
/run/current-system/sw/bin/ghc --print-global-package-db
Reading installed packages...
/run/current-system/sw/bin/ghc-pkg dump --global -v0
/run/current-system/sw/bin/ghc --print-libdir
-- Program for Lattice-Boltzmann in Futhark
import "lib/github.com/athas/vector/vector"
import "lib/github.com/athas/vector/vspace"
type real = f32
module vec2' = cat_vector vector_1 vector_1
module vec3' = cat_vector vec2' vector_1
static int futrts_wc(struct futhark_context *ctx, int32_t *out_scalar_out_5703,
int32_t *out_scalar_out_5704, int32_t *out_scalar_out_5705,
struct memblock cs_mem_5694, int32_t sizze_5621)
{
int32_t scalar_out_5695;
int32_t scalar_out_5696;
int32_t scalar_out_5697;
int32_t res_5625;
int32_t res_5626;
int8_t res_5627;
type range = (i32,i32)
type rangetree = bintree.tree range i32
let range (t: rangetree) : range =
match bintree.value t
case #leaf v -> (v,v)
case #fork range -> range
let comb_range ((xmin,xmax): range) ((ymin,ymax): range) : range =
(i32.min xmin ymin, i32.max xmax ymax)
Rec {
-- RHS size: {terms: 23, types: 4, coercions: 0, joins: 0/0}
Main.$wfib [InlPrag=NOUSERINLINE[2], Occ=LoopBreaker]
:: Int# -> Int#
[GblId, Arity=1, Caf=NoCafRefs, Str=<L,U>, Unf=OtherCon []]
Main.$wfib
= \ (ww_s5m5 :: Int#) ->
case <=# ww_s5m5 1# of {
__DEFAULT ->
case Main.$wfib (-# ww_s5m5 1#) of ww1_s5m9 { __DEFAULT ->
type opt 'a = #some a | #none
local type result 'a 'b = #recurse a | #done b
local let recurse 'a 'b (max_depth: i32) (down: a -> result a b) (up: a -> b -> result a b) (x: a) : opt b =
let (_, _, _, final) =
loop
(stack, stack_top, cur, action) =
(replicate max_depth x, 0, x, down x)
@athas
athas / spinlock.cl
Last active December 20, 2019 19:31
kernel void spinlock(int n, global long *out) {
volatile local int locks[1];
volatile local long vals[1];
// Set all locks to free.
if (get_local_id(0) == 0) {
locks[0] = 0;
}
barrier(CLK_LOCAL_MEM_FENCE);