[EMAIL PROTECTED] wrote:

Dear Ed
d this is a good enough point to tell you how to run things and what to install for the mpi version i am testing with

I have installed mpipy and lam

lam should  be available in your linux distribution ??? ;-)

mpi4py came from http://www.python.org/pypi/mpi4py (there is an mpi4py website but it is out of date, however, mpi4py is under recent development)

follow the instructions to install mpi4py

create the file  'test_multi1.py'

-------------------8<-----------------------
import multi
cmd  =  multi.mpi4py_processor.Get_name_command()
self.relax.processor.run_command(cmd)
-------------------8<-----------------------

then type lamboot

and to run the test type:

mpirun -np 6 python relax --multi mpi4py test_mult1.py
to get:

                                 relax repository checkout

                         Protein dynamics by NMR relaxation data analysis

                            Copyright (C) 2001-2006 Edward d'Auvergne

This is free software which you are welcome to modify and redistribute under the conditions of the GNU General Public License (GPL). This program, including all modules, is licensed under the GPL and comes with absolutely no warranty. For details type 'GPL'. Assistance in using this program
can be accessed by typing 'help'.

script = 'test_mult1.py'
----------------------------------------------------------------------------------------------------
import sys


import multi
cmd  =  multi.mpi4py_processor.Get_name_command()
self.relax.processor.run_command(cmd)
----------------------------------------------------------------------------------------------------
1 fbsdpcu156-9377
2 fbsdpcu156-9378
3 fbsdpcu156-9379
4 fbsdpcu156-9380
5 fbsdpcu156-9381



hope this is useful!

Now a question what is the best way to get an etrenally running relax interpreter I can just fire commands at (for the slaves)?

basically I just need to

1. do some setup
2. send a command object

but without quitting at the end of the script


do i modify interpreter.run to take a quit varaiable set to False so that run_script can be
run with quit = false?




regards
gary


Author: varioustoxins
Date: Mon Mar 19 16:13:15 2007
New Revision: 3237

URL: http://svn.gna.org/viewcvs/relax?rev=3237&view=rev
Log:
implimentation of basic command structure and simplistic processor name command
Modified:
   branches/multi_processor/multi/mpi4py_processor.py
   branches/multi_processor/relax

Modified: branches/multi_processor/multi/mpi4py_processor.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/multi_processor/multi/mpi4py_processor.py?rev=3237&r1=3236&r2=3237&view=diff
==============================================================================
--- branches/multi_processor/multi/mpi4py_processor.py (original)
+++ branches/multi_processor/multi/mpi4py_processor.py Mon Mar 19 16:13:15 2007
@@ -1,7 +1,7 @@
#!/usr/bin/env python

import sys
-
+import os


# load mpi
@@ -23,14 +23,22 @@

def exit_mpi():
    if MPI.Is_initialized() and not MPI.Is_finalized() and MPI.rank == 0:
-        sendbuf  = ['close']
+        sendbuf = Exit_command()
        for i in range(MPI.size):
            if i != 0:
                MPI.COMM_WORLD.Send(buf=sendbuf,dest=i)

+#FIXME do some inheritance
+class Exit_command(object):
+    def run(self,processor):
+        processor.do_quit=True

+class Get_name_command(object):
+    def run(self,processor):
+        result = '%s-%s' % (MPI.Get_processor_name(),os.getpid())
+        MPI.COMM_WORLD.Send(buf=result, dest=0)

-
+#FIXME do some inheritance
class Mpi4py_processor:


@@ -41,6 +49,35 @@
        # wrap sys.exit to close down mpi before exiting
        sys.exit= exit
        self.do_quit=False
+
+    def exit(self):
+        exit_mpi()
+
+    def run_command(self,command):
+        for i in range(1,MPI.size):
+            if i != 0:
+                MPI.COMM_WORLD.Send(buf=command,dest=i)
+        for i in range(1,MPI.size):
+            buf=[]
+            if i !=0:
+                elem = MPI.COMM_WORLD.Recv(source=i)
+                if type(elem) == 'object':
+                    elem.run(relax_instance)
+                else:
+                    #FIXME can't cope with multiple lines
+                    print i,elem
+
+
+#        for i in range(MPI.size):
+#            buf=[]
+#            if i !=0:
+#                print 'try',i
+#                MPI.COMM_WORLD.Recv(buf=buf, source=i)
+#                for i,elem in enumerate(buf):
+#                    if elem.type!='object':
+#                        print i,elem
+#                    else:
+#                        elem.run()

    def run(self):

@@ -53,10 +90,13 @@
            self.relax_instance.run()
            sys.exit()
        else:
-            data = MPI.COMM_WORLD.Recv(source=0)
-            if data=='close':
-                exit_mpi()
-                return
+            while not self.do_quit:
+                data = MPI.COMM_WORLD.Recv(source=0)
+                data.run(self)
+
+            #if data=='close':
+            #    exit_mpi()
+            #    return




Modified: branches/multi_processor/relax
URL: 
http://svn.gna.org/viewcvs/relax/branches/multi_processor/relax?rev=3237&r1=3236&r2=3237&view=diff
==============================================================================
--- branches/multi_processor/relax (original)
+++ branches/multi_processor/relax Mon Mar 19 16:13:15 2007
@@ -561,7 +561,9 @@
        clazz =  getattr(modules[-1], class_name)
    else:
        raise RelaxError("can't load class %s from module %s" % 
(class_name,module_path))
+
    object = clazz(relax_instance)
+    relax_instance.processor =  object
    return object

if __name__ == "__main__":


_______________________________________________
relax (http://nmr-relax.com)

This is the relax-commits mailing list
[email protected]

To unsubscribe from this list, get a password
reminder, or change your subscription options,
visit the list information page at
https://mail.gna.org/listinfo/relax-commits

.



--
-------------------------------------------------------------------
Dr Gary Thompson
Astbury Centre for Structural Molecular Biology,
University of Leeds, Astbury Building,
Leeds, LS2 9JT, West-Yorkshire, UK             Tel. +44-113-3433024
email: [EMAIL PROTECTED]                   Fax  +44-113-2331407
-------------------------------------------------------------------



_______________________________________________
relax (http://nmr-relax.com)

This is the relax-devel mailing list
[email protected]

To unsubscribe from this list, get a password
reminder, or change your subscription options,
visit the list information page at
https://mail.gna.org/listinfo/relax-devel

Reply via email to