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

I want to run my parallel programs as

$ myprogram <args> -n 4 <args> 

instead

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

The main reason is to normalize the format of the arguments in my programs.

I know what he could do as

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

but it is ugly.

Thanks a lot!:)

+6
source share
1 answer

You can use the setNumCapabilities function at run time.

+7
source

Source: https://habr.com/ru/post/950703/


All Articles