int main(void) { bool writeIntermediate = true; bool primed = false; std::vector<std::string> grids; // grids.push_back("~/GRIDS/md/md005.00036"); //grids.push_back("~/GRIDS/md/md165.27556"); //grids.push_back("~/GRIDS/md/md031.01024"); grids.push_back("~/GRIDS/md/md089.08100"); #if 0 grids.push_back("~/GRIDS/md/md031.01024"); grids.push_back("~/GRIDS/md/md050.02601"); grids.push_back("~/GRIDS/md/md063.04096"); grids.push_back("~/GRIDS/md/md089.08100"); grids.push_back("~/GRIDS/md/md127.16384"); grids.push_back("~/GRIDS/md/md165.27556"); #endif #if 0 grids.push_back("~/GRIDS/geoff/scvtmesh_100k_nodes.ascii"); grids.push_back("~/GRIDS/geoff/scvtmesh_500k_nodes.ascii"); grids.push_back("~/GRIDS/geoff/scvtmesh_1m_nodes.ascii"); #endif //grids.push_back("~/GRIDS/geoff/scvtmesh_1m_nodes.ascii"); for (size_t i = 0; i < grids.size(); i++) { std::string& grid_name = grids[i]; std::string weight_timer_name = grid_name + " Calc Weights"; timers[weight_timer_name] = new EB::Timer(weight_timer_name.c_str()); // Get contours from rbfzone.blogspot.com to choose eps_c1 and eps_c2 based on stencil_size (n) #if 0 // Too ill-conditioned? Doesnt converge in GMRES + ILU0 unsigned int stencil_size = 40; double eps_c1 = 0.027; double eps_c2 = 0.274; #else unsigned int stencil_size = 31; double eps_c1 = 0.035; double eps_c2 = 0.1; #endif GridReader* grid = new GridReader(grid_name, 4); grid->setMaxStencilSize(stencil_size); // We do not read until generate is called: Grid::GridLoadErrType err = grid->loadFromFile(); if (err == Grid::NO_GRID_FILES) { grid->generate(); #if 1 // NOTE: We force at least one node in the domain to be a boundary. //----------------------------- // We will set the first node as a boundary/ground point. We know // the normal because we're on teh sphere centered at (0,0,0) for (unsigned int nodeIndex = 0; nodeIndex < 1; nodeIndex++) { NodeType& node = grid->getNode(nodeIndex); Vec3 nodeNormal = node - Vec3(0,0,0); grid->appendBoundaryIndex(nodeIndex, nodeNormal); } #endif //----------------------------- if (writeIntermediate) { grid->writeToFile(); } } std::cout << "Generate Stencils\n"; Grid::GridLoadErrType st_err = grid->loadStencilsFromFile(); if (st_err == Grid::NO_STENCIL_FILES) { // grid->generateStencils(Grid::ST_BRUTE_FORCE); #if 1 grid->generateStencils(Grid::ST_KDTREE); #else grid->setNSHashDims(50, 50,50); grid->generateStencils(Grid::ST_HASH); #endif if (writeIntermediate) { grid->writeToFile(); } } std::cout << "Generate RBFFD Weights\n"; timers[weight_timer_name]->start(); RBFFD der(RBFFD::LSFC | RBFFD::XSFC | RBFFD::YSFC | RBFFD::ZSFC, grid, 3, 0); //TODO: der.setWeightType(RBFFD::ContourSVD); der.setEpsilonByParameters(eps_c1, eps_c2); int der_err = der.loadAllWeightsFromFile(); if (der_err) { der.computeAllWeightsForAllStencils(); timers[weight_timer_name]->stop(); #if 0 if (writeIntermediate) { der.writeAllWeightsToFile(); } #endif } if (!primed) { std::cout << "\n\n"; cout << "Priming GPU with dummy operations (removes compile from benchmarks)\n"; gpuTest(der,*grid, 1); primed = true; std::cout << "\n\n"; } // No support for GMRES on the CPU yet. //cpuTest(der,*grid); gpuTest(der,*grid); delete(grid); } timers.printAll(); timers.writeToFile(); return EXIT_SUCCESS; }
int main(void) { bool writeIntermediate = true; bool primed = false; std::vector<std::string> grids; #if 0 //grids.push_back("~/GRIDS/md/md005.00036"); grids.push_back("~/GRIDS/md/md031.01024"); grids.push_back("~/GRIDS/md/md050.02601"); grids.push_back("~/GRIDS/md/md063.04096"); grids.push_back("~/GRIDS/md/md089.08100"); grids.push_back("~/GRIDS/md/md127.16384"); grids.push_back("~/GRIDS/md/md165.27556"); #endif #if 0 grids.push_back("~/GRIDS/geoff/scvtimersesh_100k_nodes.ascii"); grids.push_back("~/GRIDS/geoff/scvtimersesh_500k_nodes.ascii"); grids.push_back("~/GRIDS/geoff/scvtimersesh_1m_nodes.ascii"); #endif //grids.push_back("~/GRIDS/geoff/scvtimersesh_1m_nodes.ascii"); grids.push_back("~/sphere_grids/md063.04096"); grids.push_back("~/sphere_grids/md079.06400"); grids.push_back("~/sphere_grids/md089.08100"); grids.push_back("~/sphere_grids/md100.10201"); grids.push_back("~/sphere_grids/md127.16384"); grids.push_back("~/sphere_grids/md141.20164"); grids.push_back("~/sphere_grids/md165.27556"); grids.push_back("~/sphere_grids/scvtmesh001.100000"); grids.push_back("~/sphere_grids/scvtmesh002.500000"); grids.push_back("~/sphere_grids/scvtmesh003.1000000"); for (size_t i = 0; i < grids.size(); i++) { std::string& grid_name = grids[i]; std::string weight_timer_name = grid_name + " Calc Weights"; timers[weight_timer_name] = new EB::Timer(weight_timer_name.c_str()); // Get contours from rbfzone.blogspot.com to choose eps_c1 and eps_c2 based on stencil_size (n) unsigned int stencil_size = 40; double eps_c1 = 0.027; double eps_c2 = 0.274; GridReader* grid = new GridReader(grid_name, 4); grid->setMaxStencilSize(stencil_size); // We do not read until generate is called: Grid::GridLoadErrType err = grid->loadFromFile(); if (err == Grid::NO_GRID_FILES) { grid->generate(); if (writeIntermediate) { grid->writeToFile(); } } std::cout << "Generate Stencils\n"; Grid::GridLoadErrType st_err = grid->loadStencilsFromFile(); if (st_err == Grid::NO_STENCIL_FILES) { // grid->generateStencils(Grid::ST_BRUTE_FORCE); #if 1 grid->generateStencils(Grid::ST_KDTREE); #else grid->setNSHashDims(50, 50,50); grid->generateStencils(Grid::ST_HASH); #endif if (writeIntermediate) { grid->writeToFile(); } } std::cout << "Generate RBFFD Weights\n"; timers[weight_timer_name]->start(); RBFFD der(RBFFD::LSFC | RBFFD::XSFC | RBFFD::YSFC | RBFFD::ZSFC, grid, 3, 0); der.setEpsilonByParameters(eps_c1, eps_c2); int der_err = der.loadAllWeightsFromFile(); if (der_err) { der.computeAllWeightsForAllStencils(); timers[weight_timer_name]->start(); if (writeIntermediate) { der.writeAllWeightsToFile(); } } if (!primed) { cout << "Priming GPU with dummy operations (removes compile from benchmarks)\n"; run_test<DUMMY, DUMMY>(der, *grid); primed = true; } cout << "Running Tests\n" << std::endl; { run_test<COO_CPU, COO_CPU>(der, *grid); run_test<COO_CPU, COO_GPU>(der, *grid); run_test<CSR_CPU, CSR_CPU>(der, *grid); run_test<CSR_CPU, CSR_GPU>(der, *grid); run_test<COO_CPU, CSR_GPU>(der, *grid); run_test<CSR_CPU, COO_GPU>(der, *grid); } delete(grid); } timers.printAll(); timers.writeToFile(); return EXIT_SUCCESS; }