parallel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Inserting Parallel argument into command script


From: Shlomi Fish
Subject: Re: Inserting Parallel argument into command script
Date: Fri, 19 Jun 2020 10:38:22 +0300

Hi Miriam,

Please reply to list:

https://www.shlomifish.org/philosophy/computers/netiquette/email/reply-to-list.html

On Fri, 19 Jun 2020 11:49:22 +1200
Miriam Dixon <miriam.gatemc@gmail.com> wrote:

> Hi,
> 
> I am very new to Parallel, Linux, and computing in general but I need to
> use it for my Masters Thesis, so I am doing my best to learn quickly.
> 

Welcome aboard!

> For my project, I am running a simulation using GATE, and I have a shell
> script to run the simulation for each of four different projection angles.
> I want to run each projection angle simulation on a different core, to
> speed things along and use the computer memory efficiently. I tried to do
> this by pulling projAngles out of my script and calling it as a parallel
> argument.
> parallel runSim.sh --projAngles {1} ::: 0 45 90 135
> 
> This seemed to work, in that it started my runSim.sh, but it didn't use the
> value from projAngles within the script,
> time=$(bc -l <<< "$projAngles*$timePerProjection")
> 

As far as I know "--projAngles" in the shell script's command line arguments
does not automatically propagate to a shell variable. E.g:

```
[shlomif@telaviv1 ~]$ cat miriam-test.bash                  
#! /bin/bash
#
# miriam-test.bash
# Copyright (C) 2020 Shlomi Fish <shlomif@cpan.org>
#
# Distributed under the terms of the MIT license.
#
echo "argv = < $@ >"
echo "projAngles = < $projAngles >"
[shlomif@telaviv1 ~]$ bash miriam-test.bash --projAngles 500
argv = < --projAngles 500 >
projAngles = <  >
[shlomif@telaviv1 ~]$ projAngles=500 bash miriam-test.bash  
argv = <  >
projAngles = < 500 >
[shlomif@telaviv1 ~]$  
```

#bash on freenode has these links in its topic:

Topic for #bash is: http://mywiki.wooledge.org/BashFAQ
| http://mywiki.wooledge.org/BashGuide | http://gnu.org/s/bash/manual |
http://wiki.bash-hackers.org/ | http://mywiki.wooledge.org/Quotes |
http://www.shellcheck.net/ | https://lists.gnu.org/mailman/listinfo/help-bash |
https://git.savannah.gnu.org/cgit/bash.git?h=devel

Jun 19 10:32:21 *
Topic for #bash set by izabera (Wed Dec 25 11:08:20 2019) Jun 19 10:32:21
-ChanServ-      [#bash] Welcome to #bash, we discuss the GNU bash shell.  Be
explicit if your question is about another shell.  Don't trust the Internet on
bash, learn from the resources in the topic instead.  You must be identified to
send to the channel.

You may wish to peruse some of them as well as
https://github.com/shlomif/Freenode-programming-channel-FAQ/blob/master/FAQ_with_ToC__generated.md
and https://perl-begin.org/FAQs/freenode-perl/ .

> Is there a way in the script or in parallel to insert the particular
> projAngles value for that run, and use it to calculate the next step?
> 

Either parse the cmd line arguments (using $1 / shift / $@ / etc.) or pass them
to the script using https://en.wikipedia.org/wiki/Environment_variable .

> Cheers,
> Miriam



-- 

Shlomi Fish       https://www.shlomifish.org/
Star Trek: “We, the Living Dead” - https://shlom.in/st-wtld

<Su-Shee> Absolutely. Also: a German dog barks “wau” and a cat meows “miau”
<rindolf> Su-Shee: German animals are true German patriots.

Please reply to list if it's a mailing list post - https://shlom.in/reply .



reply via email to

[Prev in Thread] Current Thread [Next in Thread]