Beispiel #1
0
    def Download(self, dirname, filelist):  # {{{

        if m.ispc():
            #do nothing
            return

        #copy files from cluster to current directory
        directory = '%s/%s/' % (self.executionpath, dirname)
        issmscpin(self.hostname, self.login, self.port, directory, filelist)
Beispiel #2
0
    def BuildKrigingQueueScript(self, modelname, solution, io_gather,
                                isvalgrind, isgprof):  # {{{

        #write queuing script
        if not m.ispc():

            fid = open(modelname + '.queue', 'w')
            fid.write('#!/bin/sh\n')
            if not isvalgrind:
                if self.interactive:
                    fid.write('srun -np %i %s/kriging.exe %s/%s %s ' %
                              (self.np, self.codepath, self.executionpath,
                               modelname, modelname))
                else:
                    fid.write(
                        'srun -np %i %s/kriging.exe %s/%s %s 2> %s.errlog >%s.outlog '
                        % (self.np, self.codepath, self.executionpath,
                           modelname, modelname, modelname, modelname))
            elif isgprof:
                fid.write('\n gprof %s/kriging.exe gmon.out > %s.performance'
                          & (self.codepath, modelname))
            else:
                #Add --gen-suppressions=all to get suppression lines
                fid.write('LD_PRELOAD=%s \\\n' % self.valgrindlib)
                fid.write('mpiexec -np %i %s --leak-check=full --suppressions=%s %s/kriging.exe %s/%s %s 2> %s.errlog >%s.outlog ' % \
                  (self.np,self.valgrind,self.valgrindsup,self.codepath,self.executionpath,modelname,modelname,modelname,modelname))
            if not io_gather:  #concatenate the output files:
                fid.write('\ncat %s.outbin.* > %s.outbin' %
                          (modelname, modelname))
            fid.close()

        else:  # Windows

            fid = open(modelname + '.bat', 'w')
            fid.write('@echo off\n')
            if self.interactive:
                fid.write('"%s/issm.exe" %s "%s/%s" %s ' %
                          (self.codepath, solution, self.executionpath,
                           modelname, modelname))
            else:
                fid.write('"%s/issm.exe" %s "%s/%s" %s 2> %s.errlog >%s.outlog' % \
                  (self.codepath,solution,self.executionpath,modelname,modelname,modelname,modelname))
            fid.close()

        #in interactive mode, create a run file, and errlog and outlog file
        if self.interactive:
            fid = open(modelname + '.errlog', 'w')
            fid.close()
            fid = open(modelname + '.outlog', 'w')
            fid.close()
Beispiel #3
0
    def BuildQueueScript(self, dirname, modelname, solution, io_gather,
                         isvalgrind, isgprof, isdakota,
                         isoceancoupling):  # {{{

        executable = 'issm.exe'
        if isdakota:
            version = IssmConfig('_DAKOTA_VERSION_')[0:2]
            version = float(version)
            if version >= 6:
                executable = 'issm_dakota.exe'
        if isoceancoupling:
            executable = 'issm_ocean.exe'

        #write queuing script
        if not m.ispc():

            fid = open(modelname + '.queue', 'w')
            #fid.write('#!/bin/bash -l\n\n')
            #fid.write('#SBATCH -N 1\n')
            #fid.write('#SBATCH -J my_job\n')
            #fid.write('#SBATCH --export=ALL\n\n')
            fid.write('#!/bin/bash\n')
            fid.write('#SBATCH --nodes=%i\n' % 1)  #self.np)
            fid.write('#SBATCH --ntasks=%i\n' % 1)
            fid.write('#SBATCH --ntasks-per-node=%i\n' % 1)
            fid.write('#SBATCH --cpus-per-task=%i\n' % 1)
            fid.write('#SBATCH --job-name=%s\n' % modelname)
            #fid.write('#SBATCH -t %i\n',cluster.time*60);
            fid.write('#SBATCH -p smp \n')
            fid.write('#SBATCH -o %s.outlog \n' % modelname)
            fid.write('#SBATCH -e %s.errlog \n' % modelname)
            fid.write('#SBATCH --get-user-env \n')
            #fid.write('##  Enlarge the stacksize. OpenMP-codes usually need a large stack. \n')
            #fid.write('ulimit -s unlimited\n')
            #fid.write('## This binds each thread to one core \n')
            #fid.write('export OMP_PROC_BIND=TRUE \n')
            #fid.write('## Number of threads as given by -c / --cpus-per-task \n')
            #fid.write('export OMP_NUM_THREADS=$SLURM_CPUS_PER_TASK \n')
            #fid.write('## This code snippet checks the task and thread distribution on the cores. \n')
            #fid.write('srun /global/AWIsoft/xthi/xthi.intel | sort -n -k4,4 -k6,6 > xthi.log \n')
            pth = self.executionpath + '/' + dirname
            fid.write('srun %s/issm.exe %s %s %s > %s.log\n' %
                      (self.codepath, solution, pth, modelname, modelname))
Beispiel #4
0
    def BuildQueueScript(self, dirname, modelname, solution, io_gather,
                         isvalgrind, isgprof, isdakota,
                         isoceancoupling):  # {{{

        executable = 'issm.exe'
        if isdakota:
            version = IssmConfig('_DAKOTA_VERSION_')[0:2]
            version = float(version)
            if version >= 6:
                executable = 'issm_dakota.exe'
        if isoceancoupling:
            executable = 'issm_ocean.exe'

        #write queuing script
        if not m.ispc():

            fid = open(modelname + '.queue', 'w')
            fid.write('#!/bin/sh\n')
            if not isvalgrind:
                if self.interactive:
                    if IssmConfig('_HAVE_MPI_')[0]:
                        fid.write(
                            'mpiexec -np %i %s/%s %s %s/%s %s ' %
                            (self.np, self.codepath, executable, solution,
                             self.executionpath, dirname, modelname))
                    else:
                        fid.write('%s/%s %s %s/%s %s ' %
                                  (self.codepath, executable, solution,
                                   self.executionpath, dirname, modelname))
                else:
                    if IssmConfig('_HAVE_MPI_')[0]:
                        fid.write(
                            'mpiexec -np %i %s/%s %s %s/%s %s 2> %s.errlog >%s.outlog '
                            % (self.np, self.codepath, executable, solution,
                               self.executionpath, dirname, modelname,
                               modelname, modelname))
                    else:
                        fid.write(
                            '%s/%s %s %s/%s %s 2> %s.errlog >%s.outlog ' %
                            (self.codepath, executable, solution,
                             self.executionpath, dirname, modelname, modelname,
                             modelname))
            elif isgprof:
                fid.write('\n gprof %s/%s gmon.out > %s.performance' %
                          (self.codepath, executable, modelname))
            else:
                #Add --gen-suppressions=all to get suppression lines
                fid.write('LD_PRELOAD=%s \\\n' % self.valgrindlib)
                if IssmConfig('_HAVE_MPI_')[0]:
                    fid.write('mpiexec -np %i %s --leak-check=full --suppressions=%s %s/%s %s %s/%s %s 2> %s.errlog >%s.outlog ' % \
                      (self.np,self.valgrind,self.valgrindsup,self.codepath,executable,solution,self.executionpath,dirname,modelname,modelname,modelname))
                else:
                    fid.write('%s --leak-check=full --suppressions=%s %s/%s %s %s/%s %s 2> %s.errlog >%s.outlog ' % \
                      (self.valgrind,self.valgrindsup,self.codepath,executable,solution,self.executionpath,dirname,modelname,modelname,modelname))

            if not io_gather:  #concatenate the output files:
                fid.write('\ncat %s.outbin.* > %s.outbin' %
                          (modelname, modelname))
            fid.close()

        else:  # Windows

            fid = open(modelname + '.bat', 'w')
            fid.write('@echo off\n')
            if self.interactive:
                fid.write('"%s/%s" %s "%s/%s" %s ' %
                          (self.codepath, executable, solution,
                           self.executionpath, dirname, modelname))
            else:
                fid.write('"%s/%s" %s "%s/%s" %s 2> %s.errlog >%s.outlog' % \
                 (self.codepath,executable,solution,self.executionpath,dirname,modelname,modelname,modelname))
            fid.close()

        #in interactive mode, create a run file, and errlog and outlog file
        if self.interactive:
            fid = open(modelname + '.errlog', 'w')
            fid.close()
            fid = open(modelname + '.outlog', 'w')
            fid.close()