| 2424 | | |
|---|
| 2425 | | log(osg::NOTICE,"Then generate the root task"); |
|---|
| 2426 | | log(osg::NOTICE,"Then generate the intermediate tasks if any"); |
|---|
| 2427 | | log(osg::NOTICE,"Then generate the leaf tasks if any"); |
|---|
| 2428 | | |
|---|
| 2429 | | if (getBuildLog()) |
|---|
| 2430 | | { |
|---|
| 2431 | | popOperationLog(); |
|---|
| | 2434 | |
|---|
| | 2435 | int bottomDistributedBuildLevel = getDistributedBuildSecondarySplitLevel()==0 ? |
|---|
| | 2436 | getDistributedBuildSplitLevel() : |
|---|
| | 2437 | getDistributedBuildSecondarySplitLevel(); |
|---|
| | 2438 | |
|---|
| | 2439 | computeDestinationGraphFromSources(bottomDistributedBuildLevel+1); |
|---|
| | 2440 | |
|---|
| | 2441 | if (!_destinationGraph.valid()) return false; |
|---|
| | 2442 | |
|---|
| | 2443 | |
|---|
| | 2444 | // initialize various tasks related settings |
|---|
| | 2445 | std::string sourceFile = taskManager->getSourceFileName(); |
|---|
| | 2446 | std::string basename = taskManager->getBuildName(); |
|---|
| | 2447 | std::string taskDirectory = getTaskDirectory(); |
|---|
| | 2448 | if (!taskDirectory.empty()) taskDirectory += "/"; |
|---|
| | 2449 | |
|---|
| | 2450 | std::string fileCacheName; |
|---|
| | 2451 | if (System::instance()->getFileCache()) fileCacheName = System::instance()->getFileCache()->getFileName(); |
|---|
| | 2452 | |
|---|
| | 2453 | bool logging = getNotifyLevel() > ALWAYS; |
|---|
| | 2454 | |
|---|
| | 2455 | |
|---|
| | 2456 | // create root task |
|---|
| | 2457 | { |
|---|
| | 2458 | std::ostringstream taskfile; |
|---|
| | 2459 | taskfile<<taskDirectory<<basename<<"_root_L0_X0_Y0.task"; |
|---|
| | 2460 | |
|---|
| | 2461 | std::ostringstream app; |
|---|
| | 2462 | app<<"osgdem --run-path "<<taskManager->getRunPath()<<" -s "<<sourceFile<<" --record-subtile-on-leaf-tiles -l "<<getDistributedBuildSplitLevel()<<" --task "<<taskfile.str(); |
|---|
| | 2463 | |
|---|
| | 2464 | if (!fileCacheName.empty()) |
|---|
| | 2465 | { |
|---|
| | 2466 | app<<" --cache "<<fileCacheName; |
|---|
| | 2467 | } |
|---|
| | 2468 | |
|---|
| | 2469 | if (logging) |
|---|
| | 2470 | { |
|---|
| | 2471 | std::ostringstream logfile; |
|---|
| | 2472 | logfile<<taskDirectory<<basename<<"_root_L0_X0_Y0.log"; |
|---|
| | 2473 | app<<" --log "<<logfile.str(); |
|---|
| | 2474 | } |
|---|
| | 2475 | #if 0 |
|---|
| | 2476 | else |
|---|
| | 2477 | { |
|---|
| | 2478 | app<<" > /dev/null"; |
|---|
| | 2479 | } |
|---|
| | 2480 | #endif |
|---|
| | 2481 | |
|---|
| | 2482 | taskManager->addTask(taskfile.str(), app.str(), sourceFile); |
|---|
| | 2483 | } |
|---|
| | 2484 | |
|---|
| | 2485 | |
|---|
| | 2486 | // need to create an intermediate level if required. |
|---|
| | 2487 | if (getDistributedBuildSecondarySplitLevel()!=0) |
|---|
| | 2488 | { |
|---|
| | 2489 | CollectSubtiles cs(getDistributedBuildSplitLevel()-1); |
|---|
| | 2490 | _destinationGraph->accept(cs); |
|---|
| | 2491 | |
|---|
| | 2492 | for(CollectSubtiles::SubtileList::iterator itr = cs._subtileList.begin(); |
|---|
| | 2493 | itr != cs._subtileList.end(); |
|---|
| | 2494 | ++itr) |
|---|
| | 2495 | { |
|---|
| | 2496 | CompositeDestination* cd = itr->get(); |
|---|
| | 2497 | |
|---|
| | 2498 | std::ostringstream taskfile; |
|---|
| | 2499 | taskfile<<taskDirectory<<basename<<"_subtile_L"<<cd->_level<<"_X"<<cd->_tileX<<"_Y"<<cd->_tileY<<".task"; |
|---|
| | 2500 | |
|---|
| | 2501 | |
|---|
| | 2502 | std::ostringstream app; |
|---|
| | 2503 | app<<"osgdem --run-path "<<taskManager->getRunPath()<<" -s "<<sourceFile<<" --record-subtile-on-leaf-tiles -l "<<getDistributedBuildSecondarySplitLevel()<<" --subtile "<<cd->_level<<" "<<cd->_tileX<<" "<<cd->_tileY<<" --task "<<taskfile.str(); |
|---|
| | 2504 | |
|---|
| | 2505 | |
|---|
| | 2506 | if (!fileCacheName.empty()) |
|---|
| | 2507 | { |
|---|
| | 2508 | app<<" --cache "<<fileCacheName; |
|---|
| | 2509 | } |
|---|
| | 2510 | |
|---|
| | 2511 | if (logging) |
|---|
| | 2512 | { |
|---|
| | 2513 | std::ostringstream logfile; |
|---|
| | 2514 | |
|---|
| | 2515 | logfile<<taskDirectory<<basename<<"_subtile_L"<<cd->_level<<"_X"<<cd->_tileX<<"_Y"<<cd->_tileY<<".log"; |
|---|
| | 2516 | app<<" --log "<<logfile.str(); |
|---|
| | 2517 | } |
|---|
| | 2518 | #if 0 |
|---|
| | 2519 | else |
|---|
| | 2520 | { |
|---|
| | 2521 | app<<" > /dev/null"; |
|---|
| | 2522 | } |
|---|
| | 2523 | #endif |
|---|
| | 2524 | taskManager->addTask(taskfile.str(), app.str(), sourceFile); |
|---|
| | 2525 | } |
|---|
| | 2526 | } |
|---|
| | 2527 | |
|---|
| | 2528 | // create the bottom level split |
|---|
| | 2529 | { |
|---|
| | 2530 | // bottom set of tasks |
|---|
| | 2531 | CollectSubtiles cs(bottomDistributedBuildLevel-1); |
|---|
| | 2532 | _destinationGraph->accept(cs); |
|---|
| | 2533 | |
|---|
| | 2534 | for(CollectSubtiles::SubtileList::iterator itr = cs._subtileList.begin(); |
|---|
| | 2535 | itr != cs._subtileList.end(); |
|---|
| | 2536 | ++itr) |
|---|
| | 2537 | { |
|---|
| | 2538 | CompositeDestination* cd = itr->get(); |
|---|
| | 2539 | |
|---|
| | 2540 | std::ostringstream taskfile; |
|---|
| | 2541 | taskfile<<taskDirectory<<basename<<"_subtile_L"<<cd->_level<<"_X"<<cd->_tileX<<"_Y"<<cd->_tileY<<".task"; |
|---|
| | 2542 | |
|---|
| | 2543 | |
|---|
| | 2544 | std::ostringstream app; |
|---|
| | 2545 | app<<"osgdem --run-path "<<taskManager->getRunPath()<<" -s "<<sourceFile<<" --subtile "<<cd->_level<<" "<<cd->_tileX<<" "<<cd->_tileY<<" --task "<<taskfile.str(); |
|---|
| | 2546 | |
|---|
| | 2547 | if (!fileCacheName.empty()) |
|---|
| | 2548 | { |
|---|
| | 2549 | app<<" --cache "<<fileCacheName; |
|---|
| | 2550 | } |
|---|
| | 2551 | |
|---|
| | 2552 | if (logging) |
|---|
| | 2553 | { |
|---|
| | 2554 | std::ostringstream logfile; |
|---|
| | 2555 | |
|---|
| | 2556 | logfile<<taskDirectory<<basename<<"_subtile_L"<<cd->_level<<"_X"<<cd->_tileX<<"_Y"<<cd->_tileY<<".log"; |
|---|
| | 2557 | app<<" --log "<<logfile.str(); |
|---|
| | 2558 | } |
|---|
| | 2559 | #if 0 |
|---|
| | 2560 | else |
|---|
| | 2561 | { |
|---|
| | 2562 | app<<" > /dev/null"; |
|---|
| | 2563 | } |
|---|
| | 2564 | #endif |
|---|
| | 2565 | taskManager->addTask(taskfile.str(), app.str(), sourceFile); |
|---|
| | 2566 | } |
|---|