Re: [AMBER] test_amber_cuda.sh requires small fix

From: Jason Swails <jason.swails.gmail.com>
Date: Wed, 2 Nov 2011 13:27:41 -0400

On Wed, Nov 2, 2011 at 11:13 AM, Jan-Philip Gehrcke <jgehrcke.googlemail.com
> wrote:

> Hey,
>
> after I've finally managed to build AmberTools & Amber & pmemd.cuda, I
> tried to test pmemd.cuda:
>
> $ cd $AMBERHOME/test
> $ ./test_amber_cuda.sh 2>&1 | tee test_amber_cuda.log
> [: 35: unexpected operator
> [: 42: unexpected operator
> Warning. DO_PARALLEL is set to mpirun -np 4. This environment variable
> is being unset.
> cd cuda && make -k test.pmemd.cuda GPU_ID= PREC_MODEL=
> make[1]: Entering directory
> `/home/bioinfp/jang/sumpf/Amber11/test/amber11/test/cuda'
> ------------------------------------
> Running CUDA Implicit solvent tests.
> Precision Model =
> GPU_ID =
> ------------------------------------
> cd trpcage/ && ./Run_md_trpcage netcdf.mod
> ../../../bin/pmemd.cuda_: Command not found.
>
>
> This is the same problem as reported here:
> http://archive.ambermd.org/201104/0296.html
>
> On my Ubuntu 10.04, /bin/sh is dash and not bash, which is a bit more
> sensitive to unclean code. POSIX compliant scripts run on both, dash and
> bash. I've consolidated the following part of test_amber_cuda.sh a bit:
>
> if [ "x$1" = "x" ]; then
> echo "Using default GPU_ID = -1"
> GPU_ID="-1"
> else
> GPU_ID="$1"
> fi
>

Thanks for the report! I recently switched away from Ubuntu on my main
Machine, so I don't catch bash-isms in scripts anymore. This has been
fixed in the developer tree for both test_amber_cuda.sh and
test_amber_cuda_parallel.sh. I altered it slightly to be

if [ $# -lt 1 ]; then

in those cases, since I think that's a little clearer (if the number of
arguments given is less than 1, use the default precision model). Also,
the "-z" test may be what you're looking for here.

"-z <string>" evaluates to True of the string is missing, or False
otherwise. Thus,

if [ "x$var" = "x" ]; then

is equivalent to

if [ -z "$var" ]; then

(unrelated to Amber, but potentially still helpful), and has always worked
in dash for me before.

All the best,
Jason

All the best,
Jason


> if [ "x$2" = "x" ]; then
> echo "Using default PREC_MODEL = SPDP"
> PREC_MODEL="SPDP"
> else
> PREC_MODEL="$2"
> fi
>
> Using that, the defaults of PREC_MODEL and GPU_ID are set correctly.
>
>
> Now I will have fun with my new GPU machine :-)
>
> Jan-Philip
>
> _______________________________________________
> AMBER mailing list
> AMBER.ambermd.org
> http://lists.ambermd.org/mailman/listinfo/amber
>



-- 
Jason M. Swails
Quantum Theory Project,
University of Florida
Ph.D. Candidate
352-392-4032
_______________________________________________
AMBER mailing list
AMBER.ambermd.org
http://lists.ambermd.org/mailman/listinfo/amber
Received on Wed Nov 02 2011 - 10:30:09 PDT
Custom Search