/** Performs a full initialization of * the Lattice Boltzmann system. All derived parameters * and the fluid are reset to their default values. */ void lb_init_gpu() { /** set parameters for transfer to gpu */ lb_reinit_parameters_gpu(); lb_realloc_particles_gpu(); lb_realloc_fluid_gpu(); lb_init_GPU(&lbpar_gpu); LB_TRACE (fprintf(stderr,"lb_init_gpu \n")); }
/** Performs a full initialization of * the Lattice Boltzmann system. All derived parameters * and the fluid are reset to their default values. */ void lb_init_gpu() { LB_TRACE(printf("Begin initialzing fluid on GPU\n")); /** set parameters for transfer to gpu */ lb_reinit_parameters_gpu(); lb_realloc_particles_gpu(); lb_init_GPU(&lbpar_gpu); gpu_init_particle_comm(); cuda_bcast_global_part_params(); LB_TRACE(printf("Initialzing fluid on GPU successful\n")); }
void on_integration_start() { char *errtext; EVENT_TRACE(fprintf(stderr, "%d: on_integration_start\n", this_node)); INTEG_TRACE(fprintf(stderr,"%d: on_integration_start: reinit_thermo = %d, resort_particles=%d\n", this_node,reinit_thermo,resort_particles)); /********************************************/ /* sanity checks */ /********************************************/ if ( time_step < 0.0 ) { errtext = runtime_error(128); ERROR_SPRINTF(errtext, "{010 time_step not set} "); } if ( skin < 0.0 ) { errtext = runtime_error(128); ERROR_SPRINTF(errtext,"{011 skin not set} "); } if ( temperature < 0.0 ) { errtext = runtime_error(128); ERROR_SPRINTF(errtext,"{012 thermostat not initialized} "); } #ifdef NPT if (integ_switch == INTEG_METHOD_NPT_ISO) { if (nptiso.piston <= 0.0) { char *errtext = runtime_error(128); ERROR_SPRINTF(errtext,"{014 npt on, but piston mass not set} "); } #ifdef ELECTROSTATICS switch(coulomb.method) { case COULOMB_NONE: break; #ifdef P3M case COULOMB_P3M: break; #endif /*P3M*/ default: { char *errtext = runtime_error(128); ERROR_SPRINTF(errtext,"{014 npt only works with P3M} "); } } #endif /*ELECTROSTATICS*/ #ifdef DIPOLES switch (coulomb.Dmethod) { case DIPOLAR_NONE: break; #ifdef DP3M case DIPOLAR_P3M: break; #endif default: { char *errtext = runtime_error(128); ERROR_SPRINTF(errtext,"NpT does not work with your dipolar method, please use P3M."); } } #endif /* ifdef DIPOLES */ } #endif /*NPT*/ if (!check_obs_calc_initialized()) return; #ifdef LB if(lattice_switch & LATTICE_LB) { if (lbpar.agrid <= 0.0) { errtext = runtime_error(128); ERROR_SPRINTF(errtext,"{098 Lattice Boltzmann agrid not set} "); } if (lbpar.tau <= 0.0) { errtext = runtime_error(128); ERROR_SPRINTF(errtext,"{099 Lattice Boltzmann time step not set} "); } if (lbpar.rho <= 0.0) { errtext = runtime_error(128); ERROR_SPRINTF(errtext,"{100 Lattice Boltzmann fluid density not set} "); } if (lbpar.viscosity <= 0.0) { errtext = runtime_error(128); ERROR_SPRINTF(errtext,"{101 Lattice Boltzmann fluid viscosity not set} "); } if (dd.use_vList && skin>=lbpar.agrid/2.0) { errtext = runtime_error(128); ERROR_SPRINTF(errtext, "{104 LB requires either no Verlet lists or that the skin of the verlet list to be less than half of lattice-Boltzmann grid spacing.} "); } } #endif #ifdef LB_GPU if(this_node == 0) { if(lattice_switch & LATTICE_LB_GPU) { if (lbpar_gpu.agrid < 0.0) { errtext = runtime_error(128); ERROR_SPRINTF(errtext,"{098 Lattice Boltzmann agrid not set} "); } if (lbpar_gpu.tau < 0.0) { errtext = runtime_error(128); ERROR_SPRINTF(errtext,"{099 Lattice Boltzmann time step not set} "); } if (lbpar_gpu.rho < 0.0) { errtext = runtime_error(128); ERROR_SPRINTF(errtext,"{100 Lattice Boltzmann fluid density not set} "); } if (lbpar_gpu.viscosity < 0.0) { errtext = runtime_error(128); ERROR_SPRINTF(errtext,"{101 Lattice Boltzmann fluid viscosity not set} "); } if (lb_reinit_particles_gpu) { lb_realloc_particles_gpu(); lb_reinit_particles_gpu = 0; } } } #endif #ifdef METADYNAMICS meta_init(); #endif #ifdef REACTIONS if(reaction.rate != 0.0) { if(max_cut < reaction.range) { errtext = runtime_error(128); ERROR_SPRINTF(errtext,"{105 Reaction range of %f exceeds maximum cutoff of %f} ", reaction.range, max_cut); } } #endif /********************************************/ /* end sanity checks */ /********************************************/ /* Prepare the thermostat */ if (reinit_thermo) { thermo_init(); reinit_thermo = 0; recalc_forces = 1; } /* Ensemble preparation: NVT or NPT */ integrate_ensemble_init(); #ifdef SCAFACOS /* initialize Scafacos, set up the system and solver specific parameters, all on each node. functions include MPI_Bcast */ mpi_bcast_coulomb_method(); switch(coulomb.method) { case COULOMB_SCAFACOS_DIRECT: case COULOMB_SCAFACOS_EWALD: case COULOMB_SCAFACOS_FMM: case COULOMB_SCAFACOS_MEMD: case COULOMB_SCAFACOS_MMM1D: case COULOMB_SCAFACOS_MMM2D: case COULOMB_SCAFACOS_P2NFFT: case COULOMB_SCAFACOS_P3M: case COULOMB_SCAFACOS_PEPC: case COULOMB_SCAFACOS_PP3MG: case COULOMB_SCAFACOS_VMG: { mpi_scafacos_bcast_common_params(); mpi_scafacos_bcast_solver_specific(); mpi_scafacos_init(); mpi_scafacos_common_set(); mpi_scafacos_solver_specific_set(); break; } default: break; } /* tune in order to generate at least defaults for cutoff, transfer the cutoff back to Espresso and generate new cell system on each node*/ switch(coulomb.method) { case COULOMB_SCAFACOS_P2NFFT: if( scafacos.short_range_flag == 0 ) { scafacos_tune(); recalc_maximal_cutoff(); cells_on_geometry_change(0); } break; case COULOMB_SCAFACOS_P3M: if( scafacos.short_range_flag == 0 ) { scafacos_tune(); recalc_maximal_cutoff(); cells_on_geometry_change(0); } default: break; } #endif /* Update particle and observable information for routines in statistics.c */ invalidate_obs(); freePartCfg(); on_observable_calc(); }
void on_integration_start() { char *errtext; EVENT_TRACE(fprintf(stderr, "%d: on_integration_start\n", this_node)); INTEG_TRACE(fprintf(stderr,"%d: on_integration_start: reinit_thermo = %d, resort_particles=%d\n", this_node,reinit_thermo,resort_particles)); /********************************************/ /* sanity checks */ /********************************************/ if ( time_step < 0.0 ) { errtext = runtime_error(128); ERROR_SPRINTF(errtext, "{010 time_step not set} "); } if ( skin < 0.0 ) { errtext = runtime_error(128); ERROR_SPRINTF(errtext,"{011 skin not set} "); } if ( temperature < 0.0 ) { errtext = runtime_error(128); ERROR_SPRINTF(errtext,"{012 thermostat not initialized} "); } #ifdef NPT if (integ_switch == INTEG_METHOD_NPT_ISO) { if (nptiso.piston <= 0.0) { char *errtext = runtime_error(128); ERROR_SPRINTF(errtext,"{014 npt on, but piston mass not set} "); } #ifdef ELECTROSTATICS switch(coulomb.method) { case COULOMB_NONE: break; #ifdef P3M case COULOMB_P3M: break; #endif /*P3M*/ default: { char *errtext = runtime_error(128); ERROR_SPRINTF(errtext,"{014 npt only works with P3M} "); } } #endif /*ELECTROSTATICS*/ #ifdef DIPOLES switch (coulomb.Dmethod) { case DIPOLAR_NONE: break; #ifdef DP3M case DIPOLAR_P3M: break; #endif default: { char *errtext = runtime_error(128); ERROR_SPRINTF(errtext,"NpT does not work with your dipolar method, please use P3M."); } } #endif /* ifdef DIPOLES */ } #endif /*NPT*/ if (!check_obs_calc_initialized()) return; #ifdef LB if(lattice_switch & LATTICE_LB) { if (lbpar.agrid <= 0.0) { errtext = runtime_error(128); ERROR_SPRINTF(errtext,"{098 Lattice Boltzmann agrid not set} "); } if (lbpar.tau <= 0.0) { errtext = runtime_error(128); ERROR_SPRINTF(errtext,"{099 Lattice Boltzmann time step not set} "); } if (lbpar.rho <= 0.0) { errtext = runtime_error(128); ERROR_SPRINTF(errtext,"{100 Lattice Boltzmann fluid density not set} "); } if (lbpar.viscosity <= 0.0) { errtext = runtime_error(128); ERROR_SPRINTF(errtext,"{101 Lattice Boltzmann fluid viscosity not set} "); } if (dd.use_vList && skin>=lbpar.agrid/2.0) { errtext = runtime_error(128); ERROR_SPRINTF(errtext, "{104 LB requires either no Verlet lists or that the skin of the verlet list to be less than half of lattice-Boltzmann grid spacing.} "); } } #endif #ifdef LB_GPU if(this_node == 0){ if(lattice_switch & LATTICE_LB_GPU) { if (lbpar_gpu.agrid < 0.0) { errtext = runtime_error(128); ERROR_SPRINTF(errtext,"{098 Lattice Boltzmann agrid not set} "); } if (lbpar_gpu.tau < 0.0) { errtext = runtime_error(128); ERROR_SPRINTF(errtext,"{099 Lattice Boltzmann time step not set} "); } if (lbpar_gpu.rho < 0.0) { errtext = runtime_error(128); ERROR_SPRINTF(errtext,"{100 Lattice Boltzmann fluid density not set} "); } if (lbpar_gpu.viscosity < 0.0) { errtext = runtime_error(128); ERROR_SPRINTF(errtext,"{101 Lattice Boltzmann fluid viscosity not set} "); } if (lb_reinit_particles_gpu) { lb_realloc_particles_gpu(); lb_reinit_particles_gpu = 0; } } } #endif #ifdef METADYNAMICS meta_init(); #endif #ifdef CATALYTIC_REACTIONS if(reaction.ct_rate != 0.0) { if( dd.use_vList == 0 || cell_structure.type != CELL_STRUCTURE_DOMDEC) { errtext = runtime_error(128); ERROR_SPRINTF(errtext,"{105 The CATALYTIC_REACTIONS feature requires verlet lists and domain decomposition} "); check_runtime_errors(); } if(max_cut < reaction.range) { errtext = runtime_error(128); ERROR_SPRINTF(errtext,"{106 Reaction range of %f exceeds maximum cutoff of %f} ", reaction.range, max_cut); } } #endif /********************************************/ /* end sanity checks */ /********************************************/ /* Prepare the thermostat */ if (reinit_thermo) { thermo_init(); reinit_thermo = 0; recalc_forces = 1; } /* Ensemble preparation: NVT or NPT */ integrate_ensemble_init(); /* Update particle and observable information for routines in statistics.c */ invalidate_obs(); freePartCfg(); on_observable_calc(); }
void on_integration_start() { EVENT_TRACE(fprintf(stderr, "%d: on_integration_start\n", this_node)); INTEG_TRACE(fprintf(stderr,"%d: on_integration_start: reinit_thermo = %d, resort_particles=%d\n", this_node,reinit_thermo,resort_particles)); /********************************************/ /* sanity checks */ /********************************************/ integrator_sanity_checks(); #ifdef NPT integrator_npt_sanity_checks(); #endif interactions_sanity_checks(); #ifdef CATALYTIC_REACTIONS reactions_sanity_checks(); #endif #ifdef LB if(lattice_switch & LATTICE_LB) { lb_sanity_checks(); } #endif #ifdef LB_GPU if(lattice_switch & LATTICE_LB_GPU) { lb_GPU_sanity_checks(); } #endif /********************************************/ /* end sanity checks */ /********************************************/ #ifdef LB_GPU if(this_node == 0){ if (lb_reinit_particles_gpu) { lb_realloc_particles_gpu(); lb_reinit_particles_gpu = 0; } } #endif #ifdef CUDA if (reinit_particle_comm_gpu){ gpu_change_number_of_part_to_comm(); reinit_particle_comm_gpu = 0; } MPI_Bcast(gpu_get_global_particle_vars_pointer_host(), sizeof(CUDA_global_part_vars), MPI_BYTE, 0, comm_cart); #endif #ifdef METADYNAMICS meta_init(); #endif /* Prepare the thermostat */ if (reinit_thermo) { thermo_init(); reinit_thermo = 0; recalc_forces = 1; } /* Ensemble preparation: NVT or NPT */ integrate_ensemble_init(); /* Update particle and observable information for routines in statistics.cpp */ invalidate_obs(); freePartCfg(); on_observable_calc(); }
void on_integration_start() { char *errtext; int i; EVENT_TRACE(fprintf(stderr, "%d: on_integration_start\n", this_node)); INTEG_TRACE(fprintf(stderr,"%d: on_integration_start: reinit_thermo = %d, resort_particles=%d\n", this_node,reinit_thermo,resort_particles)); /********************************************/ /* sanity checks */ /********************************************/ if ( time_step < 0.0 ) { errtext = runtime_error(128); ERROR_SPRINTF(errtext, "{010 time_step not set} "); } if ( skin < 0.0 ) { errtext = runtime_error(128); ERROR_SPRINTF(errtext,"{011 skin not set} "); } if ( temperature < 0.0 ) { errtext = runtime_error(128); ERROR_SPRINTF(errtext,"{012 thermostat not initialized} "); } for (i = 0; i < 3; i++) if (local_box_l[i] < max_range) { errtext = runtime_error(128 + TCL_INTEGER_SPACE); ERROR_SPRINTF(errtext,"{013 box_l in direction %d is still too small} ", i); } #ifdef NPT if (integ_switch == INTEG_METHOD_NPT_ISO) { if (nptiso.piston <= 0.0) { char *errtext = runtime_error(128); ERROR_SPRINTF(errtext,"{014 npt on, but piston mass not set} "); } if(cell_structure.type!=CELL_STRUCTURE_DOMDEC) { char *errtext = runtime_error(128); ERROR_SPRINTF(errtext,"{014 npt requires domain decomposition cellsystem} "); } #ifdef ELECTROSTATICS switch(coulomb.method) { case COULOMB_NONE: break; #ifdef ELP3M case COULOMB_P3M: break; #endif /*ELP3M*/ case COULOMB_EWALD: break; default: { char *errtext = runtime_error(128); ERROR_SPRINTF(errtext,"{014 npt only works with Ewald sum or P3M} "); } } #endif /*ELECTROSTATICS*/ } #endif /*NPT*/ if (!check_obs_calc_initialized()) return; #ifdef LB if(lattice_switch & LATTICE_LB) { if (lbpar.agrid <= 0.0) { errtext = runtime_error(128); ERROR_SPRINTF(errtext,"{098 Lattice Boltzmann agrid not set} "); } if (lbpar.tau <= 0.0) { errtext = runtime_error(128); ERROR_SPRINTF(errtext,"{099 Lattice Boltzmann time step not set} "); } if (lbpar.rho <= 0.0) { errtext = runtime_error(128); ERROR_SPRINTF(errtext,"{100 Lattice Boltzmann fluid density not set} "); } if (lbpar.viscosity <= 0.0) { errtext = runtime_error(128); ERROR_SPRINTF(errtext,"{101 Lattice Boltzmann fluid viscosity not set} "); } } #endif #ifdef LB_GPU if(this_node == 0){ if(lattice_switch & LATTICE_LB_GPU) { if (lbpar_gpu.agrid < 0.0) { errtext = runtime_error(128); ERROR_SPRINTF(errtext,"{098 Lattice Boltzmann agrid not set} "); } if (lbpar_gpu.tau < 0.0) { errtext = runtime_error(128); ERROR_SPRINTF(errtext,"{099 Lattice Boltzmann time step not set} "); } if (lbpar_gpu.rho < 0.0) { errtext = runtime_error(128); ERROR_SPRINTF(errtext,"{100 Lattice Boltzmann fluid density not set} "); } if (lbpar_gpu.viscosity < 0.0) { errtext = runtime_error(128); ERROR_SPRINTF(errtext,"{101 Lattice Boltzmann fluid viscosity not set} "); } if (lb_reinit_particles_gpu) { lb_realloc_particles_gpu(); lb_reinit_particles_gpu = 0; } } } #endif #ifdef METADYNAMICS meta_init(); #endif /********************************************/ /* end sanity checks */ /********************************************/ /* Prepare the thermostat */ if (reinit_thermo) { thermo_init(); reinit_thermo = 0; recalc_forces = 1; } /* Ensemble preparation: NVT or NPT */ integrate_ensemble_init(); /* Update particle and observable information for routines in statistics.c */ invalidate_obs(); freePartCfg(); on_observable_calc(); }