h11=geomdoc['H11']; dresverts=mat2py(geomdoc['DRESVERTS']); fgp=geomdoc['FUNDGP']; fav=geomdoc['FAV']; JtoDmat=mat2py(geomdoc['JTOD']); packagepath=subprocess.Popen("echo \"${SLURMONGO_ROOT}\" | head -c -1",shell=True,stdout=subprocess.PIPE,preexec_fn=default_sigpipe).communicate()[0]; statepath=packagepath+"/state"; mongourifile=statepath+"/mongouri"; with open(mongourifile,"r") as mongouristream: mongouri=mongouristream.readline().rstrip("\n"); mongoclient=mongojoin.MongoClient(mongouri+"?authMechanism=SCRAM-SHA-1"); dbname=mongouri.split("/")[-1]; db=mongoclient[dbname]; triangdata=mongojoin.collectionfind(db,'TRIANG',{'H11':h11,'POLYID':polyid,'GEOMN':geomn},{'_id':0,'MORIMATP':1,'ITENSXD':1},formatresult='expression'); mongoclient.close(); ######################## Begin parallel MPI scatter/gather of toric swiss cheese information ############################### scatt=[[h11,dresverts,fgp,fav,JtoDmat,x] for x in mongojoin.distribcores(triangdata,size)]; #If fewer cores are required than are available, pass extraneous cores no information if len(scatt)<size: scatt+=[-2 for x in range(len(scatt),size)]; #Scatter and define rank-independent input variables pretoricswisscheese=comm.scatter(scatt,root=0); h11_chunk,dresverts_chunk,fgp_chunk,fav_chunk,JtoDmat_chunk,triangdata_chunk=pretoricswisscheese; #Loop for each number of large cycles from 1 to h11-1 gath=[]; for NL in range(1,h11_chunk): toricswisscheese_NL_chunk=[]; scflag=False; #Loop over each triangulation with the current number of large cycles
stdout=subprocess.PIPE, preexec_fn=default_sigpipe).communicate()[0] statepath = packagepath + "/state" mongourifile = statepath + "/mongouri" with open(mongourifile, "r") as mongouristream: mongouri = mongouristream.readline().rstrip("\n") mongoclient = mongojoin.MongoClient(mongouri + "?authMechanism=SCRAM-SHA-1") dbname = mongouri.split("/")[-1] db = mongoclient[dbname] triangs = mongojoin.collectionfind(db, 'TRIANGtemp', { 'H11': h11, 'POLYID': polyid }, { '_id': 0, 'GEOMN': 1, 'TRIANG': 1 }, formatresult='expression') #print triangs; #sys.stdout.flush(); mongoclient.close() #Set the number of basis divisors ndivsJ = matrix(rescws).rank() #Create the pseudo-Chow polynomial ring C = PolynomialRing(QQ, names=['t'] + ['D' + str(i + 1) for i in range(len(dresverts))] + ['J' + str(i + 1) for i in range(ndivsJ)]) DD = list(C.gens()[1:-ndivsJ])
preexec_fn=default_sigpipe).communicate()[0] statepath = packagepath + "/state" mongourifile = statepath + "/mongouri" with open(mongourifile, "r") as mongouristream: mongouri = mongouristream.readline().rstrip("\n") mongoclient = mongojoin.MongoClient(mongouri + "?authMechanism=SCRAM-SHA-1") dbname = mongouri.split("/")[-1] db = mongoclient[dbname] involdocs = mongojoin.collectionfind(db, 'INVOL', { 'H11': h11, 'POLYID': polyid, 'GEOMN': oldgeomn, 'TRIANGN': oldtriangn }, { '_id': 0, 'INVOLN': 1 }, formatresult='expression') #Add new properties to base tier of JSON if len(involdocs) == 0: print "None" else: for i in range(len(involdocs)): print "+INVOL." + json.dumps( { 'POLYID': polyid, 'GEOMN': oldgeomn, 'TRIANGN': oldtriangn,
triangdocs = mongojoin.collectionfind(db, 'TRIANGtemp', { 'H11': h11, 'POLYID': polyid }, { '_id': 0, 'ALLTRIANGN': 1, 'BASIS': 1, 'EULER': 1, 'JTOD': 1, 'INVBASIS': 1, 'CHERN2XJ': 1, 'CHERN2XNUMS': 1, 'IPOLYXJ': 1, 'ITENSXJ': 1, 'SRIDEAL': 1, 'CHERN2XD': 1, 'IPOLYAD': 1, 'ITENSAD': 1, 'IPOLYXD': 1, 'ITENSXD': 1, 'IPOLYAJ': 1, 'ITENSAJ': 1, 'CHERNAD': 1, 'CHERNAJ': 1, 'CHERN3XD': 1, 'CHERN3XJ': 1, 'MORIMATP': 1, 'KAHLERMATP': 1 }, formatresult='string')