File: gpaw-qsub.dtu-databar

package info (click to toggle)
gpaw 21.1.0-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 14,492 kB
  • sloc: python: 121,997; ansic: 14,138; sh: 1,125; csh: 139; makefile: 43
file content (47 lines) | stat: -rwxr-xr-x 1,582 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#!/usr/bin/env python

# This version of gpaw-qsub works in the DTU databar as per August 2012.

from optparse import OptionParser
import os
import sys

queue='hpc'   # Other option is app
maxcores = 8

p = OptionParser()
p.disable_interspersed_args()
p.add_option('-p', '--procs', type=int, default=1,
             help='number of processes')
p.add_option('-t', '--time', type=int, default=72,
             help='max running time in hours')
opts, args = p.parse_args()

# How many nodes?
if opts.procs <= maxcores:
    # Single node
    nodeclause = "nodes=1:ppn="+str(opts.procs)
    print "Job will be submitted to a single nodes with %i cores." % (opts.procs,)
elif opts.procs % maxcores == 0:
    # Use an integer number of nodes
    nodeclause = "nodes=%i:ppn=%i" % (opts.procs // maxcores, maxcores)
    print "Job will be submitted to %i nodes each with %i cores." % (opts.procs // maxcores, maxcores)
else:
    whole = opts.procs // maxcores
    remainder = opts.procs % maxcores
    nodeclause = "nodes=%i:ppn=%i+1:ppn=%i" % (whole, maxcores, remainder)
    print "Job will be submitted to %i nodes with %i cores, and one node with %i cores.  THIS IS NOT OPTIMAL." % (whole, maxcores, remainder)

print "Node clause is:", nodeclause

jobdir = os.getcwd()
#jobname = os.path.join(os.getcwd(), args[0])
jobname = args[0]

qsub = '''#!/bin/bash
cd %s
mpirun gpaw-python %s %s''' % (jobdir, jobname, ' '.join(args[1:]))
pipe = os.popen('qsub -N %s -q %s -l %s -l walltime=%i:00:00' % (jobname, queue, nodeclause, opts.time),
                'w')
pipe.write(qsub)
pipe.close()