Newer
Older
//THIS IS COMMENTED OUT - CHANGE ORIGINAL
//Cuda_Init_HBond_Indices (hb_top, system->N);
//THIS IS COMMENTED OUT - CHANGE ORIGINAL
/****/
fprintf( stderr, "p%d: allocated hbonds: total_hbonds=%d, space=%dMB\n",
Kurt A. O'Hearn
committed
system->my_rank, total_hbonds,
(int)(total_hbonds * sizeof(hbond_data) / (1024 * 1024)) );
Kurt A. O'Hearn
committed
Dev_Make_List( system->total_cap, system->total_bonds, TYP_BOND, *dev_lists + BONDS );
Make_List( system->total_cap, system->total_bonds, TYP_BOND, *lists + BONDS );
Kurt A. O'Hearn
committed
Cuda_Init_Bond_Indices( system );
fprintf( stderr, "p%d: allocated bonds: total_bonds=%d, space=%dMB\n",
system->my_rank, total_bonds,
(int)(total_bonds * sizeof(bond_data) / (1024 * 1024)) );
/* 3bodies list: since a more accurate estimate of the num.
* of three body interactions requires that bond orders have
* been computed, delay estimation until for computation */
Kurt A. O'Hearn
committed
sfree( hb_top, "Cuda_Init_Lists::hb_top" );
Kurt A. O'Hearn
committed
#endif
void Initialize( reax_system *system, control_params *control,
Kurt A. O'Hearn
committed
simulation_data *data, storage *workspace,
reax_list **lists, output_controls *out_control,
mpi_datatypes *mpi_data )
host_scratch = (void *)malloc( HOST_SCRATCH_SIZE );
char msg[MAX_STR];
if ( Init_MPI_Datatypes( system, workspace, mpi_data, msg ) == FAILURE )
{
fprintf( stderr, "p%d: init_mpi_datatypes: could not create datatypes\n",
system->my_rank );
fprintf( stderr, "p%d: mpi_data couldn't be initialized! terminating.\n",
system->my_rank );
MPI_Abort( MPI_COMM_WORLD, CANNOT_INITIALIZE );
}
Kurt A. O'Hearn
committed
fprintf( stderr, "p%d: initialized mpi datatypes\n", system->my_rank );
if ( Init_System(system, control, data, workspace, mpi_data, msg) == FAILURE )
{
fprintf( stderr, "p%d: %s\n", system->my_rank, msg );
fprintf( stderr, "p%d: system could not be initialized! terminating.\n",
system->my_rank );
MPI_Abort( MPI_COMM_WORLD, CANNOT_INITIALIZE );
}
Kurt A. O'Hearn
committed
fprintf( stderr, "p%d: system initialized\n", system->my_rank );
Kurt A. O'Hearn
committed
Init_Simulation_Data( system, control, data, msg );
fprintf( stderr, "p%d: initialized simulation data\n", system->my_rank );
Kurt A. O'Hearn
committed
Init_Workspace( system, control, workspace, msg );
fprintf( stderr, "p%d: initialized workspace\n", system->my_rank );
if ( Init_Lists( system, control, data, workspace, lists, mpi_data, msg ) ==
FAILURE )
{
fprintf( stderr, "p%d: %s\n", system->my_rank, msg );
fprintf( stderr, "p%d: system could not be initialized! terminating.\n",
system->my_rank );
MPI_Abort( MPI_COMM_WORLD, CANNOT_INITIALIZE );
Kurt A. O'Hearn
committed
fprintf( stderr, "p%d: initialized lists\n", system->my_rank );
if ( Init_Output_Files(system, control, out_control, mpi_data, msg) == FAILURE)
{
fprintf( stderr, "p%d: %s\n", system->my_rank, msg );
fprintf( stderr, "p%d: could not open output files! terminating...\n",
system->my_rank );
MPI_Abort( MPI_COMM_WORLD, CANNOT_INITIALIZE );
}
Kurt A. O'Hearn
committed
fprintf( stderr, "p%d: output files opened\n", system->my_rank );
Kurt A. O'Hearn
committed
if ( Init_Lookup_Tables(system, control, workspace->Tap, mpi_data, msg) == FAILURE )
{
fprintf( stderr, "p%d: %s\n", system->my_rank, msg );
fprintf( stderr, "p%d: couldn't create lookup table! terminating.\n",
system->my_rank );
MPI_Abort( MPI_COMM_WORLD, CANNOT_INITIALIZE );
}
Kurt A. O'Hearn
committed
fprintf( stderr, "p%d: initialized lookup tables\n", system->my_rank );
Kurt A. O'Hearn
committed
fprintf( stderr, "p%d: initialized force functions\n", system->my_rank );
Kurt A. O'Hearn
committed
/*#ifdef TEST_FORCES
Init_Force_Test_Functions();
fprintf(stderr,"p%d: initialized force test functions\n",system->my_rank);
#endif */
Kurt A. O'Hearn
committed
void Pure_Initialize( reax_system *system, control_params *control,
Kurt A. O'Hearn
committed
simulation_data *data, storage *workspace,
reax_list **lists, output_controls *out_control,
mpi_datatypes *mpi_data )
Kurt A. O'Hearn
committed
Init_Simulation_Data( system, control, data, msg );
fprintf( stderr, "p%d: initialized simulation data\n", system->my_rank );
fprintf( stderr, "p%d: pure initialized simulation data\n", system->my_rank );
Kurt A. O'Hearn
committed
Init_Workspace( system, control, workspace, msg );
fprintf( stderr, "p%d: initialized workspace\n", system->my_rank );
fprintf( stderr, "p%d: pure initialized workspace\n", system->my_rank );
if ( Init_Lists( system, control, data, workspace, lists, mpi_data, msg ) ==
FAILURE )
{
fprintf( stderr, "p%d: %s\n", system->my_rank, msg );
fprintf( stderr, "p%d: system could not be initialized! terminating.\n",
system->my_rank );
MPI_Abort( MPI_COMM_WORLD, CANNOT_INITIALIZE );
fprintf( stderr, "p%d: initialized lists\n", system->my_rank );
fprintf( stderr, "p%d: pure initialized lists done \n", system->my_rank );
Kurt A. O'Hearn
committed
#ifdef HAVE_CUDA
void Cuda_Initialize( reax_system *system, control_params *control,
Kurt A. O'Hearn
committed
simulation_data *data, storage *workspace,
reax_list **lists, output_controls *out_control,
mpi_datatypes *mpi_data )
/* HOST/DEVICE SCRATCH */
Cuda_Init_ScratchArea( );
/* MPI_DATATYPES */
if ( Init_MPI_Datatypes( system, workspace, mpi_data, msg ) == FAILURE )
{
fprintf( stderr, "p%d: init_mpi_datatypes: could not create datatypes\n",
system->my_rank );
fprintf( stderr, "p%d: mpi_data couldn't be initialized! terminating.\n",
system->my_rank );
MPI_Abort( MPI_COMM_WORLD, CANNOT_INITIALIZE );
}
Kurt A. O'Hearn
committed
fprintf( stderr, " [INIT MPI DATATYPES]\n" );
Kurt A. O'Hearn
committed
if ( Cuda_Init_System( system, control, data, workspace, mpi_data, msg ) == FAILURE )
{
fprintf( stderr, "p%d: %s\n", system->my_rank, msg );
fprintf( stderr, "p%d: system could not be initialized! terminating.\n",
system->my_rank );
MPI_Abort( MPI_COMM_WORLD, CANNOT_INITIALIZE );
}
Kurt A. O'Hearn
committed
fprintf( stderr, " [CUDA INIT SYSTEM]\n" );
Kurt A. O'Hearn
committed
dev_alloc_grid( system );
Sync_Grid( &system->my_grid, &system->d_my_grid );
fprintf( stderr, " [DEV ALLOC GRID]\n" );
Kurt A. O'Hearn
committed
//validate_grid( system );
/* SIMULATION_DATA */
Kurt A. O'Hearn
committed
Cuda_Init_Simulation_Data( system, control, data, msg );
Kurt A. O'Hearn
committed
fprintf( stderr, " [CUDA INIT SIMULATION DATA]\n" );
/* WORKSPACE */
Kurt A. O'Hearn
committed
Cuda_Init_Workspace( system, control, workspace, msg );
Kurt A. O'Hearn
committed
fprintf( stderr, " [CUDA INIT WORKSPACE]\n" );
fprintf( stderr, "p%d: initialized workspace\n", system->my_rank );
Kurt A. O'Hearn
committed
Kurt A. O'Hearn
committed
dev_alloc_control( control );
fprintf( stderr, " [DEV ALLOC CONTROL]\n" );
if ( Cuda_Init_Lists( system, control, data, workspace, lists, mpi_data, msg ) ==
FAILURE )
{
fprintf( stderr, "p%d: %s\n", system->my_rank, msg );
fprintf( stderr, "p%d: system could not be initialized! terminating.\n",
system->my_rank );
MPI_Abort( MPI_COMM_WORLD, CANNOT_INITIALIZE );
Kurt A. O'Hearn
committed
fprintf( stderr, " [CUDA INIT LISTS]\n" );
fprintf( stderr, "p%d: initialized lists\n", system->my_rank );
/* OUTPUT Files */
Kurt A. O'Hearn
committed
if ( Init_Output_Files( system, control, out_control, mpi_data, msg ) == FAILURE )
{
fprintf( stderr, "p%d: %s\n", system->my_rank, msg );
fprintf( stderr, "p%d: could not open output files! terminating...\n",
system->my_rank );
MPI_Abort( MPI_COMM_WORLD, CANNOT_INITIALIZE );
}
Kurt A. O'Hearn
committed
fprintf( stderr, " [INIT OUTPUT FILES]\n" );
fprintf( stderr, "p%d: output files opened\n", system->my_rank );
/* Lookup Tables */
Kurt A. O'Hearn
committed
if ( Init_Lookup_Tables( system, control, dev_workspace->Tap, mpi_data, msg ) == FAILURE )
{
fprintf( stderr, "p%d: %s\n", system->my_rank, msg );
fprintf( stderr, "p%d: couldn't create lookup table! terminating.\n",
system->my_rank );
MPI_Abort( MPI_COMM_WORLD, CANNOT_INITIALIZE );
}
Kurt A. O'Hearn
committed
fprintf( stderr, " [INIT LOOKUP TABLES]\n" );
fprintf( stderr, "p%d: initialized lookup tables\n", system->my_rank );
fprintf( stderr, "p%d: Device Initialization Done \n", system->my_rank );
Kurt A. O'Hearn
committed
#endif
void Initialize( reax_system *system, control_params *control,
simulation_data *data, storage *workspace,
reax_list **lists, output_controls *out_control,
mpi_datatypes *mpi_data )
Kurt A. O'Hearn
committed
host_scratch = (void *)malloc( HOST_SCRATCH_SIZE );
Kurt A. O'Hearn
committed
if ( Init_System(system, msg) == FAILURE )
{
fprintf( stderr, "p%d: %s\n", system->my_rank, msg );
fprintf( stderr, "p%d: system could not be initialized! terminating.\n",
system->my_rank );
MPI_Abort( MPI_COMM_WORLD, CANNOT_INITIALIZE );
}
Kurt A. O'Hearn
committed
fprintf( stderr, "p%d: system initialized\n", system->my_rank );
Kurt A. O'Hearn
committed
Init_Simulation_Data( system, control, data, msg );
Kurt A. O'Hearn
committed
fprintf( stderr, "p%d: initialized simulation data\n", system->my_rank );
Kurt A. O'Hearn
committed
Init_Workspace( system, control, workspace, msg );
Kurt A. O'Hearn
committed
fprintf( stderr, "p%d: initialized workspace\n", system->my_rank );
if ( Init_MPI_Datatypes( system, workspace, mpi_data, msg ) == FAILURE )
{
fprintf( stderr, "p%d: init_mpi_datatypes: could not create datatypes\n",
system->my_rank );
fprintf( stderr, "p%d: mpi_data couldn't be initialized! terminating.\n",
system->my_rank );
MPI_Abort( MPI_COMM_WORLD, CANNOT_INITIALIZE );
}
Kurt A. O'Hearn
committed
fprintf( stderr, "p%d: initialized mpi datatypes\n", system->my_rank );
if ( Init_Lists( system, control, workspace, lists, msg ) == FAILURE )
{
fprintf( stderr, "p%d: %s\n", system->my_rank, msg );
fprintf( stderr, "p%d: system could not be initialized! terminating.\n",
system->my_rank );
MPI_Abort( MPI_COMM_WORLD, CANNOT_INITIALIZE );
Kurt A. O'Hearn
committed
fprintf( stderr, "p%d: initialized lists\n", system->my_rank );
if ( Init_Output_Files(system, control, out_control, mpi_data, msg) == FAILURE)
{
fprintf( stderr, "p%d: %s\n", system->my_rank, msg );
fprintf( stderr, "p%d: could not open output files! terminating...\n",
system->my_rank );
MPI_Abort( MPI_COMM_WORLD, CANNOT_INITIALIZE );
}
Kurt A. O'Hearn
committed
fprintf( stderr, "p%d: output files opened\n", system->my_rank );
Kurt A. O'Hearn
committed
if ( Init_Lookup_Tables( system, control, workspace->Tap, mpi_data, msg ) == FAILURE )
{
fprintf( stderr, "p%d: %s\n", system->my_rank, msg );
fprintf( stderr, "p%d: couldn't create lookup table! terminating.\n",
system->my_rank );
MPI_Abort( MPI_COMM_WORLD, CANNOT_INITIALIZE );
}
Kurt A. O'Hearn
committed
fprintf( stderr, "p%d: initialized lookup tables\n", system->my_rank );
Kurt A. O'Hearn
committed
fprintf( stderr, "p%d: initialized force functions\n", system->my_rank );
Kurt A. O'Hearn
committed
/*#if defined(TEST_FORCES)
Init_Force_Test_Functions();
fprintf(stderr,"p%d: initialized force test functions\n",system->my_rank);
#endif*/
}