// perform a heat-bath over the whole lattice int OR_lattice( struct site *lat , const struct draughtboard db ) { // single node until I get the coloring correct #ifdef IMPROVED_SMEARING #pragma omp single { size_t mu , i ; for( mu = 0 ; mu < ND ; mu++ ) { for( i = 0 ; i < LVOLUME ; i++ ) { GLU_complex stap[ NCNC ] GLUalign ; zero_mat( stap ) ; all_staples_improve( stap , lat , i , mu , ND , SM_APE ) ; overrelax( lat[ i ].O[mu] , stap , 0 ) ; } } } #else size_t cmu , i ; for( cmu = 0 ; cmu < ND*db.Ncolors ; cmu++ ) { // loop draughtboard coloring const size_t mu = cmu/db.Ncolors ; const size_t c = cmu%db.Ncolors ; #pragma omp for private(i) for( i = 0 ; i < db.Nsquare[c] ; i++ ) { const size_t it = db.square[c][i] ; GLU_complex stap[ NCNC ] GLUalign ; zero_mat( stap ) ; all_staples( stap , lat , it , mu , ND , SM_APE ) ; overrelax( lat[ it ].O[mu] , stap , get_GLU_thread() ) ; } // and that is it } #endif return GLU_SUCCESS ; }
// seed the rng int initialise_par_rng( const char *rng_file ) { if( RNG_inited == GLU_FALSE ) { // tell us our rng #if (defined KISS_RNG) fprintf( stdout , "[PAR_RNG] KISS_RNG \n" ) ; #elif (defined MWC_4096_RNG) fprintf( stdout , "[PAR_RNG] MWC_4096\n" ) ; #elif (defined MWC_1038_RNG) fprintf( stdout , "[PAR_RNG] MWC_1038\n" ) ; #elif (defined XOR_1024_RNG) fprintf( stdout , "[PAR_RNG] XOR_1024\n" ) ; #else fprintf( stdout , "[PAR_RNG] WELL_512\n" ) ; #endif if( rng_file == NULL ) { // pull from the entropy pool? uint32_t *Seeds = malloc( Latt.Nthreads * sizeof( uint32_t ) ) ; size_t i ; if( Latt.Seed[0] == 0 ) { FILE *urandom = fopen( "/dev/urandom" , "r" ) ; if( urandom == NULL ) { fprintf( stderr , "[RNG] /dev/urandom not opened!! ... Exiting \n" ) ; return GLU_FAILURE ; } // read them from urandom if( fread( Seeds , sizeof( Latt.Seed ) , Latt.Nthreads , urandom ) != Latt.Nthreads ) { fprintf( stderr , "[RNG] Entropy pool Seed not read properly ! " "... Exiting \n" ) ; return GLU_FAILURE ; } fclose( urandom ) ; } else { // for( i = 0 ; i < Latt.Nthreads ; i++ ) { Seeds[ i ] = Latt.Seed[0] + i ; } // } fprintf( stdout , "[PAR_RNG] Entropy read \n" ) ; for( i = 0 ; i < Latt.Nthreads ; i++ ) { fprintf( stdout , "[PAR_RNG] Seed_%zu %u \n" , i , Seeds[i] ) ; } // do the seeding #if (defined KISS_RNG) GLU_set_par_KISS_table( Seeds ) ; #elif (defined MWC_4096_RNG) GLU_set_par_MWC_4096_table( Seeds ) ; #elif (defined MWC_1038_RNG) GLU_set_par_MWC_1038_table( Seeds ) ; #elif (defined XOR_1024_RNG) GLU_set_par_XOR_1024_table( Seeds ) ; #else GLU_set_par_WELL_512_table( Seeds ) ; #endif // warm up the rng #pragma omp parallel for private(i) for( i = 0 ; i < Latt.Nthreads ; i++ ) { size_t j ; const uint32_t thread = get_GLU_thread( ) ; for( j = 0 ; j < 10000 ; j++ ) { par_rng_dbl( thread ) ; } } fprintf( stdout , "[PAR_RNG] warmed up\n" ) ; // free the seeds free( Seeds ) ; } else { return read_par_rng_state( rng_file ) ; } RNG_inited = GLU_TRUE ; } return GLU_SUCCESS ; }