Author: bugman Date: Mon Jun 23 14:14:15 2014 New Revision: 24245 URL: http://svn.gna.org/viewcvs/relax?rev=24245&view=rev Log: Expanded the dispersion profiling master script to handle any two relax versions. To compare two relax versions, for example 3.2.2 to 3.2.1, either the path1 and path2 variables or two command line arguments can be supplied. The first path should be for the newest version. This will allow for comparing the speed differences between multiple relax versions in the future. Modified: branches/disp_spin_speed/test_suite/shared_data/dispersion/profiling/disp_profile_all.py Modified: branches/disp_spin_speed/test_suite/shared_data/dispersion/profiling/disp_profile_all.py URL: http://svn.gna.org/viewcvs/relax/branches/disp_spin_speed/test_suite/shared_data/dispersion/profiling/disp_profile_all.py?rev=24245&r1=24244&r2=24245&view=diff ============================================================================== --- branches/disp_spin_speed/test_suite/shared_data/dispersion/profiling/disp_profile_all.py (original) +++ branches/disp_spin_speed/test_suite/shared_data/dispersion/profiling/disp_profile_all.py Mon Jun 23 14:14:15 2014 @@ -21,7 +21,20 @@ # # ############################################################################### -# Python script for obtaining profiling statistics for multiple models between the current and an alternative version of relax. +"""Python script for obtaining profiling statistics for multiple models between the current and an alternative version of relax. + +There are 3 ways to use this script. The first is to modify the path1 and path2 variables in this script, where path1 is the newer relax version, and then run it as: + +$ ./disp_profile_all.py + +The second is to run this by supplying the path of the alternate relax version: + +$ ./disp_profile_all.py /data/relax/tags/3.2.1 + +The final way is to supply the path for both relax versions, where the first argument is the newer version of relax: + +$ ./disp_profile_all.py /data/relax/tags/3.2.2 /data/relax/tags/3.2.1 +""" # Python module imports. from numpy import average, arange, array, asarray, count_nonzero, float64, std, zeros @@ -64,11 +77,14 @@ ['NS R1rho 2-site', 'profiling_ns_r1rho_2site.py', 10, 10], ] -# Path to relax 3.2.2, or any other version. -if len(sys.argv) == 1: - alt_path = '/data/relax/tags/3.2.2' -else: - alt_path = sys.argv[1] +# Paths to the two relax versions. +path1 = '.' +path2 = '/data/relax/tags/3.2.2' +if len(sys.argv) == 3: + path1 = sys.argv[1] + path2 = sys.argv[2] +elif len(sys.argv) == 2: + path2 = sys.argv[1] # The Python executable name. python = 'python' @@ -83,8 +99,15 @@ for i in range(len(models)): # Alias. model, script, iter, scaling_factor = models[i] - print("Copying: model=%s script=%s iterations=%s scale=%s"%(model, script, iter, scaling_factor)) - copyfile(script, alt_path+sep+script) + + # Copy to the first path. + if path1 != '.': + print("Copying to '%s': model=%s script=%s iterations=%s scale=%s" % (path1, model, script, iter, scaling_factor)) + copyfile(script, path1+sep+script) + + # Copy to the second path. + print("Copying to '%s': model=%s script=%s iterations=%s scale=%s" % (path2, model, script, iter, scaling_factor)) + copyfile(script, path2+sep+script) # Initialise structures for the timing statistics. timings_new = {} @@ -105,10 +128,12 @@ for i in range(len(models)): model, script, iter, scaling_factor = models[i] # The commands to run. - cmds = [ - "%s %s" % (python, script), - "%s %s %s" % (python, alt_path+sep+script, alt_path), - ] + cmds = [] + if path1 == '.': + cmds.append("%s %s" % (python, script)) + else: + cmds.append("%s %s %s" % (python, path1+sep+script, path1)) + cmds.append("%s %s %s" % (python, path2+sep+script, path2)) # Loop over the commands. for cmd_index in range(2):