MRCIEU / godmc

GoDMC analysis pipeline
12 stars 2 forks source link

Problems with parallelizing #19

Closed yocra3 closed 7 years ago

yocra3 commented 7 years ago

Hi,

I tried to run the script 16c to run the linear model analysis. I tried your code and it failed:

seq 962 | parallel -j 10 -- ./16c-run.sh {}
sh: {}: command not found
error: Batch variable is not a number
Usage: ./16c-run.sh [batch number]

I think that the problem was how the script captures the input from pipes. I tried to only run seq and the script and it didn't work:

[cruiz@crealws03 godmc]$ seq 10 |  ./16c-run.sh \n
error: Batch variable is not a number
Usage: ./16c-run.sh [batch number]
[cruiz@crealws03 godmc]$ seq 10 |  ./16c-run.sh -
error: Batch variable is not a number
Usage: ./16c-run.sh [batch number]
[cruiz@crealws03 godmc]$ seq 10 |  ./16c-run.sh {}
error: Batch variable is not a number
Usage: ./16c-run.sh [batch number]

How can I solve it?

epzjlm commented 7 years ago

Have you tried it like this: seq 962 | parallel -j 10 --workdir $PWD ./16c-run.sh {}

yocra3 commented 7 years ago

Yes. It did not work either:

[cruiz@crealws03 godmc]$  seq 962 | parallel -j 10 --workdir $PWD ./16c-run.sh {}
parallel: invalid option -- -
parallel [OPTIONS] command -- arguments
        for each argument, run command with argument, in parallel
parallel [OPTIONS] -- commands
        run specified commands in parallel

Should I change workdir by a path? This was not clear for me in the wiki.

On the other hand, running the script only with the batch number works:

./16c-run.sh 1

epzjlm commented 7 years ago

Have you installed GNU parallel? What do you see if you run parallel man

yocra3 commented 7 years ago

I took a look at the documentation and I found out that I was running and old version of parallel package (from 2009). Using the documentation, I changed the code to:

parallel -j 10 ./16c-run.sh -- $(seq 962)

This is now working in parallel. If I find any additional problem, I will let you know.