Commit 7ec28b83 authored by Ali Safari's avatar Ali Safari
Browse files

preparing for cluster

parent 300df016
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -48,6 +48,7 @@ void FileReader::setParameter(const std::string &key, int in)

bool FileReader::readFile(const std::string &name)
{
  std::cout<<name<<std::endl;
   ifstream infile(name.c_str());
   if (!infile) {
       std::cout<<"opening file failed"<<endl;
+20 −1
Original line number Diff line number Diff line
@@ -55,8 +55,27 @@ int main(int argc, char **argv)
    conf.registerIntParameter("info");
    conf.registerRealParameter("epsout");

   string inputfilepath = "FileReaderTestInput.txt";
   std::cout<<argv[0]<<argv[1]<<std::endl;
    // parseparameters
    if (argc < 2) {
        // Tell the user how to run the program
        std::cerr << "Usage: you can give an input file as parameter " << std::endl;

        /* "Usage messages" are a conventional way of telling the user
         * how to run a program if they enter the command incorrectly.
         */


    }
    else {
    inputfilepath = argv[1];
  }



    //reading file
    conf.readFile("FileReaderTestInput.txt");
    conf.readFile( inputfilepath);
    conf.printParameters();

    double prob = conf.getRealParameter("prob");

start.sh

0 → 100755
+47 −0
Original line number Diff line number Diff line
#!/bin/bash -l
#
# allocate 16 nodes (64 CPUs) for 6 hours
#PBS -l nodes=4:ppn=40,walltime=16:00:00
#
# job name 
#PBS -N TestAval
#
# stdout and stderr files
#PBS -o aval.out -e aval.err
#
# first non-empty non-comment line ends PBS options

# jobs always start in $HOME -
# change to a temporary job directory on $FASTTMP

# copy input file from location where job was submitted
EXEC="$HOME/Projects/hmn-percolation/percolation"

INPUTFILE='FileReaderTestInput.txt'
SIMPATH="$HOME/Projects/hmn-percolation/Results/alpha10/20/p045"

# run
HOSTN=$(hostname)
if [ ! "${HOSTN#ww8}" == "$(hostname)" ]; then

  module load intel
  cd $SIMPATH
  echo  "Hi:   $SIMPATH/$INPUTFILE"
  $EXEC "$SIMPATH/$INPUTFILE"
else
  mkdir ${HOME}/$PBS_JOBID
  cd ${HOME}/$PBS_JOBID
  module load intel64
  module load intelmpi
  module load mkl
  mpirun_rrze -npernode 20 $EXEC -in $SIMPATH/$INPUTFILE
  cp processed_data.dat $SIMPATH

  cd
  # get rid of the temporary job dir
  rm -rf ${HOME}/$PBS_JOBID
fi
# save output on parallel file system
#mkdir -p ${HOME}/codes/SIMSRC/$PBS_JOBID