parameters file for batch runs on a cloud

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

parameters file for batch runs on a cloud

Mike F Nelson
Hello,

I’m having trouble getting my model to run on our local cloud server.  I can get to the point where my job is submitted and starts to run, but I get the following entry in the failure log:

[mfnelson@hn1 qsubTest1]$ cat instance_0/FAILURE_0
Error while running model
repast.simphony.scenario.ScenarioLoadException: Error while reading parameter input
        at repast.simphony.batch.InstanceRunner.run(InstanceRunner.java:201)
        at repast.simphony.batch.InstanceRunner.main(InstanceRunner.java:217)
Caused by: java.io.FileNotFoundException: localParamFile.txt (No such file or directory)
        at java.io.FileInputStream.open0(Native Method)
        at java.io.FileInputStream.open(FileInputStream.java:195)
        at java.io.FileInputStream.<init>(FileInputStream.java:138)
        at java.io.FileInputStream.<init>(FileInputStream.java:93)
        at java.io.FileReader.<init>(FileReader.java:58)
        at repast.simphony.batch.InstanceRunner.run(InstanceRunner.java:188)
        ... 1 more


‘localParamFile.txt’ is present in the directory from which I submitted my job via:

qsub repast.pbs


How can I tell the instance runner where to find the local parameters file?


Thanks for your help,

Mike



------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
Repast-interest mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/repast-interest
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: parameters file for batch runs on a cloud

Mike F Nelson
So…  I was able to get it to work.   I’ll detail what I did in case it is helpful:

To solve my initial problem, I edited repastwrapper.sh to add $PBS_O_WORKDIR to the search path.

I then ran into a problem with the script not giving the correct location for the unrolled parameters file.  After a lot of trial and error I noticed that the call to ‘sed’ was given an argument of “$paramFile”.  At the beginning of the script file there was a line with "param_file=$4 # unrolled param file”.

The problem was that sed was trying to find “$paramFile” which did not exist.  I got it to work by changing $paramFile to $param_file and defining $param_file as unrolledParamFile.txt via

param_file=unrolledParamFile.txt # unrolled param file

I then ran into a problem where the model run couldn’t find ‘unrolledParamFile.txt”.  I fixed that by adding the following line to the script file:

cp $param_file $instanceDir/$param_file

immediately before the cd $instanceDir line.

With those changes, I was able to get my job to submit and run.

Here is the entire contents of my repastwrapper.sh file:
(the export calls were needed to solve another problem in which my jobs were trying to use java 1.7)


#!/bin/bash

cd $PBS_O_WORKDIR

totr=$1 # total runs
rpi=$2 # runs per instance
fin=$3 # first instance number
param_file=unrolledParamFile.txt # unrolled param file

instance=$((PBS_VNODENUM + fin))

instanceDir="instance_"$instance

begin=$(((instance * rpi) + 1))

export JAVA=/usr/local/packages/java/jdk-1.8.0_92/
export PATH=$PBS_O_WORKDIR:$JAVA/bin:$JAVA/jre/bin:/usr/lib64/qt-3.3/bin:/opt/torque/bin:/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin:/usr/lib64/alliance/bin:/opt/clustertest/bin:/home5/mfnelson/bin:/home5/mfnelson/qsubTest1/
export LD_LIBRARY_PATH=$JAVA/lib:$JAVA/jre/lib
export MANPATH=$JAVA/man
export CLASSPATH=$JAVA/lib


if [ "$begin" -le "$totr" ]
then
end=$((begin + rpi - 1))
if [ "$end" -gt "$totr" ]
then
end=$totr
fi
echo "Running lines $begin to $end"

mkdir $instanceDir
cp $param_file $instanceDir/$param_file
cd $instanceDir

sed -n "$begin","$end"p "$param_file" > localParamFile.txt
ln -s "../data" data
# echo $inputArg
java -Xmx512m -cp "../lib/*" repast.simphony.batch.InstanceRunner \
-pxml ../scenario.rs/batch_params.xml \
-scenario ../scenario.rs \
-id $instance \
-pinput localParamFile.txt
fi







> On Jan 24, 2017, at 12:32 PM, Mike F Nelson <[hidden email]> wrote:
>
> Hello,
>
> I’m having trouble getting my model to run on our local cloud server.  I can get to the point where my job is submitted and starts to run, but I get the following entry in the failure log:
>
> [mfnelson@hn1 qsubTest1]$ cat instance_0/FAILURE_0
> Error while running model
> repast.simphony.scenario.ScenarioLoadException: Error while reading parameter input
> at repast.simphony.batch.InstanceRunner.run(InstanceRunner.java:201)
> at repast.simphony.batch.InstanceRunner.main(InstanceRunner.java:217)
> Caused by: java.io.FileNotFoundException: localParamFile.txt (No such file or directory)
> at java.io.FileInputStream.open0(Native Method)
> at java.io.FileInputStream.open(FileInputStream.java:195)
> at java.io.FileInputStream.<init>(FileInputStream.java:138)
> at java.io.FileInputStream.<init>(FileInputStream.java:93)
> at java.io.FileReader.<init>(FileReader.java:58)
> at repast.simphony.batch.InstanceRunner.run(InstanceRunner.java:188)
> ... 1 more
>
>
> ‘localParamFile.txt’ is present in the directory from which I submitted my job via:
>
> qsub repast.pbs
>
>
> How can I tell the instance runner where to find the local parameters file?
>
>
> Thanks for your help,
>
> Mike
>
>
>

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
Repast-interest mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/repast-interest
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: parameters file for batch runs on a cloud

Ozik, Jonathan
Hi Mike,

The typo you found in the repastwrapper.sh file is fixed in the current development branch:
-param_file=$4 # unrolled param file
+paramFile=$4 # unrolled param file

If you fix that and run the "qsub repast.pbs" command from within the complete_model directory, you shouldn't have to hard code the value of param_file to unrolledParamFile.txt.

Adding the command:
cp $param_file $instanceDir/$param_file

will make it so that each instance will run the full unrolled parameter file, which I imagine is not the intention.

The sed command is being used to subdivide the original unrolledParamFile.txt into chunks, which are then sent to individual instance runners for execution.

Jonathan

> On Jan 24, 2017, at 5:35 PM, Mike F Nelson <[hidden email]> wrote:
>
> So…  I was able to get it to work.   I’ll detail what I did in case it is helpful:
>
> To solve my initial problem, I edited repastwrapper.sh to add $PBS_O_WORKDIR to the search path.
>
> I then ran into a problem with the script not giving the correct location for the unrolled parameters file.  After a lot of trial and error I noticed that the call to ‘sed’ was given an argument of “$paramFile”.  At the beginning of the script file there was a line with "param_file=$4 # unrolled param file”.
>
> The problem was that sed was trying to find “$paramFile” which did not exist.  I got it to work by changing $paramFile to $param_file and defining $param_file as unrolledParamFile.txt via
>
> param_file=unrolledParamFile.txt # unrolled param file
>
> I then ran into a problem where the model run couldn’t find ‘unrolledParamFile.txt”.  I fixed that by adding the following line to the script file:
>
> cp $param_file $instanceDir/$param_file
>
> immediately before the cd $instanceDir line.
>
> With those changes, I was able to get my job to submit and run.
>
> Here is the entire contents of my repastwrapper.sh file:
> (the export calls were needed to solve another problem in which my jobs were trying to use java 1.7)
>
>
> #!/bin/bash
>
> cd $PBS_O_WORKDIR
>
> totr=$1 # total runs
> rpi=$2 # runs per instance
> fin=$3 # first instance number
> param_file=unrolledParamFile.txt # unrolled param file
>
> instance=$((PBS_VNODENUM + fin))
>
> instanceDir="instance_"$instance
>
> begin=$(((instance * rpi) + 1))
>
> export JAVA=/usr/local/packages/java/jdk-1.8.0_92/
> export PATH=$PBS_O_WORKDIR:$JAVA/bin:$JAVA/jre/bin:/usr/lib64/qt-3.3/bin:/opt/torque/bin:/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin:/usr/lib64/alliance/bin:/opt/clustertest/bin:/home5/mfnelson/bin:/home5/mfnelson/qsubTest1/
> export LD_LIBRARY_PATH=$JAVA/lib:$JAVA/jre/lib
> export MANPATH=$JAVA/man
> export CLASSPATH=$JAVA/lib
>
>
> if [ "$begin" -le "$totr" ]
> then
> end=$((begin + rpi - 1))
> if [ "$end" -gt "$totr" ]
> then
> end=$totr
> fi
> echo "Running lines $begin to $end"
>
> mkdir $instanceDir
> cp $param_file $instanceDir/$param_file
> cd $instanceDir
>
> sed -n "$begin","$end"p "$param_file" > localParamFile.txt
> ln -s "../data" data
> # echo $inputArg
> java -Xmx512m -cp "../lib/*" repast.simphony.batch.InstanceRunner \
> -pxml ../scenario.rs/batch_params.xml \
> -scenario ../scenario.rs \
> -id $instance \
> -pinput localParamFile.txt
> fi
>
>
>
>
>
>
>
>> On Jan 24, 2017, at 12:32 PM, Mike F Nelson <[hidden email]> wrote:
>>
>> Hello,
>>
>> I’m having trouble getting my model to run on our local cloud server.  I can get to the point where my job is submitted and starts to run, but I get the following entry in the failure log:
>>
>> [mfnelson@hn1 qsubTest1]$ cat instance_0/FAILURE_0
>> Error while running model
>> repast.simphony.scenario.ScenarioLoadException: Error while reading parameter input
>> at repast.simphony.batch.InstanceRunner.run(InstanceRunner.java:201)
>> at repast.simphony.batch.InstanceRunner.main(InstanceRunner.java:217)
>> Caused by: java.io.FileNotFoundException: localParamFile.txt (No such file or directory)
>> at java.io.FileInputStream.open0(Native Method)
>> at java.io.FileInputStream.open(FileInputStream.java:195)
>> at java.io.FileInputStream.<init>(FileInputStream.java:138)
>> at java.io.FileInputStream.<init>(FileInputStream.java:93)
>> at java.io.FileReader.<init>(FileReader.java:58)
>> at repast.simphony.batch.InstanceRunner.run(InstanceRunner.java:188)
>> ... 1 more
>>
>>
>> ‘localParamFile.txt’ is present in the directory from which I submitted my job via:
>>
>> qsub repast.pbs
>>
>>
>> How can I tell the instance runner where to find the local parameters file?
>>
>>
>> Thanks for your help,
>>
>> Mike
>>
>>
>>
>
> ------------------------------------------------------------------------------
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, SlashDot.org! http://sdm.link/slashdot
> _______________________________________________
> Repast-interest mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/repast-interest

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
Repast-interest mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/repast-interest
Loading...