import sys import argparse import traceback import pulsar as psr psr.initialize(sys.argv) def LoadDefaultModules(mm): mm.load_module("Methods","MBE","PSR_MBE") mm.load_module("Methods","CP","PSR_CP") mm.load_module("Methods","FPA","PSR_FPA") mm.load_module("Methods","MyCrzyCompMeth","PSR_CRZY_METHOD") mm.load_module("Methods","CorrelationEnergy","PSR_CORRELATION_ENERGY") mm.load_module("Methods","HelgakerCBS","PSR_HELGAKER_CBS") mm.load_module("Methods","FellerCBS","PSR_FELLER_CBS") mm.load_module("SystemFragmenters","UserDefined","PSR_UD_FRAG") mm.load_module("SystemFragmenters","NullFragmenter","PSR_NULL_FRAG") mm.load_module("SystemFragmenters","Atomizer","PSR_ATOM_FRAG") mm.load_module("SystemFragmenters","Bondizer","PSR_BOND_FRAG") mm.load_module("SystemFragmenters","Ghoster","PSR_GHOST_FRAG") mm.load_module("SystemFragmenters","CPGhoster","PSR_CP_FRAG") mm.load_module("SystemFragmenters","VMFCGhoster","PSR_VMFC_FRAG") mm.load_module("SystemFragmenters","CrystalFragger","PSR_CRYS_FRAG")
24.0, 14.0, 44.0, 34.0, 54.0, 25.0, 15.0, 45.0, 35.0, 55.0 ] order = [ 1, 0, 3, 2, 4 ] newlist = Test_Reorder(order, alist, 1, 6) tester.test_value("Test reorder with niter", True, newlist == blist) alist = [ 10.0, 20.0, 30.0, 40.0, 50.0, 11.0, 21.0, 31.0, 41.0, 51.0, 12.0, 22.0, 32.0, 42.0, 52.0, 13.0, 23.0, 33.0, 43.0, 53.0, 14.0, 24.0, 34.0, 44.0, 54.0, 15.0, 25.0, 35.0, 45.0, 55.0 ] tester.print_results() except Exception as e: print_global_output("Caught exception in main handler. Contact the developers\n") traceback.print_exc() print_global_error("\n") print_global_error(str(e)) print_global_error("\n") psr.initialize(sys.argv, color = True, debug = True) Run() psr.finalize()
mm.stop_cache_sync() psr.output.print_global_output("\nDone testing\n") except Exception as e: psr.output.print_global_output("Caught exception in main handler\n") traceback.print_exc() psr.output.print_global_error("\n") psr.output.print_global_error(str(e)) psr.output.print_global_error("\n") psr.initialize(sys.argv, color = True, debug = True, outbase = "psr_output") myrank = psr.parallel.get_proc_id() nproc = psr.parallel.get_nproc() psr.print_global_output("My rank: {}\n".format(myrank)) cpio_global = psr.modulemanager.BDBCheckpointIO("/tmp/TestChk_global.dat") cpio_local = psr.modulemanager.BDBCheckpointIO("/tmp/TestChk_local.dat.{}".format(myrank)) cp = psr.modulemanager.Checkpoint(cpio_local, cpio_global) with psr.ModuleAdministrator() as mm: cp.load_local_cache(mm) cp.load_global_cache(mm) Run(mm) psr.finalize()
test_name, test_ext = os.path.splitext(test_file) print("---------------------------------------------------") print(" Test information") print(" full_path: {}".format(full_path)) print(" test_path: {}".format(test_path)) print(" test_file: {}".format(test_file)) print(" test_name: {}".format(test_name)) print(" test_ext: {}".format(test_ext)) print("---------------------------------------------------") sys.stdout.flush() # Initialize pulsar # From now on, output should go through pulsar pulsar.initialize(sys.argv, color = False, debug = True, outbase = "psr_output_" + test_name) # We can't do the normal import. Some tests may have the # same name, which leads to a test_name.py and test_name.so # So we have to do it manually, given the full path # Slightly different, depending on the test type if test_ext == ".py": m = SourceFileLoader(test_name, full_path).load_module() else: m = ExtensionFileLoader(test_name, full_path).load_module()
tester.test("Serialization of IrrepSpinMatrix", True, testserial, ismat1) def Run(): try: tester = Tester("Testing SimpleMatrix") tester.print_header() TestMatrix(tester, SimpleMatrixF, float, TestSerialization_SimpleMatrixF) TestMatrix(tester, SimpleMatrixD, float, TestSerialization_SimpleMatrixD) TestIrrepSpinMatrix(tester, SimpleMatrixF, IrrepSpinMatrixF, float, TestSerialization_IrrepSpinMatrixF) TestIrrepSpinMatrix(tester, SimpleMatrixD, IrrepSpinMatrixD, float, TestSerialization_IrrepSpinMatrixD) tester.print_results() except Exception as e: print_global_output("Caught exception in main handler. Contact the developers\n") traceback.print_exc() print_global_error("\n") print_global_error(str(e)) print_global_error("\n") psr.initialize(sys.argv, out = "stdout", color = True, debug = True) Run() psr.finalize()