rgrinberg has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
bgs has joined #ocaml
hsw has joined #ocaml
bartholin has joined #ocaml
jao has quit [Ping timeout: 252 seconds]
gwizon has quit [Ping timeout: 252 seconds]
bartholin has quit [Quit: Leaving]
troydm has joined #ocaml
bgs has quit [Remote host closed the connection]
lthms has quit [Ping timeout: 252 seconds]
lthms has joined #ocaml
jlrnick has joined #ocaml
jlrnick has quit [Remote host closed the connection]
jlrnick has joined #ocaml
pie_ has quit [*.net *.split]
qwr has quit [*.net *.split]
Ekho has quit [*.net *.split]
mal`` has quit [*.net *.split]
towel has quit [*.net *.split]
klu has quit [*.net *.split]
dextaa has quit [*.net *.split]
dme2 has quit [*.net *.split]
Myrl has quit [*.net *.split]
oisota has quit [*.net *.split]
ohperitel has quit [*.net *.split]
adrien has quit [*.net *.split]
asm has quit [*.net *.split]
sadiq has quit [*.net *.split]
riverdc has quit [*.net *.split]
Armael has quit [*.net *.split]
ohperitel_ has joined #ocaml
qwr has joined #ocaml
adrien has joined #ocaml
klu has joined #ocaml
asm has joined #ocaml
klu has quit [Changing host]
klu has joined #ocaml
pie_ has joined #ocaml
riverdc has joined #ocaml
mal`` has joined #ocaml
asm has quit [Changing host]
asm has joined #ocaml
dme2 has joined #ocaml
towel has joined #ocaml
Armael has joined #ocaml
Myrl has joined #ocaml
sadiq has joined #ocaml
neiluj has joined #ocaml
Ekho has joined #ocaml
mro has joined #ocaml
olle has joined #ocaml
jlrnick has quit [Remote host closed the connection]
szkl has quit [Quit: Connection closed for inactivity]
jlrnick has joined #ocaml
mro has quit [Remote host closed the connection]
mro has joined #ocaml
calvnce has joined #ocaml
azimut_ has joined #ocaml
azimut has quit [Ping timeout: 255 seconds]
gahr has quit [Ping timeout: 260 seconds]
gahr has joined #ocaml
mro has quit [Remote host closed the connection]
mro has joined #ocaml
kakadu has joined #ocaml
calvnce has quit [Ping timeout: 260 seconds]
calvnce has joined #ocaml
jao has joined #ocaml
mro has quit [Remote host closed the connection]
mro has joined #ocaml
mro has quit [Quit: Leaving...]
gwizon has joined #ocaml
szkl has joined #ocaml
wingsorc has quit [Ping timeout: 252 seconds]
rgrinberg has joined #ocaml
calvnce has quit [Ping timeout: 260 seconds]
bobo_ has joined #ocaml
spip has quit [Ping timeout: 248 seconds]
gwizon has quit [Ping timeout: 260 seconds]
Haudegen has quit [Quit: Bin weg.]
rgrinberg has quit [Ping timeout: 260 seconds]
calvnce has joined #ocaml
dnh has joined #ocaml
xgqt has quit [Remote host closed the connection]
troydm has quit [Ping timeout: 246 seconds]
xgqt has joined #ocaml
mbuf has quit [Quit: Leaving]
alexherbo2 has joined #ocaml
azimut_ has quit [Remote host closed the connection]
azimut has joined #ocaml
calvnce has quit [Ping timeout: 260 seconds]
alexherbo2 has quit [Remote host closed the connection]
alexherbo2 has joined #ocaml
xd1le has quit [Quit: xd1le]
Haudegen has joined #ocaml
Tuplanolla has joined #ocaml
alexherbo2 has quit [Remote host closed the connection]
alexherbo2 has joined #ocaml
<greenbagels>
Does Unix.fork give any guarantee as to the entry point for the child process
<greenbagels>
I'm trying to multiprocess to distribute a workload without using something like MPI, much like the C fork/pipe idiom
<greenbagels>
But it looks like I do not grasp how fork interacts with the order of execution
<haesbaert>
fork "returns twice", once fork returns you have two processes, the order of which one will be execute first or if both will end up in parallel on different cores, is undefined
<haesbaert>
*executed
<haesbaert>
usually you setup a Pipe, then fork, the child writes to one end, and the parent reads from the other end
<haesbaert>
does that help ? the order of execution is irrelevant as the IPC is buffered (pipe, socketpair and whatnot)
<greenbagels>
haesbaert: that makes sense but I meant more like, I write a print statement, then a fork, then a print statement
<theblatte>
the print statement after the fork will get executed twice: once by the parent and once by the child
<greenbagels>
Instead of only the last print expression being evaluated by both processes, both print expressions are double-evaluated
<theblatte>
ah, that's because of the buffering by Format or others, probably!
<greenbagels>
Ah
<theblatte>
flush everything before forking
<greenbagels>
Yeah I was using Printf so that makes sense
troydm has joined #ocaml
<greenbagels>
Yes that works wonderfully theblatte; thanks friends!
<theblatte>
high on my list of "random fork() gotchas", together with calling Random.self_init() after fork() to avoid every process getting the same stream of random numbers
<greenbagels>
Ah yes I would have fallen to that one too, whoops
azimut has quit [Remote host closed the connection]
azimut has joined #ocaml
ewd has joined #ocaml
troydm has quit [Ping timeout: 255 seconds]
azimut_ has joined #ocaml
azimut has quit [Ping timeout: 255 seconds]
<octachron>
With OCaml 5 PRNG, rather than reseeding the Random generator, it is probably better to split the generator in either the child or the parent.
<haesbaert>
it's time to include getentropy() in stdlib :D
<haesbaert>
oh wait it's there, I missed something
<haesbaert>
oh not exported
gwizon has joined #ocaml
<theblatte>
octachron: hmmm, I understood nothing but ok, I'll keep that in mind for the upgrade :)
<octachron>
Random.self_init () is an expensive operation that requires some system call to be able to generate a "fresh enough" state for the Random generator.
<companion_cube>
you can also eschew all global state, and use Random.make_self_init()
<companion_cube>
and carry state around
<octachron>
In OCaml 5, the random generator has been changed to be able to support a new split operation that generates this kind of "fresh enough" state from the pre-existing Random generator state without going through the OS.
<octachron>
companion_cube, you also need to generate an independent seed for the child if you are carrying the state yourself.
alexherbo2 has quit [Remote host closed the connection]
alexherbo2 has joined #ocaml
<companion_cube>
ah, sure, don't use the same state
<companion_cube>
but normally you should fork early enough that the state isn't setup yet
<greenbagels>
Ok new question, I'm having the parent record Sys.time() before forking, then having it fork 16 times and wait for all its children to complete some work and transfer them back thru 16 pipes, then recording Sys.time() in the parent again
<greenbagels>
But this time difference between the two time() calls seems too low; like I would expect the 16 forks to speed things up by at *most* a factor of 16, but its looking like 2400x instead...
<companion_cube>
Sys.time measures CPU time in the process, you should probably use mtime to get a proper (monotonic) clock
<companion_cube>
if all the parent does it wait, it consumes very little cpu time
<greenbagels>
Oh true!
<greenbagels>
That does make for an interesting comparison with multithreading, where the cpu clock gives you too *large* of a value because it sums cpu time over threads in a single process
<greenbagels>
Neat
troydm has joined #ocaml
<haesbaert>
btw, why don't we have clock_monotonic in stdlib still ? was there a reason for not including or just no one did it yet ?
<haesbaert>
I mean clock_gettime(2)
oisota has joined #ocaml
jlrnick has quit [Ping timeout: 252 seconds]
Haudegen has quit [Quit: Bin weg.]
azimut_ has quit [Ping timeout: 255 seconds]
kakadu has quit [Quit: Konversation terminated!]
ewd has quit [Ping timeout: 268 seconds]
<companion_cube>
you could try to propose it
<companion_cube>
but they're probably going to ask why it should be in the stdlib
alexherbo2 has quit [Remote host closed the connection]
alexherbo2 has joined #ocaml
<haesbaert>
ack
<companion_cube>
(if you look at mtime, there's a bit of magic to make it work on multiple platforms, iirc. It's not just clock_gettime)
<haesbaert>
multiple platforms I'm guessing you mean windows
<haesbaert>
oh os x is being funny, leme se
szkl has quit [Quit: Connection closed for inactivity]
<haesbaert>
they included only in 10.12 :/
Haudegen has joined #ocaml
bgs has joined #ocaml
neiluj has quit [Ping timeout: 248 seconds]
Serpent7776 has joined #ocaml
rwmjones is now known as rwmjones|hols
bgs has quit [Remote host closed the connection]
lthms has quit [Ping timeout: 252 seconds]
lthms has joined #ocaml
neiluj has joined #ocaml
gwizon has quit [Quit: Lost terminal]
waleee has joined #ocaml
bartholin has joined #ocaml
alexherbo2 has quit [Remote host closed the connection]
alexherbo2 has joined #ocaml
alexherbo2 has quit [Remote host closed the connection]
alexherbo2 has joined #ocaml
gwizon has joined #ocaml
jlrnick has joined #ocaml
alexherbo2 has quit [Remote host closed the connection]
alexherbo2 has joined #ocaml
rgrinberg has joined #ocaml
mro has joined #ocaml
jlrnick has quit [Ping timeout: 255 seconds]
Serpent7776 has quit [Ping timeout: 260 seconds]
Serpent7776 has joined #ocaml
John_Ivan has joined #ocaml
bartholin has quit [Quit: Leaving]
bgs has joined #ocaml
bgs has quit [Remote host closed the connection]
oriba has joined #ocaml
azimut has joined #ocaml
mro has quit [Quit: Leaving...]
gwizon has quit [Quit: Lost terminal]
dnh has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
azimut has quit [Remote host closed the connection]
azimut has joined #ocaml
azimut has quit [Remote host closed the connection]
azimut has joined #ocaml
rgrinberg has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
alexherbo2 has quit [Remote host closed the connection]
Serpent7776 has quit [Ping timeout: 252 seconds]
azimut has quit [Remote host closed the connection]