44 MPI_Comm comm,
int numProcs,
int localProc){
48 std::vector<std::string> stdstrings;
55 std::string solverName;
56 std::string datasource;
57 std::string constraintform;
70 fei::console_out() <<
"Failed to find one or more required parameters in input-file."
81 bool slave_constraints =
false;
82 if (
"slaves" == constraintform) {
83 slave_constraints =
true;
87 if (datasource ==
"HexBeam") {
88 hexcubeptr =
new HexBeam(W, D, DofPerNode,
92 hexcubeptr =
new HexBeamCR(W, D, DofPerNode,
99 int numCRs = (W+1)*(W+1)* ((numProcs*2)-1);
102 FEI_COUT <<
"========================================================"
105 FEI_COUT <<
"--------------------------------------------------------"<<
FEI_ENDL;
106 FEI_COUT <<
"Size W: " << W <<
" (num-elements-along-side-of-cube)"<<
FEI_ENDL;
107 FEI_COUT <<
"Size D: " << D <<
" (num-elements-along-depth-of-cube)"<<
FEI_ENDL;
114 FEI_COUT <<
"========================================================"
128 if (factory.
get() == NULL) {
133 factory->parameters(params);
136 factory->createVectorSpace(comm,
"cube3");
140 factory->createMatrixGraph(nodeSpace, dummy,
"cube3");
143 nodeSpace->setParameters(params);
144 matrixGraph->setParameters(params);
151 nodeSpace->defineFields( 1, &fieldID, &fieldSize );
152 nodeSpace->defineIDTypes(1, &nodeIDType );
153 nodeSpace->defineIDTypes(1, &crIDType );
159 init_shared_nodes( matrixGraph.
get(), hexcube ) );
161 int firstLocalCRID = 0;
162 if (slave_constraints) {
164 init_slave_constraints( matrixGraph.
get(), hexcube) );
168 init_constraints( matrixGraph.
get(), hexcube, localProc, firstLocalCRID) );
171 CHK_ERR( matrixGraph->initComplete() );
175 if (localProc == 0) {
190 if (localProc == 0) {
192 FEI_COUT <<
"Create-Matrix cpu time: " << fei_creatematrix_time <<
FEI_ENDL;
200 factory->createLinearSystem(matrixGraph);
202 CHK_ERR( linSys->parameters(params));
204 linSys->setMatrix(mat);
205 linSys->setSolutionVector(solnVec);
206 linSys->setRHS(rhsVec);
214 if (!slave_constraints) {
216 load_constraints(linSys.
get(), hexcube, firstLocalCRID) );
219 CHK_ERR( linSys->loadComplete() );
223 if (localProc == 0) {
227 FEI_COUT <<
"Total assembly wall time: "
228 << fei_init_time + fei_creatematrix_time + fei_load_time <<
FEI_ENDL;
241 std::string solver_name_value;
244 const char* charptr_solvername =
245 solver_name_value.empty() ? 0 : solver_name_value.c_str();
255 int err = solver->solve(linSys.
get(),
264 if (localProc==0)
FEI_COUT <<
"solve returned err: " << err <<
", status: "
272 CHK_ERR( solnVec->scatterToOverlap() );
283 <<
" FEI initialize: " << fei_init_time <<
FEI_ENDL
284 <<
" FEI create-matrix: " << fei_creatematrix_time <<
FEI_ENDL
285 <<
" FEI load: " << fei_load_time <<
FEI_ENDL
286 <<
" solve: " << solve_time <<
FEI_ENDL
287 <<
"Total program time: " << elapsed_cpu_time <<
FEI_ENDL;
289#if defined(FEI_PLATFORM) && defined(FEI_OPT_LEVEL)
290 double benchmark = fei_init_time;
292 std::string slavestr;
293 if (!constraintform.empty()) {
294 slavestr = constraintform;
296 if (slavestr.size() > 0) slavestr +=
"_";
299 testname_init <<
"cube3_init_"<<slavestr<<W<<
"_"<<D<<
"_"<<DofPerNode<<
"_"
300 <<solverName<<
"_np"<<numProcs<<
"_"
301 <<FEI_PLATFORM<<
"_"<<FEI_OPT_LEVEL;
303 testname_create <<
"cube3_creatematrix_"<<slavestr<<W<<
"_"<<D<<
"_"<<DofPerNode
304 <<
"_"<<solverName<<
"_np"<<numProcs<<
"_"
305 <<FEI_PLATFORM<<
"_"<<FEI_OPT_LEVEL;
307 testname_load <<
"cube3_load_"<<slavestr<<W<<
"_"<<D<<
"_"<<DofPerNode<<
"_"
308 <<solverName<<
"_np"<<numProcs<<
"_"
309 <<FEI_PLATFORM<<
"_"<<FEI_OPT_LEVEL;
311 double file_init, file_create, file_load;
312 bool file_benchmarks_available =
true;
315 testname_init.str().c_str());
317 testname_create.str().c_str());
319 testname_load.str().c_str());
321 catch (std::runtime_error& exc) {
322 file_benchmarks_available =
false;
325 if (file_benchmarks_available) {
327 bool init_test_passed =
331 benchmark = fei_creatematrix_time;
332 bool create_test_passed =
336 benchmark = fei_load_time;
337 bool load_test_passed =
341 returnValue = init_test_passed&&create_test_passed&&load_test_passed ? 0 : 1;
347 bool testPassed = returnValue==0;
348 if (testPassed && localProc == 0) {
int beam_main(int argc, char **argv, MPI_Comm comm, int numProcs, int localProc)