Пример #1
0
def fixup_mpiprocs_ompthreads( sel ):
	selstr = repr(pbs.event().job.Resource_List["select"])

	if "mpiprocs" not in sel and "ompthreads" not in sel:
		mpiprocs   = int(sel["ncpus"])
		ompthreads = 1
		pbs.event().job.Resource_List["select"] = pbs.select( selstr + ":mpiprocs=" + str(mpiprocs ) + ":ompthreads=" + str(ompthreads) )
	elif "mpiprocs" not in sel and "ompthreads" in sel:
		ompthreads = int(sel["ompthreads"])
		mpiprocs   = ( sel["ncpus"] / ompthreads )
		if mpiprocs < 1:
			mpiprocs = 1
		pbs.event().job.Resource_List["select"] = pbs.select( selstr + ":mpiprocs=" + str(mpiprocs ) )
		# Add mpiprocs = ncpus / ompthreads
	elif "mpiprocs" in sel and "ompthreads" not in sel:
		mpiprocs   = int( sel["mpiprocs"] )
		ompthreads = int( sel["ncpus"] ) / mpiprocs 
		if ompthreads < 1:
			ompthreads =1
		pbs.event().job.Resource_List["select"] = pbs.select( selstr + ":ompthreads=" + str(ompthreads ) )
	else:
			mpiprocs  = int(sel["mpiprocs"])
			ompthreads= int(sel["ompthreads"])
			if (mpiprocs * ompthreads) != int(sel["ncpus"]):
				pbs.event().reject( "mpiprocs * ompthreads must equal ncpus" )
Пример #2
0
def fixup_mpiprocs_ompthreads(sel):
    exempt = False
    try:
        qn = pbs.event().job.queue.name
        if qn in ["pqmrwarn", "pqmrwarn2"]:
            exempt = True
    except:
        pass

    selstr = repr(pbs.event().job.Resource_List["select"])

    if "mpiprocs" not in sel and "ompthreads" not in sel:
        mpiprocs = int(sel["ncpus"])
        ompthreads = 1
        pbs.event().job.Resource_List["select"] = pbs.select(selstr +
                                                             ":mpiprocs=" +
                                                             str(mpiprocs) +
                                                             ":ompthreads=" +
                                                             str(ompthreads))
    elif "mpiprocs" not in sel and "ompthreads" in sel:
        ompthreads = int(sel["ompthreads"])
        mpiprocs = (sel["ncpus"] / ompthreads)
        if mpiprocs < 1:
            mpiprocs = 1
        pbs.event().job.Resource_List["select"] = pbs.select(selstr +
                                                             ":mpiprocs=" +
                                                             str(mpiprocs))
        # Add mpiprocs = ncpus / ompthreads
    elif "mpiprocs" in sel and "ompthreads" not in sel:
        mpiprocs = int(sel["mpiprocs"])
        ompthreads = int(sel["ncpus"]) / mpiprocs
        if ompthreads < 1:
            ompthreads = 1
        pbs.event().job.Resource_List["select"] = pbs.select(selstr +
                                                             ":ompthreads=" +
                                                             str(ompthreads))
    else:
        mpiprocs = int(sel["mpiprocs"])
        ompthreads = int(sel["ompthreads"])
        if (mpiprocs * ompthreads) != int(sel["ncpus"]):
            if not exempt:
                pbs.event().reject("mpiprocs * ompthreads must equal ncpus")
Пример #3
0
def set_select_key(job, key, value):
    select_expr = get_select_expr(job)
    key_values = select_expr.split(":")

    found = False

    for i in range(1, len(key_values)):
        possible_key, _ = key_values[i].split("=", 1)
        if possible_key == key:
            found = True
            key_values[i] = "%s=%s" % (key, value)

    if not found:
        append_select_expr(job, key, value)
    else:
        job.Resource_List["select"] = pbs.select(":".join(key_values))
Пример #4
0
    def __queuejob_handler(self):
        pbs.logmsg(pbs.LOG_DEBUG, "Docker queuejob handler start")

        newselect = []
        if "select" in self.j.Resource_List.keys():
            for i in str(self.j.Resource_List["select"]).split("+"):
                if re.search("docker=[Tt]{1}rue", i):
                    newselect.append(i)
                    continue
                newselect.append(i + ":docker=true")
        else:
            newselect.append("docker=true")

        pbs.logmsg(pbs.LOG_DEBUG, "Old select: %s" % str(self.j.Resource_List))
        self.j.Resource_List["select"] = pbs.select("+".join(newselect))
        pbs.logmsg(pbs.LOG_DEBUG, "New select: %s" % str(self.j.Resource_List))
Пример #5
0
def append_select_expr(job, key, value):
    select_expr = get_select_expr(job)
    prefix = ":" if select_expr else ""
    job.Resource_List["select"] = pbs.select(select_expr + "%s%s=%s" %
                                             (prefix, key, value))
Пример #6
0
def fixup_icib(queue, sel):
    if "multinode" in queue:
        selstr = repr(pbs.event().job.Resource_List["select"])
        selstr = selstr + ":icib=true"
        pbs.event().job.Resource_List["select"] = pbs.select(selstr)
Пример #7
0
if (mppmem != None):
    select=select + "mem=%s:" %mppmem

# Set any mpplabels
if (mpplabels != None):
    labellist = mpplabels.split(',')
    for label in labellist:
        newlabel="PBScraylabel_" + label
        select=select + "%s=True:" %newlabel 

# The user requested mpp* resources, which means they want to use Cray 
# compute nodes. So we set vntype=cray_compute automatically in the hook.
select=select + "vntype=cray_compute"

j.Resource_List["select"]=pbs.select(select)

# Set place=scatter if mppnppn was requested
if (hooksetnppn == 0):
  j.Resource_List["place"]=pbs.place("scatter")

# If mppnodes is given:
#         Expand the nodelist keeping the given order of nodes.
#         Find the matching vnode name.
#         Build a list of matching vnode names.
def pbs_expandrange(seq):
    # Deal with the ranges first
    range = list(seq.partition('-'))

    lower = int(range[0])
    upper = int(range[2])
Пример #8
0
         mysrv.resources_available['debug_hooks']).split(',')
      ):
   debug_me=True

def dbg_svr_log(string):
   '''quick function to wrap debug logging to the server'''
   # Abort if the hook_debug value is not set
   if(debug_me):
      header = "DEBUG"
      footer = "".join(["%s" % "*" for s in range(80)])
      pbs.logmsg(pbs.LOG_ERROR, "%s\n%s\n%s" % ( header, string, footer ))

# If select is totally empty, set up reasonable defaults
if( myjob.Resource_List["select"] == None ):
   dbg_svr_log('myjob select is: %s' % myjob.Resource_List['select'])
   myjob.Resource_List["select"] = pbs.select(
      "1:ncpus=%d" % mysrv.default_chunk['ncpus'])

### obtain qmgr defaults/maximums
# Default value of networks.  This can be overridden by admin by changing
# value of PBS_ibm_ib_default_networks.
if ( 'PBS_ibm_ib_default_networks' in mysrv.resources_available and 
      mysrv.resources_available['PBS_ibm_ib_default_networks'] >= 0 ):
   default_networks = mysrv.resources_available['PBS_ibm_ib_default_networks']

# Maximum value of instances.  If not specified it will default to the value
# above in the defaults area.
if ( 'PBS_ibm_ib_max_instances' in mysrv.resources_available and 
   mysrv.resources_available['PBS_ibm_ib_max_instances'] != None):
   max_instances = mysrv.resources_available['PBS_ibm_ib_max_instances']

### Obtain user entered values
Пример #9
0
                        ompthreads = ncpus / mpiprocs
                        if not ompthreads:
                            ompthreads = 1
                    except:
                        ompthreads = 1
                    i += ":ompthreads=%s" % ompthreads

                elif not mpiprocs and ompthreads:
                    try:
                        mpiprocs = ncpus / ompthreads
                        if not mpiprocs:
                            mpiprocs = 1
                    except:
                        mpiprocs = 1
                    i += ":mpiprocs=%d" % mpiprocs

                newselect.append(i)

            pbs.logmsg(pbs.LOG_DEBUG, "Old select: %s" % str(j.Resource_List))
            j.Resource_List["select"] = pbs.select("+".join(newselect))
            pbs.logmsg(pbs.LOG_DEBUG, "New select: %s" % str(j.Resource_List))

        if "ncpus" in j.Resource_List.keys(
        ) and not "mpiprocs" in j.Resource_List.keys():
            j.Resource_List["mpiprocs"] = j.Resource_List["ncpus"]

except SystemExit:
    pass
except Exception as err:
    e.reject("job-enqueued hook failed with error: %s" % str(err))