#!/usr/bin/python # # Computes speedup results for my implementation of the midpoint method # # Written by: # -- # John L. Weatherwax 2006-10-16 # # email: wax@alum.mit.edu # # Please send comments and especially bug reports to the # above email address. # #----- import os from math import sqrt from numberTheory import * #maxNumProcs = 2+1; maxNumProcs = 5+1; #numOfProcs = [ 4, 9, 16, 25, 36 ] # <- using a list #numOfProcs = ( 4, 9, 16, 25, 36 ) # <- using a tuple numOfProcs = map( (lambda x:x*x), range( 2, maxNumProcs ) ) print "number of processors to run speed up tests with = " + str(numOfProcs) # Compute the least common multiple of all processors (this is our baseline workload): # lcm_p = numOfProcs[0] for p in numOfProcs[1:]: lcm_p = lcm( lcm_p, p ) #print "lcm thus far = " + str(lcm_p) # lcm_p = the baseline amount of work (number of particles) that must be # performed for the measurement of speedup: print "lcm of total number of processors = " + str(lcm_p) # The multiple of the base work unit to use: # #workMult = range( 2, 5 ) #workMult = range( 10, 15 ) workMult = range( 30, 35 ) for wm in workMult: work = lcm_p*wm # the actual amount of work that will be distributed to each speed up run #p=16 for p in numOfProcs: Ms = int(sqrt(p)); Ns = Ms; NbPP = work/p; # A command submittal looks like: # bsub -a mpichp4 -eo output.txt -n 4 mpirun.lsf "\$HOME/Parallel_MD/Code/midpoint.out 2 2 10 10 print " Parallel version running with (Ms,Ns,NbPP)=(" + str(Ms) + "," + str(Ns) + "," + str(NbPP) + ")..." bsubCmd = "bsub -a mpichp4 -eo par_output.txt -n " + str(p) + " mpirun.lsf /home/gridsan/wax/Parallel_MD/Code/midpoint.out " + str(Ms) + " " + str(Ns) + " " + str(NbPP) + " 10" print bsubCmd #os.system(bsubCmd) print "The serial version will run with a Total Number of Particles (NbPP) = " + str(work) # Run the serial version ... should be done once above ... bsubCmd = "cd SerialVersion; bsub -a mpichp4 -eo ser_output.txt -n 1 mpirun.lsf /home/gridsan/wax/Parallel_MD/Code/SerialVersion/sequential_short_range.out " + str(p) + " 10" print bsubCmd #os.system(bsubCmd) print