Author: varioustoxins Date: Fri Apr 27 23:58:18 2007 New Revision: 3274 URL: http://svn.gna.org/viewcvs/relax?rev=3274&view=rev Log: correction to master slave output prefixes Modified: branches/multi_processor/minimise/generic.py branches/multi_processor/multi/PrependStringIO.py branches/multi_processor/multi/commands.py branches/multi_processor/multi/mpi4py_processor.py branches/multi_processor/multi/processor.py branches/multi_processor/relax Modified: branches/multi_processor/minimise/generic.py URL: http://svn.gna.org/viewcvs/relax/branches/multi_processor/minimise/generic.py?rev=3274&r1=3273&r2=3274&view=diff ============================================================================== --- branches/multi_processor/minimise/generic.py (original) +++ branches/multi_processor/minimise/generic.py Fri Apr 27 23:58:18 2007 @@ -425,5 +425,6 @@ else: print print_prefix + "Parameter values: " + `results` print "" + #FIXME: raising an exception here wedges mpi4py return results Modified: branches/multi_processor/multi/PrependStringIO.py URL: http://svn.gna.org/viewcvs/relax/branches/multi_processor/multi/PrependStringIO.py?rev=3274&r1=3273&r2=3274&view=diff ============================================================================== --- branches/multi_processor/multi/PrependStringIO.py (original) +++ branches/multi_processor/multi/PrependStringIO.py Fri Apr 27 23:58:18 2007 @@ -1,5 +1,7 @@ from StringIO import StringIO import sys + + class PrependOut(StringIO): @@ -9,14 +11,19 @@ self.token = token self.token_length = len(token) self.first_time = True + self.stream=stream def write(self,string): + #sys.__stdout__.write('<<' + string + '>>\n') + + string = string.replace('\n', '\n' + self.token) if self.first_time == True: - string =self.token + string + string = '\n'+self.token + string self.first_time = False - string = string.replace('\n', '\n' + self.token) + #StringIO.write(self,string) + #sys.__stdout__.write('<<' + string + '>>\n') self.stream.write(string) #self.truncate(0) @@ -36,11 +43,20 @@ self.token_length = len(token) self.first_time = True + def write(self,string): + # FIXME: raising an exception here wedges mpi4py + file_name = sys._getframe(1).f_code.co_filename.split('/')[-1] + function_name = sys._getframe(1).f_code.co_name + line_number = sys._getframe(1).f_lineno + #msg = '<<%d - %s - %s - %d: %s>>' %(id(self),file_name,function_name,line_number,string) + #sys.__stdout__.write(msg) + string = string.replace('\n', '\n' + self.token) if self.first_time == True: - string =self.token + string + string ='\n' +self.token + string self.first_time = False - string = string.replace('\n', '\n' + self.token) + + StringIO.write(self,string) @@ -49,10 +65,9 @@ def getvalue(self): result = StringIO.getvalue(self) - #if len(result) <= len(self.token): - # result = '' - #if result.endswith('\n' + self.token): - # result = result[0:-self.token_length-1] + if len(result) > 0 and result[-1] == '\n': + result = result[0:-self.token_length-1] + result=result+'\n' return result if __name__ =='__main__': Modified: branches/multi_processor/multi/commands.py URL: http://svn.gna.org/viewcvs/relax/branches/multi_processor/multi/commands.py?rev=3274&r1=3273&r2=3274&view=diff ============================================================================== --- branches/multi_processor/multi/commands.py (original) +++ branches/multi_processor/multi/commands.py Fri Apr 27 23:58:18 2007 @@ -255,8 +255,8 @@ # add debug flag or extra channels that output immediately if processor.processor_size() > 1: pre_string = processor.rank_format_string() % processor.rank() - stderr_string = ' E> ' - stdout_string = ' S> ' + stderr_string = ' E> ' + stdout_string = ' S> ' else: pre_string = '' stderr_string = '' @@ -279,8 +279,8 @@ return generic_minimise(func=self.mf.func, dfunc=self.mf.dfunc, d2func=self.mf.d2func, **self.minimise_map) - def process_result(self,processor): - self.process_results(self.results,processor,completed) +# def process_result(self,processor): +# self.process_results(self.results,processor,completed) @@ -420,9 +420,10 @@ self.h_count += results[OFFSET_H_COUNT] if results[OFFSET_WARNING] != None: self.warning.append(results[OFFSET_WARNING]) - + #FIXME: + #TESTME: do we sue short results? else: - if results[OFFSET_SHORT_FK] < short_result[OFFSET_SHORT_FK]: + if results[OFFSET_SHORT_FK] < self.short_result[OFFSET_SHORT_FK]: self.short_result[OFFSET_SHORT_MIN_PARAMS] = results[OFFSET_SHORT_MIN_PARAMS] self.short_result[OFFSET_SHORT_FK] = results[OFFSET_SHORT_FK] self.short_result[OFFSET_SHORT_K] += results[OFFSET_SHORT_K] @@ -460,7 +461,7 @@ # FIXME: Check against full result # FIXME: names not consistent in memo - # FIXME too much repacking + # FIXME: too much repacking results = (self.param_vector,self.func,self.iter,self.fc,self.gc,self.hc, self.warning) memo.add_result(results) Modified: branches/multi_processor/multi/mpi4py_processor.py URL: http://svn.gna.org/viewcvs/relax/branches/multi_processor/multi/mpi4py_processor.py?rev=3274&r1=3273&r2=3274&view=diff ============================================================================== --- branches/multi_processor/multi/mpi4py_processor.py (original) +++ branches/multi_processor/multi/mpi4py_processor.py Fri Apr 27 23:58:18 2007 @@ -174,7 +174,7 @@ -#FIXME do some inheritance +#FIXME: do some inheritance class Mpi4py_processor(Processor): Modified: branches/multi_processor/multi/processor.py URL: http://svn.gna.org/viewcvs/relax/branches/multi_processor/multi/processor.py?rev=3274&r1=3273&r2=3274&view=diff ============================================================================== --- branches/multi_processor/multi/processor.py (original) +++ branches/multi_processor/multi/processor.py Fri Apr 27 23:58:18 2007 @@ -76,7 +76,7 @@ sys.stdout = self.save_stdout def run_command_globally(self,command): - queue = [command for i in range(1,MPI.size)] + queue = [command for i in range(self.processor_size())] self.run_command_queue(queue) def abort(self): Modified: branches/multi_processor/relax URL: http://svn.gna.org/viewcvs/relax/branches/multi_processor/relax?rev=3274&r1=3273&r2=3274&view=diff ============================================================================== --- branches/multi_processor/relax (original) +++ branches/multi_processor/relax Fri Apr 27 23:58:18 2007 @@ -174,10 +174,11 @@ self.interpreter = Interpreter(self) self.interpreter.run() - elif mode == 'slave': - self.interpreter = Interpreter(self) - self.dummy_mode=1 - self.interpreter.run() + # FIXME no more threading +# elif mode == 'slave': +# self.interpreter = Interpreter(self) +# self.dummy_mode=1 +# self.interpreter.run() # FIXME no more threading # Threading mode. @@ -301,14 +302,16 @@ # Determine the relax mode and test for mutually exclusive modes. ################################################################# - +# TODO: this should be a task # Show the version number. if options.version: mode = 'version' # Run the relax tests. elif options.test_suite or options.unit_test: - # Make sure no script is supplied. +#FIXME: multiprocessor options should be mostly resolved independant of the run mode + self.multiprocessor_type = options.multiprocessor + self.n_processors = options.n_processors # Make sure no script is supplied. if self.script_file: parser.error("a script should not be supplied when executing the test suite")