← Back to team overview

yade-users team mailing list archive

Re: [Question #698152]: Resuming long interrupted calculations

 

Question #698152 on Yade changed:
https://answers.launchpad.net/yade/+question/698152

    Status: Open => Solved

Olivier Gillia confirmed that the question is solved:
I found another solution by the use of pickle. I have defined de OmegaParallel space, in which I put all the variables I want to retrieve when resuming. I do : 
 
if iResume:
 
    path_name1 = './RESULTATS/'
 
    test_case = table.test_case
    filename_save     = path_name1 + test_case + '-sauv.bin'
    filename_savePara = path_name1 + test_case + '-sauvPara.bin'
 
    print "Retrieving saved configuration in file :",filename_save
    print "                           and in file :",filename_savePara
 
    O.load(filename_save)
 
    OParaFile = open(filename_savePara,'rb')
    OPara = pickle.load(OParaFile)
    OParaFile.close()
 
    print "Resuming calculation at cycle no :",OPara.n_cycle
    print "                     at phase no :",OPara.n_phase
    print "                     at time     :",('%6.4f' %  (O.time))
    print "                     at iter     :",O.iter
 
else:
    … calculations takes place here … 
          #====== Saving the configuration for later possible resuming 
          O.save(OPara.filename_save)
          OParaFile = open(OPara.filename_savePara,'wb')
          pickle.dump(OPara, OParaFile)
          OParaFile.close()
          print "Saving at :"
          affIter()
 
The only thing that you need to do is to declare a omegaParallel class as an external module, and import it at the beginning :
import omegaParallel
 
while the omegaParallel.py file contains :
omegaParallel.py
class OmegaParallel:
    def __init__(self, s):
        self.s = s
    r1 = 0.0
    myVariables=…

-- 
You received this question notification because your team yade-users is
an answer contact for Yade.