to_i64
type t
val index [n] 'a : [n]a -> t -> a
I was originally thinking of something like
let index [n] 't 'i (ts: [n]t) (index: i) = ts[i]
but that won't compile regardless
@Gusten_Isfeldt_gitlab Also, be careful in general. I never finished implementing proper synchronisation for accumulator operators that cannot be implemented with hardware atomics (basically, primitive operators).
@athas would this manifest as incorrect results, and if so, would the errors in general be small, like missed values in the accumulation?
c
backend.
let lj (sigma:f32) (epsilon:f32) (r:f32) =
let sdr = sigma/r
let sdr2 = sdr*sdr
let sdr6 = sdr2*sdr2*sdr2
let sdr12 = sdr6*sdr6
in 4*epsilon*(sdr12-sdr6)
let k_B:f32 = 8.617333262125e-5 -- eV/K
let p T V = f32.exp (-V/(k_B*T))
let sigma:f32 = 1
let epsilon:f32 = 1
let n:i64 = 100
let rs = tabulate n (\i -> 3*sigma* f32.from_fraction i n)
let vs = map (\r -> let v = lj sigma epsilon r in (v, p 300 v)) rs
let rvs = zip (zip rs rs) vs
-- > :plot2d rvs
results in
Internal compiler error (unhandled IO exception).
Please report this at https://github.com/diku-dk/futhark/issues
After sending command ["store","/tmp/futhark-server-read1763236-1","out0"] to server process:fd:330: hGetLine: end of file
Server process exited unexpectedly with exit code: -11
Server stderr:
CallStack (from HasCallStack):
error, called at src/Futhark/Server.hs:141:7 in futhark-0.20.0-7O7l1SWHThQFOpbzz8q8kj:Futhark.Server
What am I doing wrong?
x
and y
values should not be zip
ped
> :plot2d rvs failed:
Invalid data file produced by Futhark server.
futhark: testplot-img: getDirectoryContents:openDirStream: does not exist (No such file or directory)
futhark literate
is just terrible at handling errors.
let rs = tabulate n (\i -> 3*sigma* f32.from_fraction i n)
let vs = map (lj sigma epsilon) rs
let ps = map (p 300) vs
let rvs = {potential = (rs, vs), probability = (rs, ps)}
-- > :plot2d rvs
Internal compiler error (unhandled IO exception).
Please report this at https://github.com/diku-dk/futhark/issues
After sending command ["store","/tmp/futhark-server-read1951878-1","out0"] to server process:fd:330: hGetLine: end of file
Server process exited unexpectedly with exit code: -11
Server stderr:
CallStack (from HasCallStack):
error, called at src/Futhark/Server.hs:141:7 in futhark-0.20.0-7O7l1SWHThQFOpbzz8q8kj:Futhark.Server
:plt2d {potential = (rs, vs), probability = (rs, ps)}
.
bool
in binary data sets? and what layout do higher ranked arrays have?