mailr15452 - in /branches/frame_order_testing/maths_fns: frame_order.py frame_order_matrix_ops.py


Others Months | Index by Date | Thread Index
>>   [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Header


Content

Posted by edward on March 07, 2012 - 12:36:
Author: bugman
Date: Wed Mar  7 12:36:44 2012
New Revision: 15452

URL: http://svn.gna.org/viewcvs/relax?rev=15452&view=rev
Log:
Shifted the transfer of much of the data to the slave command to the 
__init__() method.

This should improve the multi-processor scaling by reducing data transfer 
times per function call.
However, from testing this currently does nothing!  The structures now 
pre-transfered include:

    full_in_ref_frame
    r_ln_pivot
    A
    Ri_prime
    pcs_theta
    pcs_theta_err
    missing_pcs


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=15452&r1=15451&r2=15452&view=diff
==============================================================================
--- branches/frame_order_testing/maths_fns/frame_order.py (original)
+++ branches/frame_order_testing/maths_fns/frame_order.py Wed Mar  7 12:36:44 
2012
@@ -51,7 +51,7 @@
 class Frame_order:
     """Class containing the target function of the optimisation of Frame 
Order matrix components."""
 
-    def __init__(self, model=None, init_params=None, full_tensors=None, 
full_in_ref_frame=None, rdcs=None, rdc_errors=None, rdc_weights=None, 
rdc_vect=None, rdc_const=None, pcs=None, pcs_errors=None, pcs_weights=None, 
pcs_atoms=None, temp=None, frq=None, paramag_centre=None, 
scaling_matrix=None, num_int_pts=500, pivot=None, pivot_opt=False, 
quad_int=True):
+    def __init__(self, model=None, init_params=None, full_tensors=None, 
full_in_ref_frame=None, rdcs=None, rdc_errors=None, rdc_weights=None, 
rdc_vect=None, rdc_const=None, pcs=None, pcs_errors=None, pcs_weights=None, 
pcs_atoms=None, temp=None, frq=None, paramag_centre=zeros(3), 
scaling_matrix=None, num_int_pts=500, pivot=zeros(3), pivot_opt=False, 
quad_int=True):
         """Set up the target functions for the Frame Order theories.
         
         @keyword model:             The name of the Frame Order model.
@@ -250,7 +250,10 @@
             self.pcs_const = zeros(self.num_align, float64)
             self.r_pivot_atom = zeros((3, self.num_pcs), float64)
             self.r_pivot_atom_rev = zeros((3, self.num_pcs), float64)
+            self.r_pivot_atom_rev = zeros((3, self.num_pcs), float64)
             self.r_ln_pivot = zeros((3, self.num_pcs), float64)
+            for j in xrange(self.num_pcs):
+                self.r_ln_pivot[:, j] = pivot - self.paramag_centre
             if self.paramag_centre == None:
                 self.paramag_centre = zeros(3, float64)
 
@@ -322,7 +325,7 @@
             # Set up the slave processors.
             self.slaves = []
             for i in range(self.processor.processor_size()):
-                
self.slaves.append(Slave_command_pcs_pseudo_ellipse_qrint(blocks[i]))
+                
self.slaves.append(Slave_command_pcs_pseudo_ellipse_qrint(blocks[i], 
full_in_ref_frame=self.full_in_ref_frame, r_ln_pivot=self.r_ln_pivot, 
A=self.A_3D, Ri_prime=self.Ri_prime, pcs_theta=deepcopy(self.pcs_theta), 
pcs_theta_err=self.pcs_theta_err, missing_pcs=self.missing_pcs))
 
         # The target function aliases (Scipy numerical integration).
         else:
@@ -1180,7 +1183,11 @@
             # Subdivide the points.
             for i in range(self.processor.processor_size()):
                 # Initialise the slave command and memo.
-                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)
+                self.slaves[i].load_data(theta_x=cone_theta_x, 
theta_y=cone_theta_x, sigma_max=cone_sigma_max, 
r_pivot_atom=self.r_pivot_atom, r_pivot_atom_rev=self.r_pivot_atom_rev, 
R_eigen=self.R_eigen, RT_eigen=RT_eigen)
+
+                # Update certain data structures.
+                if self.pivot_opt:
+                    self.slaves[i].r_ln_pivot = self.r_ln_pivot
 
                 # Initialise the memo.
                 memo = Memo_pcs_pseudo_ellipse_qrint(data)
@@ -1761,7 +1768,8 @@
         # The pivot to atom vectors.
         for j in xrange(self.num_pcs):
             # The lanthanide to pivot vector.
-            self.r_ln_pivot[:, j] = pivot - self.paramag_centre
+            if self.pivot_opt:
+                self.r_ln_pivot[:, j] = pivot - self.paramag_centre
 
             # The rotated vectors.
             self.r_pivot_atom[:, j] = dot(R_ave, self.pcs_atoms[j] - pivot)

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=15452&r1=15451&r2=15452&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 12:36:44 2012
@@ -2416,40 +2416,17 @@
 class Slave_command_pcs_pseudo_ellipse_qrint(Slave_command):
     """The slave command for the quasi-random pseudo-ellipse PCS numerical 
integration."""
 
-    def __init__(self, points=None):
+    def __init__(self, points=None, full_in_ref_frame=None, r_ln_pivot=None, 
A=None, Ri_prime=None, pcs_theta=None, pcs_theta_err=None, missing_pcs=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.
-        @type theta_y:              float
-        @keyword sigma_max:         The maximum torsion angle.
-        @type sigma_max:            float
         @keyword full_in_ref_frame: An array of flags specifying if the 
tensor in the reference frame is the full or reduced tensor.
         @type full_in_ref_frame:    numpy rank-1 array
-        @keyword r_pivot_atom:      The pivot point to atom vector.
-        @type r_pivot_atom:         numpy rank-2, 3D array
-        @keyword r_pivot_atom_rev:  The reversed pivot point to atom vector.
-        @type r_pivot_atom_rev:     numpy rank-2, 3D array
         @keyword r_ln_pivot:        The lanthanide position to pivot point 
vector.
         @type r_ln_pivot:           numpy rank-2, 3D array
         @keyword A:                 The full alignment tensor of the 
non-moving domain.
         @type A:                    numpy rank-2, 3D array
-        @keyword R_eigen:           The eigenframe rotation matrix.
-        @type R_eigen:              numpy rank-2, 3D array
-        @keyword RT_eigen:          The transpose of the eigenframe rotation 
matrix (for faster calculations).
-        @type RT_eigen:             numpy rank-2, 3D array
         @keyword Ri_prime:          The empty rotation matrix for the 
in-frame isotropic cone motion, used to calculate the PCS for each state i in 
the numerical integration.
         @type Ri_prime:             numpy rank-2, 3D array
         @keyword pcs_theta:         The storage structure for the 
back-calculated PCS values.
@@ -2461,20 +2438,43 @@
         """
 
         # Store the arguments.
-        self.theta_x = theta_x
-        self.theta_y = theta_y
-        self.sigma_max = sigma_max
+        self.points = points
         self.full_in_ref_frame = full_in_ref_frame
-        self.r_pivot_atom = r_pivot_atom
-        self.r_pivot_atom_rev = r_pivot_atom_rev
         self.r_ln_pivot = r_ln_pivot
         self.A = A
-        self.R_eigen = R_eigen
-        self.RT_eigen = RT_eigen
         self.Ri_prime = Ri_prime
         self.pcs_theta = pcs_theta
         self.pcs_theta_err = pcs_theta_err
         self.missing_pcs = missing_pcs
+
+
+    def load_data(self, theta_x=None, theta_y=None, sigma_max=None, 
r_pivot_atom=None, r_pivot_atom_rev=None, R_eigen=None, RT_eigen=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.
+        @type theta_y:              float
+        @keyword sigma_max:         The maximum torsion angle.
+        @type sigma_max:            float
+        @keyword r_pivot_atom:      The pivot point to atom vector.
+        @type r_pivot_atom:         numpy rank-2, 3D array
+        @keyword r_pivot_atom_rev:  The reversed pivot point to atom vector.
+        @type r_pivot_atom_rev:     numpy rank-2, 3D array
+        @keyword R_eigen:           The eigenframe rotation matrix.
+        @type R_eigen:              numpy rank-2, 3D array
+        @keyword RT_eigen:          The transpose of the eigenframe rotation 
matrix (for faster calculations).
+        @type RT_eigen:             numpy rank-2, 3D array
+        """
+
+        # Store the arguments.
+        self.theta_x = theta_x
+        self.theta_y = theta_y
+        self.sigma_max = sigma_max
+        self.r_pivot_atom = r_pivot_atom
+        self.r_pivot_atom_rev = r_pivot_atom_rev
+        self.R_eigen = R_eigen
+        self.RT_eigen = RT_eigen
 
 
     def run(self, processor, completed):




Related Messages


Powered by MHonArc, Updated Wed Mar 07 13:40:02 2012