facebook / duckling

Language, engine, and tooling for expressing, testing, and evaluating composable language rules on input strings.
Other
4.06k stars 722 forks source link

Running duckling binary on ARM based architecture (NVIDIA Xavier, Linux) - unknown RTS option: -N #566

Open IliaGrigoriev opened 3 years ago

IliaGrigoriev commented 3 years ago

Dear Facebook Team,

I have the following problem when trying to run the successfully built duckling binary on ARM based architecture on SD Card of NVIDIA Xavier, Ubuntu 18.04, Stack version 1.5.1 aarch64:

stack build
stack exec duckling-example-exe

I get the following output:

duckling-example-exe: unknown RTS option: -N
duckling-example-exe: 
duckling-example-exe: Usage: <prog> <args> [+RTS <rtsopts> | -RTS <args>] ... --RTS <args>
duckling-example-exe: 
duckling-example-exe:    +RTS    Indicates run time system options follow
duckling-example-exe:    -RTS    Indicates program arguments follow
duckling-example-exe:   --RTS    Indicates that ALL subsequent arguments will be given to the
duckling-example-exe:            program (including any of these RTS flags)
duckling-example-exe: 
duckling-example-exe: The following run time system options are available:
duckling-example-exe: 
duckling-example-exe:   -?       Prints this message and exits; the program is not executed
duckling-example-exe:   --info   Print information about the RTS used by this program
duckling-example-exe: 
duckling-example-exe:   -K<size>  Sets the maximum stack size (default: 80% of the heap)
duckling-example-exe:             Egs: -K32k -K512k -K8M
duckling-example-exe:   -ki<size> Sets the initial thread stack size (default 1k)  Egs: -ki4k -ki2m
duckling-example-exe:   -kc<size> Sets the stack chunk size (default 32k)
duckling-example-exe:   -kb<size> Sets the stack chunk buffer size (default 1k)
duckling-example-exe: 
duckling-example-exe:   -A<size> Sets the minimum allocation area size (default 512k) Egs: -A1m -A10k
duckling-example-exe:   -n<size> Allocation area chunk size (0 = disabled, default: 0)
duckling-example-exe:   -O<size> Sets the minimum size of the old generation (default 1M)
duckling-example-exe:   -M<size> Sets the maximum heap size (default unlimited)  Egs: -M256k -M1G
duckling-example-exe:   -H<size> Sets the minimum heap size (default 0M)   Egs: -H24m  -H1G
duckling-example-exe:   -xb<addr> Sets the address from which a suitable start for the heap memory
duckling-example-exe:             will be searched from. This is useful if the default address
duckling-example-exe:             clashes with some third-party library.
duckling-example-exe:   -m<n>    Minimum % of heap which must be available (default 3%)
duckling-example-exe:   -G<n>    Number of generations (default: 2)
duckling-example-exe:   -c<n>    Use in-place compaction instead of copying in the oldest generation
duckling-example-exe:            when live data is at least <n>% of the maximum heap size set with
duckling-example-exe:            -M (default: 30%)
duckling-example-exe:   -c       Use in-place compaction for all oldest generation collections
duckling-example-exe:            (the default is to use copying)
duckling-example-exe:   -w       Use mark-region for the oldest generation (experimental)
duckling-example-exe:   -I<sec>  Perform full GC after <sec> idle time (default: 0.3, 0 == off)
duckling-example-exe: 
duckling-example-exe:   -T         Collect GC statistics (useful for in-program statistics access)
duckling-example-exe:   -t[<file>] One-line GC statistics (if <file> omitted, uses stderr)
duckling-example-exe:   -s[<file>] Summary  GC statistics (if <file> omitted, uses stderr)
duckling-example-exe:   -S[<file>] Detailed GC statistics (if <file> omitted, uses stderr)
duckling-example-exe: 
duckling-example-exe: 
duckling-example-exe:   -Z       Don't squeeze out update frames on stack overflow
duckling-example-exe:   -B       Sound the bell at the start of each garbage collection
duckling-example-exe: 
duckling-example-exe:   -h       Heap residency profile (output file <program>.hp)
duckling-example-exe:   -i<sec>  Time between heap profile samples (seconds, default: 0.1)
duckling-example-exe: 
duckling-example-exe:   -C<secs>  Context-switch interval in seconds.
duckling-example-exe:             0 or no argument means switch as often as possible.
duckling-example-exe:             Default: 0.02 sec.
duckling-example-exe:   -V<secs>  Master tick interval in seconds (0 == disable timer).
duckling-example-exe:             This sets the resolution for -C and the heap profile timer -i,
duckling-example-exe:             and is the frequence of time profile samples.
duckling-example-exe:             Default: 0.01 sec.
duckling-example-exe: 
duckling-example-exe:   --install-signal-handlers=<yes|no>
duckling-example-exe:             Install signal handlers (default: yes)
duckling-example-exe:   -e<n>     Maximum number of outstanding local sparks (default: 4096)
duckling-example-exe:   -xq       The allocation limit given to a thread after it receives
duckling-example-exe:             an AllocationLimitExceeded exception. (default: 100k)
duckling-example-exe: 
duckling-example-exe: RTS options may also be specified using the GHCRTS environment variable.
duckling-example-exe: 
duckling-example-exe: Other RTS options may be available for programs compiled a different way.
duckling-example-exe: The GHC User's Guide has full details.
duckling-example-exe:

I get the same output, when using newer version of stack (2.1.1), the lines inside duckling folder are:

./stack-2.1.1-linux-aarch64/stack build ../

and then:

./stack-2.1.1-linux-aarch64/stack exec duckling-example-exe

What am I doing wrong?

Many thanks in advance.

Best regards, Ilia

chessai commented 3 years ago

Stack isn't the issue. Looks like GHC disables SMP (symmetric multiprocessor) on older versions of ARM: https://gitlab.haskell.org/ghc/ghc/-/blob/master/hadrian/src/Oracles/Flag.hs#L69

Looks like you need a minimum of ARMv7. Can you confirm what ARM version you are on?

IliaGrigoriev commented 3 years ago

Hi. First of all, thank you very much for you reply. Here is the output from cat /proc/cpuinfo:

processor   : 0
model name  : ARMv8 Processor rev 0 (v8l)
BogoMIPS    : 62.50
Features    : fp asimd evtstrm aes pmull sha1 sha2 crc32 atomics fphp asimdhp
CPU implementer : 0x4e
CPU architecture: 8
CPU variant : 0x0
CPU part    : 0x004
CPU revision    : 0
MTS version : 45309758

processor   : 1
model name  : ARMv8 Processor rev 0 (v8l)
BogoMIPS    : 62.50
Features    : fp asimd evtstrm aes pmull sha1 sha2 crc32 atomics fphp asimdhp
CPU implementer : 0x4e
CPU architecture: 8
CPU variant : 0x0
CPU part    : 0x004
CPU revision    : 0
MTS version : 45309758

processor   : 2
model name  : ARMv8 Processor rev 0 (v8l)
BogoMIPS    : 62.50
Features    : fp asimd evtstrm aes pmull sha1 sha2 crc32 atomics fphp asimdhp
CPU implementer : 0x4e
CPU architecture: 8
CPU variant : 0x0
CPU part    : 0x004
CPU revision    : 0
MTS version : 45309758

processor   : 3
model name  : ARMv8 Processor rev 0 (v8l)
BogoMIPS    : 62.50
Features    : fp asimd evtstrm aes pmull sha1 sha2 crc32 atomics fphp asimdhp
CPU implementer : 0x4e
CPU architecture: 8
CPU variant : 0x0
CPU part    : 0x004
CPU revision    : 0
MTS version : 45309758

processor   : 4
model name  : ARMv8 Processor rev 0 (v8l)
BogoMIPS    : 62.50
Features    : fp asimd evtstrm aes pmull sha1 sha2 crc32 atomics fphp asimdhp
CPU implementer : 0x4e
CPU architecture: 8
CPU variant : 0x0
CPU part    : 0x004
CPU revision    : 0
MTS version : 45309758

processor   : 5
model name  : ARMv8 Processor rev 0 (v8l)
BogoMIPS    : 62.50
Features    : fp asimd evtstrm aes pmull sha1 sha2 crc32 atomics fphp asimdhp
CPU implementer : 0x4e
CPU architecture: 8
CPU variant : 0x0
CPU part    : 0x004
CPU revision    : 0
MTS version : 45309758

processor   : 6
model name  : ARMv8 Processor rev 0 (v8l)
BogoMIPS    : 62.50
Features    : fp asimd evtstrm aes pmull sha1 sha2 crc32 atomics fphp asimdhp
CPU implementer : 0x4e
CPU architecture: 8
CPU variant : 0x0
CPU part    : 0x004
CPU revision    : 0
MTS version : 45309758

processor   : 7
model name  : ARMv8 Processor rev 0 (v8l)
BogoMIPS    : 62.50
Features    : fp asimd evtstrm aes pmull sha1 sha2 crc32 atomics fphp asimdhp
CPU implementer : 0x4e
CPU architecture: 8
CPU variant : 0x0
CPU part    : 0x004
CPU revision    : 0
MTS version : 45309758

Best regards, Ilia

IliaGrigoriev commented 3 years ago
./stack-2.1.1-linux-aarch64/stack ghc -- --version
The Glorious Glasgow Haskell Compilation System, version 8.0.2
uname -a
Linux ilia 4.9.140-tegra #1 SMP PREEMPT Mon Dec 9 22:52:02 PST 2019 aarch64 aarch64 aarch64 GNU/Linux
chessai commented 3 years ago

Can you try just removing the -N option from the rts-options?

chessai commented 3 years ago

Bump on this @IliaGrigoriev

IliaGrigoriev commented 3 years ago

Hi @chessai,

sorry, there has been an overload of additional tasks since January this year. I should be able to come back to the task, which required duckling setup on ARM in the mid April this year.

Best wishes, Ilia

finusdev commented 1 year ago

So how can we run Duckling on aarm64 now? Already tried also with docker

vieenrose commented 1 year ago

You could use the following command to remove -N option, as workaround

find . -type f -name "*.cabal" -exec sed -i 's/-with-rtsopts=-N//g' {} +

After building Duckling v0.1.6.1 on Jetson Xavier 8GB, the resulting executable is now runnable on Xavier as well as on Nano.