Learn

First SEGL experiment

In this lesson we describe a very simple experiment example. 

Also we want to make a summ of two numbers. We have two input files - a%i.txt and b%i.txt. And the result of summ will be saved into output.txt.

%i - means that we have a set of files with such names as a1.txt, a2.txt b1.txt, b2.txt and so on. Using %i we may work with dinamycaly created datasets in runtime, where the number of datasets is depended from input data.

So if we have files a1.txt, a2.txt, a3.txt and b1.txt, b2.txt, b3.txt - we will have 3 datasets. For dataset number 1 will be made the summ of values from a1.txt and b1.txt. For dataset 2 - a2.txt and b2.txt and so on.

Also we need a script that will calculate a summ. For example:

 #!/bin/bash
#
#PBS -l nodes=1,walltime=0:25:00
#PBS -e err.out
#PBS -o std.out

input1=#a
input2=#b

#cd to the work dir
path=`dirname $input1`
cd $path

#calculate summ
var=0
num=`cat $input1`
var=$num
num=`cat $input2`
let "var += $num";

#save result 
echo $var > output.txt

Values #a and #b (line numbers 7 and 8) will be replased with real file names a1.txt...b1.txt... in runtime.

Now we may start the video lesson.

The same example in PDF and HTML you may find in Documentation->Tutorials section.