extern void #MARK_init(void); void init_extensions(void) { ah_init(); addrtype_init(); comment_init(); 2connmark_init(); conntrack_init(); 2dscp_init(); 2ecn_init(); esp_init(); hashlimit_init(); helper_init(); icmp_init(); iprange_init(); length_init(); limit_init(); mac_init(); multiport_init(); #2mark_init(); owner_init(); physdev_init(); pkttype_init(); policy_init(); realm_init(); sctp_init(); standard_init(); state_init(); tcp_init(); 2tcpmss_init(); 2tos_init(); 2ttl_init(); udp_init(); unclean_init(); CLASSIFY_init(); CONNMARK_init(); DNAT_init(); LOG_init(); #DSCP_init(); ECN_init(); MASQUERADE_init(); MIRROR_init(); NETMAP_init(); NFQUEUE_init(); NOTRACK_init(); REDIRECT_init(); REJECT_init(); #MARK_init(); }
int main( int argc, char *argv[] ) { MPI_Init( &argc, &argv ); MPI_Comm_rank( MPI_COMM_WORLD, &rank ); standard_init(); read_init_arg(argc, argv); printf0("Running initialization...\n"); DDalphaAMG_initialize( &init, ¶ms, &status ); printf0("Initialized %d levels in %.2f sec\n", status.success, status.time); int nlvl = status.success; read_params_arg(argc, argv); comm_cart = DDalphaAMG_get_communicator(); MPI_Comm_rank( comm_cart, &rank ); printf0("Running updating\n"); DDalphaAMG_update_parameters( ¶ms, &status ); if (status.success) printf0("Updating time %.2f sec\n", status.time); /* * Reading the configuration. In plaq, it returns the plaquette value * if provided in the configuration header. */ double *gauge_field; int vol = init.global_lattice[T] * init.global_lattice[X] * init.global_lattice[Y] * init.global_lattice[Z] / init.procs[T] / init.procs[X] / init.procs[Y] / init.procs[Z]; gauge_field = (double *) malloc(18*4*vol*sizeof(double)); printf0("Reading config.\n"); DDalphaAMG_read_configuration( gauge_field, conf_file, conf_format, &status ); printf0("Reading configuration time %.2f sec\n", status.time); printf0("Desired plaquette %.13lf\n", status.info); printf0("Setting config.\n"); DDalphaAMG_set_configuration( gauge_field, &status ); printf0("Setting configuration time %.2f sec\n", status.time); printf0("Computed plaquette %.13lf\n", status.info); printf0("Running setup\n"); DDalphaAMG_setup( &status ); printf0("Run %d setup iterations in %.2f sec (%.1f %% on coarse grid)\n", status.success, status.time, 100.*(status.coarse_time/status.time)); printf0("Total iterations on fine grid %d\n", status.iter_count); printf0("Total iterations on coarse grids %d\n", status.coarse_iter_count); /* * Defining fine and coarse vector randomly. */ double *vector1[nlvl], *vector2[nlvl]; int vols[nlvl], vars[nlvl]; vols[0]=vol; vars[0]=3*4*2; for ( int i=1; i<nlvl; i++ ) { vols[i] = vols[i-1] / params.block_lattice[i-1][T] / params.block_lattice[i-1][X] / params.block_lattice[i-1][Y] / params.block_lattice[i-1][Z]; vars[i]=params.mg_basis_vectors[i-1]*2*2; // a factor of 2 is for the spin, the other for the complex } for ( int i=0; i<nlvl; i++ ) { vector1[i] = (double *) malloc(vars[i]*vols[i]*sizeof(double)); vector2[i] = (double *) malloc(vars[i]*vols[i]*sizeof(double)); } for ( int i=0; i<nlvl; i++ ) for ( int j=0; j<vars[i]*vols[i]; j++ ) vector1[i][j] = ((double)rand()/(double)RAND_MAX)-0.5; for ( int i=1; i<nlvl; i++ ) { printf0("Testing RP=1 on level %d\n",i); DDalphaAMG_prolongate(vector2[i-1], vector1[i], i-1, &status); DDalphaAMG_restrict(vector2[i], vector2[i-1], i-1, &status); double num=0, den=0; for ( int j=0; j<vars[i]*vols[i]; j++ ) { vector2[i][j] -= vector1[i][j]; num += vector2[i][j]*vector2[i][j]; den += vector1[i][j]*vector1[i][j]; } printf0("Restult (1-RP)v = %e\n\n", num/den); } for ( int i=1; i<nlvl; i++ ) { printf0("Testing coarse operator on level %d\n",i); DDalphaAMG_prolongate(vector1[i-1], vector1[i], i-1, &status); DDalphaAMG_apply_coarse_operator(vector2[i-1], vector1[i-1], i-1, &status); DDalphaAMG_restrict(vector2[i], vector2[i-1], i-1, &status); DDalphaAMG_apply_coarse_operator(vector1[i], vector1[i], i, &status); double num=0, den=0; for ( int j=0; j<vars[i]*vols[i]; j++ ) { vector2[i][j] -= vector1[i][j]; num += vector2[i][j]*vector2[i][j]; den += vector1[i][j]*vector1[i][j]; } printf0("Restult (D_c-RDP)v = %e\n\n", num/den); } // free(vector_in); // free(vector_out); //free(gauge_field); // DDalphaAMG_finalize(); MPI_Finalize(); }