int main() { InitPersistentMemoryManager(); OpenStorageFile("test.bin"); SetStorageFileMemoryMapping(); link_index isA = CreateLink(itself, itself, itself); link_index isNotA = CreateLink(itself, itself, isA); link_index link = CreateLink(itself, isA, itself); link_index thing = CreateLink(itself, isNotA, link); UpdateLink(isA, isA, isA, link); // После этого минимальное ядро системы можно считать сформированным //DeleteLink(isA); // Одна эта операция удалит все 4 связи ResetStorageFileMemoryMapping(); CloseStorageFile(); return 0; }
BOOL CED2kLinkDlg::OnSetActive() { if (!CResizablePage::OnSetActive()) return FALSE; if (m_bDataChanged) { //hashsetlink - check if at least one file has a hasset BOOL bShowHashset = FALSE; BOOL bShowAICH = FALSE; BOOL bShowHTML = FALSE; for (int i = 0; i != m_paFiles->GetSize(); i++){ if (!(*m_paFiles)[i]->IsKindOf(RUNTIME_CLASS(CKnownFile))) continue; bShowHTML = TRUE; CKnownFile* file = STATIC_DOWNCAST(CKnownFile, (*m_paFiles)[i]); if (file->GetFileIdentifier().GetAvailableMD4PartHashCount() > 0 && file->GetFileIdentifier().HasExpectedMD4HashCount()) { bShowHashset = TRUE; } if (file->GetFileIdentifier().HasAICHHash()) { bShowAICH = TRUE; } if (bShowHashset && bShowAICH) break; } GetDlgItem(IDC_LD_HASHSETCHE)->EnableWindow(bShowHashset); if (!bShowHashset) ((CButton*)GetDlgItem(IDC_LD_HASHSETCHE))->SetCheck(BST_UNCHECKED); GetDlgItem(IDC_LD_HTMLCHE)->EnableWindow(bShowHTML); UpdateLink(); m_bDataChanged = false; } return TRUE; }
//------------------------------------------------------------------ //AlgGheatBath::NodeCheckerBoardRun() // Do checkerboard over the nodes when at least one of the direction // perpendicular to the updated link has node_sites of 2. // This is necessary for the correctness of the heatbath algorithm, when // the rectangle action is involved. //! Run the heatbath algorithm //------------------------------------------------------------------ void AlgGheatBath::NodeCheckerBoardRun() { char *fname = "NodeCheckerBoardRun()"; VRB.Func(cname,fname); // Set the Lattice pointer //---------------------------------------------------------------- Lattice& lat = AlgLattice(); int do_checker[4]= {0, 0, 0, 0}; for(int u=0;u<4;u++) if(GJP.NodeSites(u)==2) for(int v=0;v<4;v++) if (v!= u) do_checker[v]= 1; relocate(); LRG.SetInterval(1,-1); int node_checker = (GJP.XnodeCoor()+GJP.YnodeCoor() +GJP.ZnodeCoor()+GJP.TnodeCoor())&1; //VRB.Flow(cname, fname, // "do_checker0=%d,do_checker1=%d,do_checker2=%d,do_checker3=%d\n", // do_checker[0],do_checker[1],do_checker[2],do_checker[3]); // Run the gauge heat bath //---------------------------------------------------------------- for(int i=0; i< alg_ghb_arg->num_iter; i++){ // Heat bath // Checkerboard everything, do even or odd sites for( int checker=0; checker <=1; checker++ ) { // Scan over local subvolume doing all even(odd) links // index for "x" is consistant with GsiteOffset: "x,y,z,t" order int x[4], y[4]; for( y[3] = 0; y[3] < 2; y[3]++) for( y[2] = 0; y[2] < 2; y[2]++) for( y[1] = 0; y[1] < 2; y[1]++) for( y[0] = 0; y[0] < 2; y[0]++) if( (y[0]+y[1]+y[2]+y[3])%2 == checker) { // printf("y = %d %d %d %d\n",y[0],y[1],y[2],y[3]); for( x[3] = y[3]; x[3] < GJP.TnodeSites(); x[3]+=2) for( x[2] = y[2]; x[2] < GJP.ZnodeSites(); x[2]+=2) for( x[1] = y[1]; x[1] < GJP.YnodeSites(); x[1]+=2) for( x[0] = y[0]; x[0] < GJP.XnodeSites(); x[0]+=2) for( int mu=0; mu<4; mu++ ) { // printf("x = %d %d %d %d\n",x[0],x[1],x[2],x[3]);fflush(stdout); #ifdef GHB_TIMING int clock1 = clock(); #endif for( int node_ck =0; node_ck<2; node_ck++){ // Build the staple: //if don't do checkerboard over nodes, then only get the staple //once. if we need to do checkerboard over the nodes, we need to //get the staple twice, for every node must be doing exactly same //transmission of links. //VRB.Flow(cname, fname, "x=%d y=%d z=%d t=%d mu=%d\n", // x[0], x[1], x[2], x[3], mu); Matrix mStaple; if((do_checker[mu]==0 && node_ck==0) || do_checker[mu] == 1) { //VRB.Flow(cname, fname, "mu=%d do_checker=%d node_ck=%d\n", // mu, do_checker[mu], node_ck); //lat.ClearBufferedLink(x,mu); lat.AllStaple( mStaple, x, mu ); lat.ClearBufferedLink(x,mu); } //if don't do the checkerboard over nodes, then all nodes //update the link together once. if we need to do checkerboard over //nodes do the update of the link only when node_checker==node_ck // if((do_checker[mu]==0 && node_ck==0) || (do_checker[mu]==1 && node_checker == node_ck)){ Matrix * pmLink = lat.GaugeField(); pmLink += mu + lat.GsiteOffset(x); UpdateLink(pmLink, mStaple); } //end inner if } //end of node_ck loop #ifdef GHB_TIMING printf("one link update time %d\n", clock()-clock1); #endif } // (end mu loop ) } // (end site loop) } // (end checkerboard loop) preserve_seed(); // Increment gauge field counter //---------------------------------------------------------------- lat.GupdCntInc(1); // If GJP.Snodes() !=1 the gauge field is spread out // accross s-slices of processors. It must be identical // on each slice. Check to make sure and exit if it // is not identical. A case where this is relevant // is the DWF spread-out case. //---------------------------------------------------------------- lat.GsoCheck(); } // Reunitarize lat.Reunitarize(); lat.ClearAllBufferedLink(); //VRB.FuncEnd(cname, fname); }
//------------------------------------------------------------------ void AlgGheatBath::NoCheckerBoardRun() { char *fname = "NoCheckerBoardRun()"; VRB.Func(cname,fname); // Set the Lattice pointer //---------------------------------------------------------------- Lattice& lat = AlgLattice(); if (lat.Gclass() != G_CLASS_WILSON){ ERR.General(cname,fname," Only correct for Wilson gauge action\n"); } relocate(); LRG.SetInterval(1,-1); // Run the gauge heat bath //---------------------------------------------------------------- for(int i=0; i< alg_ghb_arg->num_iter; i++){ // Heat bath // Checkerboard everything, do even or odd sites for( int checker=0; checker <=1; checker++ ) { // Scan over local subvolume doing all even(odd) links // index for "x" is consistant with GsiteOffset: "x,y,z,t" order int x[4], y[4]; for( y[3] = 0; y[3] < 2; y[3]++) for( y[2] = 0; y[2] < 2; y[2]++) for( y[1] = 0; y[1] < 2; y[1]++) for( y[0] = 0; y[0] < 2; y[0]++) if( (y[0]+y[1]+y[2]+y[3])%2 == checker) { for( x[3] = y[3]; x[3] < GJP.TnodeSites(); x[3]+=2) for( x[2] = y[2]; x[2] < GJP.ZnodeSites(); x[2]+=2) for( x[1] = y[1]; x[1] < GJP.YnodeSites(); x[1]+=2) for( x[0] = y[0]; x[0] < GJP.XnodeSites(); x[0]+=2) for( int mu=0; mu<4; mu++ ) { #ifdef GHB_TIMING int clock1 = clock(); #endif // Build the staple: Matrix mStaple; lat.AllStaple( mStaple, x, mu ); lat.ClearBufferedLink(x,mu); Matrix * pmLink = lat.GaugeField(); pmLink += mu + lat.GsiteOffset(x); UpdateLink(pmLink, mStaple); #ifdef GHB_TIMING printf("one link update time %d\n", clock()-clock1); #endif } // (end mu loop) } // (end site loop) } // (end checkerboard loop) preserve_seed(); // Increment gauge field counter //---------------------------------------------------------------- lat.GupdCntInc(1); // If GJP.Snodes() !=1 the gauge field is spread out // accross s-slices of processors. It must be identical // on each slice. Check to make sure and exit if it // is not identical. A case where this is relevant // is the DWF spread-out case. //---------------------------------------------------------------- lat.GsoCheck(); } // Reunitarize lat.Reunitarize(); lat.ClearAllBufferedLink(); }
void CED2kLinkDlg::OnSettingsChange() { UpdateLink(); }