def main(): parser = argparse.ArgumentParser(description="connect worker queue") parser.add_argument("p", type=int, help="p-spin") parser.add_argument("nspins", type=int, help="number of spins") parser.add_argument("--nsteps", type=int, help="number of basin hopping steps", default=1000) args = parser.parse_args() nspins = args.nspins p = args.p dbname = "pspin_spherical_p{}_N{}.sqlite".format(p, nspins) interactions = get_database_params_worker(dbname, nspins, p) system = create_system(nspins, p, interactions) fname = 'server_uri_pspin_spherical_p{}_N{}.uri'.format(p, nspins) uri = get_server_uri(fname, nspins, p) worker = BasinhoppingWorker(uri, system=system) worker.run(args.nsteps)
def main(): parser = argparse.ArgumentParser(description="connect worker queue") parser.add_argument("p", type=int, help="p-spin") parser.add_argument("nspins", type=int, help="number of spins") parser.add_argument("--strategy", type=str, help="strategy to adopt: random (default), " "untrap, combine, gmin", default="random") args = parser.parse_args() nspins = args.nspins p = args.p dbname = "pspin_spherical_p{}_N{}.sqlite".format(p, nspins) interactions = get_database_params_worker(dbname, nspins, p) system = create_system(nspins, p, interactions) fname = 'server_uri_pspin_spherical_p{}_N{}.uri'.format(p, nspins) uri = get_server_uri(fname, nspins, p) worker = ConnectWorker(uri, system=system, strategy=args.strategy) worker.run()
def main(): parser = argparse.ArgumentParser( description="do nested sampling on a 3 layer elu neural network") # psping variables parser.add_argument("dbname", type=str, help="database name") parser.add_argument("--dtype", type=str, help="data type (recommended float64)", default='float64') parser.add_argument("--device", type=str, help="device on which TensorFlow should run", default='cpu') args = parser.parse_args() print args # pspin parameters dbname = os.path.abspath(args.dbname) dtype, device = args.dtype, args.device db, (nspins, p, interactions) = get_database_params(dbname) system = create_system(nspins, p, interactions, dtype=dtype, device=device) run_gui(system, db)
def main(): parser = argparse.ArgumentParser(description="dispatcher queue") parser.add_argument("p", type=int, help="p-spin") parser.add_argument("nspins", type=int, help="number of spins") parser.add_argument("--server-name", type=str, help="name of the dispatcher", default=None) parser.add_argument( "--host", type=str, help="address of the host (node on which the worker is started)", default=None) parser.add_argument("--port", type=int, help="port number on which the worker is started)", default=0) args = parser.parse_args() #set-up database nspins = args.nspins p = args.p dbname = "pspin_spherical_p{}_N{}.sqlite".format(p, nspins) print "setting up p={} N={} with database {}".format(p, nspins, dbname) #deal with existing database (if calculations has to be restarted) try: db, interactions = get_database_params_server(dbname, nspins, p) print "Warning: database {} already exists, using the already existing database".format( dbname) except IOError: db = None interactions = None system = create_system(nspins, p, interactions) if db is None: db = system.create_database(dbname) #start connect manager server_name = args.server_name if args.host is None: hostname = socket.gethostname() host = Pyro4.socketutil.getIpAddress(hostname, workaround127=True) else: host = args.host if args.port == 0: port = pick_unused_port() else: port = args.port connect_manager = ConnectServer(system, db, server_name=server_name, host=host, port=port) print "printing server uri..." fname = 'server_uri_pspin_spherical_p{}_N{}.uri'.format(p, nspins) uri = write_server_uri(fname, server_name, host, port, nspins, p) print "done" if db.number_of_minima() == 0: print "there are no minima in the database. Start a basinhopping run to generate minima" else: print "Working on %d minima" % db.number_of_minima() print "to start searching for minima:" print " python start_basinhopping_worker.py" print "to start connecting minima:" print " python start_connect_worker.py" connect_manager.run()
def main(): parser = argparse.ArgumentParser( description="do nested sampling on a 3 layer elu neural network") # pspin variables parser.add_argument("p", type=int, help="p-spin") parser.add_argument("nspins", type=int, help="number of spins") parser.add_argument("--dtype", type=str, help="data type (recommended float32)", default='float32') parser.add_argument("--device", type=str, help="device on which TensorFlow should run", default='cpu') # operations to perform parser.add_argument("--bh", type=int, help="number of basin hopping steps to perform", default=0) parser.add_argument("--refine", action='store_true', help="refine database") parser.add_argument("--connect", action="store_true", help="run all") parser.add_argument("--connect-method", type=str, help="method used to connect", default='random') args = parser.parse_args() print args # pspin parameters p, nspins = args.p, args.nspins dtype, device = args.dtype, args.device #operations bh_niter = args.bh connect, connect_method = args.connect, args.connect_method refine = args.refine dbname = "pspin_spherical_p{}_N{}.sqlite".format(p, nspins) try: db, interactions = get_database_params_server(dbname, nspins, p) print "Warning: database {} already exists, using the already existing database".format( dbname) except IOError: db = None interactions = None system = create_system(nspins, p, interactions, dtype=dtype, device=device) if db is None: db = system.create_database(dbname) #now actually run the computation fname = None if bh_niter > 0: bh = system.get_basinhopping(database=db, outstream=None) bh.run(bh_niter) if refine: print "\n refining database \n" refine_database(system, db, tol=1e-10, nsteps=int(2.5e4), maxstep=1, iprint=1000) if connect: fname = "pspin_spherical_p{}_N{}.dg.pdf".format(p, nspins) run_double_ended_connect(system, db, strategy=connect_method) if fname is not None: make_disconnectivity_graph(system, db, fname=fname)