mratsim / weave

A state-of-the-art multithreading runtime: message-passing based, fast, scalable, ultra-low overhead
Other
537 stars 22 forks source link

parafib error: MPSC channel size was 512 #105

Closed lessneek closed 4 years ago

lessneek commented 4 years ago
$ nim -v                          
Nim Compiler Version 1.1.1 [Linux: amd64]
Compiled at 2020-02-08
Copyright (c) 2006-2019 by Andreas Rumpf

active boot switches: -d:release

parafib.nim:

import weave

proc fib(n: int): int =
  # int64 on x86-64
  if n < 2:
    return n

  let x = spawn fib(n-1)
  let y = fib(n-2)

  result = sync(x) + y

proc main() =
  var n = 20

  init(Weave)
  let f = fib(n)
  exit(Weave)

  echo f

main()
nim c --threads:on ./parafib.nim
Error: unhandled exception: ~/.nimble/pkgs/weave-0.1.0/weave/memory/memory_pools.nim(625, 8) `sizeof(ChannelMpscUnboundedBatch[ptr MemBlock]) == 272` MPSC channel size was 512 [AssertionError]
mratsim commented 4 years ago

Works for me on one of the commits from yesterday, will try updating to see if there is a regression. Was your compiler installed through choosenim?

image

mratsim commented 4 years ago

Recompiled on the latest commit, it still works

image

My guess is that somehow the compiler you compiled on 2020-02-08 was from before:

mratsim commented 4 years ago

Sorry, actually the issue is the following: