예제 #1
0
def GetProdU():
    pdq.Init("")

    pdq.streams = pdq.CreateClosed("Production", pdq.TERM, 20.0, 20.0)
    pdq.nodes = pdq.CreateNode("CPU", pdq.CEN, pdq.FCFS)
    pdq.nodes = pdq.CreateNode("DK1", pdq.CEN, pdq.FCFS)
    pdq.nodes = pdq.CreateNode("DK2", pdq.CEN, pdq.FCFS)

    pdq.SetDemand("CPU", "Production", 0.30)
    pdq.SetDemand("DK1", "Production", 0.08)
    pdq.SetDemand("DK2", "Production", 0.10)

    pdq.Solve(pdq.APPROX)

    return (pdq.GetUtilization("CPU", "Production", pdq.TERM))
예제 #2
0
파일: fesc.py 프로젝트: weddingjuma/PDQ
def mem_model(n, m):
    x = 0.0

    for i in range(1, n + 2):
        if (i <= m):
            pdq.Init("")

            pdq.nodes = pdq.CreateNode("CPU", pdq.CEN, pdq.FCFS)
            pdq.nodes = pdq.CreateNode("DK1", pdq.CEN, pdq.FCFS)
            pdq.nodes = pdq.CreateNode("DK2", pdq.CEN, pdq.FCFS)

            pdq.streams = pdq.CreateClosed("work", pdq.TERM, i, 0.0)

            pdq.SetDemand("CPU", "work", 3.0)
            pdq.SetDemand("DK1", "work", 4.0)
            pdq.SetDemand("DK2", "work", 2.0)

            pdq.Solve(pdq.EXACT)

            x = pdq.GetThruput(pdq.TERM, "work")

            sm_x.append(x)
        else:
            sm_x.append(x)  # last computed value
예제 #3
0
def multiserver(m, stime):
    work = "reqs"
    node = "bus"

    x = 0.0

    for i in range(1, CPUS + 1):
        if (i <= m):
            pdq.Init("multibus")

            streams = pdq.CreateClosed(work, pdq.TERM, i, 0.0)
            nodes = pdq.CreateNode(node, pdq.CEN, pdq.ISRV)

            pdq.SetDemand(node, work, stime)
            pdq.Solve(pdq.EXACT)

            x = pdq.GetThruput(pdq.TERM, work)

            sm_x[i] = x
        else:
            sm_x[i] = x
예제 #4
0
파일: orca.py 프로젝트: weddingjuma/PDQ
#
# Created by NJG on Thu, May 31, 2007
#
# Blair Zajac, author of Orca states:
# "If long term trends indicate increasing figures, more or faster CPUs
# will eventually be necessary unless load can be displaced. For ideal
# utilization of your CPU, the maximum value here should be equal to the
# number of CPUs in the box."
#
# Zajac's comment implies any waiting line is bad.
# PDQ steady-state model for HPC/batch workload with 
# stretch factor == 1 (no waiting line).
# Very low arrival rate over 10 hour period.

import pdq

processors  = 4
arrivalRate = 0.099 # jobs per hour (very low arrivals)
crunchTime  = 10.0  # hours (very long service time)

pdq.Init("ORCA LA Model")
s = pdq.CreateOpen("Crunch", arrivalRate)
n = pdq.CreateNode("HPCnode", int(processors), pdq.MSQ)
pdq.SetDemand("HPCnode", "Crunch", crunchTime)
pdq.SetWUnit("Jobs")
pdq.SetTUnit("Hour")
pdq.Solve(pdq.CANON)
pdq.Report()

예제 #5
0
파일: dbc.py 프로젝트: pjpuglia/pdq-qnm-pkg
for k in range(Namp):
    name = "AMP%d" % k
    nodes = pdq.CreateNode(name, pdq.CEN, pdq.FCFS)

for k in range(Ndsu):
    name = "DSU%d" % k
    nodes = pdq.CreateNode(name, pdq.CEN, pdq.FCFS)

streams = pdq.CreateClosed("query", pdq.TERM, importrs, think)

# pdq.SetGraph("query", 100) - unsupported call

for k in range(Nifp):
    name = "IFP%d" % k
    pdq.SetDemand(name, "query", Sifp / Nifp)

for k in range(Namp):
    name = "AMP%d" % k
    pdq.SetDemand(name, "query", Samp / Namp)

for k in range(Ndsu):
    name = "DSU%d" % k
    pdq.SetDemand(name, "query", Sdsu / Ndsu)

# 300 nodes takes about a minute to solve on a PowerMac

print("Solving ... ")

pdq.Solve(pdq.EXACT)
예제 #6
0
#  copies of the Software, and permit persons to whom the Software is         #
#  furnished to do so, under the terms of the COPYING file.                   #
#                                                                             #
#  This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY  #
#  KIND, either express or implied.                                           #
###############################################################################

#
# Created by NJG on Wed, Apr 18, 2007
#
#
# $Id: orca.py,v 1.2 2009/03/26 02:55:32 pfeller Exp $

import pdq

# Measured parameters
servers = 4
arivrate = 0.099  # per hr
servtime = 10.0  # hrs

pdq.Init("ORCA Batch")
nstreams = pdq.CreateOpen("Crunch", arivrate)
pdq.SetWUnit("Jobs")
pdq.SetTUnit("Hours")

nnodes = pdq.CreateNode("HPC", int(servers), pdq.MSQ)

pdq.SetDemand("HPC", "Crunch", servtime)
pdq.Solve(pdq.CANON)
pdq.Report()
예제 #7
0
파일: abcache.py 프로젝트: weddingjuma/PDQ
    nodes = pdq.CreateNode(cname, pdq.CEN, pdq.FCFS)

#----- Create CPU nodes, workloads, and demands ----------------------

(no, Wrwht) = intwt(Nrwht)

print "no %d %f  Nrwht %d, Wrwht %d" % (no, no, Nrwht, Wrwht)

for i in range(no):
    wname = "%s%d" % (RWHT, i)

    streams = pdq.CreateClosed(wname, pdq.TERM, Nrwht, Zrwht)

    cname = "%s%d" % (L2C, i)

    pdq.SetDemand(cname, wname, 1.0)
    pdq.SetDemand(BUS, wname, 0.0)  # no bus activity

    print "i %2d  cname %10s  nodes %2d  streams %d" % (i, cname, nodes,
                                                        streams)

(no, Wrdop) = intwt(Nrdop)

print "no %d  Nrdop %d, Wrdop %d" % (no, Nrdop, Wrdop)

for i in range(no):
    wname = "%s%d" % (RDOP, i)

    streams = pdq.CreateClosed(wname, pdq.TERM, Nrdop, Zrdop)

    cname = "%s%d" % (L2C, i)
예제 #8
0
pdq.SetComment("A simple M/M/1 queue")

#---- Define the workload and circuit type ---------------------------

pdq.streams = pdq.CreateOpen("work", arrivRate)

pdq.SetWUnit("Customers")
pdq.SetTUnit("Seconds")

#---- Define the queueing center -------------------------------------

pdq.nodes = pdq.CreateNode("server", pdq.CEN, pdq.FCFS)

#---- Define service demand due to workload on the queueing center ---

pdq.SetDemand("server", "work", service_time)

#---- Solve the model ------------------------------------------------
#  Must use the CANONical method for an open circuit

pdq.Solve(pdq.CANON)

#---- Generate a report ----------------------------------------------

pdq.Report()

#---------------------------------------------------------------------

comment = pdq.GetComment()

print 'pdq.GetComment -> \"%s\"' % comment
예제 #9
0
파일: open1msq.py 프로젝트: weddingjuma/PDQ
#  $Id: open1msq.py,v 1.2 2009/03/26 02:55:32 pfeller Exp $
#
#---------------------------------------------------------------------

import pdq

arrivalRate = 0.75
serviceTime = 1.0

pdq.Init("Open1 MSQ Test")
pdq.SetComment("Cf. M/M/1/FCFS against MSQ with m=1 in PyDQ.")

pdq.streams = pdq.CreateOpen("work", arrivalRate)

pdq.SetWUnit("Customers")
pdq.SetTUnit("Seconds")

pdq.nodes = pdq.CreateNode("MM1", pdq.CEN, pdq.FCFS)
pdq.nodes = pdq.CreateNode("MMm", 1, pdq.MSQ)

pdq.SetDemand("MM1", "work", serviceTime)
pdq.SetDemand("MMm", "work", serviceTime)

pdq.Solve(pdq.CANON)

print "Using: %s" % pdq.version

pdq.Report()

#---------------------------------------------------------------------
예제 #10
0
파일: spamcan1.py 프로젝트: weddingjuma/PDQ
#  KIND, either express or implied.                                           #
###############################################################################

#
# Created by NJG on Wed, Apr 18, 2007
#
# Queueing model of an email-spam analyzer system comprising a
# battery of SMP servers essentially running in batch mode.
# Each node was a 4-way SMP server.
# The performance metric of interest was the mean queue length.
#
# This simple M/M/4 model gave results that were in surprisingly
# good agreement with monitored queue lengths.
#
# $Id: spamcan1.py,v 1.2 2009/03/31 00:48:34 pfeller Exp $

import pdq

# Measured performance parameters
cpusPerServer = 4
emailThruput = 2376  # emails per hour
scannerTime = 6.0  # seconds per email

pdq.Init("Spam Farm Model")
# Timebase is SECONDS ...
nstreams = pdq.CreateOpen("Email", float(emailThruput) / 3600)
nnodes = pdq.CreateNode("spamCan", int(cpusPerServer), pdq.MSQ)
pdq.SetDemand("spamCan", "Email", scannerTime)
pdq.Solve(pdq.CANON)
pdq.Report()
예제 #11
0
파일: spamcan.py 프로젝트: weddingjuma/PDQ
#  This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY  #
#  KIND, either express or implied.                                           #
###############################################################################

#
# Created by NJG on Wed, Apr 18, 2007
#
# Queueing model of an email-spam analyzer system comprising a
# battery of SMP servers essentially running in batch mode.
# Each node was a 4-way SMP server.
# The performance metric of interest was the mean queue length.
#
# This simple M/M/4 model gave results that were in surprisingly
# good agreement with monitored queue lengths.
#
# $Id: spamcan.py,v 1.2 2009/03/26 02:55:32 pfeller Exp $

import pdq

# Measured parameters
servers = 4
arivrate = 0.66  # per min
servtime = 6.0  # seconds

pdq.Init("SPAM Analyzer")
nstreams = pdq.CreateOpen("Email", arivrate)
nnodes = pdq.CreateNode("spamCan", int(servers), pdq.MSQ)
pdq.SetDemand("spamCan", "Email", servtime)
pdq.Solve(pdq.CANON)
pdq.Report()
예제 #12
0
파일: mc-test.py 프로젝트: weddingjuma/PDQ
#---- Define the workload and circuit type ---------------------------

pdq.streams = pdq.CreateClosed("term1", pdq.TERM, 5.0, 20.0)
pdq.streams = pdq.CreateClosed("term2", pdq.TERM, 15.0, 30.0)
pdq.streams = pdq.CreateClosed("batch", pdq.BATCH, 5.0, 0.0)

#---- Define the queueing center -------------------------------------

pdq.nodes = pdq.CreateNode("node1", pdq.CEN, pdq.FCFS)
pdq.nodes = pdq.CreateNode("node2", pdq.CEN, pdq.FCFS)
pdq.nodes = pdq.CreateNode("node3", pdq.CEN, pdq.FCFS)

#---- Define service demand ------------------------------------------

pdq.SetDemand("node1", "term1", 0.50)
pdq.SetDemand("node1", "term2", 0.04)
pdq.SetDemand("node1", "batch", 0.06)

pdq.SetDemand("node2", "term1", 0.40)
pdq.SetDemand("node2", "term2", 0.20)
pdq.SetDemand("node2", "batch", 0.30)

pdq.SetDemand("node3", "term1", 1.20)
pdq.SetDemand("node3", "term2", 0.05)
pdq.SetDemand("node3", "batch", 0.06)

#---- Solve it -------------------------------------------------------

pdq.Solve(pdq.EXACT)
예제 #13
0
print "**** %s Solution ****:\n" % technique
print "  N      R (w1)    R (w2)"

for pop in range(1, 10):
   pdq.Init("Test_Exact_calc")

   #---- Define the workload and circuit type ----------------------------------

   pdq.streams = pdq.CreateClosed("w1", pdq.TERM, 1.0 * pop, think)
   pdq.streams = pdq.CreateClosed("w2", pdq.TERM, 1.0 * pop, think)

   #---- Define the queueing center --------------------------------------------

   pdq.nodes = pdq.CreateNode("node", pdq.CEN, pdq.FCFS)

   #---- service demand --------------------------------------------------------

   pdq.SetDemand("node", "w1", 1.0)
   pdq.SetDemand("node", "w2", 0.5)

   #---- Solve the model -------------------------------------------------------

   pdq.Solve(tech)

   print "%3.0f    %8.4f  %8.4f" % (pop,
    pdq.GetResponse(pdq.TERM, "w1"),
    pdq.GetResponse(pdq.TERM, "w2"));


예제 #14
0
#!/usr/bin/env python
###############################################################################
#  Copyright (C) 1994 - 2009, Performance Dynamics Company                    #
#                                                                             #
#  This software is licensed as described in the file COPYING, which          #
#  you should have received as part of this distribution. The terms           #
#  are also available at http://www.perfdynamics.com/Tools/copyright.html.    #
#                                                                             #
#  You may opt to use, copy, modify, merge, publish, distribute and/or sell   #
#  copies of the Software, and permit persons to whom the Software is         #
#  furnished to do so, under the terms of the COPYING file.                   #
#                                                                             #
#  This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY  #
#  KIND, either express or implied.                                           #
###############################################################################

#
# M/M/1 in PyDQ

import pdq

pdq.Init("Python Test Script")
pdq.nodes = pdq.CreateNode("Deadhorse", pdq.CEN, pdq.FCFS)
pdq.streams = pdq.CreateOpen("Floggit", 0.75)
pdq.SetWUnit("Cust")
pdq.SetTUnit("Min")
pdq.SetDemand("Deadhorse", "Floggit", 1.0)
pdq.Solve(pdq.CANON)
pdq.Report()
예제 #15
0
파일: passport.py 프로젝트: weddingjuma/PDQ
p12 = 0.30
p13 = 0.70
p23 = 0.20
p32 = 0.10

w3 = (p13 + p23 * p12) / (1 - p23 * p32)
w2 = p12 + p32 * w3

#---- Initialize and solve the model ---------------------------------

pdq.Init("Passport Office")

pdq.streams = pdq.CreateOpen("Applicant", 0.00427)

pdq.nodes = pdq.CreateNode("Window1", pdq.CEN, pdq.FCFS)
pdq.nodes = pdq.CreateNode("Window2", pdq.CEN, pdq.FCFS)
pdq.nodes = pdq.CreateNode("Window3", pdq.CEN, pdq.FCFS)
pdq.nodes = pdq.CreateNode("Window4", pdq.CEN, pdq.FCFS)

pdq.SetDemand("Window1", "Applicant", 20.0)
pdq.SetDemand("Window2", "Applicant", 600.0 * w2)
pdq.SetDemand("Window3", "Applicant", 300.0 * w3)
pdq.SetDemand("Window4", "Applicant", 60.0)

pdq.Solve(pdq.CANON)

pdq.Report()

#---------------------------------------------------------------------
예제 #16
0
파일: baseline.py 프로젝트: weddingjuma/PDQ
txCD = "CatDsply"
txRQ = "RemQuote"
txSU = "StatusUp"

#----- Define an OPEN circuit aggregate workload -------------------------------

no_streams = pdq.CreateOpen(txCD, USERS * 4.0 / 60.0)
no_streams = pdq.CreateOpen(txRQ, USERS * 8.0 / 60.0)
no_streams = pdq.CreateOpen(txSU, USERS * 1.0 / 60.0)

#-------------------------------------------------------------------------------
#  Define the service demands on each physical resource ...
#  CD request + reply chain  from workflow diagram
#-------------------------------------------------------------------------------

pdq.SetDemand("PC", txCD, demand[(CD_Req, PC)] + (5 * demand[(CD_Rpy, PC)]))
pdq.SetDemand("FS", txCD, demand[(Req_CD, FS)] + (5 * demand[(CD_Msg, FS)]))

for i in range(FS_DISKS):
    pdq.SetDemand(
        FDarray[i].label, txCD, demand[(Req_CD, FDarray[i].id)] +
        (5 * demand[(CD_Msg, FDarray[i].id)]))

pdq.SetDemand("GW", txCD, demand[(GT_Snd, GW)] + (5 * demand[(GT_Rcv, GW)]))
pdq.SetDemand("MF", txCD, demand[(MF_CD, MF)])

for i in range(MF_DISKS):
    pdq.SetDemand(MDarray[i].label, txCD, demand[(MF_CD, MDarray[i].id)])

#-------------------------------------------------------------------------------
#  NOTE: Synchronous process execution caimports data for the CD
예제 #17
0
from math import *

arrivalRate = 40.0 / 60  # cust per min
browseTime = 45.0  # mins
buyingTime = 4.0  # mins
cashiers = 3

pdq.Init("Big Book Store Model")

# Create an open circuit Jackson network
streams = pdq.CreateOpen("Customers", arrivalRate)

pdq.SetWUnit("Cust")
pdq.SetTUnit("Min")  # timebase for PDQ report

#*** New MSQ flag tells PDQ the following are multiserver nodes ***

# M/M/inf queue defined as 100 times the number of Erlangs = lambda * S
nodes = pdq.CreateNode("Browsing",
                       int(ceil(arrivalRate * browseTime)) * 100, pdq.MSQ)

# M/M/m where m is the number of cashiers
nodes = pdq.CreateNode("Checkout", cashiers, pdq.MSQ)

# Set service times ...
pdq.SetDemand("Browsing", "Customers", browseTime)
pdq.SetDemand("Checkout", "Customers", buyingTime)

pdq.Solve(pdq.CANON)
pdq.Report()
예제 #18
0
파일: closed.py 프로젝트: weddingjuma/PDQ
think    = 0.1


#---- Initialize the model -------------------------------------------
# Give model a name and initialize internal PDQ variables

pdq.Init("Closed Queue")

#print "**** %s ****:" % (solve_as == pdq.EXACT ? "EXACT" : "APPROX")


#--- Define the workload and circuit type ----------------------------

pdq.streams = pdq.CreateClosed("w1", pdq.TERM, 1.0 * pop, think)


#--- Define the queueing center --------------------------------------

pdq.nodes   = pdq.CreateNode("node", pdq.CEN, pdq.FCFS)


#---- Define service demand ------------------------------------------

pdq.SetDemand("node", "w1", 0.10)

pdq.Solve(pdq.APPROX)

pdq.Report()

#---------------------------------------------------------------------
예제 #19
0
#  $Id$
#
#---------------------------------------------------------------------

import pdq

#---------------------------------------------------------------------
# Based on simple_series_circuit.c
#
# An open queueing circuit with 3 centers.

arrivals_per_second = 0.10

pdq.Init("Simple Series Circuit")

pdq.streams = pdq.CreateOpen("Work", arrivals_per_second)

pdq.nodes = pdq.CreateNode("Center1", pdq.CEN, pdq.FCFS)
pdq.nodes = pdq.CreateNode("Center2", pdq.CEN, pdq.FCFS)
pdq.nodes = pdq.CreateNode("Center3", pdq.CEN, pdq.FCFS)

pdq.SetDemand("Center1", "Work", 1.0)
pdq.SetDemand("Center2", "Work", 2.0)
pdq.SetDemand("Center3", "Work", 3.0)

pdq.Solve(pdq.CANON)

pdq.Report()

#---------------------------------------------------------------------
예제 #20
0
pdq.streams = pdq.CreateClosed("Production", pdq.TERM, 20.0, 20.0)
pdq.streams = pdq.CreateClosed("Developmnt", pdq.TERM, 15.0, 15.0)

#---- Nodes ----------------------------------------------------------

pdq.nodes = pdq.CreateNode("CPU", pdq.CEN, pdq.FCFS)

if (PRIORITY):
    pdq.nodes = pdq.CreateNode("shadCPU", pdq.CEN, pdq.FCFS)

pdq.nodes = pdq.CreateNode("DK1", pdq.CEN, pdq.FCFS)
pdq.nodes = pdq.CreateNode("DK2", pdq.CEN, pdq.FCFS)

#---- Service demands at each node -----------------------------------

pdq.SetDemand("CPU", "Production", 0.30)

if (PRIORITY):
    pdq.SetDemand("shadCPU", "Developmnt", 1.00 / (1 - Ucpu_prod))
else:
    pdq.SetDemand("CPU", "Developmnt", 1.00)

pdq.SetDemand("DK1", "Production", 0.08)
pdq.SetDemand("DK1", "Developmnt", 0.05)

pdq.SetDemand("DK2", "Production", 0.10)
pdq.SetDemand("DK2", "Developmnt", 0.06)

#---- Import APPROX rather than EXACT to match the numbers in the book -

pdq.Solve(pdq.APPROX)
예제 #21
0
""" Use the service demands derived from the solved traffic equations 
    to parameterize and solve PyDQ queueing model of the passport office
"""

# Initialize and solve the model 
pdq.Init("Passport Office");

numStreams = pdq.CreateOpen("Applicant", L[0]);

numNodes = pdq.CreateNode("Window0", pdq.CEN, pdq.FCFS);
numNodes = pdq.CreateNode("Window1", pdq.CEN, pdq.FCFS);
numNodes = pdq.CreateNode("Window2", pdq.CEN, pdq.FCFS);
numNodes = pdq.CreateNode("Window3", pdq.CEN, pdq.FCFS);

pdq.SetDemand("Window0", "Applicant", D[0]);
pdq.SetDemand("Window1", "Applicant", D[1]);
pdq.SetDemand("Window2", "Applicant", D[2]);
pdq.SetDemand("Window3", "Applicant", D[3]);

pdq.Solve(pdq.CANON);
pdq.Report();

# Utilizations: L_0 * D_k
r = array([L[0]*D[0], L[0]*D[1], L[0]*D[2], L[0]*D[3]])

# Queue lengths
print "U0: %6.2f\tQ0: %6.2f" % (r[0]*100, r[0] / (1 - r[0]))
print "U1: %6.2f\tQ1: %6.2f" % (r[1]*100, r[1] / (1 - r[1]))
print "U2: %6.2f\tQ2: %6.2f" % (r[2]*100, r[2] / (1 - r[2]))
print "U3: %6.2f\tQ3: %6.2f" % (r[3]*100, r[3] / (1 - r[3]))
예제 #22
0
파일: closed1.py 프로젝트: weddingjuma/PDQ
#pop   = 200.0
pop = 100.0
think = 300.0
servt = 0.63

##### Initialize the model giving it a name ##########################

pdq.Init("Time Share Computer")
pdq.SetComment("This is just a simple M/M/1 queue.")

##### Define the workload and circuit type ###########################

pdq.streams = pdq.CreateClosed("compile", pdq.TERM, pop, think)

##### Define the queueing center #####################################

pdq.nodes = pdq.CreateNode("CPU", pdq.CEN, pdq.FCFS)

##### Define service demand ##########################################

pdq.SetDemand("CPU", "compile", servt)

##### Solve the model ################################################

pdq.Solve(pdq.EXACT)

pdq.Report()

#---------------------------------------------------------------------