Author: bugman Date: Wed Mar 7 11:54:57 2012 New Revision: 15451 URL: http://svn.gna.org/viewcvs/relax?rev=15451&view=rev Log: Shifted the Sobol' point subdivision from the target function to the __init__() method. This should speed up the target function. The data transfer to the slave also occurs at the __init__() method level, reducing data transfers per function call. Modified: branches/frame_order_testing/maths_fns/frame_order.py branches/frame_order_testing/maths_fns/frame_order_matrix_ops.py Modified: branches/frame_order_testing/maths_fns/frame_order.py URL: http://svn.gna.org/viewcvs/relax/branches/frame_order_testing/maths_fns/frame_order.py?rev=15451&r1=15450&r2=15451&view=diff ============================================================================== --- branches/frame_order_testing/maths_fns/frame_order.py (original) +++ branches/frame_order_testing/maths_fns/frame_order.py Wed Mar 7 11:54:57 2012 @@ -314,10 +314,15 @@ self.create_sobol_data(n=self.num_int_pts, dims=['sigma']) self.func = self.func_free_rotor_qrint + # Subdivide the Sobol' data points for the slave processors. + blocks = [] + for block in self.subdivide(self.sobol_angles, self.processor.processor_size()): + blocks.append(block) + # Set up the slave processors. self.slaves = [] for i in range(self.processor.processor_size()): - self.slaves.append(Slave_command_pcs_pseudo_ellipse_qrint()) + self.slaves.append(Slave_command_pcs_pseudo_ellipse_qrint(blocks[i])) # The target function aliases (Scipy numerical integration). else: @@ -1173,19 +1178,15 @@ data.pcs_theta = self.pcs_theta # Subdivide the points. - i = 0 - for block in self.subdivide(self.sobol_angles, self.processor.processor_size()): + for i in range(self.processor.processor_size()): # Initialise the slave command and memo. - self.slaves[i].load_data(points=block, theta_x=cone_theta_x, theta_y=cone_theta_x, sigma_max=cone_sigma_max, full_in_ref_frame=self.full_in_ref_frame, r_pivot_atom=self.r_pivot_atom, r_pivot_atom_rev=self.r_pivot_atom_rev, r_ln_pivot=self.r_ln_pivot, A=self.A_3D, R_eigen=self.R_eigen, RT_eigen=RT_eigen, Ri_prime=self.Ri_prime, pcs_theta=deepcopy(self.pcs_theta), pcs_theta_err=self.pcs_theta_err, missing_pcs=self.missing_pcs) + self.slaves[i].load_data(theta_x=cone_theta_x, theta_y=cone_theta_x, sigma_max=cone_sigma_max, full_in_ref_frame=self.full_in_ref_frame, r_pivot_atom=self.r_pivot_atom, r_pivot_atom_rev=self.r_pivot_atom_rev, r_ln_pivot=self.r_ln_pivot, A=self.A_3D, R_eigen=self.R_eigen, RT_eigen=RT_eigen, Ri_prime=self.Ri_prime, pcs_theta=deepcopy(self.pcs_theta), pcs_theta_err=self.pcs_theta_err, missing_pcs=self.missing_pcs) # Initialise the memo. memo = Memo_pcs_pseudo_ellipse_qrint(data) # Queue the block. self.processor.add_to_queue(self.slaves[i], memo) - - # Increment the slave count. - i += 1 # Wait for completion. self.processor.run_queue() Modified: branches/frame_order_testing/maths_fns/frame_order_matrix_ops.py URL: http://svn.gna.org/viewcvs/relax/branches/frame_order_testing/maths_fns/frame_order_matrix_ops.py?rev=15451&r1=15450&r2=15451&view=diff ============================================================================== --- branches/frame_order_testing/maths_fns/frame_order_matrix_ops.py (original) +++ branches/frame_order_testing/maths_fns/frame_order_matrix_ops.py Wed Mar 7 11:54:57 2012 @@ -2416,11 +2416,20 @@ class Slave_command_pcs_pseudo_ellipse_qrint(Slave_command): """The slave command for the quasi-random pseudo-ellipse PCS numerical integration.""" - def load_data(self, points=None, theta_x=None, theta_y=None, sigma_max=None, full_in_ref_frame=None, r_pivot_atom=None, r_pivot_atom_rev=None, r_ln_pivot=None, A=None, R_eigen=None, RT_eigen=None, Ri_prime=None, pcs_theta=None, pcs_theta_err=None, missing_pcs=None): - """Set up the slave command, storing the integration points. + def __init__(self, points=None): + """Store the pre-target function invariable data. @keyword points: The subdivision of points to process on the slave processor. @type points: numpy rank-2, 3D array + """ + + # Store the arguments. + self.points = points + + + def load_data(self, theta_x=None, theta_y=None, sigma_max=None, full_in_ref_frame=None, r_pivot_atom=None, r_pivot_atom_rev=None, r_ln_pivot=None, A=None, R_eigen=None, RT_eigen=None, Ri_prime=None, pcs_theta=None, pcs_theta_err=None, missing_pcs=None): + """Store the target function level variable data. + @keyword theta_x: The x-axis half cone angle. @type theta_x: float @keyword theta_y: The y-axis half cone angle. @@ -2449,10 +2458,9 @@ @type pcs_theta_err: numpy rank-2 array @keyword missing_pcs: A structure used to indicate which PCS values are missing. @type missing_pcs: numpy rank-2 array - """ + """ # Store the arguments. - self.points = points self.theta_x = theta_x self.theta_y = theta_y self.sigma_max = sigma_max