def quit_sage(verbose=True): """ If you use Sage in library mode, you should call this function when your application quits. It makes sure any child processes are also killed, etc. """ if verbose: t1 = cputime(_cpu_time_) t1m = int(t1 / 60) t1s = t1 - t1m * 60 t2 = walltime(_wall_time_) t2m = int(t2 / 60) t2s = t2 - t2m * 60 print "Exiting Sage (CPU time %sm%.2fs, Wall time %sm%.2fs)." % ( t1m, t1s, t2m, t2s) import gc gc.collect() from sage.interfaces.quit import expect_quitall expect_quitall(verbose=verbose) import sage.matrix.matrix_mod2_dense sage.matrix.matrix_mod2_dense.free_m4ri() import sage.libs.flint.flint sage.libs.flint.flint.free_flint_stack() # stop the twisted reactor try: from twisted.internet import reactor if reactor.running: reactor.callFromThread(reactor.stop) except ImportError: pass # Free globally allocated mpir integers. import sage.rings.integer sage.rings.integer.free_integer_pool() sage.rings.integer.clear_mpz_globals() import sage.algebras.quatalg.quaternion_algebra_element sage.algebras.quatalg.quaternion_algebra_element._clear_globals() from sage.libs.all import symmetrica symmetrica.end()
def quit_sage(verbose=True): """ If you use Sage in library mode, you should call this function when your application quits. It makes sure any child processes are also killed, etc. """ if verbose: t1 = cputime(_cpu_time_) t1m = int(t1) // 60 t1s = t1 - t1m * 60 t2 = walltime(_wall_time_) t2m = int(t2) // 60 t2s = t2 - t2m * 60 print("Exiting Sage (CPU time %sm%.2fs, Wall time %sm%.2fs)." % (t1m, t1s, t2m, t2s)) import gc gc.collect() from sage.interfaces.quit import expect_quitall expect_quitall(verbose=verbose) import sage.matrix.matrix_mod2_dense sage.matrix.matrix_mod2_dense.free_m4ri() import sage.libs.flint.flint sage.libs.flint.flint.free_flint_stack() # stop the twisted reactor try: from twisted.internet import reactor if reactor.running: reactor.callFromThread(reactor.stop) except ImportError: pass # Free globally allocated mpir integers. import sage.rings.integer sage.rings.integer.free_integer_pool() import sage.algebras.quatalg.quaternion_algebra_element sage.algebras.quatalg.quaternion_algebra_element._clear_globals() from sage.libs.all import symmetrica symmetrica.end()
def quit_sage(verbose=True): """ If you use Sage in library mode, you should call this function when your application quits. It makes sure any child processes are also killed, etc. """ if verbose: t1 = cputime(_cpu_time_) t1m = int(t1) // 60 t1s = t1 - t1m * 60 t2 = walltime(_wall_time_) t2m = int(t2) // 60 t2s = t2 - t2m * 60 print("Exiting Sage (CPU time %sm%.2fs, Wall time %sm%.2fs)." % (t1m, t1s, t2m, t2s)) import gc gc.collect() from sage.interfaces.quit import expect_quitall expect_quitall(verbose=verbose) import sage.matrix.matrix_mod2_dense sage.matrix.matrix_mod2_dense.free_m4ri() import sage.libs.flint.flint sage.libs.flint.flint.free_flint_stack() # Free globally allocated gmp integers. import sage.rings.integer sage.rings.integer.free_integer_pool() import sage.algebras.quatalg.quaternion_algebra_element sage.algebras.quatalg.quaternion_algebra_element._clear_globals() from sage.libs.all import symmetrica symmetrica.end()
def quit_sage(verbose=True): """ If you use Sage in library mode, you should call this function when your application quits. It makes sure any child processes are also killed, etc. """ if verbose: t1 = cputime(_cpu_time_) t1m = int(t1 / 60) t1s = t1 - t1m * 60 t2 = walltime(_wall_time_) t2m = int(t2 / 60) t2s = t2 - t2m * 60 print "Exiting Sage (CPU time %sm%.2fs, Wall time %sm%.2fs)." % ( t1m, t1s, t2m, t2s) from sage.interfaces.quit import expect_quitall expect_quitall(verbose=verbose) import sage.matrix.matrix_mod2_dense sage.matrix.matrix_mod2_dense.free_m4ri() import sage.libs.flint.flint sage.libs.flint.flint.free_flint_stack() pari._unsafe_deallocate_pari_stack() ### The following is removed -- since it would cleanup ### the tmp directory that the sage cleaner depends upon. # The following code close all open file descriptors, # so that on shared file systems the delete_tmpfiles # command below works. # AUTHOR: # * Kate Minola (2007-05-03) #import resource # Resource usage information. #maxfd = resource.getrlimit(resource.RLIMIT_NOFILE)[1] #if maxfd != resource.RLIM_INFINITY: # Iterate through and close all file descriptors. # for fd in range(0, maxfd): # try: # os.close(fd) # except OSError: # ERROR, fd wasn't open to begin with (ignored) # pass # Now delete the temp files #from sage.misc.misc import delete_tmpfiles #delete_tmpfiles() # stop the twisted reactor try: from twisted.internet import reactor if reactor.running: reactor.callFromThread(reactor.stop) except ImportError: pass # Free globally allocated mpir integers. import sage.rings.integer sage.rings.integer.free_integer_pool() sage.rings.integer.clear_mpz_globals() import sage.algebras.quatalg.quaternion_algebra_element sage.algebras.quatalg.quaternion_algebra_element._clear_globals() from sage.libs.all import symmetrica symmetrica.end()
def quit_sage(verbose=True): """ If you use Sage in library mode, you should call this function when your application quits. It makes sure any child processes are also killed, etc. """ if verbose: t1 = cputime(_cpu_time_) t1m = int(t1/60); t1s=t1-t1m*60 t2 = walltime(_wall_time_) t2m = int(t2/60); t2s=t2-t2m*60 print "Exiting Sage (CPU time %sm%.2fs, Wall time %sm%.2fs)."%( t1m,t1s,t2m,t2s) from sage.interfaces.quit import expect_quitall expect_quitall(verbose=verbose) import sage.matrix.matrix_mod2_dense sage.matrix.matrix_mod2_dense.free_m4ri() import sage.libs.flint.flint sage.libs.flint.flint.free_flint_stack() pari._unsafe_deallocate_pari_stack() ### The following is removed -- since it would cleanup ### the tmp directory that the sage cleaner depends upon. # The following code close all open file descriptors, # so that on shared file systems the delete_tmpfiles # command below works. # AUTHOR: # * Kate Minola (2007-05-03) #import resource # Resource usage information. #maxfd = resource.getrlimit(resource.RLIMIT_NOFILE)[1] #if maxfd != resource.RLIM_INFINITY: # Iterate through and close all file descriptors. # for fd in range(0, maxfd): # try: # os.close(fd) # except OSError: # ERROR, fd wasn't open to begin with (ignored) # pass # Now delete the temp files #from sage.misc.misc import delete_tmpfiles #delete_tmpfiles() # stop the twisted reactor try: from twisted.internet import reactor if reactor.running: reactor.callFromThread(reactor.stop) except ImportError: pass # Free globally allocated mpir integers. import sage.rings.integer sage.rings.integer.free_integer_pool() sage.rings.integer.clear_mpz_globals() import sage.algebras.quatalg.quaternion_algebra_element sage.algebras.quatalg.quaternion_algebra_element._clear_globals() from sage.libs.all import symmetrica symmetrica.end()