Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to set the number of threads at run time (avoiding +RTS -N#)

I wish run my parallel programs as

$ myprogram <args> -n 4 <args>

instead

$ myprogram <args> +RTS -N4 -RTS <args>

the main reason is to normalize the argument format on my programs.

I know it would can do as

$ myprogramwrapper <args> -n 4 <args>
$ cat myprogramwrapper
#!/bin/bash
ARG1=parse args
ARG2=...
NCORES=....
myprogram $ARG1 ... +RTS -N$NCORES

but it's ugly.

Thanks a lot! :)

like image 454
josejuan Avatar asked Jul 31 '13 09:07

josejuan


1 Answers

You can use function setNumCapabilities at runtime.

like image 96
Fedor Gogolev Avatar answered Sep 28 '22 00:09

Fedor Gogolev